diff --git a/app/assets/stylesheets/root.css.scss b/app/assets/stylesheets/root.css.scss new file mode 100644 index 0000000..7c37211 --- /dev/null +++ b/app/assets/stylesheets/root.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the root controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index 10ff98e..49a3d62 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -27,7 +27,7 @@ class OrdersController < ApplicationController end end - def index + def overview @users_by_name = User.members.order(:name) @users_by_order = User.members.order(:orders_count).reverse_order end diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb new file mode 100644 index 0000000..998ad09 --- /dev/null +++ b/app/controllers/root_controller.rb @@ -0,0 +1,11 @@ +class RootController < ApplicationController + def root + if !current_user + redirect_to new_user_session_path + elsif current_user.koelkast? + redirect_to orders_path + else + redirect_to current_user + end + end +end diff --git a/app/helpers/root_helper.rb b/app/helpers/root_helper.rb new file mode 100644 index 0000000..04269a6 --- /dev/null +++ b/app/helpers/root_helper.rb @@ -0,0 +1,2 @@ +module RootHelper +end diff --git a/app/views/orders/index.html.erb b/app/views/orders/overview.html.erb similarity index 100% rename from app/views/orders/index.html.erb rename to app/views/orders/overview.html.erb diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index e486ac3..daa8a5e 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,3 +1,4 @@ +<%= render partial: 'flash' %>