renalware-core 2.0.24 → 2.0.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -5
  3. data/app/assets/images/renalware/print-button-example.png +0 -0
  4. data/app/assets/stylesheets/renalware/partials/_layout.scss +4 -0
  5. data/app/assets/stylesheets/renalware/pdf.scss +12 -0
  6. data/app/assets/stylesheets/renalware/protocol_pdf.scss +4 -0
  7. data/app/assets/stylesheets/renalware/table_pdf.scss +210 -0
  8. data/app/controllers/renalware/admissions/consults_controller.rb +24 -6
  9. data/app/controllers/renalware/concerns/pdf_renderable.rb +11 -2
  10. data/app/controllers/renalware/renal/aki_alerts_controller.rb +29 -7
  11. data/app/controllers/renalware/transplants/registration_statuses_controller.rb +1 -1
  12. data/app/models/renalware/admissions/consult_query.rb +3 -0
  13. data/app/models/renalware/feeds/message_processor.rb +5 -0
  14. data/app/models/renalware/feeds/persist_message.rb +4 -1
  15. data/app/models/renalware/renal.rb +1 -1
  16. data/app/models/renalware/renal/aki_alert.rb +1 -0
  17. data/app/presenters/renalware/admissions/admission_presenter.rb +1 -1
  18. data/app/views/renalware/admissions/consults/_filters.html.slim +10 -1
  19. data/app/views/renalware/admissions/consults/_filters.pdf.slim +32 -0
  20. data/app/views/renalware/admissions/consults/_table.html.slim +9 -8
  21. data/app/views/renalware/admissions/consults/_table.pdf.slim +35 -0
  22. data/app/views/renalware/admissions/consults/index.html.slim +7 -0
  23. data/app/views/renalware/admissions/consults/index.pdf.slim +10 -0
  24. data/app/views/renalware/hd/sessions/_empty_row.html.slim +2 -0
  25. data/app/views/renalware/hd/sessions/_row.html.slim +3 -0
  26. data/app/views/renalware/hd/sessions/_show.html.slim +5 -6
  27. data/app/views/renalware/hd/sessions/_thead.html.slim +4 -0
  28. data/app/views/renalware/layouts/pdf.pdf.slim +1 -1
  29. data/app/views/renalware/letters/contacts/_edit.html.slim +1 -1
  30. data/app/views/renalware/renal/aki_alerts/_filters.pdf.slim +25 -0
  31. data/app/views/renalware/renal/aki_alerts/_table.pdf.slim +29 -0
  32. data/app/views/renalware/renal/aki_alerts/edit.html.slim +1 -1
  33. data/app/views/renalware/renal/aki_alerts/index.html.slim +10 -0
  34. data/app/views/renalware/renal/aki_alerts/index.pdf.slim +14 -0
  35. data/app/views/renalware/shared/_please_print_using_print_button_warning.html.slim +18 -0
  36. data/app/views/renalware/transplants/donor_followups/_form.html.slim +2 -2
  37. data/app/views/renalware/transplants/recipient_followups/_form.html.slim +6 -1
  38. data/app/views/renalware/transplants/registration_statuses/_inputs.html.slim +4 -0
  39. data/app/views/renalware/transplants/registration_statuses/_list.html.slim +18 -5
  40. data/config/locales/custom.yml +2 -3
  41. data/config/locales/renalware/hd/session.en.yml +3 -0
  42. data/db/migrate/20180510151959_update_hd_overall_audit_to_version_7.rb +6 -0
  43. data/db/migrate/20180511100345_add_notes_to_transplant_registration_statuses.rb +5 -0
  44. data/db/migrate/20180511140415_add_message_hash_messaging_messages.rb +6 -0
  45. data/db/seeds/default/deaths/death_causes.rb +4 -4
  46. data/db/seeds/default/patients/patients_languages.rb +4 -3
  47. data/db/seeds/default/renal/prd_descriptions.rb +7 -5
  48. data/db/seeds/default/system/countries.rb +10 -6
  49. data/db/views/reporting_hd_overall_audit_v07.sql +44 -0
  50. data/lib/renalware/configuration.rb +4 -0
  51. data/lib/renalware/engine.rb +2 -0
  52. data/lib/renalware/version.rb +1 -1
  53. data/spec/factories/admissions/consults.rb +12 -0
  54. data/spec/support/capybara.rb +16 -21
  55. metadata +15 -3
  56. data/spec/support/poltergeist.rb +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 144398e98d896ad11911bf67c7d3c41532a7e7d599d8e753f3ea07fa5cdd1335
