diff options
-rw-r--r-- | app/models/issue_status.rb | 2 | ||||
-rw-r--r-- | app/views/issue_statuses/_form.html.erb | 1 | ||||
-rw-r--r-- | app/views/issue_statuses/index.api.rsb | 1 | ||||
-rw-r--r-- | app/views/issue_statuses/index.html.erb | 2 | ||||
-rw-r--r-- | app/views/issues/_attributes.html.erb | 5 | ||||
-rw-r--r-- | config/locales/en.yml | 3 | ||||
-rw-r--r-- | public/stylesheets/application.css | 6 | ||||
-rw-r--r-- | test/fixtures/issue_statuses.yml | 5 | ||||
-rw-r--r-- | test/functional/issue_statuses_controller_test.rb | 10 | ||||
-rw-r--r-- | test/functional/issues_controller_test.rb | 43 | ||||
-rw-r--r-- | test/integration/api_test/issue_statuses_test.rb | 2 | ||||
-rw-r--r-- | test/unit/issue_status_test.rb | 5 |
12 files changed, 78 insertions, 7 deletions
diff --git a/app/models/issue_status.rb b/app/models/issue_status.rb index 3080fea8a..a93bd5ddc 100644 --- a/app/models/issue_status.rb +++ b/app/models/issue_status.rb @@ -31,6 +31,7 @@ class IssueStatus < ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name, :case_sensitive => true validates_length_of :name, :maximum => 30 + validates_length_of :description, :maximum => 255 validates_inclusion_of :default_done_ratio, :in => 0..100, :allow_nil => true scope :sorted, lambda {order(:position)} @@ -38,6 +39,7 @@ class IssueStatus < ActiveRecord::Base safe_attributes( 'name', + 'description', 'is_closed', 'position', 'default_done_ratio') diff --git a/app/views/issue_statuses/_form.html.erb b/app/views/issue_statuses/_form.html.erb index 2c333a304..8f06451c6 100644 --- a/app/views/issue_statuses/_form.html.erb +++ b/app/views/issue_statuses/_form.html.erb @@ -2,6 +2,7 @@ <div class="box tabular"> <p><%= f.text_field :name, :required => true %></p> +<p><%= f.text_area :description, :rows => 4 %></p> <% if Issue.use_status_for_done_ratio? %> <p><%= f.select :default_done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }), :include_blank => true, :label => :field_done_ratio %></p> <% end %> diff --git a/app/views/issue_statuses/index.api.rsb b/app/views/issue_statuses/index.api.rsb index 4f3b732d8..e1d85c78d 100644 --- a/app/views/issue_statuses/index.api.rsb +++ b/app/views/issue_statuses/index.api.rsb @@ -4,6 +4,7 @@ api.array :issue_statuses do api.id status.id api.name status.name api.is_closed status.is_closed + api.description status.description end end end diff --git a/app/views/issue_statuses/index.html.erb b/app/views/issue_statuses/index.html.erb index c9f120cbd..509abd831 100644 --- a/app/views/issue_statuses/index.html.erb +++ b/app/views/issue_statuses/index.html.erb @@ -12,6 +12,7 @@ <th><%=l(:field_done_ratio)%></th> <% end %> <th><%=l(:field_is_closed)%></th> + <th><%=l(:field_description)%></th> <th></th> <th></th> </tr></thead> @@ -23,6 +24,7 @@ <td><%= status.default_done_ratio %></td> <% end %> <td><%= checked_image status.is_closed? %></td> + <td class="description"><%= status.description %></td> <td> <% unless WorkflowTransition.where('old_status_id = ? OR new_status_id = ?', status.id, status.id).exists? %> <span class="icon icon-warning"> diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index b5003c436..0487b5ee2 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -5,11 +5,14 @@ <% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %> <p> <%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), {:required => true}, - :onchange => "updateIssueFrom('#{escape_javascript(update_issue_form_path(@project, @issue))}', this)" %> + :onchange => "updateIssueFrom('#{escape_javascript(update_issue_form_path(@project, @issue))}', this)", + :title => @issue.status.description %> + <%= content_tag 'a', l(:label_open_issue_statuses_description), :class => 'icon-only icon-help', :title => l(:label_open_issue_statuses_description), :onclick => "showModal('issue_statuses_description', '500px'); return false;", :href => '#' if @allowed_statuses.any? {|s| s.description.present? } %> <% if @issue.transition_warning %> <span class="icon-only icon-warning" title="<%= @issue.transition_warning %>"><%= @issue.transition_warning %></span> <% end %> </p> +<%= render partial: 'issues/issue_status_description', locals: { issue_statuses: @allowed_statuses } %> <%= hidden_field_tag 'was_default_status', @issue.status_id, :id => nil if @issue.status == @issue.default_status %> <% else %> <p><label><%= l(:field_status) %></label> <%= @issue.status %></p> diff --git a/config/locales/en.yml b/config/locales/en.yml index 5397a521d..5a950a7ff 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1119,6 +1119,8 @@ en: label_inherited_from_group: "Inherited from group %{name}" label_trackers_description: Trackers description label_open_trackers_description: View all trackers description + label_issue_statuses_description: Issue statuses description + label_open_issue_statuses_description: View all issue statuses description label_preferred_body_part_text: Text label_preferred_body_part_html: HTML label_issue_history_properties: Property changes @@ -1314,6 +1316,7 @@ en: text_project_closed: This project is closed and read-only. text_turning_multiple_off: "If you disable multiple values, multiple values will be removed in order to preserve only one value per item." text_select_apply_tracker: "Select tracker" + text_select_apply_issue_status: "Select issue status" text_avatar_server_config_html: The current avatar server is <a href="%{url}">%{url}</a>. You can configure it in config/configuration.yml. text_no_subject: no subject text_allowed_queries_to_select: Public (to any users) queries only selectable diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index e63983706..f8e11b050 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -578,9 +578,9 @@ body.controller-issues h2.inline-flex {padding-right: 0} #issue_tree .issue > td.assigned_to, #relations .issue > td.assigned_to { white-space: nowrap; } -#trackers_description {display:none;} -#trackers_description dt {font-weight: bold; text-decoration: underline;} -#trackers_description dd {margin: 0; padding: 0 0 1em 0;} +#trackers_description, #issue_statuses_description {display:none;} +#trackers_description dt, #issue_statuses_description dt {font-weight: bold; text-decoration: underline;} +#trackers_description dd, #issue_statuses_description dd {margin: 0; padding: 0 0 1em 0;} #issue-form .assign-to-me-link { padding-left: 5px; } diff --git a/test/fixtures/issue_statuses.yml b/test/fixtures/issue_statuses.yml index 56a58f20a..31a01d77b 100644 --- a/test/fixtures/issue_statuses.yml +++ b/test/fixtures/issue_statuses.yml @@ -2,21 +2,24 @@ issue_statuses_001: id: 1 name: New + description: Description for New issue status is_closed: false position: 1 issue_statuses_002: id: 2 name: Assigned + description: Description for Assigned issue status is_closed: false position: 2 issue_statuses_003: id: 3 name: Resolved + description: Description for Resolved issue status is_closed: false position: 3 issue_statuses_004: - name: Feedback id: 4 + name: Feedback is_closed: false position: 4 issue_statuses_005: diff --git a/test/functional/issue_statuses_controller_test.rb b/test/functional/issue_statuses_controller_test.rb index b6a3dfab0..3ab88c614 100644 --- a/test/functional/issue_statuses_controller_test.rb +++ b/test/functional/issue_statuses_controller_test.rb @@ -64,6 +64,7 @@ class IssueStatusesControllerTest < Redmine::ControllerTest get :new assert_response :success assert_select 'input[name=?]', 'issue_status[name]' + assert_select 'textarea[name=?]', 'issue_status[description]' end def test_create @@ -72,7 +73,8 @@ class IssueStatusesControllerTest < Redmine::ControllerTest :create, :params => { :issue_status => { - :name => 'New status' + :name => 'New status', + :description => 'New status description' } } ) @@ -80,6 +82,7 @@ class IssueStatusesControllerTest < Redmine::ControllerTest assert_redirected_to :action => 'index' status = IssueStatus.order('id DESC').first assert_equal 'New status', status.name + assert_equal 'New status description', status.description end def test_create_with_failure @@ -99,6 +102,7 @@ class IssueStatusesControllerTest < Redmine::ControllerTest get(:edit, :params => {:id => '3'}) assert_response :success assert_select 'input[name=?][value=?]', 'issue_status[name]', 'Resolved' + assert_select 'textarea[name=?]', 'issue_status[description]', 'Description for Resolved issue status' end def test_update @@ -107,13 +111,15 @@ class IssueStatusesControllerTest < Redmine::ControllerTest :params => { :id => '3', :issue_status => { - :name => 'Renamed status' + :name => 'Renamed status', + :description => 'Renamed status description' } } ) assert_redirected_to :action => 'index' status = IssueStatus.find(3) assert_equal 'Renamed status', status.name + assert_equal 'Renamed status description', status.description end def test_update_with_failure diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index e0da28e22..d572a1f80 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -3881,6 +3881,49 @@ class IssuesControllerTest < Redmine::ControllerTest assert_select 'div#trackers_description', 0 end + def test_get_new_should_show_issue_status_description + @request.session[:user_id] = 2 + get :new, :params => { + :project_id => 1, + :issue => { + :status_id => 2 + } + } + assert_response :success + + assert_select 'form#issue-form' do + assert_select 'a[title=?]', 'View all issue statuses description', :text => 'View all issue statuses description' + assert_select 'select[name=?][title=?]', 'issue[status_id]', 'Description for Assigned issue status' + end + + assert_select 'div#issue_statuses_description' do + assert_select 'h3', :text => 'Issue statuses description', :count => 1 + assert_select 'dt', 2 + assert_select 'dt', :text => 'New', :count => 1 + assert_select 'dd', :text => 'Description for New issue status', :count => 1 + end + end + + def test_get_new_should_not_show_issue_status_description + IssueStatus.update_all(:description => '') + + @request.session[:user_id] = 2 + get :new, :params => { + :project_id => 1, + :issue => { + :status_id => 2 + } + } + assert_response :success + + assert_select 'form#issue-form' do + assert_select 'a[title=?]', 'View all issue statuses description', 0 + assert_select 'select[name=?][title=?]', 'issue[status_id]', '' + end + + assert_select 'div#issue_statuses_description', 0 + end + def test_get_new_should_show_create_and_follow_button_when_issue_is_subtask_and_back_url_is_present @request.session[:user_id] = 2 get :new, params: { diff --git a/test/integration/api_test/issue_statuses_test.rb b/test/integration/api_test/issue_statuses_test.rb index c92ba55a9..7e7de65ac 100644 --- a/test/integration/api_test/issue_statuses_test.rb +++ b/test/integration/api_test/issue_statuses_test.rb @@ -29,6 +29,8 @@ class Redmine::ApiTest::IssueStatusesTest < Redmine::ApiTest::Base assert_equal 'application/xml', @response.media_type assert_select 'issue_statuses[type=array] issue_status id', :text => '2' do assert_select '~ name', :text => 'Assigned' + assert_select '~ is_closed', :text => 'false' + assert_select '~ description', :text => 'Description for Assigned issue status' end end end diff --git a/test/unit/issue_status_test.rb b/test/unit/issue_status_test.rb index 3d2366886..25514d8e1 100644 --- a/test/unit/issue_status_test.rb +++ b/test/unit/issue_status_test.rb @@ -151,4 +151,9 @@ class IssueStatusTest < ActiveSupport::TestCase assert !issue.closed? assert_nil issue.closed_on end + + def test_issue_status_should_have_description + issue_status = IssueStatus.find(1) + assert_equal 'Description for New issue status', issue_status.description + end end |