decidim-notify 0.4 → 0.5

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +36 -1
  3. data/Rakefile +8 -0
  4. data/app/cells/decidim/notify/note/show.erb +1 -1
  5. data/app/cells/decidim/notify/participant_cell.rb +2 -1
  6. data/app/controllers/decidim/notify/conversations_controller.rb +1 -1
  7. data/app/models/decidim/notify/author.rb +1 -1
  8. data/app/packs/entrypoints/decidim_notify_component.js +9 -0
  9. data/app/packs/entrypoints/decidim_notify_component.scss +1 -0
  10. data/app/packs/entrypoints/decidim_notify_selects.js +1 -0
  11. data/app/{assets → packs}/images/decidim/notify/icon.svg +0 -0
  12. data/app/packs/src/decidim/notify/consumer.js +7 -0
  13. data/app/{assets/javascripts/decidim/notify/conversations.js.es6 → packs/src/decidim/notify/notify.js} +20 -21
  14. data/app/packs/src/decidim/notify/notify_channel.js +100 -0
  15. data/app/{assets/javascripts/decidim/notify/select2.js.es6 → packs/src/decidim/notify/notify_selects.js} +15 -12
  16. data/app/{assets → packs}/stylesheets/decidim/notify/admin.scss +0 -0
  17. data/app/{assets/stylesheets/decidim/notify/_hexagon.scss → packs/stylesheets/decidim/notify/hexagon.scss} +0 -0
  18. data/app/{assets → packs}/stylesheets/decidim/notify/notify.scss +6 -3
  19. data/{vendor/assets/stylesheets → app/packs/stylesheets/decidim/notify}/select2-foundation-theme.css +0 -0
  20. data/app/views/decidim/notify/admin/conversations/index.html.erb +2 -1
  21. data/app/views/decidim/notify/conversations/_script.js.erb +4 -2
  22. data/app/views/decidim/notify/conversations/index.html.erb +6 -6
  23. data/config/assets.rb +42 -0
  24. data/config/i18n-tasks.yml +1 -0
  25. data/config/locales/ca.yml +5 -0
  26. data/config/locales/cs.yml +5 -0
  27. data/config/locales/en.yml +5 -0
  28. data/config/locales/es.yml +5 -0
  29. data/lib/decidim/notify/component.rb +4 -4
  30. data/lib/decidim/notify/engine.rb +2 -2
  31. data/lib/decidim/notify/version.rb +2 -2
  32. data/lib/decidim/notify.rb +14 -17
  33. data/lib/tasks/decidim_notify_webpacker_tasks.rake +62 -0
  34. data/package.json +200 -0
  35. metadata +24 -22
  36. data/app/assets/config/decidim_notify_manifest.css +0 -2
  37. data/app/assets/config/decidim_notify_manifest.js +0 -3
  38. data/app/assets/javascripts/cable.js +0 -13
  39. data/app/assets/javascripts/channels/decidim/notify/conversations.js +0 -90
  40. data/vendor/assets/javascripts/select2.js +0 -6147
  41. data/vendor/assets/stylesheets/select2.css +0 -515
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cda9fb6f92d4c096fc00bbaa40545217339b862d51770f7be553b3ebef79751
4
- data.tar.gz: b2bd1a84e145972173269768322bd013a9593adfb17a27bf71adf4ddfeeda8e4
3
+ metadata.gz: d826e0ee3d003b459cd85fd8a526d9ee0a6c14b8a984e98065e53a521b7a1851
4
+ data.tar.gz: a40f55f042d0de8df2b537c486d21df1460abee7ce1e0b11fe908431947e1c75
5
5
  SHA512:
