Class: PlanMyStuff::LabelsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- PlanMyStuff::LabelsController
- Defined in:
- app/controllers/plan_my_stuff/labels_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /issues/:issue_id/labels.
-
#destroy ⇒ Object
DELETE /issues/:issue_id/labels/:id.
Instance Method Details
#create ⇒ 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 create 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], repo: params[:repo])) return end issue = PMS::Issue.find(params[:issue_id].to_i, repo: params[:repo]) PMS::Label.add(issue: issue, labels: labels) flash[:success] = 'Label was successfully added.' redirect_to(plan_my_stuff.issue_path(issue.number, repo: issue.repo.full_name)) end |
#destroy ⇒ Object
DELETE /issues/:issue_id/labels/:id
22 23 24 25 26 27 28 |
# File 'app/controllers/plan_my_stuff/labels_controller.rb', line 22 def destroy issue = PMS::Issue.find(params[:issue_id].to_i, repo: params[:repo]) PMS::Label.remove(issue: issue, labels: [params[:id]]) flash[:success] = 'Label was successfully removed.' redirect_to(plan_my_stuff.issue_path(issue.number, repo: issue.repo.full_name)) end |