Project

General

Profile

Feature #34703 » feature-34703-1.patch

Mizuki ISHIKAWA, 2021-02-10 09:03

View differences:

app/helpers/application_helper.rb
1817 1817
    )
1818 1818
  end
1819 1819

  
1820
  def copy_object_url_link(url, only_icon=false)
1821
    link_to_function(
1822
      l(:button_copy_link), "copyTextToClipboard(this);",
1823
      class: "#{only_icon ? 'icon-only' : 'icon'} icon-copy-link",
1824
      data: {'clipboard-text' => url},
1825
      title: (l(:button_copy_link) if only_icon)
1826
    )
1827
  end
1828

  
1820 1829
  private
1821 1830

  
1822 1831
  def wiki_helper
app/helpers/journals_helper.rb
28 28
  # Returns the action links for an issue journal
29 29
  def render_journal_actions(issue, journal, options={})
30 30
    links = []
31
    dropbown_links = []
32
    indice = journal.indice || @journal.issue.visible_journals_with_index.find{|j| j.id == @journal.id}.indice
33

  
34
    dropbown_links << copy_object_url_link(issue_url(issue, anchor: "note-#{indice}", only_path: false))
31 35
    if journal.notes.present?
32 36
      if options[:reply_links]
33
        indice = journal.indice || @journal.issue.visible_journals_with_index.find{|j| j.id == @journal.id}.indice
34 37
        links << link_to(l(:button_quote),
35 38
                         quoted_issue_path(issue, :journal_id => journal, :journal_indice => indice),
36 39
                         :remote => true,
......
47 50
                         :title => l(:button_edit),
48 51
                         :class => 'icon-only icon-edit'
49 52
                        )
50
        links << link_to(l(:button_delete),
53
        dropbown_links << link_to(l(:button_delete),
51 54
                         journal_path(journal, :journal => {:notes => ""}),
52 55
                         :remote => true,
53 56
                         :method => 'put', :data => {:confirm => l(:text_are_you_sure)},
54
                         :title => l(:button_delete),
55
                         :class => 'icon-only icon-del'
57
                         :class => 'icon icon-del'
56 58
                        )
57 59
      end
58 60
    end
59
    safe_join(links, ' ')
61
    safe_join(links, ' ') +
62
    actions_dropdown do
63
      safe_join(dropbown_links, ' ')
64
    end
60 65
  end
61 66

  
62 67
  def render_notes(issue, journal, options={})
app/views/issues/_action_menu.html.erb
5 5
<%= link_to l(:button_log_time), new_issue_time_entry_path(@issue),
6 6
            :class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project) %>
7 7
<%= watcher_link(@issue, User.current) %>
8
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue),
9
            :class => 'icon icon-copy' if User.current.allowed_to?(:copy_issues, @project) && Issue.allowed_target_projects.any? %>
10
<%= link_to l(:button_delete), issue_path(@issue),
11
            :data => {:confirm => issues_destroy_confirmation_message(@issue)},
12
            :method => :delete, :class => 'icon icon-del' if @issue.deletable? %>
8
<%= actions_dropdown do %>
9
  <%= copy_object_url_link(issue_url(@issue, only_path: false)) %>
10
  <%= link_to l(:button_copy), project_copy_issue_path(@project, @issue),
11
              :class => 'icon icon-copy' if User.current.allowed_to?(:copy_issues, @project) && Issue.allowed_target_projects.any? %>
12
  <%= link_to l(:button_delete), issue_path(@issue),
13
              :data => {:confirm => issues_destroy_confirmation_message(@issue)},
14
              :method => :delete, :class => 'icon icon-del' if @issue.deletable? %>
15
<% end %>
13 16
</div>
config/locales/en.yml
1145 1145
  button_change_password: Change password
1146 1146
  button_copy: Copy
1147 1147
  button_copy_and_follow: Copy and follow
1148
  button_copy_link: Copy link
1148 1149
  button_annotate: Annotate
1149 1150
  button_update: Update
1150 1151
  button_configure: Configure
public/javascripts/application.js
563 563
  return key;
564 564
}
565 565

  
566
function copyTextToClipboard(target) {
567
  if (target) {
568
    var temp = document.createElement('textarea');
569
    temp.value = target.getAttribute('data-clipboard-text');
570
    document.body.appendChild(temp);
571
    temp.select();
572
    document.execCommand('copy');
573
    if (temp.parentNode) {
574
      temp.parentNode.removeChild(temp);
575
    }
576
    if ($(target).closest('.drdn.expanded').length) {
577
      $(target).closest('.drdn.expanded').removeClass("expanded");
578
    }
579
  }
580
  return false;
581
}
582

  
566 583
function updateIssueFrom(url, el) {
567 584
  $('#all_attributes input, #all_attributes textarea, #all_attributes select').each(function(){
568 585
    $(this).data('valuebeforeupdate', $(this).val());
public/stylesheets/application.css
1607 1607
.icon-file.application-pdf { background-image: url(../images/files/pdf.png); }
1608 1608
.icon-file.application-zip { background-image: url(../images/files/zip.png); }
1609 1609
.icon-file.application-gzip { background-image: url(../images/files/zip.png); }
1610
.icon-copy-link { background-image: url(../images/page_link.png); }
1610 1611

  
1611 1612
.sort-handle.ajax-loading { background-image: url(../images/loading.gif); }
1612 1613
tr.ui-sortable-helper { border:1px solid #e4e4e4; }
(1-1/9)