6
- metadata.gz: 86abc812ea0dc7143a1bbb874855b027ba4625c6b9891664ed8d4b8ff9ac034ff772bbf133c14260be036bb28362ed2ae2134056957202be50a2873c14570f87
7
- data.tar.gz: a5ed9d3668593357e2d8ff0d7879caf2420af6e5c66a22f33153ac77d66aa19530870952c446e65dce2a36ed4fdb634ad85a77009b7d382c860a830cb2586922
6
+ metadata.gz: c0d093d1fb4edb338607a95c04790142df9814a8319535e9d2abd2f11405508a7f6450ba1d1e433b7861e561cebb647c76db7f9003598beefb256bb8ed6ea46d
7
+ data.tar.gz: 4df80371b49cb253fcb782e1f3e1a2d498bb819eb3398e23a6e04650fe98db25f4fad7684a2dd10dd35e8acb0f4b598d9630efb311fae86eee19b01e89bd9107
data/README.md CHANGED
@@ -19,7 +19,7 @@ Space.
19
19
  Add this line to your application's Gemfile:
20
20
 
21
21
  ```ruby
22
- gem "decidim-notify", "~> 0.4.0"
22
+ gem "decidim-notify"
23
23
  ```
24
24
 
25
25
  And then execute:
@@ -27,13 +27,48 @@ And then execute:
27
27
  ```bash
28
28
  bundle
29
29
  bundle exec rails decidim_notify:install:migrations
30
+ bundle exec rails decidim_notify:webpacker:install
30
31
  bundle exec rails db:migrate
31
32
  ```
32
33
 
34
+ > NOTE: the `decidim_notify:webpacker:install` is only necessary for Decidim versions starting at 0.25.
35
+
36
+ > **IMPORTANT!** A Decidim application might not have activate `ActionCable` by default, which is needed by this plugin.
37
+ > Check if your `config/application.rb` file has the line `require "action_cable/engine"` uncommented. Overall it should look something like this:
38
+ >
39
+ > ```ruby
40
+ > # frozen_string_literal: true
41
+ >
42
+ > require_relative "boot"
43
+ >
44
+ >
45
+ > require "decidim/rails"
46
+ > # Add the frameworks used by your app that are not loaded by Decidim.
47
+ > require "action_cable/engine"
48
+ > # require "action_mailbox/engine"
49
+ > # require "action_text/engine"
50
+ >
51
+ >
52
+ > # Require the gems listed in Gemfile, including any gems
53
+ > # you've limited to :test, :development, or :production.
54
+ > Bundler.require(*Rails.groups)
55
+ >
56
+ > module DecidimApp
57
+ > class Application < Rails::Application
58
+ > ...
59
+ > end
60
+ > end
61
+ > ```
62
+
63
+ The correct version of Notify should resolved automatically by the Bundler.
64
+ However you can force some specific version using `gem "decidim-notify", "~> 0.5.0"` in the Gemfile.
65
+
33
66
  Depending on your Decidim version, choose the corresponding Plugin version to ensure compatibility:
34
67
 
35
68
  | Notify version | Compatible Decidim versions |
36
69
  |---|---|
70
+ | 0.5.x | 0.25.x, 0.26.x |
71
+ | 0.4.x | 0.24.x |
37
72
  | 0.3.x | 0.21.x - 0.24.x |
38
73
 
39
74
  ### Configuration
data/Rakefile CHANGED
@@ -9,6 +9,12 @@ def install_module(path)
9
9
  end
10
10
  end
11
11
 
12
+ def override_webpacker_config_files(path)
13
+ Dir.chdir(path) do
14
+ system("bundle exec rake decidim_notify:webpacker:install")
15
+ end
16
+ end
17
+
12
18
  def seed_db(path)
13
19
  Dir.chdir(path) do
14
20
  system("bundle exec rake db:seed")
@@ -19,6 +25,7 @@ desc "Generates a dummy app for testing"
19
25
  task test_app: "decidim:generate_external_test_app" do
20
26
  ENV["RAILS_ENV"] = "test"
21
27
  install_module("spec/decidim_dummy_app")
28
+ override_webpacker_config_files("spec/decidim_dummy_app")
22
29
  end
23
30
 
24
31
  desc "Generates a development app."
@@ -36,5 +43,6 @@ task :development_app do
36
43
  end
37
44
 
38
45
  install_module("development_app")
46
+ override_webpacker_config_files("development_app")
39
47
  seed_db("development_app")
40
48
  end
@@ -9,7 +9,7 @@
9
9
  </div>
10
10
  <% if note_taker? %>
11
11
  <div class="media-object-section buttons">
12
- <%= button_to edit_path, method: :delete, remote: true, class: "delete", data: { confirm: t("decidim.notify.conversations.destroy.sure") } do %>
12
+ <%= link_to edit_path, method: :delete, remote: true, class: "delete", data: { confirm: t("decidim.notify.conversations.destroy.sure") } do %>
13
13
  <%= icon "trash" %>
14
14
  <% end %>
15
15
  <%= link_to edit_path, class: "edit" do %>
@@ -15,7 +15,8 @@ module Decidim
15
15
  end
16
16
 
17
17
  def avatar_url
18
- model&.avatar_url(:profile)
18
+ path = model.attached_uploader(:avatar).path(variant: :profile) if model.respond_to?(:attached_uploader)
19
+ path.presence || ActionController::Base.helpers.asset_pack_path("media/images/default-avatar.svg")
19
20
  end
20
21
 
21
22
  def current_component
@@ -75,7 +75,7 @@ module Decidim
75
75
  query = Author.for(current_component).joins(:user)
76
76
  query = query.where("decidim_notify_authors.code=:code OR decidim_users.name ILIKE :term OR decidim_users.nickname ILIKE :term", code: term.to_i, term: "%#{term}%")
77
77
 
78
- render json: query.all.collect { |u| { id: u.code, name: u.name, avatar: u&.avatar_url, nickname: u.nickname, text: format_user_name(u) } }
78
+ render json: query.all.collect { |u| { id: u.code, name: u.name, avatar: u.attached_uploader(:avatar).path, nickname: u.nickname, text: format_user_name(u) } }
79
79
  else
80
80
  render json: []
81
81
  end
@@ -14,7 +14,7 @@ module Decidim
14
14
  validates :code, numericality: { greater_than_or_equal_to: 1 }, uniqueness: { scope: :decidim_component_id }
15
15
 
16
16
  delegate :name, :nickname, :organization, :avatar, to: :user
17
- delegate :profile_url, :avatar_url, to: :user, allow_nil: true
17
+ delegate :profile_url, :attached_uploader, to: :user, allow_nil: true
18
18
 
19
19
  default_scope { order(code: :asc) }
20
20
 
@@ -0,0 +1,9 @@
1
+ import "src/decidim/notify/notify.js"
2
+ import "src/decidim/notify/notify_selects"
3
+ import "src/decidim/notify/notify_channel"
4
+
5
+ // Images
6
+ require.context("../images", true)
7
+
8
+ // CSS
9
+ import "entrypoints/decidim_notify_component.scss";
@@ -0,0 +1 @@
1
+ @import "stylesheets/decidim/notify/notify";
@@ -0,0 +1 @@
1
+ import "src/decidim/notify/notify_selects.js"
@@ -0,0 +1,7 @@
1
+ // app/javascript/channels/consumer.js
2
+ // Action Cable provides the framework to deal with WebSockets in Rails.
3
+ // You can generate new channels where WebSocket features live using the `bin/rails generate channel` command.
4
+
5
+ import { createConsumer } from "@rails/actioncable"
6
+
7
+ export default createConsumer((window.Notify && window.Notify.cableUrl) || "/notify_cable")
@@ -1,8 +1,7 @@
1
- //= require decidim/notify/select2
2
1
 
