Class: PlanMyStuff::LabelsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- PlanMyStuff::LabelsController
- Defined in:
- app/controllers/plan_my_stuff/labels_controller.rb
Instance Method Summary collapse
-
#add_to_issue ⇒ Object
POST /issues/:issue_id/labels.
-
#remove_from_issue ⇒ Object
DELETE /issues/:issue_id/labels/:name.
Instance Method Details
#add_to_issue ⇒ Object
POST /issues/:issue_id/labels
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/plan_my_stuff/labels_controller.rb', line 6 def add_to_issue labels = parse_labels(params[:label_name]) if labels.blank? flash[:error] = 'Label name is required.' redirect_to(plan_my_stuff.issue_path(params[:issue_id])) return end issue = PMS::Issue.find(params[:issue_id].to_i, repo: params[:repo]&.to_sym) PMS::Label.add(issue: issue, labels: labels) flash[:success] = 'Label was successfully added.' redirect_to(plan_my_stuff.issue_path(issue.number)) end |
#remove_from_issue ⇒ Object
DELETE /issues/:issue_id/labels/:name
22 23 24 25 26 27 28 |
# File 'app/controllers/plan_my_stuff/labels_controller.rb', line 22 def remove_from_issue issue = PMS::Issue.find(params[:issue_id].to_i, repo: params[:repo]&.to_sym) PMS::Label.remove(issue: issue, labels: [params[:name]]) flash[:success] = 'Label was successfully removed.' redirect_to(plan_my_stuff.issue_path(issue.number)) end |