summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/projects_controller.rb1
-rw-r--r--app/helpers/issues_helper.rb7
-rw-r--r--app/helpers/trackers_helper.rb6
-rw-r--r--app/models/tracker.rb4
-rw-r--r--app/views/issues/_form.html.erb9
-rw-r--r--app/views/issues/_trackers_description.html.erb13
-rw-r--r--app/views/projects/settings/_issues.html.erb2
-rw-r--r--app/views/projects/show.html.erb2
-rw-r--r--app/views/trackers/_form.html.erb1
-rw-r--r--app/views/trackers/index.api.rsb1
-rw-r--r--app/views/trackers/index.html.erb2
-rw-r--r--config/locales/en.yml2
-rw-r--r--db/migrate/20190315102101_add_trackers_description.rb5
-rw-r--r--public/stylesheets/application.css5
-rw-r--r--public/stylesheets/responsive.css4
-rw-r--r--test/fixtures/trackers.yml2
-rw-r--r--test/functional/issues_controller_test.rb43
-rw-r--r--test/integration/api_test/trackers_test.rb1
-rw-r--r--test/unit/tracker_test.rb6
19 files changed, 110 insertions, 6 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 09cc0f713..ca9959bac 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -35,6 +35,7 @@ class ProjectsController < ApplicationController
helper :queries
helper :repositories
helper :members
+ helper :trackers
# Lists visible projects
def index
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 00bf5092b..ec340cd82 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -188,13 +188,18 @@ module IssuesHelper
end
def trackers_options_for_select(issue)
+ trackers = trackers_for_select(issue)
+ trackers.collect {|t| [t.name, t.id]}
+ end
+
+ def trackers_for_select(issue)
trackers = issue.allowed_target_trackers
if issue.new_record? && issue.parent_issue_id.present?
trackers = trackers.reject do |tracker|
issue.tracker_id != tracker.id && tracker.disabled_core_fields.include?('parent_issue_id')
end
end
- trackers.collect {|t| [t.name, t.id]}
+ trackers
end
class IssueFieldsRows
diff --git a/app/helpers/trackers_helper.rb b/app/helpers/trackers_helper.rb
index dd305c91e..468fe610f 100644
--- a/app/helpers/trackers_helper.rb
+++ b/app/helpers/trackers_helper.rb
@@ -20,4 +20,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module TrackersHelper
+
+ def tracker_name_tag(tracker)
+ title = tracker.description.presence
+ css = title ? "field-description" : nil
+ content_tag 'span', tracker.name, :class => css, :title => title
+ end
end
diff --git a/app/models/tracker.rb b/app/models/tracker.rb
index 81fea01ba..3565294a3 100644
--- a/app/models/tracker.rb
+++ b/app/models/tracker.rb
@@ -38,6 +38,7 @@ class Tracker < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
validates_length_of :name, :maximum => 30
+ validates_length_of :description, :maximum => 255
scope :sorted, lambda { order(:position) }
scope :named, lambda {|arg| where("LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip)}
@@ -71,7 +72,8 @@ class Tracker < ActiveRecord::Base
'core_fields',
'position',
'custom_field_ids',
- 'project_ids'
+ 'project_ids',
+ 'description'
def to_s; name end
diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb
index c99927d8a..5bc98ebbd 100644
--- a/app/views/issues/_form.html.erb
+++ b/app/views/issues/_form.html.erb
@@ -16,8 +16,13 @@
<% end %>
<% if @issue.safe_attribute?('tracker_id') || (@issue.persisted? && @issue.tracker_id_changed?) %>
-<p><%= f.select :tracker_id, trackers_options_for_select(@issue), {:required => true},
- :onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)" %></p>
+<p>
+ <%= f.select :tracker_id, trackers_options_for_select(@issue), {:required => true},
+ :onchange => "updateIssueFrom('#{escape_javascript update_issue_form_path(@project, @issue)}', this)",
+ :title => @issue.tracker.description %>
+ <%= content_tag 'a', l(:label_open_trackers_description), :class => 'icon-only icon-help', :title => l(:label_open_trackers_description), :onclick => "showModal('trackers_description', '500px'); return false;", :href => '#' if trackers_for_select(@issue).any? {|t| t.description.present? } %>
+</p>
+ <%= render partial: 'issues/trackers_description', locals: {trackers: trackers_for_select(@issue)} %>
<% end %>
<% if @issue.safe_attribute? 'subject' %>
diff --git a/app/views/issues/_trackers_description.html.erb b/app/views/issues/_trackers_description.html.erb
new file mode 100644
index 000000000..63c361983
--- /dev/null
+++ b/app/views/issues/_trackers_description.html.erb
@@ -0,0 +1,13 @@
+<% if trackers.any? {|t| t.description.present? } %>
+ <div class="modal" id="trackers_description">
+ <h3 class="title"><%= l(:label_trackers_description) %></h3>
+ <dl>
+ <% trackers.each do |tracker| %>
+ <% if tracker.description.present? %>
+ <dt><%= tracker.name %></dt>
+ <dd><%= tracker.description %></dd>
+ <% end %>
+ <% end %>
+ </dl>
+ </div>
+<% end %>
diff --git a/app/views/projects/settings/_issues.html.erb b/app/views/projects/settings/_issues.html.erb
index dc5265d8e..13c3ebc34 100644
--- a/app/views/projects/settings/_issues.html.erb
+++ b/app/views/projects/settings/_issues.html.erb
@@ -6,7 +6,7 @@
<% @trackers.each do |tracker| %>
<label class="floating">
<%= check_box_tag 'project[tracker_ids][]', tracker.id, @project.trackers.to_a.include?(tracker), :id => nil %>
- <%= tracker %>
+ <%= tracker_name_tag tracker %>
</label>
<% end %>
<%= hidden_field_tag 'project[tracker_ids][]', '' %>
diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb
index 14fd0817f..9c2d47524 100644
--- a/app/views/projects/show.html.erb
+++ b/app/views/projects/show.html.erb
@@ -52,7 +52,7 @@
<% @trackers.each do |tracker| %>
<tr>
<td class="name">
- <%= link_to tracker.name, project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id) %>
+ <%= link_to tracker.name, project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id), :title => tracker.description %>
</td>
<td>
<%= link_to @open_issues_by_tracker[tracker].to_i, project_issues_path(@project, :set_filter => 1, :tracker_id => tracker.id) %>
diff --git a/app/views/trackers/_form.html.erb b/app/views/trackers/_form.html.erb
index 9697adb07..27e086e56 100644
--- a/app/views/trackers/_form.html.erb
+++ b/app/views/trackers/_form.html.erb
@@ -11,6 +11,7 @@
:required => true %>
</p>
<p><%= f.check_box :is_in_roadmap %></p>
+<p><%= f.text_area :description, :rows => 4 %></p>
<p>
<label><%= l(:field_core_fields) %></label>
<% Tracker::CORE_FIELDS.each do |field| %>
diff --git a/app/views/trackers/index.api.rsb b/app/views/trackers/index.api.rsb
index de8579124..59affd7ae 100644
--- a/app/views/trackers/index.api.rsb
+++ b/app/views/trackers/index.api.rsb
@@ -4,6 +4,7 @@ api.array :trackers do
api.id tracker.id
api.name tracker.name
api.default_status(:id => tracker.default_status.id, :name => tracker.default_status.name) unless tracker.default_status.nil?
+ api.description tracker.description
end
end
end
diff --git a/app/views/trackers/index.html.erb b/app/views/trackers/index.html.erb
index 633edbcdb..20d09754d 100644
--- a/app/views/trackers/index.html.erb
+++ b/app/views/trackers/index.html.erb
@@ -9,6 +9,7 @@
<thead><tr>
<th><%=l(:label_tracker)%></th>
<th><%=l(:field_default_status)%></th>
+ <th><%=l(:field_description)%></th>
<th></th>
<th></th>
</tr></thead>
@@ -17,6 +18,7 @@
<tr>
<td class="name"><%= link_to tracker.name, edit_tracker_path(tracker) %></td>
<td><%= tracker.default_status.name %></td>
+ <td class="description"><%= tracker.description %></td>
<td>
<% unless tracker.workflow_rules.exists? %>
<span class="icon icon-warning">
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 63e33cfab..332d5e206 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1043,6 +1043,8 @@ en:
label_nothing_to_preview: Nothing to preview
label_inherited_from_parent_project: "Inherited from parent project"
label_inherited_from_group: "Inherited from group %{name}"
+ label_trackers_description: Trackers description
+ label_open_trackers_description: View all trackers description
button_login: Login
button_submit: Submit
diff --git a/db/migrate/20190315102101_add_trackers_description.rb b/db/migrate/20190315102101_add_trackers_description.rb
new file mode 100644
index 000000000..b2ece45f4
--- /dev/null
+++ b/db/migrate/20190315102101_add_trackers_description.rb
@@ -0,0 +1,5 @@
+class AddTrackersDescription < ActiveRecord::Migration[5.2]
+ def change
+ add_column :trackers, :description, :string, :after => :name
+ end
+end
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 147c8d4a0..4afcb70d7 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -489,6 +489,10 @@ div.issue.overdue .due-date .value { color: #c22; }
#issue_tree td.checkbox, #relations td.checkbox {display:none;}
#relations td.buttons, #issue_tree td.buttons {padding:0;}
+#trackers_description {display:none;}
+#trackers_description dt {font-weight: bold; text-decoration: underline;}
+#trackers_description dd {margin: 0; padding: 0 0 1em 0;}
+
fieldset.collapsible {border-width: 1px 0 0 0;}
fieldset.collapsible>legend { padding-left: 18px; background: url(../images/arrow_down.png) no-repeat 4px 40%; cursor:pointer; }
fieldset.collapsible.collapsed>legend { background-image: url(../images/arrow_right.png); }
@@ -1545,6 +1549,7 @@ img.filecontent.image {background-image: url(../images/transparent.png);}
overflow:hidden;
}
+
img {
image-orientation: from-image;
}
diff --git a/public/stylesheets/responsive.css b/public/stylesheets/responsive.css
index aa85d3091..a2193864c 100644
--- a/public/stylesheets/responsive.css
+++ b/public/stylesheets/responsive.css
@@ -755,6 +755,10 @@
float: none !important;
}
+ #all_attributes #issue_tracker_id {
+ width: 90%;
+ }
+
#issue_is_private_label {
display: inline;
}
diff --git a/test/fixtures/trackers.yml b/test/fixtures/trackers.yml
index c969549f6..41602a78f 100644
--- a/test/fixtures/trackers.yml
+++ b/test/fixtures/trackers.yml
@@ -5,12 +5,14 @@ trackers_001:
is_in_chlog: true
default_status_id: 1
position: 1
+ description: Description for Bug tracker
trackers_002:
name: Feature request
id: 2
is_in_chlog: true
default_status_id: 1
position: 2
+ description: Description for Feature request tracker
trackers_003:
name: Support request
id: 3
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 30ecd3073..e1637d83d 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -2969,6 +2969,49 @@ class IssuesControllerTest < Redmine::ControllerTest
assert_select 'option', text: /#{t.name}/, count: 0
end
+ def test_get_new_should_show_trackers_description
+ @request.session[:user_id] = 2
+ get :new, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1
+ }
+ }
+ assert_response :success
+
+ assert_select 'form#issue-form' do
+ assert_select 'a[title=?]', 'View all trackers description', :text => 'View all trackers description'
+ assert_select 'select[name=?][title=?]', 'issue[tracker_id]', 'Description for Bug tracker'
+ end
+
+ assert_select 'div#trackers_description' do
+ assert_select 'h3', 1, :text => 'Trackers description'
+ # only Bug and Feature have descriptions
+ assert_select 'dt', 2, :text => 'Bug'
+ assert_select 'dd', 2, :text => 'Description for Bug tracker'
+ end
+ end
+
+ def test_get_new_should_not_show_trackers_description_for_trackers_without_description
+ Tracker.update_all(:description => '')
+
+ @request.session[:user_id] = 2
+ get :new, :params => {
+ :project_id => 1,
+ :issue => {
+ :tracker_id => 1
+ }
+ }
+ assert_response :success
+
+ assert_select 'form#issue-form' do
+ assert_select 'a[title=?]', 'View all trackers description', 0
+ assert_select 'select[name=?][title=?]', 'issue[tracker_id]', ''
+ end
+
+ assert_select 'div#trackers_description', 0
+ end
+
def test_update_form_for_new_issue
@request.session[:user_id] = 2
post :new, :params => {
diff --git a/test/integration/api_test/trackers_test.rb b/test/integration/api_test/trackers_test.rb
index d29f288c4..3e89aeec3 100644
--- a/test/integration/api_test/trackers_test.rb
+++ b/test/integration/api_test/trackers_test.rb
@@ -30,6 +30,7 @@ class Redmine::ApiTest::TrackersTest < Redmine::ApiTest::Base
assert_select 'trackers[type=array] tracker id', :text => '2' do
assert_select '~ name', :text => 'Feature request'
+ assert_select '~ description', :text => 'Description for Feature request tracker'
end
end
end
diff --git a/test/unit/tracker_test.rb b/test/unit/tracker_test.rb
index f5cacd986..9f471ee87 100644
--- a/test/unit/tracker_test.rb
+++ b/test/unit/tracker_test.rb
@@ -134,4 +134,10 @@ class TrackerTest < ActiveSupport::TestCase
end
end
end
+
+ def test_tracker_should_have_description
+ tracker = Tracker.find(1)
+ assert tracker.respond_to?(:description)
+ assert_equal tracker.description, "Description for Bug tracker"
+ end
end