decidim-decidim_awesome 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -1
- data/README.md +134 -15
- data/app/cells/concerns/decidim/decidim_awesome/proposal_m_cell_override.rb +4 -24
- data/app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb +9 -5
- data/app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb +1 -1
- data/app/commands/concerns/decidim/decidim_awesome/proposals/admin/update_proposal_override.rb +31 -0
- data/app/commands/concerns/decidim/decidim_awesome/proposals/create_collaborative_draft_override.rb +27 -0
- data/app/commands/concerns/decidim/decidim_awesome/proposals/create_proposal_override.rb +27 -0
- data/app/commands/concerns/decidim/decidim_awesome/proposals/update_collaborative_draft_override.rb +27 -0
- data/app/commands/concerns/decidim/decidim_awesome/proposals/update_proposal_override.rb +26 -0
- data/app/commands/decidim/decidim_awesome/admin/create_proposal_custom_field.rb +4 -3
- data/app/commands/decidim/decidim_awesome/admin/destroy_proposal_custom_field.rb +6 -3
- data/app/controllers/concerns/decidim/decidim_awesome/admin/maintenance_context.rb +43 -0
- data/app/controllers/concerns/decidim/decidim_awesome/admin_accountability/admin/filterable_helper.rb +3 -2
- data/app/controllers/concerns/decidim/decidim_awesome/limit_pending_amendments.rb +35 -0
- data/app/controllers/concerns/decidim/decidim_awesome/proposals/orderable_override.rb +9 -22
- data/app/controllers/decidim/decidim_awesome/admin/admin_accountability_controller.rb +7 -7
- data/app/controllers/decidim/decidim_awesome/admin/application_controller.rb +2 -0
- data/app/controllers/decidim/decidim_awesome/admin/checks_controller.rb +7 -3
- data/app/controllers/decidim/decidim_awesome/admin/config_controller.rb +8 -5
- data/app/controllers/decidim/decidim_awesome/admin/constraints_controller.rb +3 -1
- data/app/controllers/decidim/decidim_awesome/admin/custom_redirects_controller.rb +0 -2
- data/app/controllers/decidim/decidim_awesome/admin/maintenance_controller.rb +76 -0
- data/app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb +0 -2
- data/app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb +12 -4
- data/app/controllers/decidim/decidim_awesome/iframe_component/iframe_controller.rb +8 -1
- data/app/forms/concerns/decidim/decidim_awesome/proposals/proposal_form_override.rb +21 -0
- data/app/forms/{decidim → concerns/decidim}/decidim_awesome/proposals/proposal_wizard_create_step_form_override.rb +1 -0
- data/app/forms/decidim/decidim_awesome/admin/config_form.rb +35 -9
- data/app/helpers/{decidim → concerns/decidim}/decidim_awesome/amendments_helper_override.rb +17 -7
- data/app/helpers/concerns/decidim/decidim_awesome/proposals/application_helper_override.rb +126 -0
- data/app/helpers/decidim/decidim_awesome/admin/config_constraints_helpers.rb +5 -26
- data/app/jobs/decidim/decidim_awesome/destroy_private_data_job.rb +22 -0
- data/app/models/concerns/decidim/decidim_awesome/has_proposal_extra_fields.rb +38 -9
- data/app/models/decidim/decidim_awesome/paper_trail_version.rb +5 -1
- data/app/models/decidim/decidim_awesome/proposal_extra_field.rb +35 -1
- data/app/overrides/decidim/proposals/admin/proposals/show/add_private_body.html.erb.deface +7 -0
- data/app/overrides/decidim/proposals/admin/proposals/show/replace_body.html.erb.deface +5 -0
- data/app/overrides/decidim/proposals/proposals/show/limit_amendments_modal.html.erb.deface +5 -0
- data/app/packs/entrypoints/decidim_decidim_awesome_map.scss +1 -1
- data/app/packs/src/decidim/decidim_awesome/admin/auto_edit.js +5 -3
- data/app/packs/src/decidim/decidim_awesome/admin/constraints.js +1 -1
- data/app/packs/src/decidim/decidim_awesome/admin/custom_fields_builder.js +5 -4
- data/app/packs/src/decidim/decidim_awesome/amendments/show_modal_on_limits.js +30 -0
- data/app/packs/src/decidim/decidim_awesome/awesome_application.js +1 -0
- data/app/packs/src/decidim/decidim_awesome/editors/editor.js +1 -6
- data/app/packs/src/decidim/decidim_awesome/editors/tabs_focus.js +18 -9
- data/app/packs/src/decidim/decidim_awesome/forms/custom_fields_renderer.js +35 -26
- data/app/packs/src/decidim/decidim_awesome/proposals/custom_fields.js +31 -15
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/codemirror.scss +12 -7
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/constraints.scss +69 -25
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_fields.scss +34 -27
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/user_picker.scss +2 -2
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin.scss +3 -3
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss +28 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_application.scss +3 -2
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_map/map.scss +15 -15
- data/app/packs/stylesheets/decidim/decidim_awesome/editors/quill_editor.scss +3 -3
- data/app/packs/stylesheets/decidim/decidim_awesome/forms/autosave.scss +3 -3
- data/app/packs/stylesheets/decidim/decidim_awesome/forms/custom_fields.scss +187 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/shared/spinner.scss +47 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/voting/voting_cards.scss +7 -7
- data/app/permissions/decidim/decidim_awesome/admin/permissions.rb +14 -3
- data/app/presenters/concerns/decidim/decidim_awesome/proposals/proposal_presenter_override.rb +20 -0
- data/app/presenters/decidim/decidim_awesome/admin_log/component_presenter_override.rb +30 -0
- data/app/presenters/decidim/decidim_awesome/private_data_presenter.rb +70 -0
- data/app/queries/decidim/decidim_awesome/private_data_finder.rb +19 -0
- data/app/serializers/concerns/decidim/decidim_awesome/proposal_serializer_override.rb +1 -0
- data/app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_methods.rb +72 -0
- data/app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_override.rb +38 -0
- data/app/serializers/decidim/decidim_awesome/proposals/private_proposal_serializer.rb +42 -0
- data/app/types/concerns/decidim/decidim_awesome/add_proposal_type_custom_fields.rb +59 -0
- data/app/types/concerns/decidim/decidim_awesome/{proposal_type_override.rb → add_proposal_type_vote_weights.rb} +3 -1
- data/app/views/decidim/decidim_awesome/admin/checks/index.html.erb +52 -48
- data/app/views/decidim/decidim_awesome/admin/config/_autoedit_box_label.html.erb +7 -2
- data/app/views/decidim/decidim_awesome/admin/config/_constraints.html.erb +16 -8
- data/app/views/decidim/decidim_awesome/admin/config/_form_admins.html.erb +1 -1
- data/app/views/decidim/decidim_awesome/admin/config/_form_editors.html.erb +12 -16
- data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_custom_fields.html.erb +35 -15
- data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_private_custom_fields.html.erb +1 -0
- data/app/views/decidim/decidim_awesome/admin/config/_form_proposals.html.erb +22 -22
- data/app/views/decidim/decidim_awesome/admin/config/_form_styles.html.erb +1 -1
- data/app/views/decidim/decidim_awesome/admin/config/show.html.erb +1 -1
- data/app/views/decidim/decidim_awesome/admin/custom_redirects/index.html.erb +14 -13
- data/app/views/decidim/decidim_awesome/admin/maintenance/_private_data.html.erb +44 -0
- data/app/views/decidim/decidim_awesome/admin/maintenance/show.html.erb +44 -0
- data/app/views/decidim/decidim_awesome/admin/menu_hacks/index.html.erb +28 -29
- data/app/views/decidim/decidim_awesome/admin/proposals/_editor.html.erb +8 -5
- data/app/views/decidim/decidim_awesome/admin/proposals/_private_body.html.erb +20 -0
- data/app/views/decidim/decidim_awesome/amendments/_modal.html.erb +16 -0
- data/app/views/decidim/decidim_awesome/custom_fields/_form_render.html.erb +10 -2
- data/app/views/layouts/decidim/decidim_awesome/admin/_base.html.erb +21 -0
- data/app/views/layouts/decidim/decidim_awesome/admin/application.html.erb +1 -73
- data/app/views/layouts/decidim/decidim_awesome/admin/maintenance.html.erb +19 -0
- data/config/i18n-tasks.yml +22 -3
- data/config/locales/ca.yml +97 -9
- data/config/locales/cs.yml +109 -6
- data/config/locales/de.yml +92 -6
- data/config/locales/en.yml +102 -8
- data/config/locales/es.yml +96 -8
- data/config/locales/eu.yml +15 -1
- data/config/locales/fr.yml +94 -6
- data/config/locales/hu.yml +53 -4
- data/config/locales/it.yml +16 -6
- data/config/locales/ja.yml +94 -6
- data/config/locales/lt.yml +0 -2
- data/config/locales/nl.yml +9 -4
- data/config/locales/pt-BR.yml +16 -7
- data/config/locales/ro-RO.yml +11 -2
- data/config/locales/sv.yml +17 -6
- data/db/migrate/20240531224204_add_decidim_awesome_proposal_private_fields.rb +29 -0
- data/db/migrate/20240729164227_add_decidim_awesome_proposal_private_fields_date.rb +20 -0
- data/lib/decidim/decidim_awesome/admin_engine.rb +22 -6
- data/lib/decidim/decidim_awesome/api/types/localized_custom_fields_type.rb +22 -0
- data/lib/decidim/decidim_awesome/api/types/translated_custom_fields_type.rb +52 -0
- data/lib/decidim/decidim_awesome/awesome.rb +45 -8
- data/lib/decidim/decidim_awesome/awesome_helpers.rb +5 -1
- data/lib/decidim/decidim_awesome/checksums.yml +23 -0
- data/lib/decidim/decidim_awesome/custom_fields.rb +8 -0
- data/lib/decidim/decidim_awesome/engine.rb +143 -52
- data/lib/decidim/decidim_awesome/lock.rb +47 -0
- data/lib/decidim/decidim_awesome/menu.rb +146 -0
- data/lib/decidim/decidim_awesome/test/initializer.rb +4 -1
- data/lib/decidim/decidim_awesome/test/shared_examples/{box_label_editor.rb → box_label_editor_examples.rb} +1 -1
- data/lib/decidim/decidim_awesome/test/shared_examples/config_examples.rb +20 -2
- data/lib/decidim/decidim_awesome/test/shared_examples/custom_fields_examples.rb +155 -0
- data/lib/decidim/decidim_awesome/test/shared_examples/editor_examples.rb +24 -0
- data/lib/decidim/decidim_awesome/test/shared_examples/menu_hack_contexts.rb +2 -2
- data/lib/decidim/decidim_awesome/test/shared_examples/scoped_admins_examples.rb +3 -5
- data/lib/decidim/decidim_awesome/test/shared_examples/summary_examples.rb +78 -12
- data/lib/decidim/decidim_awesome/version.rb +1 -1
- data/package.json +2 -2
- metadata +52 -13
- data/app/helpers/decidim/decidim_awesome/proposals/application_helper_override.rb +0 -78
- /data/app/presenters/{decidim → concerns/decidim}/decidim_awesome/menu_item_presenter_override.rb +0 -0
- /data/app/presenters/{decidim → concerns/decidim}/decidim_awesome/menu_presenter_override.rb +0 -0
@@ -1,18 +1,14 @@
|
|
1
|
-
<div class="
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
<%= form.check_box key %>
|
14
|
-
<p class="help-text"><%= t("help.#{key}", scope: "decidim.decidim_awesome.admin.config.form") %></p>
|
15
|
-
|
16
|
-
<%= render(partial: "decidim/decidim_awesome/admin/config/constraints", locals: { key: key, constraints: constraints_for(key) }) %>
|
1
|
+
<div class="form__wrapper decidim_awesome-form">
|
2
|
+
<div class="row column">
|
3
|
+
<p class="help-text"><%= t("help.drag_and_drop_supported", scope: "decidim.decidim_awesome.admin.config.form") %>
|
4
|
+
<%= t("help.original_editor_override", scope: "decidim.decidim_awesome.admin.config.form") %></p>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<% enabled_configs([:allow_images_in_full_editor, :allow_images_in_small_editor, :allow_videos_in_editors]).each do |key| %>
|
8
|
+
<div class="row column">
|
9
|
+
<%= form.check_box key, help_text: t("help.#{key}", scope: "decidim.decidim_awesome.admin.config.form") %>
|
10
|
+
|
11
|
+
<%= render(partial: "decidim/decidim_awesome/admin/config/constraints", locals: { key: key, constraints: constraints_for(key) }) %>
|
12
|
+
</div>
|
17
13
|
<% end %>
|
18
14
|
</div>
|
@@ -1,24 +1,44 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
<%
|
2
|
+
priv = (config_var == "proposal_private_custom_fields")
|
3
|
+
field = priv ? "proposal_private_custom_field" : "proposal_custom_field"
|
4
|
+
%>
|
5
|
+
<div class="form__wrapper row column decidim_awesome-form">
|
6
|
+
<% if config_enabled? config_var %>
|
7
|
+
<% if priv %>
|
8
|
+
<div>
|
9
|
+
<p class="help-text text-alert"><%= t("help.proposal_private_custom_fields", scope: "decidim.decidim_awesome.admin.config.form") %></p>
|
10
|
+
<p class="help-text"><%= t("help.proposal_private_custom_fields_translations",
|
11
|
+
scope: "decidim.decidim_awesome.admin.config.form",
|
12
|
+
warning: content_tag(:i, t("decidim.decidim_awesome.proposal_private_custom_fields_disclosure")),
|
13
|
+
key: content_tag("code", "decidim.decidim_awesome.proposal_private_custom_fields_disclosure")
|
14
|
+
).html_safe %></p>
|
15
|
+
</div>
|
16
|
+
<% else %>
|
17
|
+
<div class="colors-help">
|
18
|
+
<p class="help-text"><%= t("help.proposal_custom_fields", scope: "decidim.decidim_awesome.admin.config.form") %></p>
|
19
|
+
<p class="help-text"><%= t("help.proposal_custom_fields_example", scope: "decidim.decidim_awesome.admin.config.form") %></p>
|
20
|
+
<p class="help-text"><%= t("help.proposal_custom_fields_translations", scope: "decidim.decidim_awesome.admin.config.form") %></p>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
<% form.object.send(config_var)&.each do |key, value| %>
|
24
|
+
<div class="card proposal_custom_fields_container<%= " private" if priv %> js-box-container" data-key="<%= key %>" data-var="<%= config_var %>">
|
25
|
+
<%= render("decidim/decidim_awesome/admin/config/autoedit_box_label", var: config_var, key: key, scope: "#{field}_#{key}", delete_path: decidim_admin_decidim_awesome.proposal_custom_field_path(key: key, private: priv)) %>
|
11
26
|
<p class="form-error is-visible"><%= errors[key.to_sym].join("<br>") if errors %></p>
|
12
|
-
|
13
|
-
|
27
|
+
|
28
|
+
<%= hidden_field_tag key, value, name: "config[#{config_var}][#{key}]" %>
|
29
|
+
|
30
|
+
<div class="proposal_custom_fields_editor <%= " private" if priv %>">
|
14
31
|
<div class="loading-spinner"></div>
|
15
32
|
</div>
|
16
|
-
|
33
|
+
|
34
|
+
<%= render("decidim/decidim_awesome/admin/config/constraints", key: "#{field}_#{key}", constraints: constraints_for("#{field}_#{key}")) %>
|
17
35
|
</div>
|
18
36
|
<% end %>
|
19
37
|
|
20
|
-
<%= link_to
|
21
|
-
|
38
|
+
<%= link_to decidim_admin_decidim_awesome.proposal_custom_fields_path(private: priv), method: :post, class: "add-field button small hollow mr-auto" do %>
|
39
|
+
<%= icon "plus", class: "small" %>
|
40
|
+
<%= t("new", scope: "decidim.decidim_awesome.admin.config.form_#{config_var}") %>
|
41
|
+
<% end %>
|
22
42
|
<% end %>
|
23
43
|
</div>
|
24
44
|
|
data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_private_custom_fields.html.erb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<%= render "form_proposal_custom_fields", **local_assigns %>
|
@@ -30,7 +30,7 @@
|
|
30
30
|
</div>
|
31
31
|
<% end %>
|
32
32
|
|
33
|
-
<% if config_enabled?
|
33
|
+
<% if config_enabled?(:validate_title_min_length, :validate_title_max_caps_percent, :validate_title_max_marks_together, :validate_title_start_with_caps) %>
|
34
34
|
</div> <!-- .card-section -->
|
35
35
|
</div><!-- .card -->
|
36
36
|
|
@@ -69,7 +69,7 @@
|
|
69
69
|
</div>
|
70
70
|
<% end %>
|
71
71
|
|
72
|
-
<% if config_enabled?
|
72
|
+
<% if config_enabled?(:validate_body_min_length, :validate_body_max_caps_percent, :validate_body_max_marks_together, :validate_body_start_with_caps) %>
|
73
73
|
</div> <!-- .card-section -->
|
74
74
|
</div><!-- .card -->
|
75
75
|
|
@@ -78,31 +78,31 @@
|
|
78
78
|
<h2 class="card-title"><%= t("validators.body", scope: "decidim.decidim_awesome.admin.config.form") %></h2>
|
79
79
|
</div>
|
80
80
|
<div class="card-section">
|
81
|
-
|
82
|
-
|
81
|
+
<% if config_enabled? :validate_body_start_with_caps %>
|
82
|
+
<%= form.check_box :validate_body_start_with_caps %>
|
83
83
|
|
84
|
-
|
85
|
-
|
84
|
+
<%= render(partial: "decidim/decidim_awesome/admin/config/constraints", locals: { key: :validate_body_start_with_caps, constraints: constraints_for(:validate_body_start_with_caps) }) %>
|
85
|
+
<% end %>
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
87
|
+
<% if config_enabled? :validate_body_min_length %>
|
88
|
+
<%= form.number_field :validate_body_min_length %>
|
89
|
+
<p class="help-text"><%= t("help.validate_body_min_length", scope: "decidim.decidim_awesome.admin.config.form") %></p>
|
90
90
|
|
91
|
-
|
92
|
-
|
91
|
+
<%= render(partial: "decidim/decidim_awesome/admin/config/constraints", locals: { key: :validate_body_min_length, constraints: constraints_for(:validate_body_min_length) }) %>
|
92
|
+
<% end %>
|
93
93
|
|
94
|
-
|
95
|
-
|
96
|
-
|
94
|
+
<% if config_enabled? :validate_body_max_caps_percent %>
|
95
|
+
<%= form.number_field :validate_body_max_caps_percent %>
|
96
|
+
<p class="help-text"><%= t("help.validate_body_max_caps_percent", scope: "decidim.decidim_awesome.admin.config.form") %></p>
|
97
97
|
|
98
|
-
|
99
|
-
|
98
|
+
<%= render(partial: "decidim/decidim_awesome/admin/config/constraints", locals: { key: :validate_body_max_caps_percent, constraints: constraints_for(:validate_body_max_caps_percent) }) %>
|
99
|
+
<% end %>
|
100
100
|
|
101
|
-
|
102
|
-
|
103
|
-
|
101
|
+
<% if config_enabled? :validate_body_max_marks_together %>
|
102
|
+
<%= form.number_field :validate_body_max_marks_together %>
|
103
|
+
<p class="help-text"><%= t("help.validate_body_max_marks_together", scope: "decidim.decidim_awesome.admin.config.form") %></p>
|
104
104
|
|
105
|
-
|
106
|
-
|
107
|
-
|
105
|
+
<%= render(partial: "decidim/decidim_awesome/admin/config/constraints", locals: { key: :validate_body_max_marks_together, constraints: constraints_for(:validate_body_max_marks_together) }) %>
|
106
|
+
<% end %>
|
107
|
+
</div>
|
108
108
|
<% end %>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
</p>
|
11
11
|
|
12
12
|
<% form.object.scoped_styles&.each do |key, value| %>
|
13
|
-
<div class="scoped_styles_container" data-key="<%= key %>">
|
13
|
+
<div class="scoped_styles_container p-4 js-box-container" data-key="<%= key %>">
|
14
14
|
<%= render(partial: "decidim/decidim_awesome/admin/config/autoedit_box_label", locals: { var: "scoped_styles", key: key, scope: "scoped_style_#{key}", delete_path: decidim_admin_decidim_awesome.scoped_style_path(key: key) }) %>
|
15
15
|
<p class="form-error is-visible" id="custom-style-error-<%= key %>"><%= errors[key.to_sym].join("<br>") if errors %></p>
|
16
16
|
<%= text_area_tag key, value, name: "config[scoped_styles][#{key}]", rows: 5 %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%= decidim_form_for(@form, method: :patch, url: decidim_admin_decidim_awesome.config_path(config_var), html: { class: "awesome-edit-config" }, data: { "safe-path" => decidim_admin_decidim_awesome.config_path(config_var) }) do |f| %>
|
2
2
|
<div class="card">
|
3
3
|
<div class="card-divider">
|
4
|
-
|
4
|
+
<%= t(".title", setting: t(config_var, scope: "decidim.decidim_awesome.admin.config.title")) %>
|
5
5
|
</div>
|
6
6
|
<div class="card-section">
|
7
7
|
<%= render partial: "form_#{config_var}", locals: { form: f, errors: defined?(errors) ? errors : nil } %>
|
@@ -5,20 +5,20 @@
|
|
5
5
|
<%= link_to t(".new"), decidim_admin_decidim_awesome.new_custom_redirect_path, class: "button tiny button--title" %>
|
6
6
|
</h2>
|
7
7
|
</div>
|
8
|
-
<div class="card-section">
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
<div class="card-section p-4">
|
9
|
+
<p class="help-text -mt-2 mb-4"><%= t(".description").html_safe %></p>
|
10
|
+
<div class="table-scroll decidim_awesome-form">
|
11
|
+
<table class="table-list custom-redirections-table">
|
12
|
+
<thead>
|
13
13
|
<tr>
|
14
14
|
<th><%= t("custom_redirect.active", scope: "activemodel.attributes") %></th>
|
15
15
|
<th><%= t("custom_redirect.origin", scope: "activemodel.attributes") %></th>
|
16
16
|
<th><%= t("custom_redirect.destination", scope: "activemodel.attributes") %></th>
|
17
|
-
<th class="redirect-status"><%= link_to(t(".check_redirections"), "#", class: "button
|
18
|
-
<th class="actions"
|
17
|
+
<th class="redirect-status"><%= link_to(t(".check_redirections"), "#", class: "button button__secondary button__xs pull-right secondary check-custom-redirections") if current_config.present? %></th>
|
18
|
+
<th class="actions"><%= t("decidim.decidim_awesome.admin.actions") %></th>
|
19
19
|
</tr>
|
20
|
-
|
21
|
-
|
20
|
+
</thead>
|
21
|
+
<tbody>
|
22
22
|
<% current_config.each do |origin, item| %>
|
23
23
|
<tr class="custom-redirection" data-origin="<%= origin %>" data-item="<%= item.to_json %>">
|
24
24
|
<td><%= check item["active"] %></td>
|
@@ -26,12 +26,13 @@
|
|
26
26
|
<td><%= item["destination"] %></td>
|
27
27
|
<td class="redirect-status"></td>
|
28
28
|
<td class="table-list__actions">
|
29
|
-
<%= icon_link_to "pencil", decidim_admin_decidim_awesome.edit_custom_redirect_path(md5(origin)), t(".edit"), class: "action-icon--edit" %>
|
30
|
-
<%= icon_link_to "circle-
|
29
|
+
<%= icon_link_to "pencil-line", decidim_admin_decidim_awesome.edit_custom_redirect_path(md5(origin)), t(".edit"), class: "action-icon--edit" %>
|
30
|
+
<%= icon_link_to "close-circle-line", decidim_admin_decidim_awesome.custom_redirect_path(md5(origin)), t(".remove"), method: :delete, class: "action-icon--remove", data: { confirm: t(".confirm_destroy") } %>
|
31
31
|
</td>
|
32
32
|
</tr>
|
33
33
|
<% end %>
|
34
|
-
|
35
|
-
|
34
|
+
</tbody>
|
35
|
+
</table>
|
36
|
+
</div>
|
36
37
|
</div>
|
37
38
|
</div>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<div class="mb-8">
|
2
|
+
<p class="help-text"><%= t(".help_html", time_ago: time_ago) %>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<% if collection.empty? %>
|
6
|
+
<div class="callout warning"><%= t(".no_data", time_ago: time_ago) %></div>
|
7
|
+
<% else %>
|
8
|
+
<div class="table-scroll autorefresh" data-url="<%= maintenance_path(:private_data).split("?").first %>">
|
9
|
+
<table class="table-list">
|
10
|
+
<thead>
|
11
|
+
<tr>
|
12
|
+
<th><%= t(".component") %></th>
|
13
|
+
<th><%= t(".items_count") %></th>
|
14
|
+
<th><%= t(".last_date") %></th>
|
15
|
+
<th><%= t("decidim.decidim_awesome.admin.actions") %></th>
|
16
|
+
</tr>
|
17
|
+
</thead>
|
18
|
+
|
19
|
+
<tbody>
|
20
|
+
<% collection.each do |resource| %>
|
21
|
+
<% item = present(resource) %>
|
22
|
+
<tr data-id="<%= item.id %>">
|
23
|
+
<td><%= link_to item.name, item.path %></td>
|
24
|
+
<td data-autorefresh="total"><%= item.total %></td>
|
25
|
+
<td data-autorefresh="time_ago"><%= item.time_ago %></td>
|
26
|
+
<td data-autorefresh="done">
|
27
|
+
<% if item.locked? %>
|
28
|
+
<span class="loading-spinner primary" title="<%= t(".removing") %>"></span>
|
29
|
+
<% elsif item.destroyable? %>
|
30
|
+
<%= link_to destroy_private_data_maintenance_path(:private_data, resource_id: item), method: :delete, class: "button button__primary button__xs tiny", data: { confirm: t(".confirm_delete") } do %>
|
31
|
+
<%= icon "trash" %>
|
32
|
+
<%= t(".delete") %>
|
33
|
+
<% end %>
|
34
|
+
<% else %>
|
35
|
+
<span class="not-destroyable" title="<%= t(".not_destroyable") %>"><%= icon "ban" %></span>
|
36
|
+
<% end %>
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
<% end %>
|
40
|
+
</tbody>
|
41
|
+
</table>
|
42
|
+
</div>
|
43
|
+
<% end %>
|
44
|
+
<%= paginate collection, theme: "decidim" %>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<div class="card-section section_<%= current_view %>">
|
2
|
+
<%= render current_view %>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<script>
|
6
|
+
document.addEventListener("DOMContentLoaded", function() {
|
7
|
+
const wrappers = document.querySelectorAll('.autorefresh');
|
8
|
+
|
9
|
+
function updateTableWithJsonData(element) {
|
10
|
+
const trs = element.querySelectorAll('tr[data-id]');
|
11
|
+
const tr_ids = [...trs].map(tr => parseInt(tr.dataset.id, 10));
|
12
|
+
|
13
|
+
fetch(element.dataset.url + "?" + new URLSearchParams({resources: tr_ids}))
|
14
|
+
.then(response => response.json())
|
15
|
+
.then(data => {
|
16
|
+
trs.forEach(tr => {
|
17
|
+
const items = tr.querySelectorAll('[data-autorefresh]');
|
18
|
+
const id = parseInt(tr.dataset.id, 10);
|
19
|
+
const newData = data.find(item => item.id === id);
|
20
|
+
// console.log("newData", newData, "items", items, "id", id, "tr", tr, "data", data);
|
21
|
+
if (newData) {
|
22
|
+
items.forEach(item => {
|
23
|
+
const field = item.dataset.autorefresh;
|
24
|
+
if (field && newData[field]) {
|
25
|
+
item.innerHTML = newData[field];
|
26
|
+
}
|
27
|
+
});
|
28
|
+
if (newData.locked) {
|
29
|
+
setTimeout(() => updateTableWithJsonData(element), 1000);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
});
|
33
|
+
})
|
34
|
+
.catch(error => {
|
35
|
+
console.error('Error fetching data:', error);
|
36
|
+
});
|
37
|
+
}
|
38
|
+
|
39
|
+
wrappers.forEach(element => {
|
40
|
+
updateTableWithJsonData(element);
|
41
|
+
});
|
42
|
+
});
|
43
|
+
</script>
|
44
|
+
</script>
|
@@ -5,39 +5,38 @@
|
|
5
5
|
<%= link_to t(".new"), decidim_admin_decidim_awesome.new_menu_hack_path, class: "button tiny button--title" %>
|
6
6
|
</h2>
|
7
7
|
</div>
|
8
|
-
<div class="
|
9
|
-
<div class="row column decidim_awesome-form">
|
8
|
+
<div class="table-scroll">
|
10
9
|
<table class="table-list">
|
11
10
|
<thead>
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
<tr>
|
12
|
+
<th><%= t("menu.raw_label", scope: "activemodel.attributes") %></th>
|
13
|
+
<th><%= t("menu.url", scope: "activemodel.attributes") %></th>
|
14
|
+
<th><%= t("menu.position", scope: "activemodel.attributes") %></th>
|
15
|
+
<th><%= t("menu.target", scope: "activemodel.attributes") %></th>
|
16
|
+
<th><%= t("menu.visibility", scope: "activemodel.attributes") %></th>
|
17
|
+
<th class="actions"><%= t("decidim.decidim_awesome.admin.actions") %></th>
|
18
|
+
</tr>
|
20
19
|
</thead>
|
21
20
|
<tbody>
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
21
|
+
<% current_items.each do |item| %>
|
22
|
+
<tr<%= " class=menu_hack-addition" if item.try(:overrided?) == false %>>
|
23
|
+
<td><%= item.label %></td>
|
24
|
+
<td><%= item.url %></td>
|
25
|
+
<td><%= item.position %></td>
|
26
|
+
<td><%= target_options.invert[item.try(:target)||""] %></td>
|
27
|
+
<td><%= visibility_options.invert[item.try(:visibility)] %></td>
|
28
|
+
<td class="table-list__actions">
|
29
|
+
<%= icon_link_to "pencil", decidim_admin_decidim_awesome.edit_menu_hack_path(md5(item.url)), t(".edit"), class: "action-icon--edit" %>
|
30
|
+
<% if item.respond_to?(:overrided?) %>
|
31
|
+
<%= icon_link_to "circle-x", decidim_admin_decidim_awesome.menu_hack_path(md5(item.url)), t(".remove#{'_hack' if item.overrided?}"), method: :delete, class: "action-icon--remove", data: { confirm: t(".confirm_destroy") } %>
|
32
|
+
<% else %>
|
33
|
+
<span class="action-icon">
|
34
|
+
<%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %>
|
35
|
+
</span>
|
36
|
+
<% end %>
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
<% end %>
|
41
40
|
</tbody>
|
42
41
|
</table>
|
43
42
|
</div>
|
@@ -1,6 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<% if Decidim::DecidimAwesome.enabled?(:proposal_custom_fields) && editor = admin_editor_for_proposal_body(form) %>
|
2
|
+
<%= editor %>
|
3
|
+
<% else %>
|
4
|
+
<%= form.translated :editor, :body, hashtaggable: true, aria: { label: :body } %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<% if Decidim::DecidimAwesome.enabled?(:proposal_private_custom_fields) && private_custom_fields = awesome_proposal_custom_fields_for(:private_body) %>
|
8
|
+
<%= render_proposal_custom_fields_override(private_custom_fields, form, :private_body) if private_custom_fields.present? %>
|
6
9
|
<% end %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<div class="card-section" data-component="accordion" id="accordion-private_body">
|
2
|
+
<button class="card-divider-button" data-controls="panel-private_body" type="button">
|
3
|
+
<%= icon "arrow-right-s-line" %>
|
4
|
+
<h2 class="card-title">
|
5
|
+
<%= t "decidim.decidim_awesome.admin.proposal_custom_fields.private_body" %>
|
6
|
+
</h2>
|
7
|
+
</button>
|
8
|
+
<div id="panel-private_body">
|
9
|
+
<div class="component__show_private_data-grid">
|
10
|
+
<div><%= Decidim::ContentProcessor.render_without_format(render_sanitized_content(proposal, :private_body)).html_safe %></div>
|
11
|
+
<% if proposal&.extra_fields&.private_body_updated_at %>
|
12
|
+
<div class="date_info">
|
13
|
+
<%= t("decidim.decidim_awesome.admin.proposal_custom_fields.private_data_last_update", time_ago: time_ago_in_words(proposal.extra_fields.private_body_updated_at)) if proposal.extra_fields.private_body.present? %>
|
14
|
+
<%= t("decidim.decidim_awesome.admin.proposal_custom_fields.private_data_last_remove", time_ago: time_ago_in_words(proposal.extra_fields.private_body_updated_at)) if proposal.extra_fields.private_body.blank? %>
|
15
|
+
<%= link_to t("decidim.decidim_awesome.admin.proposal_custom_fields.remove_private_data"), decidim_admin_decidim_awesome.maintenance_path(:private_data) if proposal.extra_fields.private_body_updated_at && proposal.extra_fields.private_body_updated_at < Decidim::DecidimAwesome.private_data_expiration_time.ago %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<!--the modal window will be used in another pr-->
|
2
|
+
<div class="reveal show limit_amendments_modal limit-amendments-modal" id="LimitAmendmentsModal" data-reveal role="dialog" aria-modal="true" aria-labelledby="LimitAmendmentsModal-label" data-limit-amendments="<%= current_component.settings&.limit_pending_amendments %>">
|
3
|
+
<div class="reveal__content">
|
4
|
+
<div class="instructions"><%= t("decidim.decidim_awesome.amendments.modal.explanation_html",
|
5
|
+
proposal_link: present(@proposal).proposal_path + "#comments") %></div>
|
6
|
+
|
7
|
+
<% if current_component.current_settings&.amendments_visibility == "all" %>
|
8
|
+
<div class="instructions"><%= t("decidim.decidim_awesome.amendments.modal.current_amendment_html",
|
9
|
+
amendment_link: present(@proposal.amendment.emendation).proposal_path) %></div>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<div class="text-center">
|
13
|
+
<button class="button vote-action" data-close><%= t("decidim.decidim_awesome.amendments.modal.dismiss") %></button>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
@@ -1,5 +1,13 @@
|
|
1
|
-
<div class="
|
2
|
-
|
1
|
+
<div class="decidim_awesome-custom_fields <%= name %>">
|
2
|
+
<% if name == :private_body %>
|
3
|
+
<p class="private_body-disclosure help-text"><%= icon "lock-locked" %><%= t("decidim.decidim_awesome.proposal_private_custom_fields_disclosure") %></p>
|
4
|
+
<% end %>
|
5
|
+
<div class="proposal_custom_field proposal_custom_field--<%= name %>"
|
6
|
+
id="proposal-custom-field-<%= name %>"
|
7
|
+
data-spec="<%= spec.to_json %>"
|
8
|
+
data-name="<%= "#{form.object_name}[#{name}]" %>">
|
9
|
+
<div class="loading-spinner"></div>
|
10
|
+
</div>
|
3
11
|
</div>
|
4
12
|
|
5
13
|
<%= form.hidden_field name %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<% content_for :sidebar_menu_nav do %>
|
2
|
+
<%= sidebar_menu(:awesome_admin_menu).render %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<%= stylesheet_pack_tag "decidim_admin_decidim_awesome", media: "all" %>
|
6
|
+
<%= javascript_pack_tag "decidim_admin_decidim_awesome", defer: true %>
|
7
|
+
|
8
|
+
<%= render "layouts/decidim/admin/application" do %>
|
9
|
+
<div class="process-title">
|
10
|
+
<div class="process-title-content">
|
11
|
+
<%= link_to t("decidim.admin.menu.decidim_awesome"), decidim_admin_decidim_awesome.config_path(:editors), target: "_blank" %>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<%= yield %>
|
16
|
+
|
17
|
+
<div class="pokecode-credits"><%= t("credits", scope: "decidim.decidim_awesome", version: link_to(awesome_version, "https://github.com/decidim-ice/decidim-module-decidim_awesome/"), company: link_to("PokeCode", "https://pokecode.net")).html_safe %></div>
|
18
|
+
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<%= render partial: "layouts/decidim/decidim_awesome/awesome_config" %>
|
@@ -1,75 +1,3 @@
|
|
1
|
-
|
2
|
-
aria_selected_link_to(safe_join([icon(icon_name), text]), link, options)
|
3
|
-
end %>
|
4
|
-
|
5
|
-
<% content_for :secondary_nav do %>
|
6
|
-
<div class="secondary-nav">
|
7
|
-
<div class="secondary-nav__title">
|
8
|
-
<%= t "layouts.decidim.admin.decidim_awesome.title" %>
|
9
|
-
</div>
|
10
|
-
|
11
|
-
<ul>
|
12
|
-
<% if menus[:editors] %>
|
13
|
-
<li <% if is_active_link?(decidim_admin_decidim_awesome.config_path(:editors)) %> class="is-active" <% end %>>
|
14
|
-
<%= icon_aria_selected_link_to I18n.t("menu.editors", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.config_path(:editors), "text" %>
|
15
|
-
</li>
|
16
|
-
<% end %>
|
17
|
-
<% if menus[:proposals] %>
|
18
|
-
<li <% if is_active_link?(decidim_admin_decidim_awesome.config_path(:proposals)) %> class="is-active" <% end %>>
|
19
|
-
<%= icon_aria_selected_link_to I18n.t("menu.proposals", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.config_path(:proposals), "document" %>
|
20
|
-
</li>
|
21
|
-
<% end %>
|
22
|
-
<% if menus[:surveys] %>
|
23
|
-
<li <% if is_active_link?(decidim_admin_decidim_awesome.config_path(:surveys)) %> class="is-active" <% end %>>
|
24
|
-
<%= icon_aria_selected_link_to I18n.t("menu.surveys", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.config_path(:surveys), "spreadsheet" %>
|
25
|
-
</li>
|
26
|
-
<% end %>
|
27
|
-
<% if menus[:styles] %>
|
28
|
-
<li <% if is_active_link?(decidim_admin_decidim_awesome.config_path(:styles)) %> class="is-active" <% end %>>
|
29
|
-
<%= icon_aria_selected_link_to I18n.t("menu.styles", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.config_path(:styles), "brush" %>
|
30
|
-
</li>
|
31
|
-
<% end %>
|
32
|
-
<% if menus[:proposal_custom_fields] %>
|
33
|
-
<li <% if is_active_link?(decidim_admin_decidim_awesome.config_path(:proposal_custom_fields)) %> class="is-active" <% end %>>
|
34
|
-
<%= icon_aria_selected_link_to I18n.t("menu.proposal_custom_fields", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.config_path(:proposal_custom_fields), "layers" %>
|
35
|
-
</li>
|
36
|
-
<% end %>
|
37
|
-
<% if menus[:admins] %>
|
38
|
-
<li <% if is_active_link?(decidim_admin_decidim_awesome.config_path(:admins)) %> class="is-active" <% end %>>
|
39
|
-
<%= icon_aria_selected_link_to I18n.t("menu.admins", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.config_path(:admins), "people" %>
|
40
|
-
</li>
|
41
|
-
<% end %>
|
42
|
-
<% if menus[:menu_hacks] %>
|
43
|
-
<li <% if is_active_link?(decidim_admin_decidim_awesome.menu_hacks_path) %> class="is-active" <% end %>>
|
44
|
-
<%= icon_aria_selected_link_to I18n.t("menu.menu_hacks", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.menu_hacks_path, "menu" %>
|
45
|
-
</li>
|
46
|
-
<% end %>
|
47
|
-
<% if menus[:custom_redirects] %>
|
48
|
-
<li <% if is_active_link?(decidim_admin_decidim_awesome.custom_redirects_path) %> class="is-active" <% end %>>
|
49
|
-
<%= icon_aria_selected_link_to I18n.t("menu.custom_redirects", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.custom_redirects_path, "share-boxed" %>
|
50
|
-
</li>
|
51
|
-
<% end %>
|
52
|
-
<% if menus[:livechat] %>
|
53
|
-
<li <% if is_active_link?(decidim_admin_decidim_awesome.config_path(:livechat)) %> class="is-active" <% end %>>
|
54
|
-
<%= icon_aria_selected_link_to I18n.t("menu.livechat", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.config_path(:livechat), "chat" %>
|
55
|
-
</li>
|
56
|
-
<% end %>
|
57
|
-
<li <% if is_active_link?(decidim_admin_decidim_awesome.checks_path) %> class="is-active" <% end %>>
|
58
|
-
<%= icon_aria_selected_link_to I18n.t("menu.checks", scope: "decidim.decidim_awesome.admin"), decidim_admin_decidim_awesome.checks_path, "pulse" %>
|
59
|
-
</li>
|
60
|
-
</ul>
|
61
|
-
</div>
|
62
|
-
<% end %>
|
63
|
-
|
64
|
-
<%= render "layouts/decidim/admin/application" do %>
|
65
|
-
<div class="process-title">
|
66
|
-
<div class="process-title-content">
|
67
|
-
<%= link_to t("decidim.admin.menu.decidim_awesome"), decidim_admin_decidim_awesome.config_path(:editors), target: "_blank" %>
|
68
|
-
</div>
|
69
|
-
</div>
|
70
|
-
|
1
|
+
<%= render "layouts/decidim/decidim_awesome/admin/base" do %>
|
71
2
|
<%= yield %>
|
72
|
-
|
73
|
-
<div class="pokecode-credits"><%= t("credits", scope: "decidim.decidim_awesome", version: link_to(awesome_version, "https://github.com/decidim-ice/decidim-module-decidim_awesome/"), company: link_to("PokeCode", "https://pokecode.net")).html_safe %></div>
|
74
|
-
|
75
3
|
<% end %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= render "layouts/decidim/decidim_awesome/admin/base" do %>
|
2
|
+
<div class="item_show__header">
|
3
|
+
<h2 class="item_show__header-title">
|
4
|
+
<%= t("layouts.decidim.decidim_awesome.admin.maintenance.title", title: t(current_view, scope: "layouts.decidim.decidim_awesome.admin.maintenance.titles")) %>
|
5
|
+
|
6
|
+
<% available_views.each do |view, parts| %>
|
7
|
+
<% next if view == current_view %>
|
8
|
+
|
9
|
+
<%= link_to parts[:path], class: "button button__secondary button__xs tiny button--title" do %>
|
10
|
+
<%= icon parts[:icon] %>
|
11
|
+
<%= parts[:title] %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
</h2>
|
15
|
+
</div>
|
16
|
+
<div class="card">
|
17
|
+
<%= yield %>
|
18
|
+
</div>
|
19
|
+
<% end %>
|