Class: SprintTaskLocksController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SprintTaskLocksController
- Defined in:
- app/controllers/sprint_task_locks_controller.rb
Instance Attribute Summary collapse
-
#sprint ⇒ Object
readonly
Returns the value of attribute sprint.
-
#task ⇒ Object
readonly
Returns the value of attribute task.
Instance Method Summary collapse
Methods inherited from ApplicationController
#after_sign_in_path_for, #api_authenticate!, #current_project, #expire_revision!, #followed_projects, #no_cache, #read_revision, #require_login, #return_or_cache_revision!, #revision, #save_current_project, #set_current_project, #unfurling?
Methods included from UrlHelper
#edit_release_path, #edit_release_url, #feature_path, #github_commit_range_url, #github_commit_url, #github_project_url, #github_url?, #goldmine_case_number_url, #link_to_project_feature, #new_release_url, #release_path, #release_url, #releases_path
Instance Attribute Details
#sprint ⇒ Object (readonly)
Returns the value of attribute sprint.
5 6 7 |
# File 'app/controllers/sprint_task_locks_controller.rb', line 5 def sprint @sprint end |
#task ⇒ Object (readonly)
Returns the value of attribute task.
5 6 7 |
# File 'app/controllers/sprint_task_locks_controller.rb', line 5 def task @task end |
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/sprint_task_locks_controller.rb', line 8 def create if sprint.completed? render json: {base: ["The Sprint is completed. You cannot check out or check in tasks."]}, status: :unprocessable_entity return end if task.checked_out?(sprint) render json: {base: ["Task ##{task.shorthand} is already checked out"]}, status: 422 else task.check_out!(sprint, current_user) head :ok end end |
#destroy ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/sprint_task_locks_controller.rb', line 23 def destroy if sprint.completed? render json: {base: ["The Sprint is completed. You cannot check out or check in tasks."]}, status: :unprocessable_entity return end if task.checked_out_by_me?(sprint, current_user) task.check_in!(sprint) head :ok elsif task.checked_out?(sprint) render json: {base: ["Ticket ##{task.shorthand} is checked out. You cannot check it in"]}, status: 422 else head :ok end end |