4
- data.tar.gz: 36f8a5016b94cfa5c67c2b79e3043e97515fb996bfb1ddacb6d960b0aac35bc5
3
+ metadata.gz: 30e742fd5ca6fbadf5677398c873b1a644ac00076e7da84387ba9892252496ac
4
+ data.tar.gz: 4a575ab8a82880f2b9e66901415c42fd118e7cd0833d986bd899553ae0dbf317
5
5
  SHA512:
6
- metadata.gz: 29eb437d433f724352b58695f23453d273270c5aa4e0a3309f6509e39c76ca0589d52000fff1d417787375f353798e658c37f6fb61deb4399b995034389e948b
7
- data.tar.gz: 7efd9963d89407778f3ce6d20541824a45845aaf494a3e8c43f0d89392429cb4cb42212599dc12e5acb33e46db9008e8815cf7b8a191022643042bfa04ed8c37
6
+ metadata.gz: db22bef034ecdcef77e77d15a524a3a924d42fec046b377ca3f666a1d7070dd9288c1e355cc540013fdf585d11f2711e1a4043e55bd84796fe97b0e2c7d129e3
7
+ data.tar.gz: 13ac8dd0fb46a1eb03594e8c7dce8be3ddf9bcd423fcf15faa7491c7cbedd395c03b66835fd5d082d7de65a5f3db02f727186f5eb10b1a08d0b4587dc7c1cafa
data/README.md CHANGED
@@ -117,12 +117,26 @@ delayed_job logs to its own log. To see the output:
117
117
 
118
118
  ## Running tests
119
119
 
