Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refinements to print template #8337

Merged
merged 2 commits into from
Sep 8, 2020

Conversation

Tlazypanda
Copy link
Collaborator

Follow up pr to #8292

  • Opens the print in a new tab
  • Remove the header/footer and other partials from print template
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with rake test
  • code is in uniquely-named feature branch and has no merge conflicts 📁
  • screenshots/GIFs are attached 📎 in case of UI updation
  • ask @publiclab/reviewers for help, in a comment below

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If tests do fail, click on the red X to learn why by reading the logs.

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software

Thanks!

@gitpod-io
Copy link

gitpod-io bot commented Aug 21, 2020

@codecov
Copy link

codecov bot commented Aug 21, 2020

Codecov Report

Merging #8337 into main will increase coverage by 0.58%.
The diff coverage is 91.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8337      +/-   ##
==========================================
+ Coverage   81.28%   81.87%   +0.58%     
==========================================
  Files         101      101              
  Lines        5872     5902      +30     
==========================================
+ Hits         4773     4832      +59     
+ Misses       1099     1070      -29     
Impacted Files Coverage Δ
app/controllers/tag_controller.rb 81.45% <83.33%> (+0.05%) ⬆️
app/controllers/spam2_controller.rb 71.84% <84.61%> (+10.30%) ⬆️
app/controllers/admin_controller.rb 80.24% <100.00%> (ø)
app/controllers/batch_controller.rb 90.19% <100.00%> (+22.23%) ⬆️
app/controllers/comment_controller.rb 86.95% <100.00%> (ø)
app/controllers/home_controller.rb 98.38% <100.00%> (ø)
app/controllers/like_controller.rb 72.22% <100.00%> (ø)
app/controllers/notes_controller.rb 83.46% <100.00%> (+0.06%) ⬆️
app/controllers/wiki_controller.rb 85.40% <100.00%> (+0.05%) ⬆️
app/helpers/application_helper.rb 84.70% <100.00%> (+0.18%) ⬆️
... and 4 more

@Tlazypanda Tlazypanda force-pushed the refine_print_template branch from 11e47b7 to 0081f28 Compare August 21, 2020 20:56
@Tlazypanda
Copy link
Collaborator Author

Hey @jywarren @cesswairimu as per the discussion this will now open the print template in a new tab and has removed the header/footer and other partials from the print template 😅 Now can you help guide me on what all checks I should add to the tests? and what other changes we should incorporate here Thanks ✌️

@Tlazypanda Tlazypanda closed this Aug 21, 2020
@Tlazypanda Tlazypanda reopened this Aug 21, 2020
@gitpod-io
Copy link

gitpod-io bot commented Aug 21, 2020

@Tlazypanda Tlazypanda closed this Aug 22, 2020
@Tlazypanda Tlazypanda reopened this Aug 22, 2020
@gitpod-io
Copy link

gitpod-io bot commented Aug 22, 2020

@jywarren
Copy link
Member

Hi Sneha! Can you share a screenshot?

This looks great. For tests maybe some basic functional tests to confirm content on the page, and then perhaps some specific ones in a system test to look for how it handles dynamic content like inline grid tables, YouTube vids, things like that? That system test can be kind of a policy description of how we wish such content to be rendered for print. What do you think?

@Tlazypanda Tlazypanda force-pushed the refine_print_template branch 4 times, most recently from 6fa0981 to bb8f70f Compare August 30, 2020 17:07
@Tlazypanda
Copy link
Collaborator Author

Tlazypanda commented Aug 30, 2020

Hey @jywarren @cesswairimu while writing tests, I am facing this difficulty that my tests written are passing locally but on travis its showing wrong number of arguments (1,3) I looked it up and its a bug https://stackoverflow.com/questions/49151785/error-while-doing-escape-interpolation-inside-assert-select-in-rails-4-2

Tests passing locally here
Screenshot from 2020-08-30 22-34-39

