Project

General

Profile

Feature #34703 » diff-rejected.patch

Mizuki ISHIKAWA, 2021-02-10 09:18

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
    tag.div(class: 'copy-link-wrapper') do
1822
      link_to_function(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)) +
1826
      tag.span(l(:text_success_copied), class: 'success-copied-message')
1827
    end
1828
  end
1829

  
1820 1830
  private
1821 1831

  
1822 1832
  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
    indice = journal.indice || @journal.issue.visible_journals_with_index.find{|j| j.id == @journal.id}.indice
32

  
33
    links << copy_object_url_link(issue_url(issue, anchor: "note-#{indice}", only_path: false), true)
31 34
    if journal.notes.present?
32 35
      if options[:reply_links]
33
        indice = journal.indice || @journal.issue.visible_journals_with_index.find{|j| j.id == @journal.id}.indice
34 36
        links << link_to(l(:button_quote),
35 37
                         quoted_issue_path(issue, :journal_id => journal, :journal_indice => indice),
36 38
                         :remote => true,
app/views/issues/_action_menu.html.erb
4 4
            :class => 'icon icon-edit', :accesskey => accesskey(:edit) if @issue.editable? %>
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
<%= copy_object_url_link(issue_url(@issue, only_path: false)) %>
7 8
<%= watcher_link(@issue, User.current) %>
8 9
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue),
9 10
            :class => 'icon icon-copy' if User.current.allowed_to?(:copy_issues, @project) && Issue.allowed_target_projects.any? %>
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
......
1263 1264
  text_select_apply_tracker: "Select tracker"
1264 1265
  text_avatar_server_config_html: The current avatar server is <a href="%{url}">%{url}</a>. You can configure it in config/configuration.yml.
1265 1266
  text_no_subject: no subject
1267
  text_success_copied: Copied.
1266 1268

  
1267 1269

  
1268 1270
  default_role_manager: Manager
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

  
577
    $(target.nextElementSibling).show().delay(2000).fadeOut(300);
578
  }
579
  return false;
580
}
581

  
566 582
function updateIssueFrom(url, el) {
567 583
  $('#all_attributes input, #all_attributes textarea, #all_attributes select').each(function(){
568 584
    $(this).data('valuebeforeupdate', $(this).val());
public/stylesheets/application.css
596 596
#history div:target h4.note-header {background-color:#DDEEFF;}
597 597
#history p.nodata {display: none;}
598 598

  
599
.copy-link-wrapper {
600
  display: inline; position: relative;
601
}
602
.copy-link-wrapper .success-copied-message {
603
  display: none;
604
  z-index: 25;
605
  position: absolute;
606
  border: 1px solid #555;
607
  background-color: #fff;
608
  padding: 4px;
609
  font-size: 0.8em;
610
  color: #453f3f;
611
  top: 15px;
612
  right: 0px;
613
}
614

  
599 615
div#activity dl, #search-results { margin-left: 2em; }
600 616
div#activity dd, #search-results dd { margin-bottom: 1em; padding-left: 18px; font-size: 0.9em; }
601 617
div#activity dt.me .time { border-bottom: 1px solid #999; }
......
1607 1623
.icon-file.application-pdf { background-image: url(../images/files/pdf.png); }
1608 1624
.icon-file.application-zip { background-image: url(../images/files/zip.png); }
1609 1625
.icon-file.application-gzip { background-image: url(../images/files/zip.png); }
1626
.icon-copy-link { background-image: url(../images/page_link.png); }
1610 1627

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