Project

General

Profile

Feature #34703 » feature-34703-1.patch

Mizuki ISHIKAWA, 2021-02-10 09:03

View differences:

app/helpers/application_helper.rb
)
end
def copy_object_url_link(url, only_icon=false)
link_to_function(
l(:button_copy_link), "copyTextToClipboard(this);",
class: "#{only_icon ? 'icon-only' : 'icon'} icon-copy-link",
data: {'clipboard-text' => url},
title: (l(:button_copy_link) if only_icon)
)
end
private
def wiki_helper
app/helpers/journals_helper.rb
# Returns the action links for an issue journal
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,
......
:title => l(:button_edit),
:class => 'icon-only icon-edit'
)
links << link_to(l(:button_delete),
dropbown_links << link_to(l(:button_delete),
journal_path(journal, :journal => {:notes => ""}),
:remote => true,
:method => 'put', :data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => 'icon-only icon-del'
:class => 'icon icon-del'
)
end
end
safe_join(links, ' ')
safe_join(links, ' ') +
actions_dropdown do
safe_join(dropbown_links, ' ')
end
end
def render_notes(issue, journal, options={})
app/views/issues/_action_menu.html.erb
<%= link_to l(:button_log_time), new_issue_time_entry_path(@issue),
:class => 'icon icon-time-add' if User.current.allowed_to?(:log_time, @project) %>
<%= watcher_link(@issue, User.current) %>
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue),
:class => 'icon icon-copy' if User.current.allowed_to?(:copy_issues, @project) && Issue.allowed_target_projects.any? %>
<%= link_to l(:button_delete), issue_path(@issue),
:data => {:confirm => issues_destroy_confirmation_message(@issue)},
:method => :delete, :class => 'icon icon-del' if @issue.deletable? %>
<%= actions_dropdown do %>
<%= copy_object_url_link(issue_url(@issue, only_path: false)) %>
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue),
:class => 'icon icon-copy' if User.current.allowed_to?(:copy_issues, @project) && Issue.allowed_target_projects.any? %>
<%= link_to l(:button_delete), issue_path(@issue),
:data => {:confirm => issues_destroy_confirmation_message(@issue)},
:method => :delete, :class => 'icon icon-del' if @issue.deletable? %>
<% end %>
</div>
config/locales/en.yml
button_change_password: Change password
button_copy: Copy
button_copy_and_follow: Copy and follow
button_copy_link: Copy link
button_annotate: Annotate
button_update: Update
button_configure: Configure
public/javascripts/application.js
return key;
}
function copyTextToClipboard(target) {
if (target) {
var temp = document.createElement('textarea');
temp.value = target.getAttribute('data-clipboard-text');
document.body.appendChild(temp);
temp.select();
document.execCommand('copy');
if (temp.parentNode) {
temp.parentNode.removeChild(temp);
}
if ($(target).closest('.drdn.expanded').length) {
$(target).closest('.drdn.expanded').removeClass("expanded");
}
}
return false;
}
function updateIssueFrom(url, el) {
$('#all_attributes input, #all_attributes textarea, #all_attributes select').each(function(){
$(this).data('valuebeforeupdate', $(this).val());
public/stylesheets/application.css
.icon-file.application-pdf { background-image: url(../images/files/pdf.png); }
.icon-file.application-zip { background-image: url(../images/files/zip.png); }
.icon-file.application-gzip { background-image: url(../images/files/zip.png); }
.icon-copy-link { background-image: url(../images/page_link.png); }
.sort-handle.ajax-loading { background-image: url(../images/loading.gif); }
tr.ui-sortable-helper { border:1px solid #e4e4e4; }
(1-1/9)