Class: PlanMyStuff::TestingProjectItemsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- PlanMyStuff::TestingProjectItemsController
- Defined in:
- app/controllers/plan_my_stuff/testing_project_items_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /testing_projects/:testing_project_id/items.
-
#new ⇒ Object
GET /testing_projects/:testing_project_id/items/new.
Instance Method Details
#create ⇒ Object
POST /testing_projects/:testing_project_id/items
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/plan_my_stuff/testing_project_items_controller.rb', line 15 def create project_number = params[:testing_project_id].to_i item = PlanMyStuff::TestingProjectItem.create!( item_params[:title], draft: true, body: item_params[:body], project_number: project_number, ) item.update_testers!(item_params[:testers]) if item_params[:testers].present? item.update_watchers!(item_params[:watchers]) if item_params[:watchers].present? item.update_due_date!(Date.parse(item_params[:due_date])) if item_params[:due_date].present? item.update_pass_mode!(item_params[:pass_mode]) if item_params[:pass_mode].present? flash[:success] = 'Item added.' redirect_to(plan_my_stuff.testing_project_path(project_number)) rescue ArgumentError, PlanMyStuff::Error, Octokit::Error => e pms_handle_rescue(e) flash[:error] = e. redirect_to(plan_my_stuff.testing_project_path(project_number)) end |
#new ⇒ Object
GET /testing_projects/:testing_project_id/items/new
6 7 8 9 10 11 12 |
# File 'app/controllers/plan_my_stuff/testing_project_items_controller.rb', line 6 def new @project = PlanMyStuff::TestingProject.find(params[:testing_project_id].to_i) rescue PlanMyStuff::Error, Octokit::Error => e pms_handle_rescue(e) flash[:error] = e. redirect_to(plan_my_stuff.testing_projects_path) end |