Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Fixes #476 Printing a patient record #525

Merged
merged 21 commits into from
Jul 11, 2016
Merged

Conversation

dapierce
Copy link
Contributor

Fixes #476 Printing a patient record

  • Adds print stylesheet, with printing-specific css.
  • Removed left padding of navigation from the print style, and set basic color and margin styles for printing.
  • Adds definition of a new css class ‘print-section’, which will only show on a printed report.
  • In app/locales/en/translations.js, added the string 'messages.for_authorized_persons' with the message: 'This report is for authorized persons only.' (Will require actual translation into additional languages, in this commit I just used Google Translate for placeholder translations into all the current language files).
  • Added a header to app/templates/section.hbs to add messages.for_authorized_persons text, using the ‘print-section’ class.

This might not be exactly as envisioned, but I would appreciate any feedback. Thanks!

cc @HospitalRun/core-maintainers

Removes left padding as well as buttons and navigation for print.
Added _print.scss to styles directory, and added import for it in
app.scss. Removed print styles from _temp_misc.scss.
Includes a definition of a new class ‘print-section’, which will only
show on a printed report.

In translations.js, added the string messages.for_authorized_persons
with the message: “This report is for authorized persons only.”
(Will require actual translation into additional languages, in this
commit I just used Google Translate for placeholder translations into
all the current language files).

Added a header to the section template to read
messages.for_authorized_persons text, using the ‘print-section’ class.
@dapierce dapierce changed the title Issue476 Fixes #476 Printing a patient record Jun 21, 2016
@jkleinsc
Copy link
Member

Thanks for the pr @dapierce ! We will take a look at this. @tangollama what do you think? @jglovier any issues/concerns about the css changes here?

@jglovier
Copy link
Member

@dapierce can you please add an image of the final outcome here for quick reference?

@dapierce
Copy link
Contributor Author

dapierce commented Jun 28, 2016

@jglovier here are a couple examples:

Patient page as seen in Print dialog box

Viewing same page in Chrome dev tools emulating print media

@jglovier
Copy link
Member

There a couple things we could clean up later, but in general this looks great and is super helpful. 🤘 👍 ⚡

🚢


.print-section { display: block; text-align: center; }

.panel-footer, .btn, .nav, .view-current-title { display: none; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each selector should be on their own line. In fact I thought we had a test for that in the Stylelint. Wonder why it's not failing the build? cc @billybonks

@jglovier
Copy link
Member

Found some CSS syntax issues that need cleaned up before merging. Wonder why Stylelint isn't failling the build on these though?

@jkleinsc
Copy link
Member

jkleinsc commented Jul 7, 2016

@jglovier Not sure why stylelint isn't failing the build here, but if I test this code change with the latest from master, it does throw an error:

not ok 7 PhantomJS 2.1 - Style Lint: _print.scss should pass stylelint
    ---
        actual: >
            false
        expected: >
            true
        stack: >
            http:https://localhost:7357/assets/test-support.js:4130:17
            http:https://localhost:7357/assets/tests.js:54:7
            runTest@http:https://localhost:7357/assets/test-support.js:2779:32
            run@http:https://localhost:7357/assets/test-support.js:2764:11
            http:https://localhost:7357/assets/test-support.js:2906:14
            process@http:https://localhost:7357/assets/test-support.js:2565:24
            begin@http:https://localhost:7357/assets/test-support.js:2547:9
            http:https://localhost:7357/assets/test-support.js:2607:9
        message: >
            7:5 Expected variable for "color". (sh-waqar/declaration-use-variable)
        Log: |
    ...

@dapierce can you correct this issue? We should be able to accept the PR once this is set.

@billybonks
Copy link
Contributor

@jkleinsc because he is using a colour that hasn't been set to a variable 😄

@dapierce
Copy link
Contributor Author

dapierce commented Jul 7, 2016

I will change to color variables in the print scss--been away for a bit, but I should be able to update the PR this week.

@billybonks
Copy link
Contributor

@dapierce i love the fact that you added translations into every locale 👍 .

@jkleinsc jkleinsc added the in progress indicates that issue/pull request is currently being worked on label Jul 7, 2016
@dapierce
Copy link
Contributor Author

dapierce commented Jul 8, 2016

I have updated my PR, but I'm not really sure why the tests are all failing on this one.

EDIT: I found the part where it combs the stylesheet, I'll make another update to this!

margin: 0 5%;
font-size: 12pt;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use px values here.

@jglovier
Copy link
Member

jglovier commented Jul 8, 2016

@dapierce btw for your convenience, if you are using Atom there is a handy linter package you can install that will show you SCSS linting failures in real time as you work, and what the fix is. More on that here.

@dapierce
Copy link
Contributor Author

I have made updates to the _print.scss that fixed the printed page margin and pass the lint test. I tried Atom and the scss lint, however I was unable to find the lint rules file (the readme github link doesn't work) and it seems by default the rules are different than our project's rules.

@jkleinsc
Copy link
Member

@dapierce Looks good to me. I'm going to merge this PR in.

@jkleinsc jkleinsc merged commit 9028ef3 into HospitalRun:master Jul 11, 2016
@jglovier
Copy link
Member

@dapierce oooff. My bad. Those docs need updated. We're using Stylelint now, not SCSS Lint anymore. 😖

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
in progress indicates that issue/pull request is currently being worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants