summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2024-06-04 20:04:45 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2024-06-04 20:04:45 +0000
commit38a8adb2a20c9c6ae57b0633037290c64a34b624 (patch)
tree3e3a7ca75019c0c8846dc2ac820e8b819ce30aad /app
parentc19176a5c48e33e6bcfe280736092154deb58181 (diff)
downloadredmine-38a8adb2a20c9c6ae57b0633037290c64a34b624.tar.gz
redmine-38a8adb2a20c9c6ae57b0633037290c64a34b624.zip
Adds description field to custom queries (#9309).
Patch by Go MAEDA (@maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@22855 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/queries_controller.rb1
-rw-r--r--app/helpers/queries_helper.rb3
-rw-r--r--app/models/query.rb1
-rw-r--r--app/views/admin/projects.html.erb1
-rw-r--r--app/views/calendars/show.html.erb1
-rw-r--r--app/views/gantts/show.html.erb1
-rw-r--r--app/views/issues/index.html.erb1
-rw-r--r--app/views/projects/index.html.erb1
-rw-r--r--app/views/queries/_form.html.erb2
-rw-r--r--app/views/timelog/index.html.erb1
-rw-r--r--app/views/users/index.html.erb1
11 files changed, 13 insertions, 1 deletions
diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb
index db5d785f9..53ce029b9 100644
--- a/app/controllers/queries_controller.rb
+++ b/app/controllers/queries_controller.rb
@@ -133,6 +133,7 @@ class QueriesController < ApplicationController
@query.column_names = nil if params[:default_columns]
@query.sort_criteria = (params[:query] && params[:query][:sort_criteria]) || @query.sort_criteria
@query.name = params[:query] && params[:query][:name]
+ @query.description = params[:query] && params[:query][:description]
if User.current.allowed_to?(:manage_public_queries, @query.project) || User.current.admin?
@query.visibility = (params[:query] && params[:query][:visibility]) || Query::VISIBILITY_PRIVATE
@query.role_ids = params[:query] && params[:query][:role_ids]
diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb
index 160473ae8..453149436 100644
--- a/app/helpers/queries_helper.rb
+++ b/app/helpers/queries_helper.rb
@@ -506,7 +506,8 @@ module QueriesHelper
content_tag('li',
link_to(query.name,
url_params.merge(:query_id => query),
- :class => css) +
+ :class => css,
+ :title => query.description) +
clear_link.html_safe)
end.join("\n").html_safe,
:class => 'queries'
diff --git a/app/models/query.rb b/app/models/query.rb
index 90970c96e..931abc958 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -270,6 +270,7 @@ class Query < ApplicationRecord
validates_presence_of :name
validates_length_of :name, :maximum => 255
+ validates_length_of :description, :maximum => 255
validates :visibility, :inclusion => {:in => [VISIBILITY_PUBLIC, VISIBILITY_ROLES, VISIBILITY_PRIVATE]}
validate :validate_query_filters
validate do |query|
diff --git a/app/views/admin/projects.html.erb b/app/views/admin/projects.html.erb
index e6805453a..c0e2a713e 100644
--- a/app/views/admin/projects.html.erb
+++ b/app/views/admin/projects.html.erb
@@ -3,6 +3,7 @@
</div>
<h2><%= @query.new_record? ? l(:label_project_plural) : @query.name %></h2>
+<%= @query.persisted? && @query.description.present? ? content_tag('p', @query.description, class: 'subtitle') : '' %>
<%= form_tag(admin_projects_path(@project, nil), :method => :get, :id => 'query_form') do %>
<%= hidden_field_tag 'admin_projects', '1' %>
diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb
index d3d00a427..dfef117de 100644
--- a/app/views/calendars/show.html.erb
+++ b/app/views/calendars/show.html.erb
@@ -1,4 +1,5 @@
<h2><%= @query.new_record? ? l(:label_calendar) : @query.name %></h2>
+<%= @query.persisted? && @query.description.present? ? content_tag('p', @query.description, class: 'subtitle') : '' %>
<%= form_tag({:controller => 'calendars', :action => 'show', :project_id => @project},
:method => :get, :id => 'query_form') do %>
diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb
index 43e430311..ceca3d1a7 100644
--- a/app/views/gantts/show.html.erb
+++ b/app/views/gantts/show.html.erb
@@ -3,6 +3,7 @@
</div>
<h2><%= @query.new_record? ? l(:label_gantt) : @query.name %></h2>
+<%= @query.persisted? && @query.description.present? ? content_tag('p', @query.description, class: 'subtitle') : '' %>
<%= form_tag({:controller => 'gantts', :action => 'show',
:project_id => @project, :month => params[:month],
diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb
index 997a64e55..1ab5198a1 100644
--- a/app/views/issues/index.html.erb
+++ b/app/views/issues/index.html.erb
@@ -19,6 +19,7 @@
<h2><%= @query.new_record? ? l(:label_issue_plural) : @query.name %></h2>
<% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %>
+<%= @query.persisted? && @query.description.present? ? content_tag('p', @query.description, class: 'subtitle') : '' %>
<%= form_tag(_project_issues_path(@project), :method => :get, :id => 'query_form') do %>
<%= render :partial => 'queries/query_form' %>
diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb
index 3bd665640..d18cf6e47 100644
--- a/app/views/projects/index.html.erb
+++ b/app/views/projects/index.html.erb
@@ -5,6 +5,7 @@
</div>
<h2><%= @query.new_record? ? l(:label_project_plural) : @query.name %></h2>
+<%= @query.persisted? && @query.description.present? ? content_tag('p', @query.description, class: 'subtitle') : '' %>
<%= form_tag(projects_path(@project, nil), :method => :get, :id => 'query_form') do %>
<%= render :partial => 'queries/query_form' %>
diff --git a/app/views/queries/_form.html.erb b/app/views/queries/_form.html.erb
index 5f4fa3490..27391e8ef 100644
--- a/app/views/queries/_form.html.erb
+++ b/app/views/queries/_form.html.erb
@@ -8,6 +8,8 @@
<p><label for="query_name"><%=l(:field_name)%></label>
<%= text_field 'query', 'name', :size => 80 %></p>
+<p><label for="query_description"><%=l(:field_description)%></label>
+<%= text_field 'query', 'description', :size => 80 %></p>
<% if User.current.admin? ||
User.current.allowed_to?(:manage_public_queries, @query.project) %>
diff --git a/app/views/timelog/index.html.erb b/app/views/timelog/index.html.erb
index a045e4743..ec7580b9a 100644
--- a/app/views/timelog/index.html.erb
+++ b/app/views/timelog/index.html.erb
@@ -14,6 +14,7 @@
</div>
<h2><%= @query.new_record? ? l(:label_spent_time) : @query.name %></h2>
+<%= @query.persisted? && @query.description.present? ? content_tag('p', @query.description, class: 'subtitle') : '' %>
<%= form_tag(_time_entries_path(@project, nil), :method => :get, :id => 'query_form') do %>
<%= render :partial => 'date_range' %>
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb
index d609bfd78..9071dba19 100644
--- a/app/views/users/index.html.erb
+++ b/app/views/users/index.html.erb
@@ -8,6 +8,7 @@
</div>
<h2><%= @query.new_record? ? l(:label_user_plural) : @query.name %></h2>
+<%= @query.persisted? && @query.description.present? ? content_tag('p', @query.description, class: 'subtitle') : '' %>
<%= form_tag(users_path, method: :get, id: 'query_form') do %>
<%= render partial: 'queries/query_form' %>