From 44ea826a21071ab3e0b07ecfcd56020eea219078 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Thu, 18 Mar 2021 03:58:29 +0000 Subject: "Copy link" feature for issue and issue journal (#34703). Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@20816 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 8 ++++++++ app/helpers/journals_helper.rb | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'app/helpers') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5163ea181..fe95eea47 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1818,6 +1818,14 @@ module ApplicationHelper ) end + def copy_object_url_link(url) + link_to_function( + l(:button_copy_link), 'copyTextToClipboard(this);', + class: 'icon icon-copy-link', + data: {'clipboard-text' => url} + ) + end + private def wiki_helper diff --git a/app/helpers/journals_helper.rb b/app/helpers/journals_helper.rb index 4c3d410ec..ef649a278 100644 --- a/app/helpers/journals_helper.rb +++ b/app/helpers/journals_helper.rb @@ -29,9 +29,11 @@ module JournalsHelper def render_journal_actions(issue, journal, options={}) links = [] dropbown_links = [] + indice = journal.indice || @journal.issue.visible_journals_with_index.find{|j| j.id == @journal.id}.indice + + dropbown_links << copy_object_url_link(issue_url(issue, anchor: "note-#{indice}", only_path: false)) if journal.notes.present? if options[:reply_links] - indice = journal.indice || @journal.issue.visible_journals_with_index.find{|j| j.id == @journal.id}.indice links << link_to(l(:button_quote), quoted_issue_path(issue, :journal_id => journal, :journal_indice => indice), :remote => true, -- cgit v1.2.3