diff options
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9bb26bdec..ab418fb38 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -128,7 +128,7 @@ module ApplicationHelper # * :download - Force download (default: false) def link_to_attachment(attachment, options={}) text = options.delete(:text) || attachment.filename - icon = options.fetch(:icon, false) + icon = options.delete(:icon) if options.delete(:download) route_method = :download_named_attachment_url @@ -436,7 +436,7 @@ module ApplicationHelper def format_changeset_comments(changeset, options={}) method = options[:short] ? :short_comments : :comments - textilizable changeset, method, :formatting => Setting.commit_logs_formatting? + textilizable changeset, method, project: changeset.project, formatting: Setting.commit_logs_formatting? end def due_date_distance_in_words(date) @@ -518,6 +518,8 @@ module ApplicationHelper def render_flash_messages s = +'' flash.each do |k, v| + next unless v.is_a?(String) + s << content_tag('div', notice_icon(k) + v.html_safe, :class => "flash #{k}", :id => "flash_#{k}") end s.html_safe @@ -789,7 +791,7 @@ module ApplicationHelper end def other_formats_links(&) - concat('<p class="other-formats">'.html_safe + l(:label_export_to)) + concat('<p class="other-formats hide-when-print">'.html_safe + l(:label_export_to)) yield Redmine::Views::OtherFormatsBuilder.new(self) concat('</p>'.html_safe) end @@ -1386,7 +1388,7 @@ module ApplicationHelper <| $) }x - HEADING_RE = /(<h(\d)( [^>]+)?>(.+?)<\/h(\d)>)/i unless const_defined?(:HEADING_RE) + HEADING_RE = /(<h(\d)( [^>]+)?>(.+?)<\/h(\d)>)/im unless const_defined?(:HEADING_RE) def parse_sections(text, project, obj, attr, only_path, options) return unless options[:edit_section_links] @@ -1607,7 +1609,7 @@ module ApplicationHelper # Helper to render JSON in views def raw_json(arg) - arg.to_json.to_s.gsub('/', '\/').html_safe + arg.to_json.gsub('/', '\/').html_safe end def back_url_hidden_field_tag @@ -1805,7 +1807,7 @@ module ApplicationHelper if Setting.wiki_tablesort_enabled? tags << javascript_include_tag('tablesort-5.2.1.min.js', 'tablesort-5.2.1.number.min.js') end - tags << javascript_include_tag('application', 'responsive') + tags << javascript_include_tag('application-legacy', 'responsive') unless User.current.pref.warn_on_leaving_unsaved == '0' warn_text = escape_javascript(l(:text_warn_on_leaving_unsaved)) tags << @@ -1917,6 +1919,14 @@ module ApplicationHelper end end + def heads_for_i18n + javascript_tag( + "rm = window.rm || {};" \ + "rm.I18n = rm.I18n || {};" \ + "rm.I18n = Object.freeze({buttonCopy: '#{l(:button_copy)}'});" + ) + end + def heads_for_auto_complete(project) data_sources = autocomplete_data_sources(project) javascript_tag( @@ -1934,7 +1944,7 @@ module ApplicationHelper def copy_object_url_link(url) link_to_function( - sprite_icon('copy-link', l(:button_copy_link)), 'copyTextToClipboard(this);', + sprite_icon('copy-link', l(:button_copy_link)), 'copyDataClipboardTextToClipboard(this);', class: 'icon icon-copy-link', data: {'clipboard-text' => url} ) |