diff --git a/app/controllers/support_assignments_controller.rb b/app/controllers/support_assignments_controller.rb index 2cb8a12..7b06a0c 100644 --- a/app/controllers/support_assignments_controller.rb +++ b/app/controllers/support_assignments_controller.rb @@ -4,7 +4,11 @@ class SupportAssignmentsController < ApplicationController # GET /support_assignments # GET /support_assignments.json def index - @support_assignments = SupportAssignment.where(user_id: params[:user_id]).order :date + if params[:user_id].present? + @support_assignments = SupportAssignment.where(user_id: params[:user_id]).order :date + else + @support_assignments = SupportAssignment.all.order :date + end end # GET /support_assignments/1 @@ -66,11 +70,6 @@ def today render :show end - def all - @support_assignments = SupportAssignment.all.order :date - render :index - end - def month @support_assignments = SupportAssignment.where("strftime('%m', date) + 0 = ?", params[:month].to_i).order :date render :index diff --git a/app/helpers/support_assignments_helper.rb b/app/helpers/support_assignments_helper.rb index 3935226..2030636 100644 --- a/app/helpers/support_assignments_helper.rb +++ b/app/helpers/support_assignments_helper.rb @@ -3,7 +3,7 @@ def new_assignment_link if params[:user_id].present? link_to('New Support assignment', new_user_support_assignment_path) else - link_to('New Support assignment', new_support_assignments_path) + link_to('New Support assignment', new_support_assignment_path) end end diff --git a/app/views/application/welcome.html.erb b/app/views/application/welcome.html.erb new file mode 100644 index 0000000..4252e48 --- /dev/null +++ b/app/views/application/welcome.html.erb @@ -0,0 +1,7 @@ + +
+Browse Users: /users
+Browse Duty Assignments: /support_assignments
+ + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index fb4ac0f..a9e8617 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,9 +3,9 @@ resources :support_assignments end - resource :support_assignments, only: [:new, :create, :index] do + resources :support_assignments, only: [:new, :create, :index] + scope :support_assignments, :controller => 'support_assignments' do get 'today' - get 'all' get 'month/:month' => 'support_assignments#month' end @@ -13,7 +13,7 @@ # See how all your routes lay out with "rake routes". # You can have the root of your site routed with "root" - # root 'welcome#index' + root 'application#welcome' # Example of regular route: # get 'products/:id' => 'catalog#view'