renalware-core 2.0.143 → 2.0.144

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cb7d60384fbf68383c1160af8d367f348a292dac568ec324d2149fa5131d288
4
- data.tar.gz: 9c91c199d79f644bcb93de90558bb7a3b7f176119c6167beb2a3c51927bf03bc
3
+ metadata.gz: 681dfc892020816cf3a194e525126d5183edc902647a24f3a7368c70c49e357d
4
+ data.tar.gz: fc36c245a572d79fea89d1623d8e4baf34f6cd5aa3e209b15bb6a72dfce23dcc
5
5
  SHA512:
6
- metadata.gz: d26f5db9d00643f130bb63f9134ecaa15b13c300a1723aaaa2a272d4144917bcdec886f0db2d9072413af64cf70996fdc11f52e600d9fae7a4a3dae355a396d5
7
- data.tar.gz: dda49e2a4f3ea966327e8922263856ff918924a28ebed6b3b5c8326d75172d803e70bd7d373335217bfe6fa2b01cd856ba49911a725b72dca2f9f0432d65394f
6
+ metadata.gz: 7dc1cae45c025dea07e3be64d6a4b49a8ecff3527a899553277db43321ddbf02818500c2ca620d7c476ae3df81f9d37d00d2e9d2d9f096c4aedd86efdd3c99a5
7
+ data.tar.gz: 966296fde8a71919b5407f81b96df4b7e19c7a34ca64c78ebcdc21e06bcee7a090235312663e1c4a833029173b8ea8f41da55332c6a231188184ebf88555cf46
@@ -3872,6 +3872,28 @@ var _default$2 = function(_Controller) {
3872
3872
 
3873
3873
  _defineProperty(_default$2, "targets", [ "form", "printOptions", "printFeedback" ]);
3874
3874
 
3875
+ var $$2 = window.$;
3876
+
3877
+ var _default$3 = function(_Controller) {
3878
+ _inherits(_default, _Controller);
3879
+ function _default() {
3880
+ _classCallCheck(this, _default);
3881
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
3882
+ }
3883
+ _createClass(_default, [ {
3884
+ key: "insert",
3885
+ value: function insert(event) {
3886
+ var modal = $$2("#snippets-modal");
3887
+ var snippetBody = $$2(event.target).parent().closest("tr").find(".body").html();
3888
+ var targetInputSelector = $$2(modal).data("target");
3889
+ trix = document.querySelector("trix-editor");
3890
+ trix.editor.insertHTML(snippetBody);
3891
+ $$2(modal).foundation("reveal", "close");
3892
+ }
3893
+ } ]);
3894
+ return _default;
3895
+ }(Controller);
3896
+
3875
3897
  var application = Application.start();
3876
3898
 
3877
3899
  application.register("toggle", _default);
@@ -3879,3 +3901,5 @@ application.register("toggle", _default);
3879
3901
  application.register("hd-prescription-administration", _default$1);
3880
3902
 
3881
3903
  application.register("home-delivery-modal", _default$2);
3904
+
3905
+ application.register("snippets", _default$3);
@@ -15,6 +15,8 @@ module Renalware
15
15
  class: "reveal-modal",
16
16
  data: {
17
17
  reveal: "data-reveal",
18
+ controller: "snippets",
19
+ "snippets-target-input" => target_input_for_seleted_snippet,
18
20
  target: target_input_for_seleted_snippet
19
21
  })
20
22
  concat link_to t("snippets.insert"),
@@ -0,0 +1,16 @@
1
+ const $ = window.$
2
+ import { Controller } from "stimulus"
3
+
4
+ export default class extends Controller {
5
+ insert(event) {
6
+ // Note the trix_edito_helper is not inserting the correct class atm
7
+ // so for now we are just selecting the one and only (hopefully) trix-editor on the page
8
+ // let editorSelector = this.data.get("target-input")
9
+ let modal = $("#snippets-modal")
10
+ let snippetBody = $(event.target).parent().closest("tr").find(".body").html()
11
+ let targetInputSelector = $(modal).data("target")
12
+ trix = document.querySelector("trix-editor")
13
+ trix.editor.insertHTML(snippetBody)
14
+ $(modal).foundation("reveal", "close")
15
+ }
16
+ }
@@ -16,8 +16,10 @@ import { Application } from "stimulus"
16
16
  import ToggleController from "./controllers/toggle_controller"
17
17
  import HDPrescriptionController from "./controllers/hd/prescription_administration_controller"
18
18
  import MedicationsHomeDeliveryModalController from "./controllers/medications/home_delivery_modal_controller"
19
+ import SnippetsController from "./controllers/snippets_controller"
19
20
 
20
21
  const application = Application.start()
21
22
  application.register("toggle", ToggleController)
22
23
  application.register("hd-prescription-administration", HDPrescriptionController)
23
24
  application.register("home-delivery-modal", MedicationsHomeDeliveryModalController)
25
+ application.register("snippets", SnippetsController)
@@ -16,7 +16,8 @@ tr(data={ "snippet-id" => snippet.id, invocation_url: snippet_invocations_path(s
16
16
  = link_to "Insert",
17
17
  "#",
18
18
  title: "Insert this snippet into the letter",
19
- class: "insert-snippet button compact alternative"
19
+ class: "insert-snippet button compact alternative",
20
+ data: { action: "click->snippets#insert"}
20
21
  - unless author == :me
21
22
  td.col-width-medium.author= snippet.author
22
23
  td.css-toggle-container.title
@@ -14,14 +14,3 @@ $('.snippets').on('click', 'th a, .pagination a', function () {
14
14
  );
15
15
 
16
16
  initTogglers();
17
-
18
- $('.insert-snippet').on('click', function (e) {
19
- var modal = $("#snippets-modal");
20
- var snippetBody = $(this).parent().closest("tr").find(".body").html();
21
- var targetInputSelector = $(modal).data("target");
22
- var targetInputSelector = $(targetInputSelector)[0];
23
-
24
- targetInputSelector.editor.insertHTML(snippetBody)
25
- $(modal).foundation('reveal', 'close');
26
- }
27
- );
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renalware
4
- VERSION = "2.0.143"
4
+ VERSION = "2.0.144"
5
5
  end
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.143
4
+ version: 2.0.144
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-16 00:00:00.000000000 Z
11
+ date: 2020-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview-component
@@ -1474,6 +1474,7 @@ files:
1474
1474
  - app/inputs/user_picker_input.rb
1475
1475
  - app/javascript/renalware/controllers/hd/prescription_administration_controller.js
1476
1476
  - app/javascript/renalware/controllers/medications/home_delivery_modal_controller.js
1477
+ - app/javascript/renalware/controllers/snippets_controller.js
1477
1478
  - app/javascript/renalware/controllers/toggle_controller.js
1478
1479
  - app/javascript/renalware/index.js
1479
1480
  - app/jobs/application_job.rb