renalware-core 2.0.144 → 2.0.145

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: 681dfc892020816cf3a194e525126d5183edc902647a24f3a7368c70c49e357d
4
- data.tar.gz: fc36c245a572d79fea89d1623d8e4baf34f6cd5aa3e209b15bb6a72dfce23dcc
3
+ metadata.gz: 264987f5d8be265da2a90a036b68107e57d56799d4ead8c1b40e11a351a9d65a
4
+ data.tar.gz: db66496b53c89e79e7ba629ba799ef891abd739b3097eeec89aedfcba2b21155
5
5
  SHA512:
6
- metadata.gz: 7dc1cae45c025dea07e3be64d6a4b49a8ecff3527a899553277db43321ddbf02818500c2ca620d7c476ae3df81f9d37d00d2e9d2d9f096c4aedd86efdd3c99a5
7
- data.tar.gz: 966296fde8a71919b5407f81b96df4b7e19c7a34ca64c78ebcdc21e06bcee7a090235312663e1c4a833029173b8ea8f41da55332c6a231188184ebf88555cf46
6
+ metadata.gz: be45e35ef297c5b1f031cdbbebdf0fa3579dbcc32c31b1d5786efaa96dd520328aff549ed7513cbf3d4a2599ae906595efecf93cc6d0c62cb56c8652ece29f7c
7
+ data.tar.gz: 9bf397ab6768aa9ef420077804f457865959f906ebac530e6149ab3cc68d3c7e5d4af60aed095a6e5deb1748c13abdf263faa243b9e74bfed729f77514675306
@@ -88,19 +88,19 @@ Renalware.Letters = (function() {
88
88
  })
89
89
  };
90
90
 
91
- var initInsertEventNotesIntoTextEditor = function() {
92
- $(".insert-data-notes").on("click", function(e) {
93
- e.preventDefault();
94
- var notes = $(this).data("notes");
95
- var targetEditorSelector = $(this).data("target");
96
- if (notes && targetEditorSelector) {
97
- var targetInput = $(targetEditorSelector)[0];
98
- targetInput.editor.insertHTML(notes);
99
- } else {
100
- alert("There are no notes to insert");
101
- }
102
- });
103
- };
91
+ // var initInsertEventNotesIntoTextEditor = function() {
92
+ // $(".insert-data-notes").on("click", function(e) {
93
+ // e.preventDefault();
94
+ // var notes = $(this).data("notes");
95
+ // var targetEditorSelector = $(this).data("target");
96
+ // if (notes && targetEditorSelector) {
97
+ // var targetInput = $(targetEditorSelector)[0];
98
+ // targetInput.editor.insertHTML(notes);
99
+ // } else {
100
+ // alert("There are no notes to insert");
101
+ // }
102
+ // });
103
+ // };
104
104
 