Also for the system tests, right now I have just added a test to check a new tab is opened. For writing tests to check specific content, I will have to first add them to the revisions.yml file right? (like the video/inline table etc in markdown form) and then check for fetching those tags and if the styles are applied or not? 😅 (Also a curious question : why can't we write this as a functional test 😅 ) A bit new to this bit. Thanks ✌️

@jywarren
Copy link
Member

Hmm, is it a difference in the environment for Travis? I can dig into this more soon but could we either use a different kind of assertion or change the Travis config?

Yes, that's right we can change the fixture, or you could edit the node revision in Ruby in the test!

Finally, a functional test could work! However if we write a system test we can confirm if JavaScript works on the page as well, but it's up to you. I'm not sure if a functional test can test for a new tab though...? It might have to be an integration test. System tests are a little more expensive but much more powerful and closer to live usage.

Thanks!!!

@Tlazypanda Tlazypanda force-pushed the refine_print_template branch from bb8f70f to e4ed7ea Compare August 31, 2020 05:31
@Tlazypanda Tlazypanda closed this Sep 1, 2020
@Tlazypanda Tlazypanda reopened this Sep 1, 2020
@gitpod-io
Copy link

gitpod-io bot commented Sep 1, 2020

@Tlazypanda
Copy link
Collaborator Author

@jywarren Update here that changing the form of assertion from assert_select to assert_equal and css_select has resolved this issue and tests are passing now.

Now, will start working on inline tables and video tests 😅

@jywarren
Copy link
Member

jywarren commented Sep 1, 2020

This is awesome. Would you like to merge this and work progressively in add-on PRs? Or just wait a bit? Thanks a ton!!

@Tlazypanda Tlazypanda force-pushed the refine_print_template branch from e4ed7ea to 362a1c5 Compare September 2, 2020 07:26
@Tlazypanda
Copy link
Collaborator Author

Hey @jywarren Have added some more system tests to check blockquotes, videos, code blocks and tables. can you kindly review and let me know if this works? 😅

Also adding gif for showing the new tab change and also no nav bar
print_new_tb

@jywarren
Copy link
Member

jywarren commented Sep 2, 2020

I think this looks great! Let's merge it, what do you think?

@jywarren
Copy link
Member

jywarren commented Sep 2, 2020

Can we keep headers in the same font, Junction light?

@Tlazypanda
Copy link
Collaborator Author

Yessss!! @jywarren if there are any more changes to be done please let me know I will take up in more follow up prs 😅

@Tlazypanda
Copy link
Collaborator Author

Ohh yeah sure : sweat_smile: I will change that I used Arial because for printing it was the most suggested font

@Tlazypanda Tlazypanda force-pushed the refine_print_template branch from 362a1c5 to df0f43a Compare September 4, 2020 01:28
@Tlazypanda
Copy link
Collaborator Author

Hey @jywarren have changed the heading font to Junction light 😅 sorry for the delay got busy with assignments

@Tlazypanda Tlazypanda requested a review from jywarren September 5, 2020 09:33
@jywarren
Copy link
Member

jywarren commented Sep 8, 2020

No prob, and i think the fallback would be Arial if any issues occur with rendering Junction. Thanks! Merging!!!!

@jywarren jywarren merged commit c816bbe into publiclab:main Sep 8, 2020
@jywarren
Copy link
Member

jywarren commented Sep 8, 2020

Woohoo!!!

@jywarren jywarren changed the title wip: refine print template refinements to print template Sep 8, 2020
nadimakhtar97 pushed a commit to nadimakhtar97/plots2 that referenced this pull request Sep 21, 2020
* refine print template

* add tests
shubhangikori pushed a commit to shubhangikori/plots2 that referenced this pull request Oct 12, 2020
* refine print template

* add tests
alvesitalo pushed a commit to alvesitalo/plots2 that referenced this pull request Oct 14, 2020
* refine print template

* add tests
piyushswain pushed a commit to piyushswain/plots2 that referenced this pull request Oct 22, 2020
* refine print template

* add tests
manchere pushed a commit to manchere/plots2 that referenced this pull request Feb 13, 2021
* refine print template

* add tests
lagunasmel pushed a commit to lagunasmel/plots2 that referenced this pull request Mar 2, 2021
* refine print template

* add tests
reginaalyssa pushed a commit to reginaalyssa/plots2 that referenced this pull request Oct 16, 2021
* refine print template

* add tests
ampwang pushed a commit to ampwang/plots2 that referenced this pull request Oct 26, 2021
* refine print template

* add tests
billymoroney1 pushed a commit to billymoroney1/plots2 that referenced this pull request Dec 28, 2021
* refine print template

* add tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants