From 96080580083081655a8b5879a8d04bef8042ace2 Mon Sep 17 00:00:00 2001 From: Tom Bull Date: Wed, 2 Mar 2016 13:58:30 +0000 Subject: [PATCH] Merge branch '3.2-stable' of github.com:redmine/redmine # Conflicts: # config/locales/ar.yml # config/locales/az.yml # config/locales/bs.yml # config/locales/ca.yml # config/locales/cs.yml # config/locales/da.yml # config/locales/de.yml # config/locales/el.yml # config/locales/en-GB.yml # config/locales/es-PA.yml # config/locales/es.yml # config/locales/et.yml # config/locales/eu.yml # config/locales/fa.yml # config/locales/fi.yml # config/locales/gl.yml # config/locales/he.yml # config/locales/hr.yml # config/locales/hu.yml # config/locales/id.yml # config/locales/it.yml # config/locales/ja.yml # config/locales/ko.yml # config/locales/lt.yml # config/locales/lv.yml # config/locales/mk.yml # config/locales/mn.yml # config/locales/nl.yml # config/locales/no.yml # config/locales/pl.yml # config/locales/pt-BR.yml # config/locales/pt.yml # config/locales/ro.yml # config/locales/ru.yml # config/locales/sk.yml # config/locales/sl.yml # config/locales/sq.yml # config/locales/sr-YU.yml # config/locales/sr.yml # config/locales/sv.yml # config/locales/th.yml # config/locales/tr.yml # config/locales/uk.yml # config/locales/vi.yml # config/locales/zh.yml # lib/redmine/pagination.rb --- app/helpers/queries_helper.rb | 12 ++++++++++++ app/models/issue.rb | 10 ++++++++++ app/models/issue_query.rb | 1 + app/views/settings/_display.html.erb | 2 ++ config/locales/en.yml | 2 ++ config/settings.yml | 3 +++ public/stylesheets/application.css | 2 +- 7 files changed, 31 insertions(+), 1 deletion(-) diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index 9ad2540..51f60c9 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -17,6 +17,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +require "htmlentities" + module QueriesHelper include ApplicationHelper @@ -150,6 +152,16 @@ module QueriesHelper content_tag('span', value.to_s(issue) {|other| link_to_issue(other, :subject => false, :tracker => false)}.html_safe, :class => value.css_classes_for(issue)) + when :latest_journal_text + last_note_html = textilizable(value, :inline_attachments => false, :attachments => false) + last_note_html = last_note_html.gsub('>', '> ') + last_note_unformatted_text = strip_tags(last_note_html) + last_note_unformatted_text = last_note_unformatted_text.gsub('ΒΆ', '') + html_decoder = HTMLEntities.new + last_note_unformatted_text = html_decoder.decode(last_note_unformatted_text) + last_note_unformatted_text = last_note_unformatted_text.gsub(/\s+/, ' ') + truncated_text = truncate(last_note_unformatted_text, length: Setting.last_note_text_length.to_i, separator: ' ') + format_object(truncated_text) else format_object(value) end diff --git a/app/models/issue.rb b/app/models/issue.rb index ba7a9b1..d3f0188 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -740,6 +740,16 @@ class Issue < ActiveRecord::Base end end + # Returns the notes from the latest journal where notes exist + def latest_journal_text + if new_record? + nil + else + last_note_object = journals.where.not(notes: '').order(created_on: :desc).first + last_note_object.nil? ? "" : last_note_object.notes + end + end + # Returns a scope for journals that have an id greater than journal_id def journals_after(journal_id) scope = journals.reorder("#{Journal.table_name}.id ASC") diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb index 429201e..5b3a23c 100644 --- a/app/models/issue_query.rb +++ b/app/models/issue_query.rb @@ -43,6 +43,7 @@ class IssueQuery < Query QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'), QueryColumn.new(:closed_on, :sortable => "#{Issue.table_name}.closed_on", :default_order => 'desc'), QueryColumn.new(:relations, :caption => :label_related_issues), + QueryColumn.new(:latest_journal_text, :caption => :label_last_note), QueryColumn.new(:description, :inline => false) ] diff --git a/app/views/settings/_display.html.erb b/app/views/settings/_display.html.erb index 3497f90..5482700 100644 --- a/app/views/settings/_display.html.erb +++ b/app/views/settings/_display.html.erb @@ -24,6 +24,8 @@

<%= setting_check_box :thumbnails_enabled %>

<%= setting_text_field :thumbnails_size, :size => 6 %>

+ +

<%= setting_text_field :last_note_text_length, :size => 6 %>

<%= submit_tag l(:button_save) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 7d98034..526ea92 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -419,6 +419,7 @@ en: setting_session_timeout: Session inactivity timeout setting_thumbnails_enabled: Display attachment thumbnails setting_thumbnails_size: Thumbnails size (in pixels) + setting_last_note_text_length: Length of text to display in 'Last Note' field (characters) setting_non_working_week_days: Non-working days setting_jsonp_enabled: Enable JSONP support setting_default_projects_tracker_ids: Default trackers for new projects @@ -779,6 +780,7 @@ en: label_permissions_report: Permissions report label_watched_issues: Watched issues label_related_issues: Related issues + label_last_note: Last note label_applied_status: Applied status label_loading: Loading... label_relation_new: New relation diff --git a/config/settings.yml b/config/settings.yml index 5031b68..955cc19 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -254,6 +254,9 @@ thumbnails_enabled: thumbnails_size: format: int default: 100 +last_note_text_length: + format: int + default: 30 non_working_week_days: serialized: true default: diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 2885920..3f0b77f 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -154,7 +154,7 @@ tr.project.idnt-7 td.name {padding-left: 9.5em;} tr.project.idnt-8 td.name {padding-left: 11em;} tr.project.idnt-9 td.name {padding-left: 12.5em;} -tr.issue { text-align: center; white-space: nowrap; } +tr.issue { text-align: center; } tr.issue td.subject, tr.issue td.category, td.assigned_to, tr.issue td.string, tr.issue td.text, tr.issue td.relations, tr.issue td.parent { white-space: normal; } tr.issue td.relations { text-align: left; } tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;} -- 2.6.4