120
- Install PhantomJS if you don't have it already (check with `phantomjs -v`).
121
- Download from [here](http://phantomjs.org/download.html) of follow these instructions
120
+ ### Install chromedriver
122
121
 
123
- wget -O /tmp/phantomjs.tar.bz2 http://airslie-public.s3.amazonaws.com/phantomjs-2.1.1-linux-x86_64.tar.bz2
124
- tar -xjf /tmp/phantomjs.tar.bz2 -C /tmp
125
- mv /tmp/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
122
+ On a Mac:
123
+
124
+ ```
125
+ brew install chromedriver
126
+ gem install chromedriver-helper
127
+ chromedriver-update
128
+ ```
129
+
130
+ If you have chromedriver errors it maybe your installed version of Chrome is not
131
+ compatible your chromedriver version.
132
+
133
+ In this case check your versions
134
+ ```
135
+ chromedriver -v
136
+ chrome -v
137
+ ``
138
+ and consult the driver release notee eg for [2.38](https://chromedriver.storage.googleapis.com/2.38/notes.txt)
139
+ to check compatibility
126
140
 
127
141
  ### RSpec unit and integration tests
128
142
 
@@ -43,6 +43,10 @@ html {
43
43
  min-height: 100%;
44
44
  padding-bottom: 2rem;
45
45
  overflow-y: auto;
46
+
47
+ @media print {
48
+ overflow-y: visible;
49
+ }
46
50
  }
47
51
 
48
52
  .layout-wrapper {
@@ -1,3 +1,14 @@
1
+ html,
2
+ body {
3
+ font-size: 10px;
4
+ font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
5
+ }
6
+
7
+ .page-break {
8
+ display:block;
9
+ clear:both;
10
+ page-break-after:always;
11
+ }
1
12
 
2
13
  .letter-wrapper {
3
14
  &.draft, &.pendingreview {
@@ -6,3 +17,4 @@
6
17
  background-position: center center;
7
18
  }
8
19
  }
20
+
@@ -166,6 +166,10 @@ h1 {
166
166
  &.col-width-notes {
167
167
  min-width: 10rem;
168
168
  }
169
+
170
+ &.col-width-user {
171
+ min-width: 5rem;
172
+ }
169
173
  }
170
174
  }
171
175
  }
@@ -0,0 +1,210 @@
1
+
2
+ .noprint {
3
+ display: none !important;
4
+ min-width: 0em !important;
5
+ }
6
+
7
+ .print-only {
8
+ display: block;
9
+ }
10
+
11
+ a,
12
+ a:visited {
13
+ color: #000;
14
+ text-decoration: none;
15
+ }
16
+
17
+ .pdf {
18
+ // Header with Main title to the left and a muted subtitle to the right
19
+ .header {
20
+ h1, h2 {
21
+ margin-bottom: 7px;
22
+ margin-top: 0px;
23
+ line-height: 2rem;
24
+ }
25
+ h1 {
26
+ float: left;
27
+ font-size: 2rem;
28
+ }
29
+
30
+ h2 {
31
+ float: right;
32
+ font-size: 1.7rem;
33
+ line-height: 1.7rem;
34
+ font-weight: normal;
35
+ margin-top: 4px;
36
+ }
37
+
38
+ .muted {
39
+ color: #555;
40
+ }
41
+ }
42
+
43
+ table {
44
+ width: 100%;
45
+ border-collapse: collapse;
46
+
47
+ // Could make this the default pdf table style but separate class for now
48
+ &.spacy {
49
+ td,
50
+ th {
51
+ padding: 4px 0;
52
+ }
53
+ }
54
+
55
+ &.nested-table-in-order-to-prevent-orphaned-rows {
56
+ page-break-inside: avoid !important;
57
+ border-top: solid 1px #000;
58
+ }
59
+
60
+ tr {
61
+ page-break-inside: avoid;
62
+ }
63
+
64
+ th {
65
+ text-align: left;
66
+ padding: 4px 0;
67
+ }
68
+
69
+ td {
70
+ border-bottom: solid 1px #ddd;
71
+ }
72
+
73
+ td,
74
+ th {
75
+ page-break-inside: avoid;
76
+
77
+ p {
78
+ padding: 0;
79
+ margin: 0;
80
+ }
81
+ }
82
+ }
83
+
84
+ // This section displays a summary of applied filters as a table
85
+ .filter-summary {
86
+ clear: both;
87
+ margin-bottom: 8px;
88
+
89
+ table {
90
+ width: auto;
91
+ }
92
+
93
+ th, td {
94
+ border: none;
95
+ }
96
+
97
+ th {
98
+ padding-left: 8px;
99
+ padding-right: 3px;
100
+ }
101
+
102
+ th:first-child {
103
+ text-decoration: underline;
104
+ padding-left: 0px;
105
+ }
106
+ }
107
+
108
+ // Table helper classes copied form the main application
109
+ tr th,
110
+ tr td {
111
+ &.col-width-date {
112
+ width: 7.8em;
113
+
114
+ &.wide {
115
+ width: 9rem;
116
+ }
117
+ }
118
+
119
+ &.col-width-time {
120
+ width: 3rem;
121
+ min-width: 2.7rem;
122
+ }
123
+
124
+ &.col-width-date-time {
125
+ width: 9.5rem;
126
+ min-width: 9.3rem;
127
+ }
128
+
129
+ &.col-width-reference-without-prefix {
130
+ width: 7rem;
131
+ min-width: 5.5rem;
132
+ white-space: nowrap;
133
+ }
134
+
135
+ &.col-width-reference-no {
136
+ width: 8rem;
137
+ min-width: 8rem;
138
+ white-space: nowrap;
139
+ }
140
+
141
+ &.col-width-nhs-no {
142
+ width: 7rem;
143
+ min-width: 7rem;
144
+ white-space: nowrap;
145
+ }
146
+
147
+ &.col-width-bp {
148
+ width: 4.5rem;
149
+ min-width: 3.8rem;
150
+ }
151
+
152
+ &.col-width-toggle {
153
+ width: 9.7rem;
154
+ min-width: 9.7rem;
155
+ }
156
+
157
+ &.col-width-tiny {
158
+ width: 3rem;
159
+ }
160
+
161
+ &.col-width-tinyish {
162
+ width: 5rem;
163
+ min-width: 4.5rem;
164
+ }
165
+
166
+ &.col-width-small {
167
+ width: 7rem;
168
+ min-width: 5.1rem;
169
+ }
170
+
171
+ &.col-width-medium {
172
+ width: 12rem;
173
+ min-width: 10rem;
174
+ }
175
+
176
+ &.col-width-medium-ish {
177
+ width: 14rem;
178
+ min-width: 12rem;
179
+ }
180
+
181
+ &.col-width-large {
182
+ width: 20rem;
183
+ min-width: 15rem;
184
+ }
185
+
186
+ &.column-6-width {
187
+ width: 6%;
188
+ }
189
+
190
+ &.col-width-6 {
191
+ width: 6rem;
192
+ }
193
+
194
+ &.col-width-9 {
195
+ width: 9rem;
196
+ }
197
+
198
+ &.col-width-11 {
199
+ width: 11rem;
200
+ }
201
+
202
+ &.col-width-13 {
203
+ width: 13rem;
204
+ }
205
+
206
+ &.at-least {
207
+ width: auto;
208
+ }
209
+ }
210
+ }
@@ -7,17 +7,35 @@ module Renalware
7
7
  module Admissions
8
8
  class ConsultsController < BaseController
9
9
  include Renalware::Concerns::Pageable
10
+ include Renalware::Concerns::PdfRenderable
10
11
 
11
12
  # rubocop:disable Metrics/AbcSize
12
13
  def index
13
14
  session[:consults_results] = nil if params.key?(:reset)
14
15
  query = ConsultQuery.new(params[:q])
15
- consults = query.call.page(page).per(per_page)
16
- authorize consults
17
- render locals: {
18
- consults: CollectionPresenter.new(consults, ConsultPresenter),
19
- query: query.search
20
- }
16
+
17
+ respond_to do |format|
18
+ format.pdf do
19
+ consults = query.call
20
+ authorize consults
21
+ options = default_pdf_options.merge!(
22
+ pdf: "Admission Consults #{I18n.l(Time.zone.today)}",
23
+ locals: {
24
+ consults: CollectionPresenter.new(consults, ConsultPresenter),
25
+ query: query.search
26
+ }
27
+ )
28
+ render options
29
+ end
30
+ format.html do
31
+ consults = query.call.page(page).per(per_page)
32
+ authorize consults
33
+ render locals: {
34
+ consults: CollectionPresenter.new(consults, ConsultPresenter),
35
+ query: query.search
36
+ }
37
+ end
38
+ end
21
39
  end
22
40
  # rubocop:enable Metrics/AbcSize
23
41
 
@@ -10,19 +10,23 @@ module Renalware
10
10
  included do
11
11
  protected
12
12
 
13
+ # rubocop:disable Metrics/MethodLength
13
14
  def default_pdf_options
14
15
  {
15
16
  page_size: "A4",
16
17
  layout: "renalware/layouts/pdf",
17
18
  disposition: "inline",
19
+ margin: { top: 10, bottom: 10, left: 10, right: 10 },
18
20
  footer: {
19
21
  font_size: 8,
20
- right: "Page [page] of [topage]"
22
+ right: "Page [page] of [topage]",
23
+ left: I18n.l(Time.zone.now)
21
24
  },
22
- show_as_html: Rails.env.development? && params.key?(:debug),
25
+ show_as_html: render_pdf_as_html?,
23
26
  encoding: "UTF-8"
24
27
  }
25
28
  end
29
+ # rubocop:enable Metrics/MethodLength
26
30
 
27
31
  # Render a Liquid template loaded from the database.
28
32
  # The template may have variable place holders w.g. {{ patient.name }} and these
@@ -37,6 +41,11 @@ module Renalware
37
41
 
38
42
  private
39
43
 
44
+ def render_pdf_as_html?
45
+ Renalware.config.render_pdf_as_html_for_debugging ||
46
+ (Rails.env.development? || Rails.env.test?) && params.key?(:debug)
47
+ end
48
+
40
49
  # By default if no variables supplied, we insert the patient drop to allow basic patient
41
50
  # data to be accessed in the template with eg {{ patient.name }}
42
51
  # Note the has key must be a string and not a symbol.
@@ -6,17 +6,17 @@ module Renalware
6
6
  module Renal
7
7
  class AKIAlertsController < BaseController
8
8
  include Renalware::Concerns::Pageable
9
+ include Renalware::Concerns::PdfRenderable
9
10
 
10
11
  def index
11
12
  query = search_form.query
12
- alerts = query.call.page(page).per(per_page)
13
+ alerts = query.call
13
14
  authorize alerts
14
- render locals: {
15
- alerts: alerts,
16
- form: search_form,
17
- search: query.search,
18
- path_params: path_params
19
- }
15
+
16
+ respond_to do |format|
17
+ format.pdf { render_index_pdf(query, alerts) }
18
+ format.html { render_index_html(query, alerts) }
19
+ end
20
20
  end
21
21
 
22
22
  def edit
@@ -35,6 +35,28 @@ module Renalware
35
35
 
36
36
  private
37
37
 
38
+ def render_index_pdf(query, alerts)
39
+ options = default_pdf_options.merge!(
40
+ pdf: "AKI Alerts #{I18n.l(Time.zone.today)}",
41
+ locals: {
42
+ alerts: alerts,
43
+ form: search_form,
44
+ search: query.search,
45
+ path_params: path_params
46
+ }
47
+ )
48
+ render options
49
+ end
50
+
51
+ def render_index_html(query, alerts)
52
+ render locals: {
53
+ alerts: alerts.page(page).per(per_page),
54
+ form: search_form,
55
+ search: query.search,
56
+ path_params: path_params
57
+ }
58
+ end
59
+
38
60
  def search_form
39
61
  @search_form ||= begin
40
62
  options = params.key?(:q) ? search_params : {}
@@ -67,7 +67,7 @@ module Renalware
67
67
  def status_params
68
68
  params
69
69
  .require(:transplants_registration_status)
70
- .permit(:started_on, :description_id)
70
+ .permit(:started_on, :description_id, :notes)
71
71
  .merge(by: current_user)
72
72
  end
73
73
  end