Closed (fixed)
Project:
Area Print
Version:
7.x-1.1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 May 2012 at 02:08 UTC
Updated:
13 Jun 2012 at 05:51 UTC
I think this would be a common design wish. I could see a lot of people wanting to put the Print button inside a content frame for printing but not have the print button itself get printed. I am going to have to modify the javascript file to get this on one of my own projects. And I thought I should suggest it as a standard feature.
I'm not sure how to implement the feature without hard-coding the button id in javascript and requiring the id to be used in the template file, but I don't see anything wrong with a hardcoded id either.
Comments
Comment #1
bfr commentedi'm sorry, i dont understand at all what you are after, maybe because i just woke up :)
The problem with hard coded id is that you cannot use more than one button per page. What if i have a view that lists nodes with print buttons in them for example?
Anyway, could you open this up a little bit for me, in which situation you would want to attach the print button but not show it to anyone?
edit: ahh, now i got it, i misunderstood the word "printed" :) I REALLY have to wake up first, i'll think this through then.
Comment #2
pha3z commentedHere's a code example of what I'm talking about. I want the print button displayed below the title of a region. I want the title and content both printed, but I don't want the print button itself to show up on the printed paper.
Here's a code example:
Comment #3
bfr commentedI added option 'hide_button'. See the README.txt.
Tested quickly and seemed to work, but please test in your setup. Again, get the latest version with git or wait for the tarball to update.
I wanted to add option to also hide ALL the print buttons from the page, but seems there is no "#class" definition in the form api, so we would have to wrap the button inside
<div>or<span>or something, so i'll leave that for later time if it's needed.Comment #4
pha3z commentedI'm sorry for taking so long to test this. I got pretty busy.
First Issue:
I tested the latest developer version. Either I did something wrong or I'm getting very weird results. It does not matter whether I set 'hide_button' => TRUE, or 'hide_button' => FALSE, The results are always the same. In Chrome, the print button still shows up. In Firefox and IE the button is invisible. Did I do something wrong?
Second Issue:
In FF and IE, even though the button is invisible, it is still taking up space in the layout. This seems undesirable for most purposes. The point of hiding the button is primarily to make more room on the printed sheet. Did you use "visibility: hidden" or "display: none"? To make the button completely be removed and not take up space, you need to use "display: none". I think this would be a better choice for most users.
Ideally, you would actually offer both options. Instead of hide_button as a boolean, you could have a variable called "RenderStyle" and have three optional values: "HIDDEN", "NO_DISPLAY", and "VISIBLE" with VISIBLE being default. Of course, this is a little more complex. Its up to you what you do, but for me the whole purpose of hiding something is to make more space in the layout (display: none). You're limited in what you can fit on a piece of paper.
- Jim
Comment #5
bfr commentedHmm, i'm using jQuery's hide(), which, according to this:
http://api.jquery.com/hide/
And
I'll have to check what's going on.
Comment #6
pha3z commentedAre you able to reproduce the behavior I'm describing in the first issue? Because that needs to be dealt with first. I want to make sure its not something I'm doing wrong on my end.
Comment #7
bfr commentedCan not test with IE currently, but with Chrome and Firefox it's working fine on my setup. Are you getting any javascript errors? Are you doing something to the button with CSS?
Do you have any experience with JS? The Javascript is pretty simple(All the magic is pretty much happening in the areaPrint function, you can focus on that one), you could try to debug a little bit. This is what hides the button:
LINE 31 on area_print.js:
You could console.log() or alert() those variables(hideButton, buttonId) to see if they are really getting something.
Comment #8
pha3z commentedI threw in some alerts and discovered the variable was not being set. I went back to my themes folder and discovered I was editing the area_print options in a page template from an old no-longer used theme. I'll delete it now to avoid making that mistake again!! LOL
Everything works fine!! My fault!
I think we can consider this issue closed. :)
Thanks!
Comment #9
bfr commentedOk great ;)