decidim-admin 0.29.2 → 0.30.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/admin/multi_select_picker/show.erb +10 -0
- data/app/cells/decidim/admin/multi_select_picker_cell.rb +38 -0
- data/app/commands/decidim/admin/bulk_action.rb +92 -0
- data/app/commands/decidim/admin/bulk_block_users.rb +75 -0
- data/app/commands/decidim/admin/bulk_unblock_users.rb +66 -0
- data/app/commands/decidim/admin/bulk_unreport_users.rb +69 -0
- data/app/commands/decidim/admin/content_blocks/update_content_block.rb +1 -1
- data/app/commands/decidim/admin/create_participatory_space_private_user.rb +3 -1
- data/app/commands/decidim/admin/create_share_token.rb +39 -0
- data/app/commands/decidim/admin/create_taxonomy.rb +23 -0
- data/app/commands/decidim/admin/create_taxonomy_filter.rb +24 -0
- data/app/commands/decidim/admin/destroy_share_token.rb +22 -0
- data/app/commands/decidim/admin/destroy_taxonomy.rb +18 -0
- data/app/commands/decidim/admin/destroy_taxonomy_filter.rb +20 -0
- data/app/commands/decidim/admin/hide_menu_component.rb +37 -0
- data/app/commands/decidim/admin/hide_resource.rb +4 -2
- data/app/commands/decidim/admin/publish_all_participatory_space_private_users.rb +50 -0
- data/app/commands/decidim/admin/publish_component.rb +3 -0
- data/app/commands/decidim/admin/reorder_components.rb +47 -0
- data/app/commands/decidim/admin/reorder_taxonomies.rb +76 -0
- data/app/commands/decidim/admin/unhide_resource.rb +11 -3
- data/app/commands/decidim/admin/unpublish_all_participatory_space_private_users.rb +50 -0
- data/app/commands/decidim/admin/unreport_resource.rb +11 -3
- data/app/commands/decidim/admin/update_component_permissions.rb +53 -13
- data/app/commands/decidim/admin/update_participatory_space_private_user.rb +11 -0
- data/app/commands/decidim/admin/update_share_token.rb +24 -0
- data/app/commands/decidim/admin/update_taxonomy.rb +20 -0
- data/app/commands/decidim/admin/update_taxonomy_filter.rb +28 -0
- data/app/controllers/concerns/decidim/admin/component_taxonomies_helper.rb +19 -0
- data/app/controllers/concerns/decidim/admin/filterable.rb +15 -18
- data/app/controllers/concerns/decidim/admin/has_trashable_resources.rb +170 -0
- data/app/controllers/concerns/decidim/admin/needs_admin_tos_accepted.rb +2 -29
- data/app/controllers/concerns/decidim/admin/participatory_space_admin_context.rb +12 -2
- data/app/controllers/concerns/decidim/admin/taxonomies/filterable.rb +27 -0
- data/app/controllers/decidim/admin/application_controller.rb +1 -2
- data/app/controllers/decidim/admin/areas_controller.rb +1 -0
- data/app/controllers/decidim/admin/block_user_controller.rb +42 -0
- data/app/controllers/decidim/admin/component_permissions_controller.rb +2 -4
- data/app/controllers/decidim/admin/components_controller.rb +50 -9
- data/app/controllers/decidim/admin/concerns/has_private_users.rb +59 -2
- data/app/controllers/decidim/admin/global_moderations_controller.rb +4 -0
- data/app/controllers/decidim/admin/moderated_users_controller.rb +26 -0
- data/app/controllers/decidim/admin/moderations_controller.rb +18 -0
- data/app/controllers/decidim/admin/newsletters_controller.rb +50 -7
- data/app/controllers/decidim/admin/resource_permissions_controller.rb +1 -1
- data/app/controllers/decidim/admin/scopes_controller.rb +1 -0
- data/app/controllers/decidim/admin/share_tokens_controller.rb +109 -7
- data/app/controllers/decidim/admin/taxonomies_controller.rb +129 -0
- data/app/controllers/decidim/admin/taxonomy_filters_controller.rb +112 -0
- data/app/controllers/decidim/admin/taxonomy_filters_selector_controller.rb +81 -0
- data/app/controllers/decidim/admin/taxonomy_items_controller.rb +91 -0
- data/app/forms/concerns/decidim/has_taxonomy_form_attributes.rb +57 -0
- data/app/forms/decidim/admin/block_users_form.rb +21 -0
- data/app/forms/decidim/admin/import_example_form.rb +1 -1
- data/app/forms/decidim/admin/newsletter_form.rb +1 -1
- data/app/forms/decidim/admin/participatory_space_private_user_form.rb +5 -0
- data/app/forms/decidim/admin/selective_newsletter_form.rb +46 -11
- data/app/forms/decidim/admin/share_token_form.rb +55 -0
- data/app/forms/decidim/admin/taxonomy_filter_form.rb +85 -0
- data/app/forms/decidim/admin/taxonomy_form.rb +20 -0
- data/app/forms/decidim/admin/taxonomy_item_form.rb +54 -0
- data/app/helpers/decidim/admin/application_helper.rb +0 -1
- data/app/helpers/decidim/admin/bulk_actions_helper.rb +0 -31
- data/app/helpers/decidim/admin/moderations/reports_helper.rb +1 -1
- data/app/helpers/decidim/admin/moderations_helper.rb +1 -1
- data/app/helpers/decidim/admin/newsletters_helper.rb +57 -27
- data/app/helpers/decidim/admin/scopes_helper.rb +0 -6
- data/app/helpers/decidim/admin/search_form_helper.rb +1 -1
- data/app/helpers/decidim/admin/settings_helper.rb +85 -11
- data/app/jobs/decidim/admin/newsletter_job.rb +3 -1
- data/app/packs/entrypoints/decidim_admin.js +4 -0
- data/app/packs/src/decidim/admin/application.js +2 -0
- data/app/packs/src/decidim/admin/draggable-table.js +33 -0
- data/app/packs/src/decidim/admin/form.js +0 -1
- data/app/packs/src/decidim/admin/global_moderations.js +186 -0
- data/app/packs/src/decidim/admin/managed_moderated_users.js +186 -0
- data/app/packs/src/decidim/admin/newsletters.js +164 -82
- data/app/packs/src/decidim/admin/proposal_infinite_edit.js +3 -6
- data/app/packs/src/decidim/admin/sortable.js +28 -16
- data/app/packs/src/decidim/admin/taxonomy_filters.js +93 -0
- data/app/packs/stylesheets/decidim/admin/_component-show.scss +66 -5
- data/app/packs/stylesheets/decidim/admin/_legacy_foundation.scss +13 -0
- data/app/packs/stylesheets/decidim/admin/_select_picker.scss +20 -0
- data/app/packs/stylesheets/decidim/admin/_table-list.scss +22 -0
- data/app/packs/stylesheets/decidim/admin/_taxonomies.scss +74 -0
- data/app/packs/stylesheets/decidim/admin/application.scss +3 -0
- data/app/permissions/decidim/admin/permissions.rb +32 -1
- data/app/queries/decidim/admin/newsletter_recipients.rb +50 -14
- data/app/views/decidim/admin/areas/index.html.erb +3 -0
- data/app/views/decidim/admin/block_user/bulk_new.html.erb +45 -0
- data/app/views/decidim/admin/components/_actions.html.erb +50 -33
- data/app/views/decidim/admin/components/{_component.html.erb → _component_row.html.erb} +10 -5
- data/app/views/decidim/admin/components/_components_table.html.erb +18 -0
- data/app/views/decidim/admin/components/_form.html.erb +0 -12
- data/app/views/decidim/admin/components/_taxonomy_filters_drawer.html.erb +2 -0
- data/app/views/decidim/admin/components/_visibility_label.html.erb +9 -0
- data/app/views/decidim/admin/components/index.html.erb +12 -14
- data/app/views/decidim/admin/components/manage_trash.html.erb +11 -0
- data/app/views/decidim/admin/moderated_users/_bulk-actions.html.erb +6 -0
- data/app/views/decidim/admin/moderated_users/bulk_actions/_block.html.erb +20 -0
- data/app/views/decidim/admin/moderated_users/bulk_actions/_dropdown.html.erb +40 -0
- data/app/views/decidim/admin/moderated_users/bulk_actions/_unblock.html.erb +20 -0
- data/app/views/decidim/admin/moderated_users/bulk_actions/_unreport.html.erb +20 -0
- data/app/views/decidim/admin/moderated_users/index.html.erb +14 -6
- data/app/views/decidim/admin/moderations/_bulk-actions.html.erb +7 -0
- data/app/views/decidim/admin/moderations/_moderation-tr.html.erb +50 -0
- data/app/views/decidim/admin/moderations/_moderations-thead.html.erb +18 -0
- data/app/views/decidim/admin/moderations/bulk_actions/_dropdown.html.erb +43 -0
- data/app/views/decidim/admin/moderations/bulk_actions/_hide.html.erb +20 -0
- data/app/views/decidim/admin/moderations/bulk_actions/_unhide.html.erb +20 -0
- data/app/views/decidim/admin/moderations/bulk_actions/_unreport.html.erb +20 -0
- data/app/views/decidim/admin/moderations/index.html.erb +13 -81
- data/app/views/decidim/admin/newsletters/confirm_recipients.html.erb +64 -0
- data/app/views/decidim/admin/newsletters/select_recipients_to_deliver.html.erb +44 -20
- data/app/views/decidim/admin/participatory_space_private_users/_form.html.erb +6 -0
- data/app/views/decidim/admin/participatory_space_private_users/edit.html.erb +19 -0
- data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +15 -1
- data/app/views/decidim/admin/resource_permissions/_options_form.html.erb +5 -0
- data/app/views/decidim/admin/resource_permissions/edit.html.erb +2 -2
- data/app/views/decidim/admin/scope_types/index.html.erb +3 -0
- data/app/views/decidim/admin/scopes/index.html.erb +3 -0
- data/app/views/decidim/admin/share_tokens/_form.html.erb +52 -0
- data/app/views/decidim/admin/share_tokens/edit.html.erb +33 -0
- data/app/views/decidim/admin/share_tokens/index.html.erb +47 -0
- data/app/views/decidim/admin/share_tokens/new.html.erb +69 -0
- data/app/views/decidim/admin/taxonomies/_filters.html.erb +19 -0
- data/app/views/decidim/admin/taxonomies/_form.html.erb +5 -0
- data/app/views/decidim/admin/taxonomies/_row.html.erb +40 -0
- data/app/views/decidim/admin/taxonomies/_row_children.html.erb +8 -0
- data/app/views/decidim/admin/taxonomies/_table.html.erb +86 -0
- data/app/views/decidim/admin/taxonomies/_taxonomy_actions.html.erb +15 -0
- data/app/views/decidim/admin/taxonomies/edit.html.erb +87 -0
- data/app/views/decidim/admin/taxonomies/index.html.erb +28 -0
- data/app/views/decidim/admin/taxonomies/new.html.erb +16 -0
- data/app/views/decidim/admin/taxonomy_filters/_check_boxes.html.erb +10 -0
- data/app/views/decidim/admin/taxonomy_filters/_form.html.erb +96 -0
- data/app/views/decidim/admin/taxonomy_filters/_table.html.erb +33 -0
- data/app/views/decidim/admin/taxonomy_filters/edit.html.erb +22 -0
- data/app/views/decidim/admin/taxonomy_filters/index.html.erb +26 -0
- data/app/views/decidim/admin/taxonomy_filters/new.html.erb +32 -0
- data/app/views/decidim/admin/taxonomy_filters_selector/_check_boxes.html.erb +7 -0
- data/app/views/decidim/admin/taxonomy_filters_selector/_component_table.html.erb +25 -0
- data/app/views/decidim/admin/taxonomy_filters_selector/_taxonomies_select.html.erb +16 -0
- data/app/views/decidim/admin/taxonomy_filters_selector/index.html.erb +1 -0
- data/app/views/decidim/admin/taxonomy_filters_selector/new.html.erb +27 -0
- data/app/views/decidim/admin/taxonomy_filters_selector/show.html.erb +18 -0
- data/app/views/decidim/admin/taxonomy_items/_form.html.erb +8 -0
- data/app/views/decidim/admin/taxonomy_items/edit.html.erb +12 -0
- data/app/views/decidim/admin/taxonomy_items/new.html.erb +12 -0
- data/app/views/layouts/decidim/admin/taxonomy_filters.html.erb +17 -0
- data/app/views/layouts/decidim/admin/taxonomy_filters_selector.html.erb +10 -0
- data/config/locales/ar.yml +45 -37
- data/config/locales/bg.yml +48 -51
- data/config/locales/bs-BA.yml +1 -27
- data/config/locales/ca.yml +300 -50
- data/config/locales/cs.yml +298 -46
- data/config/locales/de.yml +300 -50
- data/config/locales/el.yml +1 -50
- data/config/locales/en.yml +300 -50
- data/config/locales/es-MX.yml +297 -47
- data/config/locales/es-PY.yml +297 -47
- data/config/locales/es.yml +297 -47
- data/config/locales/eu.yml +301 -51
- data/config/locales/fi-plain.yml +297 -47
- data/config/locales/fi.yml +297 -47
- data/config/locales/fr-CA.yml +183 -47
- data/config/locales/fr.yml +183 -47
- data/config/locales/ga-IE.yml +0 -23
- data/config/locales/gl.yml +1 -46
- data/config/locales/hu.yml +1 -51
- data/config/locales/id-ID.yml +0 -24
- data/config/locales/is-IS.yml +0 -30
- data/config/locales/it.yml +1 -46
- data/config/locales/ja.yml +298 -50
- data/config/locales/kaa.yml +0 -7
- data/config/locales/ko.yml +0 -50
- data/config/locales/lb.yml +1 -46
- data/config/locales/lt.yml +1 -50
- data/config/locales/lv.yml +1 -28
- data/config/locales/nl.yml +1 -46
- data/config/locales/no.yml +1 -46
- data/config/locales/pl.yml +3 -51
- data/config/locales/pt-BR.yml +38 -50
- data/config/locales/pt.yml +29 -49
- data/config/locales/ro-RO.yml +35 -50
- data/config/locales/ru.yml +1 -24
- data/config/locales/sk.yml +1 -28
- data/config/locales/sl.yml +0 -5
- data/config/locales/sq-AL.yml +0 -22
- data/config/locales/sr-CS.yml +1 -27
- data/config/locales/sv.yml +296 -46
- data/config/locales/th-TH.yml +0 -10
- data/config/locales/tr-TR.yml +1 -44
- data/config/locales/uk.yml +0 -23
- data/config/locales/zh-CN.yml +0 -38
- data/config/locales/zh-TW.yml +1 -50
- data/config/routes.rb +13 -12
- data/decidim-admin.gemspec +1 -1
- data/lib/decidim/admin/engine.rb +2 -1
- data/lib/decidim/admin/import/creator.rb +2 -6
- data/lib/decidim/admin/import/readers/json.rb +1 -1
- data/lib/decidim/admin/menu.rb +9 -1
- data/lib/decidim/admin/search_form_builder.rb +1 -1
- data/lib/decidim/admin/test/destroy_admin_examples.rb +2 -2
- data/lib/decidim/admin/test/filterable_examples.rb +100 -9
- data/lib/decidim/admin/test/forms/attachment_collection_form_examples.rb +1 -1
- data/lib/decidim/admin/test/forms/attachment_form_examples.rb +1 -1
- data/lib/decidim/admin/test/invite_participatory_space_admins_shared_examples.rb +2 -4
- data/lib/decidim/admin/test/manage_component_permissions_examples.rb +5 -5
- data/lib/decidim/admin/test/manage_hide_content_examples.rb +0 -1
- data/lib/decidim/admin/test/manage_moderations_examples.rb +3 -3
- data/lib/decidim/admin/test/manage_resource_soft_deletion_examples.rb +113 -0
- data/lib/decidim/admin/test/manage_taxonomy_filters_examples.rb +127 -0
- data/lib/decidim/admin/test/taxonomy_filters_examples.rb +32 -0
- data/lib/decidim/admin/test.rb +3 -1
- data/lib/decidim/admin/version.rb +1 -1
- metadata +103 -29
- data/app/commands/decidim/admin/create_category.rb +0 -15
- data/app/commands/decidim/admin/destroy_category.rb +0 -15
- data/app/commands/decidim/admin/destroy_component.rb +0 -19
- data/app/commands/decidim/admin/update_category.rb +0 -11
- data/app/controllers/decidim/admin/categories_controller.rb +0 -98
- data/app/forms/decidim/admin/category_form.rb +0 -32
- data/app/helpers/decidim/admin/resource_scope_helper.rb +0 -52
- data/app/packs/src/decidim/admin/scope_picker_enabler.component.js +0 -12
- data/app/views/decidim/admin/categories/_form.html.erb +0 -18
- data/app/views/decidim/admin/categories/edit.html.erb +0 -19
- data/app/views/decidim/admin/categories/index.html.erb +0 -65
- data/app/views/decidim/admin/categories/new.html.erb +0 -19
- data/app/views/decidim/admin/share_tokens/_share_tokens.html.erb +0 -45
- data/lib/decidim/admin/test/commands/create_category_examples.rb +0 -74
- data/lib/decidim/admin/test/commands/destroy_category_examples.rb +0 -83
- data/lib/decidim/admin/test/commands/update_category_examples.rb +0 -76
- data/lib/decidim/admin/test/forms/category_form_examples.rb +0 -70
- data/lib/decidim/admin/test/manage_categories_examples.rb +0 -128
@@ -0,0 +1,33 @@
|
|
1
|
+
<% add_decidim_page_title(t(".title", name: resource_title)) %>
|
2
|
+
|
3
|
+
<div class="item_show__header">
|
4
|
+
<h1 class="item_show__header-title">
|
5
|
+
<%= t ".title", name: resource_title %>
|
6
|
+
<a class="button button__sm button__secondary" href="<%= share_tokens_path %>"><%= t("share_tokens.index.back_to_share_tokens", scope: "decidim.admin") %></a>
|
7
|
+
</h1>
|
8
|
+
</div>
|
9
|
+
<div class="item__edit-form">
|
10
|
+
<%= decidim_form_for(@form, url: share_tokens_path(:update, id: current_token), html: { class: "form-defaults form edit_share_token" }) do |f| %>
|
11
|
+
<div class="card">
|
12
|
+
<div class="card-section">
|
13
|
+
<div class="form__wrapper">
|
14
|
+
<div class="card pt-4">
|
15
|
+
<div class="row column">
|
16
|
+
<label for="share_token-token"><%= t("token", scope: "decidim.admin.models.share_token.fields") %></label>
|
17
|
+
<div class="flex gap-4">
|
18
|
+
<%= text_field_tag :token, current_token.token, id: "share_token-token", aria: { label: t("token", scope: "decidim.admin.models.share_token.fields") }, disabled: true %>
|
19
|
+
<button type="button" class="button button__sm button__secondary text-nowrap" data-clipboard-copy="#share_token-token" data-clipboard-content="<%= current_token.url %>" data-clipboard-copy-label="<%= t("copied", scope: "decidim.admin.share_tokens.index") %>" data-clipboard-copy-message="<%= t("copy_message", scope: "decidim.admin.share_tokens.index") %>"><%= t("actions.copy_link", scope: "decidim.admin.share_tokens") %></button>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<%= render partial: "form", object: f %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<div class="item__edit-sticky">
|
28
|
+
<div class="item__edit-sticky-container">
|
29
|
+
<%= f.submit t(".update"), class: "button button__sm button__secondary" %>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
33
|
+
</div>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<div class="card share_tokens">
|
2
|
+
<div class="item_show__header">
|
3
|
+
<h2 class="item_show__header-title">
|
4
|
+
<%= t(".title", name: resource_title) %>
|
5
|
+
<a class="button button__sm button__secondary" href="<%= share_tokens_path(:new) %>"><%= icon "add-line" %><%= t(".new_share_token_button") %></a>
|
6
|
+
</h2>
|
7
|
+
</div>
|
8
|
+
<div class="mb-4">
|
9
|
+
<p class="help-text whitespace-pre-line"><%= t(".share_tokens_help_html", clipboard: icon("clipboard-line", class: "inline-block mb-1")) %></p>
|
10
|
+
</div>
|
11
|
+
<% if @share_tokens.any? %>
|
12
|
+
<div class="table-scroll">
|
13
|
+
<table class="table-list">
|
14
|
+
<thead>
|
15
|
+
<tr>
|
16
|
+
<th><%= sort_link(query, :token, t("models.share_token.fields.token", scope: "decidim.admin"), default_order: :desc) %></th>
|
17
|
+
<th class="w-32"><%= sort_link(query, :expires_at, t("models.share_token.fields.expires_at", scope: "decidim.admin"), default_order: :desc) %></th>
|
18
|
+
<th class="w-32"><%= sort_link(query, :registered_only, t("models.share_token.fields.registered_only", scope: "decidim.admin"), default_order: :desc) %></th>
|
19
|
+
<th class="w-32"><%= sort_link(query, :times_used, t("models.share_token.fields.times_used", scope: "decidim.admin"), default_order: :desc) %></th>
|
20
|
+
<th class="w-32"><%= t("models.share_token.fields.actions", scope: "decidim.admin") %></th>
|
21
|
+
</tr>
|
22
|
+
</thead>
|
23
|
+
<tbody>
|
24
|
+
<% @share_tokens.each do |share_token| %>
|
25
|
+
<tr>
|
26
|
+
<td id="js-token-<%= share_token.id %>"><%= share_token.token %></td>
|
27
|
+
<td><%= share_token.expires_at.present? ?
|
28
|
+
content_tag(:span, l(share_token.expires_at, format: :decidim_short), class: share_token.expired? ? "text-warning" : nil ) :
|
29
|
+
content_tag(:em, t(".never")) %></td>
|
30
|
+
<td><%= t("booleans.#{share_token.registered_only.present?}") %></td>
|
31
|
+
<td><%= share_token.times_used %></td>
|
32
|
+
<td class="table-list__actions">
|
33
|
+
<%= icon_link_to "pencil-line", share_tokens_path(:edit, id: share_token ), t("actions.edit", scope: "decidim.admin.share_tokens"), class: "action-icon--edit" %>
|
34
|
+
<%= icon_link_to "clipboard-line", "#", t("actions.copy_link", scope: "decidim.admin.share_tokens"), class: "action-icon--copy", data: { "clipboard-copy" => "#js-token-#{share_token.id}", "clipboard-content" => share_token.url,"clipboard-copy-label" => t(".copied"),"clipboard-copy-message" => t(".copy_message") } %>
|
35
|
+
<%= icon_link_to "eye-line", share_token.url, t("actions.preview", scope: "decidim.admin.share_tokens"), class: "action-icon--preview", target: :blank %>
|
36
|
+
<%= icon_link_to "delete-bin-line", share_tokens_path(:destroy, id: share_token ), t("actions.destroy", scope: "decidim.admin.share_tokens"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin.share_tokens") } %>
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
<% end %>
|
40
|
+
</tbody>
|
41
|
+
</table>
|
42
|
+
</div>
|
43
|
+
<% else %>
|
44
|
+
<p><%= t(".empty_html", new_token_link: link_to(t(".create_new_token"), share_tokens_path(:new) , class: "button button__text-secondary")) %></p>
|
45
|
+
<% end %>
|
46
|
+
</div>
|
47
|
+
<%= decidim_paginate @share_tokens %>
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<% add_decidim_page_title(t(".title", name: resource_title)) %>
|
2
|
+
|
3
|
+
<div class="item_show__header">
|
4
|
+
<h1 class="item_show__header-title">
|
5
|
+
<%= t ".title", name: resource_title %>
|
6
|
+
<a class="button button__sm button__secondary" href="<%= share_tokens_path %>"><%= t("share_tokens.index.back_to_share_tokens", scope: "decidim.admin") %></a>
|
7
|
+
</h1>
|
8
|
+
</div>
|
9
|
+
<div class="item__edit-form">
|
10
|
+
<%= decidim_form_for(@form, url: share_tokens_path(:create), html: { class: "form-defaults form new_share_token" }) do |f| %>
|
11
|
+
<div class="card">
|
12
|
+
<div class="card-section">
|
13
|
+
<div class="form__wrapper">
|
14
|
+
<div class="card pt-4">
|
15
|
+
<div class="row column">
|
16
|
+
<label><%= t("share_tokens.form.token", scope: "decidim.admin") %></label>
|
17
|
+
<%= f.collection_radio_buttons :automatic_token, [
|
18
|
+
[t("share_tokens.form.automatic", scope: "decidim.admin"), true],
|
19
|
+
[t("share_tokens.form.custom", scope: "decidim.admin"), false]
|
20
|
+
], :last, :first do |b| %>
|
21
|
+
<div>
|
22
|
+
<%= b.label do %>
|
23
|
+
<%= b.radio_button %>
|
24
|
+
<%= b.text %>
|
25
|
+
<% end %>
|
26
|
+
</div>
|
27
|
+
<% end %>
|
28
|
+
<div id="token-field-wrapper" class="hidden">
|
29
|
+
<%= f.text_field :token, label: t("share_tokens.form.custom_token", scope: "decidim.admin"), style: "text-transform: uppercase" %>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
<%= render partial: "form", object: f %>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
<div class="item__edit-sticky">
|
38
|
+
<div class="item__edit-sticky-container">
|
39
|
+
<%= f.submit t(".create"), class: "button button__sm button__secondary" %>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
<% end %>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<script>
|
46
|
+
document.addEventListener("DOMContentLoaded", () => {
|
47
|
+
const automaticTokenRadioButton = document.querySelector("input[name='share_token[automatic_token]'][value='true']");
|
48
|
+
const automaticTokenRadioButtons = document.querySelectorAll("input[name='share_token[automatic_token]']");
|
49
|
+
const tokenWrapper = document.getElementById("token-field-wrapper");
|
50
|
+
const tokenInput = document.querySelector("input[name='share_token[token]']");
|
51
|
+
|
52
|
+
const toggleTokenField = () => {
|
53
|
+
if (automaticTokenRadioButton.checked) {
|
54
|
+
tokenWrapper.classList.add("hidden");
|
55
|
+
tokenInput.value = "";
|
56
|
+
tokenInput.removeAttribute("required");
|
57
|
+
} else {
|
58
|
+
tokenWrapper.classList.remove("hidden");
|
59
|
+
tokenInput.focus();
|
60
|
+
}
|
61
|
+
};
|
62
|
+
|
63
|
+
automaticTokenRadioButtons.forEach(button => {
|
64
|
+
button.addEventListener("change", toggleTokenField);
|
65
|
+
});
|
66
|
+
|
67
|
+
toggleTokenField();
|
68
|
+
});
|
69
|
+
</script>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<div class="filters__section">
|
2
|
+
<div class="fcell search mt-4">
|
3
|
+
<%= search_form_for(@query, url: url_for) do |form| %>
|
4
|
+
<div class="input-group">
|
5
|
+
<%= form.search_field(
|
6
|
+
:name_or_children_name_cont,
|
7
|
+
class: "input-group-field bg-secondary/5",
|
8
|
+
label: false,
|
9
|
+
placeholder: t("filters.search_placeholder", scope: "decidim.admin.taxonomies")
|
10
|
+
) %>
|
11
|
+
<div class="input-group-button">
|
12
|
+
<button type="submit" class="text-secondary" aria-label="<%= t("decidim.search.term_input_placeholder") %>">
|
13
|
+
<%= icon "search-line", class: "fill-secondary w-4 h-4" %>
|
14
|
+
</button>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
</div>
|
19
|
+
</div>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<tr class="draggable-taxonomy" data-taxonomy-id="<%= taxonomy.id %>" role="row">
|
2
|
+
<td role="cell" class="w-12 js-drag-handle"><%== icon("draggable", class: "dragger") %></td>
|
3
|
+
<td role="cell">
|
4
|
+
<ul class="taxonomy">
|
5
|
+
<% if taxonomy.root? %>
|
6
|
+
<li><%= link_to translated_attribute(taxonomy.name), edit_taxonomy_path(taxonomy), class: "js-drawer-editor" %></li>
|
7
|
+
<li><%= taxonomy.all_children.count %></li>
|
8
|
+
<li><%= taxonomy.filters_count %></li>
|
9
|
+
<% else %>
|
10
|
+
<li><%= link_to translated_attribute(taxonomy.name), edit_taxonomy_item_path(taxonomy_id: taxonomy.root_taxonomy.id, id: taxonomy.id), class: "js-drawer-editor" %></li>
|
11
|
+
<li><%= taxonomy.taxonomizations_count %></li>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<li class="taxonomy-list__actions"><%= render "taxonomy_actions", taxonomy: %></li>
|
15
|
+
</ul>
|
16
|
+
<% if with_children && taxonomy.children.any? %>
|
17
|
+
<div class="js-sortable js-draggable-<%= taxonomy.id %>"
|
18
|
+
data-draggable-handle=".js-drag-handle"
|
19
|
+
data-draggable-accept-from=".js-draggable-<%= taxonomy.id %>"
|
20
|
+
data-sort-url="<%= reorder_taxonomies_path %>"
|
21
|
+
data-parent-id="<%= taxonomy.id %>">
|
22
|
+
<% taxonomy.children.each do |child| %>
|
23
|
+
<%= render partial: "decidim/admin/taxonomies/row_children", locals: { child:, class_name: "", grandchild: false } %>
|
24
|
+
|
25
|
+
<% if child.children.any? %>
|
26
|
+
<div class="js-sortable js-draggable-<%= child.id %>"
|
27
|
+
data-draggable-handle=".js-drag-handle"
|
28
|
+
data-draggable-accept-from=".js-draggable-<%= child.id %>"
|
29
|
+
data-sort-url="<%= reorder_taxonomies_path %>"
|
30
|
+
data-parent-id="<%= child.id %>">
|
31
|
+
<% child.children.each do |grandchild| %>
|
32
|
+
<%= render partial: "decidim/admin/taxonomies/row_children", locals: { child: grandchild, class_name: "ml-6", grandchild: true } %>
|
33
|
+
<% end %>
|
34
|
+
</div>
|
35
|
+
<% end %>
|
36
|
+
<% end %>
|
37
|
+
</div>
|
38
|
+
<% end %>
|
39
|
+
</td>
|
40
|
+
</tr>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<ul class="taxonomy <%= class_name %>" data-taxonomy-id="<%= child.id %>">
|
2
|
+
<li class="js-drag-handle">
|
3
|
+
<%== icon("draggable", class: "dragger with-children") %>
|
4
|
+
<%= link_to translated_attribute(child.name), edit_taxonomy_item_path(taxonomy_id: child.root_taxonomy.id, id: child.id), class: "js-drawer-editor" %>
|
5
|
+
</li>
|
6
|
+
<li><%= child.taxonomizations_count %></li>
|
7
|
+
<li class="taxonomy-list__actions"><%= render "taxonomy_actions", taxonomy: child %></li>
|
8
|
+
</ul>
|
@@ -0,0 +1,86 @@
|
|
1
|
+
<div class="table-scroll mt-8" role="table" aria-labelledby="taxonomies-title">
|
2
|
+
<table class="table-list">
|
3
|
+
<thead>
|
4
|
+
<tr role="row">
|
5
|
+
<th scope="col" role="columnheader" class="w-12"><span class="sr-only">Move</span></th>
|
6
|
+
<th scope="col" role="columnheader">
|
7
|
+
<ul class="taxonomy">
|
8
|
+
<li><%= t("decidim.admin.taxonomies.name") %></li>
|
9
|
+
<% if taxonomy.blank? %>
|
10
|
+
<li><%= t("decidim.admin.taxonomies.total_items") %></li>
|
11
|
+
<li><%= t("decidim.admin.taxonomies.total_filters") %></li>
|
12
|
+
<% else %>
|
13
|
+
<li><%= t("decidim.admin.taxonomies.count") %></li>
|
14
|
+
<% end %>
|
15
|
+
<li><%= t("decidim.admin.taxonomies.actions.actions") %></li>
|
16
|
+
</ul>
|
17
|
+
</th>
|
18
|
+
</tr>
|
19
|
+
</thead>
|
20
|
+
<%#
|
21
|
+
If you ever reach this template as source of inspiration for a table row drag and drop functionality,
|
22
|
+
please take in to account that this is intended to manage a complex case, as it has the capability of nesting elements (a draggable within a draggable) so that you can reorder parents and children.
|
23
|
+
In Decidim there are two ways to implement a sortable (but both use the same library html5sortable.es).
|
24
|
+
|
25
|
+
The simpler one is just to add the [data-draggable-table] attribute in the parent element, it requires to also add the [data-sort-url] attribute. This URL will be used to send a PUT request and ignore the result.
|
26
|
+
This implementation is used for instance in the admin's components table.
|
27
|
+
|
28
|
+
For cases when you need more control you can use the second implementation, which is the one used here.
|
29
|
+
It uses the "js-sortable" class to initialize the element and allows you to use all the options documented in https://github.com/lukasoppermann/html5sortable as [data-sortable-OPTION] in the html.
|
30
|
+
Take into account, that, if using the second option, you need to implement the "sortupdate" event by yourself (see this file for an example). This allows you to control the return of the request for instance.
|
31
|
+
%>
|
32
|
+
<tbody class="js-sortable js-draggable-root" data-draggable-handle=".js-drag-handle" data-draggable-accept-from=".js-draggable-root" data-sort-url="<%= reorder_taxonomies_path %>" role="rowgroup">
|
33
|
+
<% if path = path_to_prev_page(collection) %>
|
34
|
+
<tr class="draggable-taxonomy change-page" data-prev-page="<%= path %>" data-taxonomy-id="<%= collection.page(collection.prev_page).per(per_page).last&.id %>"><td colspan="2"><%= t(".to_prev_page") %></td></tr>
|
35
|
+
<% end %>
|
36
|
+
|
37
|
+
<% collection.each do |taxonomy| %>
|
38
|
+
<%= render "row", taxonomy:, with_children: !taxonomy.root? %>
|
39
|
+
<% end %>
|
40
|
+
<% if path = path_to_next_page(collection) %>
|
41
|
+
<tr class="draggable-taxonomy change-page" data-next-page="<%= path %>" data-taxonomy-id="<%= collection.page(collection.next_page).per(per_page).first&.id %>"><td colspan="2"><%= t(".to_next_page") %></td></tr>
|
42
|
+
<% end %>
|
43
|
+
</tbody>
|
44
|
+
</table>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<%= decidim_paginate collection %>
|
48
|
+
|
49
|
+
<script>
|
50
|
+
window.addEventListener("DOMContentLoaded", () => {
|
51
|
+
const sortables = document.querySelectorAll(".js-sortable");
|
52
|
+
const nextPage = document.querySelector("[data-next-page]");
|
53
|
+
const prevPage = document.querySelector("[data-prev-page]");
|
54
|
+
const token = document.querySelector('meta[name="csrf-token"]');
|
55
|
+
|
56
|
+
sortables.forEach(function(sortable) {
|
57
|
+
sortable.addEventListener("sortupdate", function (event) {
|
58
|
+
sortable.classList.add("spinner-container");
|
59
|
+
const itemsId = Array.from(event.target.children).map(item => item.dataset.taxonomyId);
|
60
|
+
const parentId = event.target.dataset.parentId || event.target.closest('[data-taxonomy-id]')?.dataset.taxonomyId || null;
|
61
|
+
|
62
|
+
fetch(sortable.dataset.sortUrl, {
|
63
|
+
method: "PATCH",
|
64
|
+
headers: {
|
65
|
+
"Content-Type": "application/json",
|
66
|
+
"X-CSRF-Token": token && token.getAttribute("content")
|
67
|
+
},
|
68
|
+
body: JSON.stringify({page: <%= collection.current_page %>, per_page: <%= per_page %>, ids_order: itemsId, parent_id: parentId})
|
69
|
+
}).then(function(response) {
|
70
|
+
if(response.ok) {
|
71
|
+
// If moved on top of the next page, lets go to the next page
|
72
|
+
if(!document.querySelector(".draggable-taxonomy:last-child").hasAttribute("data-next-page") && nextPage) {
|
73
|
+
location.href = nextPage.dataset.nextPage;
|
74
|
+
}
|
75
|
+
// If moved on top of the previous page, lets go to the previous page
|
76
|
+
else if(!document.querySelector(".draggable-taxonomy:first-child").hasAttribute("data-prev-page") && prevPage) {
|
77
|
+
location.href = prevPage.dataset.prevPage;
|
78
|
+
} else {
|
79
|
+
sortable.classList.remove("spinner-container");
|
80
|
+
}
|
81
|
+
}
|
82
|
+
});
|
83
|
+
});
|
84
|
+
});
|
85
|
+
});
|
86
|
+
</script>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% if allowed_to? :update, :taxonomy, taxonomy: taxonomy %>
|
2
|
+
<% if taxonomy.root? %>
|
3
|
+
<%= icon_link_to "pencil-line", edit_taxonomy_path(taxonomy), t("actions.edit", scope: "decidim.admin.taxonomies"), class: "action-icon--edit js-drawer-editor" %>
|
4
|
+
<%= icon_link_to "filter-line", taxonomy_filters_path(taxonomy), t("actions.filters", scope: "decidim.admin.taxonomies"), class: "-action-icon--edit" %>
|
5
|
+
<% else %>
|
6
|
+
<%= icon_link_to "pencil-line", edit_taxonomy_item_path(taxonomy_id: taxonomy.root_taxonomy.id, id: taxonomy.id), t("actions.edit", scope: "decidim.admin.taxonomies"), class: "action-icon--edit js-drawer-editor" %>
|
7
|
+
<% end %>
|
8
|
+
<% else %>
|
9
|
+
<span class="action-space icon"></span>
|
10
|
+
<% end %>
|
11
|
+
<% if allowed_to? :destroy, :taxonomy, taxonomy: taxonomy %>
|
12
|
+
<%= icon_link_to "delete-bin-line", taxonomy, t("actions.destroy", scope: "decidim.admin.taxonomies"), class: "action-icon--remove", method: :delete, data: { confirm: t(".confirm_destroy", name: strip_tags(translated_attribute(taxonomy.name))) } %>
|
13
|
+
<% else %>
|
14
|
+
<span class="action-space icon"></span>
|
15
|
+
<% end %>
|
@@ -0,0 +1,87 @@
|
|
1
|
+
<% add_decidim_page_title(t(".title", taxonomy_name: translated_attribute(taxonomy.name))) %>
|
2
|
+
|
3
|
+
<div class="item_show__header">
|
4
|
+
<h1 class="item_show__header-title">
|
5
|
+
<%= t(".title", taxonomy_name: translated_attribute(taxonomy.name)) %>
|
6
|
+
<%= link_to :back, class: "button button__transparent-secondary button__sm" do %>
|
7
|
+
<%= t(".back") %>
|
8
|
+
<% end %>
|
9
|
+
</h1>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="item__edit-form">
|
13
|
+
<%= decidim_form_for(@form, html: { class: "form-defaults form edit_taxonomy_" }) do |f| %>
|
14
|
+
<%= render partial: "form", object: f %>
|
15
|
+
<div class="item__edit-sticky">
|
16
|
+
<div class="item__edit-sticky-container">
|
17
|
+
<%= f.submit t(".update"), class: "button button__sm button__secondary" %>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="item__edit-form">
|
24
|
+
<h2 class="item_show__header-title mb-4">
|
25
|
+
<%= t(".subtitle", taxonomy_name: translated_attribute(taxonomy.name)) %>
|
26
|
+
<%= link_to t(".new_item"), new_taxonomy_item_path(taxonomy), id: "new-item", class: "js-drawer-editor button button__sm button__secondary new" %>
|
27
|
+
</h2>
|
28
|
+
|
29
|
+
<% if collection.any? %>
|
30
|
+
<%= render "filters" %>
|
31
|
+
|
32
|
+
<% if @taxonomies.any? %>
|
33
|
+
<p class="help-text mt-4"><%= t(".description") %></p>
|
34
|
+
<%= render "table", collection: @taxonomies %>
|
35
|
+
<% else %>
|
36
|
+
<p class="mt-8"><%= t("no_items_found", scope: "decidim.admin.taxonomies.index") %></p>
|
37
|
+
<% end %>
|
38
|
+
<% else %>
|
39
|
+
<p class="mt-8"><%= t(".no_items") %></p>
|
40
|
+
<% end %>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<%= decidim_drawer id: "item-form" do %>
|
44
|
+
<div data-dialog-container class="layout-content"></div>
|
45
|
+
<% end %>
|
46
|
+
|
47
|
+
<script>
|
48
|
+
document.addEventListener("decidim:loaded", function() {
|
49
|
+
var drawer = window.Decidim.currentDialogs["item-form"];
|
50
|
+
var drawerButtons = document.querySelectorAll(".js-drawer-editor");
|
51
|
+
var container = drawer.dialog.querySelector("[data-dialog-container]");
|
52
|
+
|
53
|
+
function setDrawerContent(content) {
|
54
|
+
container.innerHTML = content;
|
55
|
+
|
56
|
+
var form = container.querySelector("#taxonomy-item-form");
|
57
|
+
if(!form) {
|
58
|
+
return location.reload();
|
59
|
+
}
|
60
|
+
window.initFoundation(container);
|
61
|
+
|
62
|
+
form.addEventListener("ajax:beforeSend", function(evt) {
|
63
|
+
form.classList.add("spinner-container");
|
64
|
+
});
|
65
|
+
|
66
|
+
form.addEventListener("ajax:success", function(evt) {
|
67
|
+
var [data, _status, xhr] = event.detail;
|
68
|
+
if(xhr.responseURL.indexOf(location.pathname) > -1) {
|
69
|
+
location.href = xhr.responseURL;
|
70
|
+
} else {
|
71
|
+
setDrawerContent(data.body.innerHTML)
|
72
|
+
}
|
73
|
+
});
|
74
|
+
}
|
75
|
+
|
76
|
+
drawerButtons.forEach(function(button) {
|
77
|
+
button.addEventListener("click", function(evt) {
|
78
|
+
evt.preventDefault();
|
79
|
+
container.innerHTML = '<div class="spinner-container"> </div>';
|
80
|
+
fetch(button.getAttribute("href"))
|
81
|
+
.then(function(response) { return response.text() })
|
82
|
+
.then(function(html) { setDrawerContent(html) });
|
83
|
+
drawer.open();
|
84
|
+
});
|
85
|
+
});
|
86
|
+
});
|
87
|
+
</script>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<% add_decidim_page_title(t("taxonomies", scope: "decidim.admin.titles")) %>
|
2
|
+
|
3
|
+
<div class="card" aria-labelledby="taxonomies-title">
|
4
|
+
<div class="item_show__header">
|
5
|
+
<div class="w-full">
|
6
|
+
<h1 class="item_show__header-title" id="taxonomies-title">
|
7
|
+
<%= t "decidim.admin.titles.taxonomies" %>
|
8
|
+
<% if allowed_to? :create, :taxonomy %>
|
9
|
+
<%= link_to t(".new_taxonomy"), new_taxonomy_path, class: "button button__sm button__secondary new" %>
|
10
|
+
<% end %>
|
11
|
+
</h1>
|
12
|
+
<p class="mt-2 text-gray-600">
|
13
|
+
<%= t(".description") %>
|
14
|
+
</p>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<% if collection.any? %>
|
18
|
+
<%= render "filters" %>
|
19
|
+
|
20
|
+
<% if @taxonomies.any? %>
|
21
|
+
<%= render "table", collection: @taxonomies if @taxonomies %>
|
22
|
+
<% else %>
|
23
|
+
<p><%= t(".no_items_found") %></p>
|
24
|
+
<% end %>
|
25
|
+
<% else %>
|
26
|
+
<p><%= t("decidim.admin.taxonomies.no_taxonomies") %></p>
|
27
|
+
<% end %>
|
28
|
+
</div>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% add_decidim_page_title(t(".title")) %>
|
2
|
+
<div class="item_show__header">
|
3
|
+
<h1 class="item_show__header-title">
|
4
|
+
<%= t ".title" %>
|
5
|
+
</h1>
|
6
|
+
</div>
|
7
|
+
<div class="item__edit-form">
|
8
|
+
<%= decidim_form_for(@form, url: taxonomies_path, html: { class: "form-defaults form new_taxonomy_" }) do |f| %>
|
9
|
+
<%= render partial: "form", object: f %>
|
10
|
+
<div class="item__edit-sticky">
|
11
|
+
<div class="item__edit-sticky-container">
|
12
|
+
<%= f.submit t(".create"), class: "button button__sm button__secondary" %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
</div>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%= form.collection_check_boxes :taxonomy_items, collection, :value, :name do |item| %>
|
2
|
+
<div>
|
3
|
+
<%= item.label { item.check_box(autocomplete: false) + item.text } %>
|
4
|
+
</div>
|
5
|
+
<% if item.object.children.any? %>
|
6
|
+
<div class="ml-4 js-taxonomy-children" data-parent="<%= item.object.value %>">
|
7
|
+
<%= render "decidim/admin/taxonomy_filters/check_boxes", form:, collection: item.object.children %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
@@ -0,0 +1,96 @@
|
|
1
|
+
<div class="form__wrapper">
|
2
|
+
<div class="card pt-4">
|
3
|
+
<div class="card-section">
|
4
|
+
<div class="row column">
|
5
|
+
<%= form.text_field :root_taxonomy_id, value: translated_attribute(root_taxonomy.name), disabled: true, class: "w-full" %>
|
6
|
+
<%= form.hidden_field :root_taxonomy_id %>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
<div class="card-section">
|
10
|
+
<div class="row column">
|
11
|
+
<%= form.translated :text_field, :name, aria: { label: :name }, placeholder: translated_attribute(root_taxonomy.name), help_text: t(".name_help") %>
|
12
|
+
</div>
|
13
|
+
<div class="row column">
|
14
|
+
<%= form.translated :text_field, :internal_name, aria: { label: :internal_name }, placeholder: translated_attribute(root_taxonomy.name) %>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div class="card">
|
20
|
+
<div class="card-section">
|
21
|
+
<% if root_taxonomy.children.any? %>
|
22
|
+
<div class="card-divider">
|
23
|
+
<h2><%= t(".items", count: "<strong class=\"js-filter-children-count\">#{root_taxonomy.all_children.count}</strong>").html_safe %></h2>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div class="row column">
|
27
|
+
<div class="table-scroll half-vh">
|
28
|
+
<label><%= check_box_tag "selectAll" %> <%= t(".all") %></label>
|
29
|
+
<%= render "decidim/admin/taxonomy_filters/check_boxes", form:, collection: @form.items_collection %>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
<% else %>
|
33
|
+
<div class="card-divider">
|
34
|
+
<h2><%= t(".no_items") %></h2>
|
35
|
+
</div>
|
36
|
+
<% end %>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<div class="card">
|
41
|
+
<div class="card-section">
|
42
|
+
<div class="card-divider">
|
43
|
+
<h2><%= t(".space_filter") %></h2>
|
44
|
+
</div>
|
45
|
+
<div class="row column">
|
46
|
+
<%= form.collection_check_boxes :participatory_space_manifests, @form.available_participatory_space_manifests, :id, :name do |b| %>
|
47
|
+
<div>
|
48
|
+
<%= b.label { b.check_box + b.text } %>
|
49
|
+
</div>
|
50
|
+
<% end %>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
<script>
|
57
|
+
document.addEventListener("DOMContentLoaded", function() {
|
58
|
+
var selectAll = document.querySelector("[name='selectAll']");
|
59
|
+
var checkBoxes = document.querySelectorAll("[type='checkbox'][name='taxonomy_filter[taxonomy_items][]']");
|
60
|
+
var notChecked = document.querySelectorAll("[type='checkbox'][name='taxonomy_filter[taxonomy_items][]']:not([checked])");
|
61
|
+
var count = document.querySelector(".js-filter-children-count");
|
62
|
+
|
63
|
+
var updateCounter = function() {
|
64
|
+
var checked = Array.from(checkBoxes).filter(function(checkbox) {
|
65
|
+
return checkbox.checked;
|
66
|
+
});
|
67
|
+
count.innerHTML = checked.length;
|
68
|
+
};
|
69
|
+
|
70
|
+
var toggleChildrenSelect = function(checkbox) {
|
71
|
+
var children = document.querySelectorAll(".js-taxonomy-children[data-parent='" + checkbox.value + "'] [type='checkbox'][name='taxonomy_filter[taxonomy_items][]']");
|
72
|
+
children.forEach(function(child) {
|
73
|
+
child.checked = checkbox.checked;
|
74
|
+
toggleChildrenSelect(child);
|
75
|
+
});
|
76
|
+
updateCounter();
|
77
|
+
}
|
78
|
+
|
79
|
+
selectAll.checked = notChecked.length === 0;
|
80
|
+
selectAll.addEventListener("change", function() {
|
81
|
+
checkBoxes.forEach(function(checkbox) {
|
82
|
+
checkbox.checked = selectAll.checked;
|
83
|
+
});
|
84
|
+
updateCounter();
|
85
|
+
});
|
86
|
+
|
87
|
+
checkBoxes.forEach(function(checkbox) {
|
88
|
+
checkbox.addEventListener("change", function() {
|
89
|
+
updateCounter();
|
90
|
+
toggleChildrenSelect(checkbox);
|
91
|
+
});
|
92
|
+
});
|
93
|
+
|
94
|
+
updateCounter();
|
95
|
+
});
|
96
|
+
</script>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<div class="table-scroll mt-8" role="table" aria-labelledby="taxonomies-title">
|
2
|
+
<table class="table-list">
|
3
|
+
<thead>
|
4
|
+
<tr role="row">
|
5
|
+
<th><%= t(".internal_name") %></th>
|
6
|
+
<th><%= t(".name") %></th>
|
7
|
+
<th><%= t(".components_count") %></th>
|
8
|
+
<th class="w-16"><%= t(".actions") %></th>
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
|
+
<tbody role="rowgroup">
|
12
|
+
<% collection.each do |taxonomy_filter| %>
|
13
|
+
<tr>
|
14
|
+
<td><%= translated_attribute(taxonomy_filter.internal_name) %></td>
|
15
|
+
<td><%= translated_attribute(taxonomy_filter.name) %></td>
|
16
|
+
<td><%= taxonomy_filter.components_count %></td>
|
17
|
+
<td>
|
18
|
+
<% if allowed_to? :update, :taxonomy_filter, taxonomy_filter: %>
|
19
|
+
<%= icon_link_to "pencil-line", edit_taxonomy_filter_path(root_taxonomy, taxonomy_filter), t(".edit"), class: "action-icon--edit" %>
|
20
|
+
<% else %>
|
21
|
+
<span class="action-space icon"></span>
|
22
|
+
<% end %>
|
23
|
+
<% if allowed_to? :destroy, :taxonomy_filter, taxonomy_filter: %>
|
24
|
+
<%= icon_link_to "delete-bin-line", taxonomy_filter_path(root_taxonomy, taxonomy_filter), t(".destroy"), class: "action-icon--remove", method: :delete, data: { confirm: t(".confirm_destroy", name: strip_tags(translated_attribute(taxonomy_filter.name))) } %>
|
25
|
+
<% else %>
|
26
|
+
<span class="action-space icon"></span>
|
27
|
+
<% end %>
|
28
|
+
</td>
|
29
|
+
</tr>
|
30
|
+
<% end %>
|
31
|
+
</tbody>
|
32
|
+
</table>
|
33
|
+
</div>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<% add_decidim_page_title(t(".title")) %>
|
2
|
+
|
3
|
+
<div class="item_show__header">
|
4
|
+
<h1 class="item_show__header-title">
|
5
|
+
<%= t(".title") %>
|
6
|
+
<%= link_to :back, class: "button button__transparent-secondary button__sm" do %>
|
7
|
+
<%= t(".back") %>
|
8
|
+
<% end %>
|
9
|
+
</h1>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="item__edit-form">
|
13
|
+
<%= decidim_form_for(@form, url: taxonomy_filter_path(root_taxonomy, id: taxonomy_filter), html: { class: "form form-defaults new_taxonomy_filter_" }) do |f| %>
|
14
|
+
<%= render partial: "decidim/admin/taxonomy_filters/form", object: f %>
|
15
|
+
|
16
|
+
<div class="item__edit-sticky">
|
17
|
+
<div class="item__edit-sticky-container">
|
18
|
+
<%= f.submit t(".update"), class: "button button__sm button__secondary" %>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
22
|
+
</div>
|