105
105
  var pollBatchStatus = function(url) {
106
106
  var POLL_INTERVAL = 2000; // ms
@@ -143,7 +143,7 @@ Renalware.Letters = (function() {
143
143
  bindOnSalutationChange();
144
144
  initNewContactAsMainRecipient();
145
145
  initNewContactAsCC();
146
- initInsertEventNotesIntoTextEditor();
146
+ //initInsertEventNotesIntoTextEditor();
147
147
  bindOnLetterAboutToBatchPrint();
148
148
  bindOnLetterAboutToPrint();
149
149
  },
@@ -3885,8 +3885,7 @@ var _default$3 = function(_Controller) {
3885
3885
  value: function insert(event) {
3886
3886
  var modal = $$2("#snippets-modal");
3887
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");
3888
+ var trix = document.querySelector("trix-editor");
3890
3889
  trix.editor.insertHTML(snippetBody);
3891
3890
  $$2(modal).foundation("reveal", "close");
3892
3891
  }
@@ -3894,6 +3893,36 @@ var _default$3 = function(_Controller) {
3894
3893
  return _default;
3895
3894
  }(Controller);
3896
3895
 
3896
+ var $$3 = window.$;
3897
+
3898
+ var _default$4 = function(_Controller) {
3899
+ _inherits(_default, _Controller);
3900
+ function _default() {
3901
+ _classCallCheck(this, _default);
3902
+ return _possibleConstructorReturn(this, _getPrototypeOf(_default).apply(this, arguments));
3903
+ }
3904
+ _createClass(_default, [ {
3905
+ key: "initInsertEventNotesIntoTrixEditor",
3906
+ value: function initInsertEventNotesIntoTrixEditor(event) {
3907
+ event.preventDefault();
3908
+ var notes = $$3(event.target).data("notes");
3909
+ if (notes && this.trix) {
3910
+ this.trix.insertHTML(notes);
3911
+ } else {
3912
+ alert("There are no notes to insert");
3913
+ }
3914
+ }
3915
+ }, {
3916
+ key: "trix",
3917
+ get: function get() {
3918
+ return this.trixTarget.editor;
3919
+ }
3920
+ } ]);
3921
+ return _default;
3922
+ }(Controller);
3923
+
3924
+ _defineProperty(_default$4, "targets", [ "trix" ]);
3925
+
3897
3926
  var application = Application.start();
3898
3927
 
3899
3928
  application.register("toggle", _default);
@@ -3903,3 +3932,5 @@ application.register("hd-prescription-administration", _default$1);
3903
3932
  application.register("home-delivery-modal", _default$2);
3904
3933
 
3905
3934
  application.register("snippets", _default$3);
3935
+
3936
+ application.register("letters-form", _default$4);
@@ -3,7 +3,7 @@
3
3
  # See https://github.com/kylefox/trix/blob/master/lib/trix/simple_form/trix_editor_input.rb
4
4
  class TrixEditorInput < SimpleForm::Inputs::Base
5
5
  def input(_wrapper_options)
6
- trix_options = options.slice(:spellcheck, :toolbar, :tabindex, :input, :class)
6
+ trix_options = options.slice(:spellcheck, :toolbar, :tabindex, :input, :class, :data)
7
7
  editor_options = { input: input_class, class: "trix-content" }.merge(trix_options)
8
8
 
9
9
  editor_tag = template.content_tag("trix-editor", "", editor_options)
@@ -0,0 +1,21 @@
1
+ const $ = window.$
2
+ import { Controller } from "stimulus"
3
+
4
+ export default class extends Controller {
5
+ static targets = [ "trix" ]
6
+
7
+ initInsertEventNotesIntoTrixEditor(event) {
8
+ event.preventDefault()
9
+ let notes = $(event.target).data("notes")
10
+
11
+ if (notes && this.trix) {
12
+ this.trix.insertHTML(notes)
13
+ } else {
14
+ alert("There are no notes to insert")
15
+ }
16
+ }
17
+
18
+ get trix() {
19
+ return this.trixTarget.editor
20
+ }
21
+ }
@@ -3,13 +3,10 @@ import { Controller } from "stimulus"
3
3
 
4
4
  export default class extends Controller {
5
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")
6
+ // TODO: set up the trix editor in each page as data-target="snippets.trix"
9
7
  let modal = $("#snippets-modal")
10
8
  let snippetBody = $(event.target).parent().closest("tr").find(".body").html()
11
- let targetInputSelector = $(modal).data("target")
12
- trix = document.querySelector("trix-editor")
9
+ let trix = document.querySelector("trix-editor")
13
10
  trix.editor.insertHTML(snippetBody)
14
11
  $(modal).foundation("reveal", "close")
15
12
  }
@@ -17,9 +17,11 @@ 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
19
  import SnippetsController from "./controllers/snippets_controller"
20
+ import LettersFormController from "./controllers/letters/form_controller"
20
21
 
21
22
  const application = Application.start()
22
23
  application.register("toggle", ToggleController)
23
24
  application.register("hd-prescription-administration", HDPrescriptionController)
24
25
  application.register("home-delivery-modal", MedicationsHomeDeliveryModalController)
25
26
  application.register("snippets", SnippetsController)
27
+ application.register("letters-form", LettersFormController)
@@ -8,7 +8,7 @@ ruby:
8
8
  span= " or "
9
9
  = link_to "cancel", back_path
10
10
 
11
- .form-content
11
+ .form-content data-controller="letters-form"
12
12
  = render event if event.present?
13
13
 
14
14
  article
@@ -46,12 +46,17 @@ ruby:
46
46
  = snippets_modal_and_link_to_open_it(target_input_for_seleted_snippet: ".letter-body-editor")
47
47
 
48
48
  - if event&.respond_to?(:notes)
49
+
49
50
  = link_to "Insert #{event.class.name.demodulize.underscore.humanize.downcase} notes",
50
51
  "/",
51
- data: { notes: event.notes || "", target: ".letter-body-editor" },
52
+ data: { action: "click->letters-form#initInsertEventNotesIntoTrixEditor",
53
+ notes: event.notes || "" },
52
54
  class: "insert-data-notes button alternative right editor-toolbar-button"
53
55
 
54
- = f.input :body, as: :trix_editor, class: "letter-body-editor", wrapper: :zilch
56
+ = f.input :body,
57
+ as: :trix_editor,
58
+ wrapper: :zilch,
59
+ data: { target: "letters-form.trix" }
55
60
 
56
61
  article
57
62
  header
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renalware
4
- VERSION = "2.0.144"
4
+ VERSION = "2.0.145"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renalware-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.144
4
+ version: 2.0.145
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
@@ -1473,6 +1473,7 @@ files:
1473
1473
  - app/inputs/trix_editor_input.rb
1474
1474
  - app/inputs/user_picker_input.rb
1475
1475
  - app/javascript/renalware/controllers/hd/prescription_administration_controller.js
1476
+ - app/javascript/renalware/controllers/letters/form_controller.js
1476
1477
  - app/javascript/renalware/controllers/medications/home_delivery_modal_controller.js
1477
1478
  - app/javascript/renalware/controllers/snippets_controller.js
1478
1479
  - app/javascript/renalware/controllers/toggle_controller.js