renalware-core 2.0.164 → 2.0.165
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/renalware/partials/_tables.scss +6 -0
- data/app/components/renalware/system/admin_menu_component.html.slim +1 -0
- data/app/controllers/renalware/virology/vaccination_types_controller.rb +69 -0
- data/app/models/renalware/virology/vaccination_type.rb +25 -3
- data/app/views/renalware/virology/vaccination_types/_form.html.slim +10 -0
- data/app/views/renalware/virology/vaccination_types/edit.html.slim +3 -0
- data/app/views/renalware/virology/vaccination_types/index.html.slim +42 -0
- data/app/views/renalware/virology/vaccination_types/new.html.slim +3 -0
- data/config/permissions.yml +1 -0
- data/config/routes/virology.rb +6 -0
- data/lib/renalware/version_number.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 700d5b2079008a4d7003114ffc54c354e66ccc522b264cf8be06f7affef1b608
|
4
|
+
data.tar.gz: 9bbb9f90eda8d067104d6bbb88d3abd47a9c31c7cd31c4913f4fe400f4d13405
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34ccd19919e8e560fd814a94faaa1529ba058780b8c08afca122f737668a738ddd7865af63f8fb93446a3f18c85dfec56aaccb59429a12354c39b3f44b9779a6
|
7
|
+
data.tar.gz: 03a28eee3622a1b1e856a4d36549e85bdff271cc74f1e1f0db492dfbba1f07a8fa67fd7206919b7406fac404456cb65aa36d9da17c887e3eb886578aa737232e
|
@@ -24,6 +24,7 @@ ul.side-nav.side-nav--admin
|
|
24
24
|
= super_admin_menu_item "Print batches", renalware.letters_batches_path, %r{letters/batches}
|
25
25
|
= super_admin_menu_item "OBX", renalware.pathology_observation_descriptions_path, %r{admin/pathology_observation_descriptions}
|
26
26
|
= super_admin_menu_item "Pathology Code Groups", renalware.pathology_code_groups_path, %r{pathology/code_groups}
|
27
|
+
= super_admin_menu_item "Virology Vaccination Types", renalware.virology_vaccination_types_path, %r{virology/vaccination_types}
|
27
28
|
= admin_menu_item "Mailshots", renalware.letters_mailshots_path, %r{letters/mailshots}
|
28
29
|
= super_admin_menu_item "Playground", renalware.admin_playground_path, %r{admin/playground}
|
29
30
|
= developer_menu_item "HL7 Test", renalware.new_feeds_hl7_test_message_path, %r{admin/123}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_dependency "renalware/virology"
|
4
|
+
|
5
|
+
module Renalware
|
6
|
+
module Virology
|
7
|
+
class VaccinationTypesController < BaseController
|
8
|
+
def index
|
9
|
+
types = VaccinationType.with_deleted.ordered
|
10
|
+
authorize types
|
11
|
+
render locals: { types: types }
|
12
|
+
end
|
13
|
+
|
14
|
+
def edit
|
15
|
+
type = find_and_authorise_type
|
16
|
+
render locals: { type: type }
|
17
|
+
end
|
18
|
+
|
19
|
+
def update
|
20
|
+
type = find_and_authorise_type
|
21
|
+
if type.update(type_params)
|
22
|
+
redirect_to virology_vaccination_types_path
|
23
|
+
else
|
24
|
+
render :edit, locals: { type: type }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def new
|
29
|
+
type = VaccinationType.new
|
30
|
+
authorize type
|
31
|
+
render locals: { type: type }
|
32
|
+
end
|
33
|
+
|
34
|
+
def create
|
35
|
+
type = VaccinationType.new(type_params)
|
36
|
+
authorize type
|
37
|
+
if type.save
|
38
|
+
redirect_to virology_vaccination_types_path
|
39
|
+
else
|
40
|
+
render :new, locals: { type: type }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def destroy
|
45
|
+
find_and_authorise_type.destroy!
|
46
|
+
redirect_to virology_vaccination_types_path
|
47
|
+
end
|
48
|
+
|
49
|
+
def sort
|
50
|
+
authorize VaccinationType, :sort?
|
51
|
+
ids = params[:virology_vaccination_type]
|
52
|
+
VaccinationType.sort(ids)
|
53
|
+
render json: ids
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def find_and_authorise_type
|
59
|
+
VaccinationType.find(params[:id]).tap { |type| authorize type }
|
60
|
+
end
|
61
|
+
|
62
|
+
def type_params
|
63
|
+
params
|
64
|
+
.require("virology_vaccination_type")
|
65
|
+
.permit(:name, :code, :position)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -5,12 +5,34 @@ require_dependency "renalware/virology"
|
|
5
5
|
module Renalware
|
6
6
|
module Virology
|
7
7
|
class VaccinationType < ApplicationRecord
|
8
|
-
|
9
|
-
|
8
|
+
include Sortable
|
9
|
+
|
10
|
+
class UniquenessIncludingDeletedValidator < ActiveModel::EachValidator
|
11
|
+
def validate_each(record, attribute, value)
|
12
|
+
return unless record.send(:"#{attribute}_changed?")
|
13
|
+
|
14
|
+
if record.class.with_deleted.exists?(attribute => value)
|
15
|
+
record.errors.add attribute, (options[:message] || "already used")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
validates :name, presence: true, uniqueness_including_deleted: true
|
20
|
+
validates :code, presence: true, uniqueness_including_deleted: true
|
21
|
+
before_create :underscore_code
|
10
22
|
|
11
23
|
acts_as_paranoid
|
12
24
|
|
13
|
-
scope :ordered, -> { order(position: :asc, name: :asc) }
|
25
|
+
scope :ordered, -> { order(deleted_at: :desc, position: :asc, name: :asc) }
|
26
|
+
|
27
|
+
def self.policy_class
|
28
|
+
BasePolicy
|
29
|
+
end
|
30
|
+
|
31
|
+
def underscore_code
|
32
|
+
return if code.blank?
|
33
|
+
|
34
|
+
self.code = code.downcase.tr(" ", " ").tr(" ", "_")
|
35
|
+
end
|
14
36
|
end
|
15
37
|
end
|
16
38
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
= content_for(:actions) do
|
2
|
+
= link_to t("new_record.link_title"),
|
3
|
+
new_virology_vaccination_type_path,
|
4
|
+
class: "button"
|
5
|
+
|
6
|
+
= within_new_admin_layout(title: "Virology Vaccination Types") do
|
7
|
+
.rounded-md.bg-blue-100.px-3.py-2.flex.items-start.shadow.mb-5
|
8
|
+
i.fas.fa-info-circle.mr-2.mt-1.text-blue-500
|
9
|
+
' Deleting a type sets the 'deleted at' date, preventing the type from
|
10
|
+
' being used prospectively.
|
11
|
+
br
|
12
|
+
' The type's code cannot be edited once set, just in case it has already been used.
|
13
|
+
br
|
14
|
+
' Drag and drop the icon to change the sort order.
|
15
|
+
|
16
|
+
table.vaccination_types
|
17
|
+
thead
|
18
|
+
tr
|
19
|
+
th.actions.col-width-small
|
20
|
+
th Name
|
21
|
+
th Code
|
22
|
+
th.text-center Sort order
|
23
|
+
th.col-width-date-time Created at
|
24
|
+
th.col-width-date-time Deleted at
|
25
|
+
tbody.sortables(data-rel=sort_virology_vaccination_types_path)
|
26
|
+
- types.each do |type|
|
27
|
+
= content_tag_for(:tr, type, class: "sortable #{type.deleted? ? 'deleted' : ''}") do
|
28
|
+
td.actions
|
29
|
+
- unless type.deleted?
|
30
|
+
=link_to "Edit", edit_virology_vaccination_type_path(type)
|
31
|
+
=link_to "Delete",
|
32
|
+
virology_vaccination_type_path(type),
|
33
|
+
method: :delete,
|
34
|
+
data: { confirm: "Are you sure you want to delete this type? Doing so will prevent it from being used prospectively."}
|
35
|
+
|
36
|
+
td= type.name
|
37
|
+
td= type.code
|
38
|
+
td.handle
|
39
|
+
- unless type.deleted?
|
40
|
+
i.fas.fa-bars
|
41
|
+
td= l(type.created_at)
|
42
|
+
td= l(type.deleted_at)
|
data/config/permissions.yml
CHANGED
data/config/routes/virology.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renalware-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.165
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airslie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-import
|
@@ -1455,6 +1455,7 @@ files:
|
|
1455
1455
|
- app/controllers/renalware/virology/base_controller.rb
|
1456
1456
|
- app/controllers/renalware/virology/dashboards_controller.rb
|
1457
1457
|
- app/controllers/renalware/virology/profiles_controller.rb
|
1458
|
+
- app/controllers/renalware/virology/vaccination_types_controller.rb
|
1458
1459
|
- app/controllers/renalware/virology/vaccinations_controller.rb
|
1459
1460
|
- app/documents/document/attribute_initializer.rb
|
1460
1461
|
- app/documents/document/attribute_initializer/active_model.rb
|
@@ -3330,6 +3331,10 @@ files:
|
|
3330
3331
|
- app/views/renalware/virology/dashboards/show.html.slim
|
3331
3332
|
- app/views/renalware/virology/profiles/_summary.html.slim
|
3332
3333
|
- app/views/renalware/virology/profiles/edit.html.slim
|
3334
|
+
- app/views/renalware/virology/vaccination_types/_form.html.slim
|
3335
|
+
- app/views/renalware/virology/vaccination_types/edit.html.slim
|
3336
|
+
- app/views/renalware/virology/vaccination_types/index.html.slim
|
3337
|
+
- app/views/renalware/virology/vaccination_types/new.html.slim
|
3333
3338
|
- app/views/renalware/virology/vaccinations/_alert.html.slim
|
3334
3339
|
- app/views/renalware/virology/vaccinations/_cell.html.slim
|
3335
3340
|
- app/views/renalware/virology/vaccinations/_inputs.html.slim
|