added a print menu item to the context menu of a wiki page

pull/11883/head
Sven R. Kunze 2 years ago committed by Oliver Günther
parent c97346a3e5
commit 93bdcb537b
  1. 10
      app/views/wiki/show.html.erb
  2. 1
      config/locales/en.yml
  3. 7
      frontend/src/app/core/augmenting/dynamic-scripts/print_handler.js

@ -39,6 +39,11 @@ See COPYRIGHT and LICENSE files for more details.
<% @formatted_text = format_text (@content || @page.content), :text, attachments: @page.attachments %>
<% description strip_tags(@formatted_text) %>
<% content_for :header_tags do %>
<meta name="required_script" content="print_handler" />
<% end %>
<%= toolbar title: title, html: {class: '-with-dropdown'} do %>
<% if @editable %>
<% if User.current.allowed_to? :edit_wiki_pages, @project %>
@ -97,6 +102,11 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
<%= li_unless_nil(link_to_if_authorized(t(:label_history), {action: 'history', id: @page}, class: 'icon-context icon-activity-history')) %>
<%= li_unless_nil(link_to_if_authorized(t(:button_manage_menu_entry), {controller: '/wiki_menu_items', action: 'edit', project_id: @project.identifier, id: @page}, class: 'icon-context icon-settings')) %>
<li>
<a class="icon-context icon-print op-wiki-context-print" title="<%= t('wiki.print_hint') %>">
<%= t(:button_print) %>
</a>
</li>
<% if User.current.allowed_to?(:export_wiki_pages, @project) %>
<section data-augmented-model-wrapper
data-modal-class-name="wiki-export---modal">

@ -390,6 +390,7 @@ en:
wiki:
page_not_editable_index: The requested page does not (yet) exist. You have been redirected to the index of all wiki pages.
no_results_title_text: There are currently no wiki pages.
print_hint: This will print the content of this wiki page without any navigation bars.
index:
no_results_content_text: Add a new wiki page

@ -0,0 +1,7 @@
// we cannot just use print as the handler
function print_wiki_handler() {
print();
}
jQuery(document.body).on('click', '.op-wiki-context-print', print_wiki_handler);
Loading…
Cancel
Save