3
2
  $(() => {
4
3
  const $info = $(".form-conversations-submit .info");
5
- const $form = $('form#new_note');
4
+ const $form = $("form#new_note");
6
5
  const originalAction = $form.attr("action");
7
6
 
8
7
  const resetForm = () => {
@@ -13,45 +12,45 @@ $(() => {
13
12
  };
14
13
 
15
14
  // reset button
16
- $form.find('[type="reset"]').on('click', resetForm);
15
+ $form.find('[type="reset"]').on("click", resetForm);
17
16
 
18
17
  // edit button in notes
19
- $('#notify-chapters').on('click', 'a.edit', (e) => {
18
+ $("#notify-chapters").on("click", "a.edit", (e) => {
20
19
  e.preventDefault();
21
20
  const $a = $(e.currentTarget);
22
- const code = $a.closest('.notify-note').data('author-code');
23
- const chapter = $a.closest('.notify-note').data('chapter');
24
- const name = $a.closest('.notify-note').find('.note-name').text();
25
- const body = $a.closest('.notify-note').find('.note-body').text();
21
+ const code = $a.closest(".notify-note").data("author-code");
22
+ const chapter = $a.closest(".notify-note").data("chapter");
23
+ const name = $a.closest(".notify-note").find(".note-name").text();
24
+ const body = $a.closest(".notify-note").find(".note-body").text();
26
25
 
27
26
  $form.find('[name="_method"]').val("patch");
28
- $form.attr("action", $(e.currentTarget).attr('href'));
27
+ $form.attr("action", $(e.currentTarget).attr("href"));
29
28
  $("#note_body").val(body);
30
29
  $("#note_chapter").val(chapter);
31
- $('#note_chapter').trigger('change');
30
+ $("#note_chapter").trigger("change");
32
31
 
33
- if(code) {
32
+ if (code) {
34
33
  $("#note_code").append(`<option value="${code}" selected>${name}</option>`);
35
34
  $("#note_body").select();
36
35
  } else {
37
36
  $("#note_code").select2("open");
38
37
  }
39
38
 
40
- $("html, body").animate({ scrollTop: $('#new_note').offset().top }, 400);
39
+ $("html, body").animate({ scrollTop: $("#new_note").offset().top }, 400);
41
40
  // location = "#new_note";
42
41
 
43
42
  // console.log("edit",$(e.currentTarget).attr('href'),code,body)
44
43
  });
45
44
 
46
45
  // Keypress CTRL-Enter sends form
47
- $("#note_body").keypress(function(e){
48
- if(e.ctrlKey && (e.which === 10 || e.which === 13 )) {
49
- Rails.fire($form[0], 'submit');
46
+ $("#note_body").keypress(function(e) {
47
+ if (e.ctrlKey && (e.which === 10 || e.which === 13)) {
48
+ Rails.fire($form[0], "submit");
50
49
  }
51
50
  });
52
51
 
53
52
  const showInfo = (text, speed) => {
54
- $info.stop(true,true).html(text).show();
53
+ $info.stop(true, true).html(text).show();
55
54
  setTimeout(() => {
56
55
  $info.fadeOut("slow");
57
56
  }, speed);
@@ -59,12 +58,12 @@ $(() => {
59
58
  };
60
59
 
61
60
  // Rails AJAX events
62
- document.body.addEventListener('ajax:error', (responseText) => {
63
- showInfo(responseText.detail[0].message || responseText.detail[0], 5000).removeClass('text-success').addClass('text-alert');
61
+ document.body.addEventListener("ajax:error", (responseText) => {
62
+ showInfo(responseText.detail[0].message || responseText.detail[0], 5000).removeClass("text-success").addClass("text-alert");
64
63
  });
65
- document.body.addEventListener('ajax:success', () => {
66
- showInfo("✔", 1000).removeClass('text-alert').addClass('text-success');
64
+ document.body.addEventListener("ajax:success", () => {
65
+ showInfo("✔", 1000).removeClass("text-alert").addClass("text-success");
67
66
  resetForm();
68
- $('.dropdown-pane').foundation('close');
67
+ $(".dropdown-pane").foundation("close");
69
68
  });
70
69
  });
@@ -0,0 +1,100 @@
1
+ import consumer from "./consumer"
2
+
3
+ const App = window.App = {
4
+ id: window.Notify && window.Notify.id,
5
+ consumer: consumer
6
+ }
7
+
8
+ jQuery.fn.reverse = [].reverse;
9
+
10
+ const updateEmptyStatus = (selector) => {
11
+ $(selector).each(function() {
12
+ if ($(this).children().length == 0) {
13
+ $(this).addClass("empty");
14
+ } else {
15
+ $(this).removeClass("empty");
16
+ }
17
+ });
18
+ };
19
+
20
+ App.notifyNotesChannel = App.consumer.subscriptions.create({ channel: "Decidim::Notify::NotesChannel", id: App.id }, {
21
+ received(data) {
22
+ // console.log("note received",data);
23
+
24
+ if (data.create) {
25
+ $(`#notify-chapter-notes-${data.chapterId || "unclassified"}`).prepend(data.create);
26
+ }
27
+ if (data.update) {
28
+ let $note = $(`#notify-note-${data.id}`);
29
+ let $old = $note.closest(".notify-chapter-notes");
30
+ let $new = $(`#notify-chapter-notes-${data.chapterId || "unclassified"}`);
31
+ if ($old[0] != $new[0]) {
32
+ /* eslint-disable */
33
+ // FIXME: put it in the right place by time of creation
34
+ /* eslint-enable */
35
+ $note.detach().prependTo($new);
36
+ }
37
+ $note.replaceWith(data.update);
38
+ }
39
+ if (data.destroy) {
40
+ $(`#notify-note-${data.destroy}`).remove();
41
+ }
42
+
43
+ updateEmptyStatus(".notify-chapter-notes");
44
+ }
45
+ });
46
+
47
+
48
+ App.notifyParticipantsChannel = App.consumer.subscriptions.create({ channel: "Decidim::Notify::ParticipantsChannel", id: App.id }, {
49
+ received(data) {
50
+ // console.log("participants received",data);
51
+
52
+ $("#notify-note_takers").html(data.noteTakers);
53
+ $("#notify-participants").html(data.participants);
54
+ }
55
+ });
56
+
57
+ App.notifyChaptersChannel = App.consumer.subscriptions.create({ channel: "Decidim::Notify::ChaptersChannel", id: App.id }, {
58
+ received(data) {
59
+ // console.log("chapter received",data);
60
+ if (data.create) {
61
+ $("#notify-chapters").prepend(data.create);
62
+ $(document).foundation();
63
+ if (!$(`#note_chapter [value="${data.title}"]`).length) {
64
+ let newOption = new Option(data.title, data.title, true, true);
65
+ $("#note_chapter").append(newOption).trigger("change");
66
+ }
67
+ }
68
+
69
+ if (data.update) {
70
+ let $chapter = $(`#notify-chapter-${data.id} .chapter-title`);
71
+ if ($chapter.length) {
72
+ let old = $chapter.text();
73
+ $chapter.text(data.update);
74
+ if (data.active) {
75
+ $(".notify-chapter h3").removeClass("active");
76
+ $(`.toggle-chapter-active .switch-input:not(#chapter_active-${data.id})`).prop("checked", false);
77
+ $chapter.closest("h3").addClass("active");
78
+ }
79
+ let activate = $("#note_body").val() == "" && data.active;
80
+ let newOption = new Option(data.update, data.update, activate, activate);
81
+ $(`#note_chapter [value="${old}"]`).remove();
82
+ $("#note_chapter").append(newOption).trigger("change");
83
+ } else {
84
+ console.error("Chapter not found", data);
85
+ }
86
+ }
87
+
88
+ if (data.destroy) {
89
+ // Move notes to the unclassified
90
+ let $unclassified = $("#notify-chapter-notes-unclassified");
91
+ $(`#notify-chapter-notes-${data.destroy} .notify-note`).reverse().each(function() {
92
+ $(this).detach().prependTo($unclassified);
93
+ });
94
+
95
+ $(`#notify-chapter-${data.destroy}`).remove();
96
+ }
97
+
98
+ updateEmptyStatus(".notify-chapter-notes");
99
+ }
100
+ });
@@ -1,7 +1,9 @@
1
- // = require select2
1
+ // I haven't found a way to include jquery plugins without making webpack repeat jQuery itself
2
+ // the workaround is to use CDN providers and include them via standard <script> before any javascript_pack_tag
3
+ // require("select2/src/js/jquery.select2.js")
2
4
 
3
5
  $(() => {
4
- $('select.multiusers-select').each(function() {
6
+ $("select.multiusers-select").each(function() {
5
7
  const url = $(this).attr("data-url");
6
8
  $(this).select2({
7
9
  ajax: {
@@ -21,10 +23,9 @@ $(() => {
21
23
  });
22
24
  });
23
25
 
24
- $('select.user-select').each(function() {
26
+ $("select.user-select").each(function() {
25
27
  const url = $(this).attr("data-url");
26
28
  const placeholder = $(this).attr("placeholder");
27
-
28
29
  $(this).select2({
29
30
  ajax: {
30
31
  url: url,
@@ -43,9 +44,10 @@ $(() => {
43
44
  selectOnClose: true,
44
45
  escapeMarkup: (markup) => markup,
45
46
  templateSelection: (item) => `<b>${item.id}</b> - ${item.text}`,
46
- templateResult: function(item) {
47
+ templateResult: (item) => {
48
+ console.log(item)
47
49
  return `<div class="select2-result-repository">
48
- <div class="select2-result-repository__avatar" style="background-image:url(${item.avatar})">
50
+ <div class="select2-result-repository__avatar" style="background-image:url(${item.avatar || window.Notify.defaultAvatar})">
49
51
  <div class="hex1"></div><div class="hex2"></div>
50
52
  </div>
51
53
  <div class="select2-result-repository__meta">
@@ -55,7 +57,8 @@ $(() => {
55
57
  }
56
58
  });
57
59
 
58
- $(this).on('select2:close', () => $('#note_body').select());
60
+ $(this).on("select2:open", () => $(".select2-search__field").select());
61
+ $(this).on("select2:close", () => $("#note_body").select());
59
62
  $(this).on("select2:clear", function () {
60
63
  $(this).on("select2:opening.cancelOpen", function (evt) {
61
64
  evt.preventDefault();
@@ -65,7 +68,7 @@ $(() => {
65
68
  });
66
69
  });
67
70
 
68
- $('select.chapter-select').each(function() {
71
+ $("select.chapter-select").each(function() {
69
72
  const placeholder = $(this).attr("placeholder");
70
73
 
71
74
  $(this).select2({
@@ -75,12 +78,12 @@ $(() => {
75
78
  theme: "foundation",
76
79
  placeholder: placeholder,
77
80
  createTag: function (params) {
78
- var term = $.trim(params.term);
81
+ let term = $.trim(params.term);
79
82
 
80
- if (term === '') {
83
+ if (term === "") {
81
84
  return null;
82
85
  }
83
- var n = {
86
+ let n = {
84
87
  id: term,
85
88
  text: term
86
89
  }
@@ -88,7 +91,7 @@ $(() => {
88
91
  }
89
92
  });
90
93
 
91
- $(this).on('select2:close', () => $('#note_body').select());
94
+ $(this).on("select2:close", () => $("#note_body").select());
92
95
  $(this).on("select2:clear", function () {
93
96
  $(this).on("select2:opening.cancelOpen", function (evt) {
94
97
  evt.preventDefault();
@@ -1,5 +1,7 @@
1
- @import 'decidim/variables';
2
- @import 'decidim/utils/settings';
1
+ // From Decidicim core
2
+ @import 'stylesheets/decidim/variables';
3
+ @import 'stylesheets/decidim/utils/settings';
4
+ // From npm package
3
5
  @import "select2";
4
6
  @import "select2-foundation-theme";
5
7
  @import "hexagon";
@@ -202,7 +204,8 @@
202
204
  }
203
205
 
204
206
  .notify-note {
205
- button {
207
+ .buttons a{
208
+ display: block;
206
209
  &.tiny {
207
210
  padding-left: 0.5rem;
208
211
  padding-right: 0.5rem;
@@ -24,4 +24,5 @@
24
24
  </div>
25
25
  </div>
26
26
 
27
- <%= javascript_include_tag "decidim/notify/select2" %>
27
+ <%= javascript_include_tag "https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js" %>
28
+ <%= javascript_pack_tag "decidim_notify_selects" %>
@@ -1,7 +1,9 @@
1
1
  <script type="text/javascript">
2
2
  window.Notify = window.Notify || {};
3
3
  window.Notify.id = <%= id %>;
4
+ window.Notify.cableUrl = "<%= Decidim::Notify.config.cable_mount_path %>";
5
+ window.Notify.defaultAvatar = '<%= ActionController::Base.helpers.asset_pack_path("media/images/default-avatar.svg") %>';
4
6
  </script>
5
7
 
6
- <%= javascript_include_tag "decidim/notify/conversations" %>
7
- <%= javascript_include_tag "channels/decidim/notify/conversations" %>
8
+ <%= javascript_include_tag "https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js" %>
9
+ <%= javascript_pack_tag "decidim_notify_component" %>
@@ -30,18 +30,18 @@
30
30
  </div>
31
31
  </div>
32
32
  <div class="columns smallmedium-3">
33
- <h5><%= t ".note_takers" %></h5>
34
- <div class="card">
35
- <div class="card-section by-note-taker" id="notify-note_takers">
36
- <%= render partial: "participant", collection: @note_takers %>
37
- </div>
38
- </div>
39
33
  <h5><%= t ".participants" %></h5>
40
34
  <div class="card">
41
35
  <div class="card-section" id="notify-participants">
42
36
  <%= render partial: "participant", collection: @participants %>
43
37
  </div>
44
38
  </div>
39
+ <h5><%= t ".note_takers" %></h5>
40
+ <div class="card">
41
+ <div class="card-section by-note-taker" id="notify-note_takers">
42
+ <%= render partial: "participant", collection: @note_takers %>
43
+ </div>
44
+ </div>
45
45
  </div>
46
46
  </div>
47
47
 
data/config/assets.rb ADDED
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is located at `config/assets.rb` of your module.
4
+
5
+ # Define the base path of your module. Please note that `Rails.root` may not be
6
+ # used because we are not inside the Rails environment when this file is loaded.
7
+ base_path = File.expand_path("..", __dir__)
8
+
9
+ # Register an additional load path for webpack. All the assets within these
10
+ # directories will be available for inclusion within the Decidim assets. For
11
+ # example, if you have `app/packs/src/decidim/foo.js`, you can include that file
12
+ # in your JavaScript entrypoints (or other JavaScript files within Decidim)
13
+ # using `import "src/decidim/foo"` after you have registered the additional path
14
+ # as follows.
15
+ Decidim::Webpacker.register_path("#{base_path}/app/packs")
16
+
17
+ # Register the entrypoints for your module. These entrypoints can be included
18
+ # within your application using `javascript_pack_tag` and if you include any
19
+ # SCSS files within the entrypoints, they become available for inclusion using
20
+ # `stylesheet_pack_tag`.
21
+ Decidim::Webpacker.register_entrypoints(
22
+ decidim_notify_component: "#{base_path}/app/packs/entrypoints/decidim_notify_component.js",
23
+ decidim_notify_selects: "#{base_path}/app/packs/entrypoints/decidim_notify_selects.js",
24
+ decidim_notify_component_css: "#{base_path}/app/packs/entrypoints/decidim_notify_component.scss"
25
+ )
26
+
27
+ # If you want to import some extra SCSS files in the Decidim main SCSS file
28
+ # without adding any extra stylesheet inclusion tags, you can use the following
29
+ # method to register the stylesheet import for the main application.
30
+ Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/notify/notify")
31
+
32
+ # If you want to do the same but include the SCSS file for the admin panel's
33
+ # main SCSS file, you can use the following method.
34
+ Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/notify/admin", group: :admin)
35
+
36
+ # If you want to override some SCSS variables/settings for Foundation from the
37
+ # module, you can add the following registered import.
38
+ # Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/foo/settings", type: :settings)
39
+
40
+ # If you want to do the same but override the SCSS variables of the admin
41
+ # panel's styles, you can use the following method.
42
+ # Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/foo/admin_settings", type: :settings, group: :admin)
@@ -27,6 +27,7 @@ ignore_unused:
27
27
  - decidim.notify.chapter.update.*
28
28
  - decidim.notify.conversations.private.*
29
29
  - decidim.pages.home.statistics.*
30
+ - decidim.statistics.*
30
31
  - decidim.participatory_processes.statistics.*
31
32
 
32
33
  # keys reused from decidim-core
@@ -107,3 +107,8 @@ ca:
107
107
  notify_chapters_count: Temes de la conversa
108
108
  notify_conversations_count: Converses
109
109
  notify_notes_count: Notes de la conversa
110
+ statistics:
111
+ notify_authors_count: Autors de notes
112
+ notify_chapters_count: Capítols en les notes
113
+ notify_conversations_count: Converses
114
+ notify_notes_count: Notes
@@ -107,3 +107,8 @@ cs:
107
107
  notify_chapters_count: Témata konverzací
108
108
  notify_conversations_count: Konverzace
109
109
  notify_notes_count: Poznámky ke konverzaci
110
+ statistics:
111
+ notify_authors_count: Oznámení autorů
112
+ notify_chapters_count: Oznámení kapitol
113
+ notify_conversations_count: Oznámení konverzací
114
+ notify_notes_count: Oznámení poznámek
@@ -108,3 +108,8 @@ en:
108
108
  notify_chapters_count: Conversation topics
109
109
  notify_conversations_count: Conversations
110
110
  notify_notes_count: Conversation notes
111
+ statistics:
112
+ notify_authors_count: Notify authors
113
+ notify_chapters_count: Notify chapters
114
+ notify_conversations_count: Notify conversations
115
+ notify_notes_count: Notify notes
@@ -107,3 +107,8 @@ es:
107
107
  notify_chapters_count: Temas de la conversación
108
108
  notify_conversations_count: Conversaciones
109
109
  notify_notes_count: Notas de la conversación
110
+ statistics:
111
+ notify_authors_count: Autores de notas
112
+ notify_chapters_count: Capítulos en las notas
113
+ notify_conversations_count: Conversaciones
114
+ notify_notes_count: Notas
@@ -6,12 +6,12 @@ Decidim.register_component(:notify) do |component|
6
6
  component.engine = Decidim::Notify::Engine
7
7
  component.admin_engine = Decidim::Notify::AdminEngine
8
8
  component.icon = "decidim/notify/icon.svg"
9
- component.stylesheet = "decidim/notify/notify"
10
- component.admin_stylesheet = "decidim/notify/admin"
9
+ # component.stylesheet = "decidim/notify/notify"
10
+ # component.admin_stylesheet = "decidim/notify/admin"
11
11
 
12
12
  component.on(:before_destroy) do |instance|
13
13
  # Code executed before removing the component
14
- raise StandardEerror, "Can't remove this component, there's notes in it!" if Decidim::Notify::Note.for(instance).any?
14
+ raise StandardError, "Can't remove this component, there's notes in it!" if Decidim::Notify::Note.for(instance).any?
15
15
  end
16
16
 
17
17
  # These actions permissions can be configured in the admin panel
@@ -112,7 +112,7 @@ Decidim.register_component(:notify) do |component|
112
112
  participants = [admin_user] + Decidim::User.where(organization: component.organization).sample(3)
113
113
  # add avatars and create participants
114
114
  participants.each.with_index(1) do |user, index|
115
- user.avatar = File.new(File.join(__dir__, "seeds", "avatar#{index}.png"))
115
+ user.avatar = Rack::Test::UploadedFile.new(File.expand_path(File.join(__dir__, "seeds", "avatar#{index}.png")))
116
116
  user.save!
117
117
  # create author
118
118
  author = Decidim::Notify::Author.find_or_create_by(
@@ -17,8 +17,8 @@ module Decidim
17
17
  root to: "conversations#index"
18
18
  end
19
19
 
20
- initializer "decidim_notify.assets" do |app|
21
- app.config.assets.precompile += %w(decidim_notify_manifest.js decidim_notify_manifest.css)
20
+ initializer "decidim_notify.webpacker.assets_path" do
21
+ Decidim.register_assets_path File.expand_path("app/packs", root)
22
22
  end
23
23
 
24
24
  initializer "decidim_notify.cable" do |_app|