publiclab / plots2

a collaborative knowledge-exchange platform in Rails; we welcome first-time contributors! :balloon:
https://publiclab.org
GNU General Public License v3.0
958 stars 1.83k forks source link

Print specific template for public lab content #8128

Closed Tlazypanda closed 4 years ago

Tlazypanda commented 4 years ago

Please describe the desired behavior. Currently the publiclab website uses a set of css hiding strategies to only print important content from a note or wiki. We need to replace this with print specific template for public lab content.

This print specific template can make use of js manipulation to only pull important part of content from the note and add css styling accordingly.

Tlazypanda commented 4 years ago

Hey @jywarren @cesswairimu pulling all printability related discussions here from #7883 :sweat_smile:
I had been researching on this for a while and have created a basic js script for this for now. Here is an example page printed using this - I have here pulled only the content div in notes, added styling for tables, blockquotes etc, page break strategy for ul,ol,table etc and some header and footer content that we can add. Haven't opened a pr yet since it is a work in progress. mozillla.pdf

As we had discussed once can you share some content from the publiclab team that they had trouble printing :sweat_smile: so I can get an idea of what all content I have to deal with and how I can accordingly modify my js script. Thanks a ton!! :tada:

Also for now I have just added it as another option in the sidebar along with the already existing print options so where should we place this now and what should this option be called? :sweat_smile: Thanks :v:

Edit: The comment in the pdf is not the comment getting printed it is actually an image that I had added so sorry for any confusion caused :sweat_smile:

Tlazypanda commented 4 years ago

@ebarry Since you have been working alongside the public lab team your insights and feedback much appreciated on this :pray: :rocket:

The pdf right now is just a work in progress so I have just implemented some basic features so it doesn't look that good right now :joy: :sweat_smile:

Tlazypanda commented 4 years ago

@jywarren @cesswairimu @ebarry Updated print design :sweatsmile: Please have a look and provide feedback. Thanks :v:
[🎈 Public Lab
My work so far on the print proposal thing.pdf](https://github.com/publiclab/plots2/files/4903418/Public.Lab_.My.work.so.far.on.the.print.proposal.thing.pdf)

ebarry commented 4 years ago

super! This looks really really nice!!!!!!!!! Overall the flow and balance of headings looks great!

Couple observations:

Tlazypanda commented 4 years ago

Hey @jywarren @cesswairimu @ebarry while working on the wiki side of it I noticed that we are using iframe for showing videos :sweat_smile: since it is not possible to manipulate iframes from css/js due to CORS and other issues I was thinking of setting the display to none for that :sweat_smile: I can get the src and add it to the top of the doc but not at the place where the frame is since manipulation is not allowed (tried with insertBefore/append/contentWindow.document.title/css::after/before but getting blocked by CORS) :sweat_smile: Let me know how I should proceed with this?

Also noticed buttons like Share research note and alerts, I suppose we can add some sort of styling to differentiate them in the print doc or do you think we should display them? Not sure about this :sweat_smile:

Tlazypanda commented 4 years ago

Hey @ebarry Thanks so much for looking into this and for being honest if anything looks off :tada: (i am not a design person as you would have figured :joy: )and I have added some more queries that I have with this above can you please answer them too :sweat_smile:

Also here I have tried to avoid colors for the most part and kept text black for ink efficiency that works right? :sweat_smile: or should I make it more appealing?

ebarry commented 4 years ago

Super -- when showing the profile pic of the author followed by the name, please show all authors like this (both profile pic and name) even if it takes more than one line. Attribution is very important!

Tlazypanda commented 4 years ago

@ebarry Ohh cool gotcha!! :tada:

jywarren commented 4 years ago

Hi! For interactive content that doesn't make sense in print, like YouTube, perhaps we could add a "fallback" content inside that says YouTube video or just Embedded content with a box around it? I'm not sure, but maybe see what that looks like. I think some elements allow HTML inside as "what shows when it doesn't load properly", you know?

And, i think i remember you saying you'd be trying to generate these PDFs from a Rails template; how did you make them? Would you mind sharing a PR link (or sorry if I missed it and you have already).

Thanks! This is very exciting!

Tlazypanda commented 4 years ago

Hey @jywarren Actually at that time I was thinking of using wkhtmltopdf gem for that but as you had pointed out that we won't be requiring a lot of its functionalities and its better to have a home grown tool so I wrote a javascript file and created a dom structure from it only keeping the essential and scraping of the rest :sweat_smile: I have created a wip pr now as I get more and more idea about the styling and how to display different things in this I will keep adding commits :v: can you please review #8149 ? since I have just started on this have some refactoring and code cleaning to do :sweat_smile:

Tlazypanda commented 4 years ago

Hey @ebarry @jywarren regarding the wiki layout should we display the date created (asking since it is not there on the original wiki template that we use) also sharing screenshots for

notes-coauthor

image

link_styling

can you please review these and let me know if any changes are required? Thanks you :heart:

Tlazypanda commented 4 years ago

Hey @ebarry @jywarren can you kindly review the above changes if they are alright? :sweat_smile: Also can you please answer these queries? Thank you :heart:

Thanks a ton :100:

ebarry commented 4 years ago

Should we have a date created for wiki since we dont have it on the original template? Yes (but am still asking other people if they have opinions)

Should we have the number of edits of wiki in the print template? Yes

Can you please share some wikis/notes that were having issues with printing so I can test them out and fix if anything is not working? I'll ask people!

Currently the sidebar print options have two options of print without links and in 3-column form so are there any specific options that I should be adding along with this print template? if yes then exactly what specifications are required ? Having the two options of print seems fine. I haven't thought of any others! I will ask some people however.

Tlazypanda commented 4 years ago

Thanks @ebarry ❤️ also can you review my above message as well where I have shared the modified design? Thanks ✌️

ebarry commented 4 years ago

From your designs above, i see there are some graphic design choices like:

These all look great! Can you describe how images are handled? Do they print in the same way they are displayed on the wiki page, as in, bound by a maximum height or width?

ebarry commented 4 years ago

You can also jump on https://pad.publiclab.org/p/opencall https://zoom.us/j/934187763 right now to talk to @steviepubliclab

Tlazypanda commented 4 years ago

Hey @ebarry I am sorry I totally missed this since it was quite late in India at that time and fell asleep :sleeping: I would love to know if there's a next call I can jump on :v:

To answer your question about the images they will be displayed the same way they are on the wiki :sweat_smile:

Muchas gracias for the review :heart:

ebarry commented 4 years ago

Great! There is an open call every Tuesday at 3pm ET / 12:30AM midnight for India time -- which is not great - sorry! https://pad.publiclab.org/p/opencall Here are the pages that Mimi highlighted as having difficulty printing because of having so many images:

Tlazypanda commented 4 years ago

Hey Liz! @ebarry @jywarren Thanks so much for the invite but I am afraid it's a bit too late and I have some college work in the morning so I won't be able to join :sweat_smile: Can you please review the following changes? Thanks :heart:

As for these pages here are some changes I have made to make the images printing better: -

Screenshot from 2020-07-28 19-01-55

And as per the discussion on wiki to add the no. of revisions and the created at date here is the changes made:-

Screenshot from 2020-07-28 19-02-30

Tlazypanda commented 4 years ago

Hey @ebarry Can you please review? Thanks :v: Please let me know how I can improve :raised_hands: