Feature #29791

Hide "Files" section in wiki pages when printing

Added by Taiki I 30 days ago. Updated 17 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Wiki
Target version:3.4.7
Resolution:Fixed

Description

I do not want to display the Files toggle when printing a wiki page. But, this element does not have a class or id which can be uniquely specified.

So, I'd like you to add "attachments" to the class attribute of this element.

source:trunk/app/views/wiki/show.html.erb#L53

Japanese

私はWikiページを印刷する際にFilesトグルを表示したくないと考えています。しかし、この要素は一意に特定できるclassやidを持っていません。
このため、この要素のclass属性に例えば"attachments"を追加してほしいと思っています。

29791-hidden-wiki-attachments.patch Magnifier (1.54 KB) Yuichi HARADA, 2018-10-31 06:24

29791-hidden-wiki-attachments-v2.patch Magnifier (767 Bytes) Yuichi HARADA, 2018-10-31 07:16

Associated revisions

Revision 17614
Added by Go MAEDA 17 days ago

Hide "Files" section in wiki pages when printing (#29791).

Patch by Yuichi HARADA.

Revision 17615
Added by Go MAEDA 17 days ago

Merged r17614 from trunk to 3.4-stable (#29791).

History

#1 Updated by Yuichi HARADA 17 days ago

+1
Since it has no meaning, it should be hidden when printing.

I made a patch, and attach it.

diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erb
index 559d5e0e0..507014989 100644
--- a/app/views/wiki/show.html.erb
+++ b/app/views/wiki/show.html.erb
@@ -50,12 +50,12 @@

 <%= render(:partial => "wiki/content", :locals => {:content => @content}) %>

-<fieldset class="collapsible collapsed">
+<fieldset class="collapsible collapsed wiki-attachments">
   <legend onclick="toggleFieldset(this);"><%= l(:label_attachment_plural) %> (<%= @page.attachments.length %>)</legend>
   <div style="display: none;">

   <%= link_to_attachments @page, :thumbnails => true %>
-  
+
   <% if @editable && authorize_for('wiki', 'add_attachment') %>
   <div id="wiki_add_attachment">
     <%= form_tag({:controller => 'wiki', :action => 'add_attachment',
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index ec5bb57df..c1c6d7600 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -1487,7 +1487,7 @@ img.filecontent.image {background-image: url(../images/transparent.png);}
   #top-menu, #header, #main-menu, #sidebar, #footer, .contextual, .other-formats { display:none; }
   #main { background: #fff; }
   #content { width: 99%; margin: 0; padding: 0; border: 0; background: #fff; overflow: visible !important;}
-  #wiki_add_attachment { display:none; }
+  #wiki_add_attachment, .wiki-attachments { display:none; }
   .hide-when-print, .pagination ul.pages, .pagination .per-page { display: none !important; }
   .autoscroll {overflow-x: visible;}
   table.list {margin-top:0.5em;}

#2 Updated by Go MAEDA 17 days ago

  • Subject changed from Make it possible to uniquely specify the Files element of the wiki page to Hide "Files" section in wiki pages when printing
  • Target version set to 4.1.0

#3 Updated by Go MAEDA 17 days ago

I think adding "hide-when-print" class is better because it is simpler and can clarify the intention to hide the section when printing.

Index: app/views/wiki/show.html.erb
===================================================================
--- app/views/wiki/show.html.erb    (revision 17612)
+++ app/views/wiki/show.html.erb    (working copy)
@@ -50,7 +50,7 @@

 <%= render(:partial => "wiki/content", :locals => {:content => @content}) %>

-<fieldset class="collapsible collapsed">
+<fieldset class="collapsible collapsed hide-when-print">
   <legend onclick="toggleFieldset(this);"><%= l(:label_attachment_plural) %> (<%= @page.attachments.length %>)</legend>
   <div style="display: none;">

#4 Updated by Yuichi HARADA 17 days ago

Go MAEDA wrote:

I think adding "hide-when-print" class is better because it is simpler and can clarify the intention to hide the section when printing.

I'm sorry, "hide-when-print" class was better.

I rebuilt a patch.
Please delete the previous patch. (29791-hidden-wiki-attachments.patch)

#5 Updated by Go MAEDA 17 days ago

  • Status changed from New to Resolved
  • Assignee set to Go MAEDA
  • Target version changed from 4.1.0 to 3.4.7
  • Resolution set to Fixed

#6 Updated by Go MAEDA 17 days ago

  • Status changed from Resolved to Closed

Committed to the trunk and 3.4-stable branch. Now Files section in wiki pages is hidden when printing.

Thank you for your contribution.

#7 Updated by Taiki I 17 days ago

Thank you for All!
Happy Halloween!! XD

Also available in: Atom PDF