Skip to content
This repository has been archived by the owner on Jan 31, 2019. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'ande3577/fea/allow_closing_sprint_from_…
Browse files Browse the repository at this point in the history
…backlogs_view'
  • Loading branch information
bohansen committed Jan 26, 2014
2 parents 4a78d4c + 3f6fc9f commit 21680f8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/controllers/rb_master_backlogs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def menu
links << {:label => l(:label_release),
:url => url_for(:controller => 'rb_releases', :action => 'show', :release_id => @release, :target => '_blank', :only_path => true)
} if @release
links << {:label => l(:label_sprint_close),
:url => url_for(:controller => 'rb_sprints', :action => 'close', :sprint_id => @sprint, :only_path => true)
} if @sprint && @sprint.open? && @sprint.stories.open.none? && User.current.allowed_to?(:update_sprints, @project)


respond_to do |format|
Expand Down
10 changes: 10 additions & 0 deletions app/controllers/rb_sprints_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,14 @@ def close_completed

redirect_to :controller => 'rb_master_backlogs', :action => 'show', :project_id => @project
end

def close
if @sprint.stories.open.any?
flash[:error] = l(:error_cannot_close_sprint_with_open_stories)
else
@sprint.update_attributes({:status => 'closed'})
end
redirect_to :controller => 'rb_master_backlogs', :action => 'show', :project_id => @project
end

end
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ en:
label_sprint_cards: "Sprint cards"
label_sprint_impediments: "Sprint Impediments"
label_sprint_name: "Sprint \"%{name}\""
label_sprint_close: "Close Sprint"
label_stories: Stories
label_stories_tasks: Stories/Tasks
label_task_board: "Task board"
Expand Down Expand Up @@ -222,3 +223,4 @@ en:
* The current value will become the initial value for all
story/task properties
* State will be set to the default issue state
error_cannot_close_sprint_with_open_stories: "Cannot close a sprint while it still has open stories."
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def rb_common_routes(rb)

rb_match rb, 'sprint/create', :to => 'rb_sprints#create'
rb_match rb, 'sprint/:sprint_id/update', :to => 'rb_sprints#update'
rb_match rb, 'sprint/:sprint_id/close', :to => 'rb_sprints#close'
rb_match rb, 'sprint/:sprint_id/reset', :to => 'rb_sprints#reset'
rb_match rb, 'sprint/download/:sprint_id.xml', :to => 'rb_sprints#download', :format => 'xml'
rb_match rb, 'sprints/:project_id/close_completed', :to => 'rb_sprints#close_completed', :via => [:put]
Expand Down
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
# :show_sprints and :list_sprints are implicit in :view_master_backlog permission
permission :create_sprints, { :rb_sprints => [:new, :create] }
permission :update_sprints, {
:rb_sprints => [:edit, :update],
:rb_sprints => [:edit, :update, :close],
:rb_wikis => [:edit, :update]
}

Expand Down

0 comments on commit 21680f8

Please sign in to comment.