decidim-chatbot 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.erb_lint.yml +2134 -0
- data/.github/workflows/website.yml +57 -0
- data/.gitignore +13 -0
- data/.gitlab-ci.yml +204 -0
- data/.node-version +1 -0
- data/.nvmrc +1 -0
- data/.rspec +2 -0
- data/.rubocop.yml +17 -0
- data/.ruby-version +1 -0
- data/.simplecov +36 -0
- data/CONTRIBUTING.md +54 -0
- data/Gemfile +50 -0
- data/Gemfile.lock +1013 -0
- data/LICENSE.md +661 -0
- data/README.md +62 -0
- data/Rakefile +54 -0
- data/app/commands/decidim/chatbot/admin/destroy_item.rb +25 -0
- data/app/commands/decidim/chatbot/admin/menu_items/update_exit.rb +12 -0
- data/app/commands/decidim/chatbot/admin/menu_items/update_login.rb +12 -0
- data/app/commands/decidim/chatbot/admin/menu_items/update_propose_proposals.rb +12 -0
- data/app/commands/decidim/chatbot/admin/menu_items/update_read_blogs.rb +12 -0
- data/app/commands/decidim/chatbot/admin/menu_items/update_read_proposals.rb +12 -0
- data/app/commands/decidim/chatbot/admin/menu_items/update_vote_on_proposal.rb +12 -0
- data/app/commands/decidim/chatbot/admin/notifications/update_manual.rb +12 -0
- data/app/commands/decidim/chatbot/admin/notifications/update_phase.rb +12 -0
- data/app/commands/decidim/chatbot/admin/persist_item.rb +47 -0
- data/app/commands/decidim/chatbot/admin/reorder_items.rb +51 -0
- data/app/commands/decidim/chatbot/admin/send_test_notification.rb +74 -0
- data/app/commands/decidim/chatbot/admin/unsubscribe_user.rb +35 -0
- data/app/commands/decidim/chatbot/admin/update_chatbot.rb +17 -0
- data/app/commands/decidim/chatbot/notifications/deliver.rb +30 -0
- data/app/commands/decidim/chatbot/notifications/enqueue_phase.rb +67 -0
- data/app/commands/decidim/chatbot/notifications/send.rb +115 -0
- data/app/commands/decidim/chatbot/whatsapp/create_from_phone.rb +95 -0
- data/app/commands/decidim/chatbot/whatsapp/sync_phone.rb +56 -0
- data/app/controllers/decidim/api/rest_full/chatbot/base_controller.rb +52 -0
- data/app/controllers/decidim/api/rest_full/chatbot/chatbot_menu_items_controller.rb +49 -0
- data/app/controllers/decidim/api/rest_full/chatbot/chatbot_users_controller.rb +46 -0
- data/app/controllers/decidim/api/rest_full/chatbot/chatbots_controller.rb +40 -0
- data/app/controllers/decidim/chatbot/admin/chatbot_edit.rb +85 -0
- data/app/controllers/decidim/chatbot/admin/chatbots/generals_controller.rb +43 -0
- data/app/controllers/decidim/chatbot/admin/chatbots/menu_items_controller.rb +32 -0
- data/app/controllers/decidim/chatbot/admin/chatbots/notifications_controller.rb +92 -0
- data/app/controllers/decidim/chatbot/admin/chatbots/users/filterable.rb +33 -0
- data/app/controllers/decidim/chatbot/admin/chatbots/users_controller.rb +53 -0
- data/app/controllers/decidim/chatbot/admin/chatbots/whatsapps_controller.rb +59 -0
- data/app/controllers/decidim/chatbot/admin/chatbots_controller.rb +20 -0
- data/app/controllers/decidim/chatbot/admin/items_crud.rb +183 -0
- data/app/forms/decidim/chatbot/admin/chatbot_form.rb +20 -0
- data/app/forms/decidim/chatbot/admin/config_form.rb +20 -0
- data/app/forms/decidim/chatbot/admin/menu_item_form.rb +80 -0
- data/app/forms/decidim/chatbot/admin/menu_items/component_id_form.rb +60 -0
- data/app/forms/decidim/chatbot/admin/menu_items/exit_form.rb +24 -0
- data/app/forms/decidim/chatbot/admin/menu_items/login_form.rb +35 -0
- data/app/forms/decidim/chatbot/admin/menu_items/propose_proposals_form.rb +23 -0
- data/app/forms/decidim/chatbot/admin/menu_items/propose_proposals_labels.rb +53 -0
- data/app/forms/decidim/chatbot/admin/menu_items/read_blogs_form.rb +23 -0
- data/app/forms/decidim/chatbot/admin/menu_items/read_content_labels.rb +51 -0
- data/app/forms/decidim/chatbot/admin/menu_items/read_proposals_form.rb +23 -0
- data/app/forms/decidim/chatbot/admin/menu_items/vote_on_proposal_form.rb +123 -0
- data/app/forms/decidim/chatbot/admin/notification_item_form.rb +111 -0
- data/app/forms/decidim/chatbot/admin/notifications/manual_form.rb +13 -0
- data/app/forms/decidim/chatbot/admin/notifications/phase_form.rb +79 -0
- data/app/forms/decidim/chatbot/admin/notifications/template_fields.rb +60 -0
- data/app/forms/decidim/chatbot/admin/notifications/test_form.rb +179 -0
- data/app/helpers/decidim/chatbot/admin/items_helper.rb +44 -0
- data/app/jobs/decidim/chatbot/chatbot_webhook_job.rb +59 -0
- data/app/jobs/decidim/chatbot/send_notification_job.rb +33 -0
- data/app/models/decidim/chatbot/chatbot.rb +47 -0
- data/app/models/decidim/chatbot/item.rb +99 -0
- data/app/packs/.keep +0 -0
- data/app/presenters/decidim/chatbot/admin_log/chatbot_presenter.rb +42 -0
- data/app/presenters/decidim/chatbot/admin_log/item_presenter.rb +32 -0
- data/app/queries/decidim/chatbot/admin/proposal_vote_mode.rb +41 -0
- data/app/queries/decidim/chatbot/whatsapp_users.rb +58 -0
- data/app/serializers/decidim/api/rest_full/chatbot/chatbot_menu_item_serializer.rb +113 -0
- data/app/serializers/decidim/api/rest_full/chatbot/chatbot_notification_serializer.rb +19 -0
- data/app/serializers/decidim/api/rest_full/chatbot/chatbot_serializer.rb +66 -0
- data/app/serializers/decidim/api/rest_full/chatbot/chatbot_user_identity_serializer.rb +23 -0
- data/app/serializers/decidim/api/rest_full/chatbot/chatbot_user_serializer.rb +28 -0
- data/app/serializers/decidim/api/rest_full/chatbot/chatbot_webhook_serializer.rb +21 -0
- data/app/services/decidim/chatbot/chatbot_webhook_handler.rb +40 -0
- data/app/services/decidim/chatbot/notifications/bindings.rb +87 -0
- data/app/services/decidim/chatbot/whatsapp/body_parameters.rb +29 -0
- data/app/services/decidim/chatbot/whatsapp/graph_client.rb +136 -0
- data/app/services/decidim/chatbot/whatsapp/status_mapper.rb +93 -0
- data/app/services/decidim/chatbot/whatsapp/template_manager_url.rb +35 -0
- data/app/views/decidim/chatbot/admin/chatbots/generals/_menu_preview.html.erb +49 -0
- data/app/views/decidim/chatbot/admin/chatbots/generals/edit.html.erb +79 -0
- data/app/views/decidim/chatbot/admin/chatbots/index.html.erb +50 -0
- data/app/views/decidim/chatbot/admin/chatbots/menu_items/_form.html.erb +2 -0
- data/app/views/decidim/chatbot/admin/chatbots/menu_items/edit.html.erb +2 -0
- data/app/views/decidim/chatbot/admin/chatbots/menu_items/index.html.erb +43 -0
- data/app/views/decidim/chatbot/admin/chatbots/menu_items/new.html.erb +12 -0
- data/app/views/decidim/chatbot/admin/chatbots/notifications/_form.html.erb +4 -0
- data/app/views/decidim/chatbot/admin/chatbots/notifications/_manual_fields.html.erb +8 -0
- data/app/views/decidim/chatbot/admin/chatbots/notifications/_phase_fields.html.erb +6 -0
- data/app/views/decidim/chatbot/admin/chatbots/notifications/edit.html.erb +3 -0
- data/app/views/decidim/chatbot/admin/chatbots/notifications/index.html.erb +40 -0
- data/app/views/decidim/chatbot/admin/chatbots/notifications/new.html.erb +11 -0
- data/app/views/decidim/chatbot/admin/chatbots/notifications/test.html.erb +35 -0
- data/app/views/decidim/chatbot/admin/chatbots/tabs/_whatsapp.html.erb +47 -0
- data/app/views/decidim/chatbot/admin/chatbots/users/_filters.html.erb +23 -0
- data/app/views/decidim/chatbot/admin/chatbots/users/index.html.erb +56 -0
- data/app/views/decidim/chatbot/admin/chatbots/whatsapps/show.html.erb +5 -0
- data/app/views/decidim/chatbot/admin/shared/_item_form.html.erb +64 -0
- data/app/views/decidim/chatbot/admin/shared/_row_actions.html.erb +28 -0
- data/app/views/decidim/chatbot/admin/shared/_tabs_menu.html.erb +13 -0
- data/app/views/decidim/chatbot/admin/shared/_type_fields.html.erb +2 -0
- data/app/views/decidim/chatbot/admin/shared/_type_picker.html.erb +15 -0
- data/app/views/decidim/chatbot/admin/shared/type_fields/_component_id.html.erb +9 -0
- data/app/views/decidim/chatbot/admin/shared/type_fields/_exit.html.erb +5 -0
- data/app/views/decidim/chatbot/admin/shared/type_fields/_login.html.erb +8 -0
- data/app/views/decidim/chatbot/admin/shared/type_fields/_manual.html.erb +16 -0
- data/app/views/decidim/chatbot/admin/shared/type_fields/_phase.html.erb +46 -0
- data/app/views/decidim/chatbot/admin/shared/type_fields/_propose_proposals.html.erb +10 -0
- data/app/views/decidim/chatbot/admin/shared/type_fields/_read_blogs.html.erb +16 -0
- data/app/views/decidim/chatbot/admin/shared/type_fields/_read_proposals.html.erb +16 -0
- data/app/views/decidim/chatbot/admin/shared/type_fields/_vote_on_proposal.html.erb +26 -0
- data/app/views/decidim/chatbot/admin/shared/type_fields/vote/_shows_abstention_label.html.erb +7 -0
- data/app/views/decidim/chatbot/admin/shared/type_fields/vote/_shows_vote_label.html.erb +7 -0
- data/app/views/decidim/chatbot/admin/shared/type_fields/vote/_shows_votes_closed_warning.html.erb +6 -0
- data/app/views/decidim/chatbot/admin/shared/type_fields/vote/_shows_weight_labels.html.erb +15 -0
- data/bin/check +13 -0
- data/bin/ci-setup +38 -0
- data/bin/gen-node-client +112 -0
- data/bin/gen-openapi +248 -0
- data/bin/i18n-tasks +27 -0
- data/bin/postversion +17 -0
- data/config/i18n-tasks.yml +38 -0
- data/config/locales/decidim_chatbot.en.yml +323 -0
- data/config/locales/decidim_chatbot.fr.yml +29 -0
- data/contrib/decidim-node-client/.gitignore +4 -0
- data/contrib/decidim-node-client/.npmignore +1 -0
- data/contrib/decidim-node-client/.openapi-generator/FILES +8 -0
- data/contrib/decidim-node-client/.openapi-generator/VERSION +1 -0
- data/contrib/decidim-node-client/.openapi-generator-ignore +13 -0
- data/contrib/decidim-node-client/.yarnrc.yml +5 -0
- data/contrib/decidim-node-client/README.md +37 -0
- data/contrib/decidim-node-client/api.ts +14193 -0
- data/contrib/decidim-node-client/base.ts +70 -0
- data/contrib/decidim-node-client/common.ts +185 -0
- data/contrib/decidim-node-client/configuration.ts +138 -0
- data/contrib/decidim-node-client/git_push.sh +57 -0
- data/contrib/decidim-node-client/index.ts +16 -0
- data/contrib/decidim-node-client/package.json +49 -0
- data/contrib/decidim-node-client/packup.config.ts +7 -0
- data/contrib/decidim-node-client/tsconfig.json +25 -0
- data/contrib/decidim-node-client/yarn.lock +2367 -0
- data/crowdin.yml +15 -0
- data/db/migrate/20260725120000_create_decidim_chatbot_chatbots.rb +20 -0
- data/db/migrate/20260822120000_create_decidim_chatbot_items.rb +20 -0
- data/db/migrate/20260824120000_add_menu_and_error_copy_to_decidim_chatbot_chatbots.rb +13 -0
- data/db/migrate/20260824140000_add_enabled_to_decidim_chatbot_items.rb +7 -0
- data/decidim-chatbot.gemspec +40 -0
- data/docker-compose.ci.yml +59 -0
- data/docker-compose.yml +47 -0
- data/lib/decidim/chatbot/admin_engine.rb +67 -0
- data/lib/decidim/chatbot/admin_menu.rb +41 -0
- data/lib/decidim/chatbot/default_manifests.rb +91 -0
- data/lib/decidim/chatbot/engine.rb +107 -0
- data/lib/decidim/chatbot/manifest.rb +31 -0
- data/lib/decidim/chatbot/menu_item_label_keys.rb +26 -0
- data/lib/decidim/chatbot/registry.rb +42 -0
- data/lib/decidim/chatbot/rest_full_ability.rb +24 -0
- data/lib/decidim/chatbot/settings_tab.rb +18 -0
- data/lib/decidim/chatbot/test_definitions.rb +352 -0
- data/lib/decidim/chatbot/variable_interpolator.rb +30 -0
- data/lib/decidim/chatbot/version.rb +21 -0
- data/lib/decidim/chatbot/webhook_publisher.rb +29 -0
- data/lib/decidim/chatbot.rb +41 -0
- data/lib/decidim-chatbot.rb +3 -0
- data/lib/tasks/chatbot.rake +64 -0
- data/openapi/openapi.json +37801 -0
- data/openapitools.json +7 -0
- data/package.json +22 -0
- data/prettier.config.js +15 -0
- data/spec/commands/decidim/chatbot/admin/destroy_item_spec.rb +24 -0
- data/spec/commands/decidim/chatbot/admin/persist_item_spec.rb +80 -0
- data/spec/commands/decidim/chatbot/admin/reorder_items_spec.rb +53 -0
- data/spec/commands/decidim/chatbot/admin/send_test_notification_spec.rb +105 -0
- data/spec/commands/decidim/chatbot/admin/unsubscribe_user_spec.rb +46 -0
- data/spec/commands/decidim/chatbot/admin/update_chatbot_spec.rb +56 -0
- data/spec/commands/decidim/chatbot/notifications/enqueue_phase_spec.rb +59 -0
- data/spec/commands/decidim/chatbot/notifications/send_spec.rb +101 -0
- data/spec/commands/decidim/chatbot/whatsapp/create_from_phone_spec.rb +122 -0
- data/spec/commands/decidim/chatbot/whatsapp/sync_phone_spec.rb +110 -0
- data/spec/controllers/decidim/chatbot/admin/chatbots_controller_spec.rb +25 -0
- data/spec/factories/chatbot.rb +44 -0
- data/spec/forms/decidim/chatbot/admin/chatbot_form_spec.rb +41 -0
- data/spec/forms/decidim/chatbot/admin/config_form_spec.rb +30 -0
- data/spec/forms/decidim/chatbot/admin/menu_item_form_spec.rb +49 -0
- data/spec/forms/decidim/chatbot/admin/menu_items/component_id_form_spec.rb +54 -0
- data/spec/forms/decidim/chatbot/admin/menu_items/component_id_forms_spec.rb +512 -0
- data/spec/forms/decidim/chatbot/admin/menu_items/exit_form_spec.rb +39 -0
- data/spec/forms/decidim/chatbot/admin/menu_items/login_form_spec.rb +101 -0
- data/spec/forms/decidim/chatbot/admin/menu_items/propose_proposals_form_prefill_spec.rb +26 -0
- data/spec/forms/decidim/chatbot/admin/menu_items/read_blogs_form_prefill_spec.rb +22 -0
- data/spec/forms/decidim/chatbot/admin/notifications/manual_form_spec.rb +130 -0
- data/spec/forms/decidim/chatbot/admin/notifications/phase_form_spec.rb +79 -0
- data/spec/forms/decidim/chatbot/admin/notifications/test_form_spec.rb +172 -0
- data/spec/jobs/decidim/chatbot/chatbot_webhook_job_spec.rb +47 -0
- data/spec/jobs/decidim/chatbot/send_notification_job_spec.rb +53 -0
- data/spec/lib/decidim/chatbot/engine_spec.rb +44 -0
- data/spec/lib/decidim/chatbot/registry_spec.rb +30 -0
- data/spec/lib/decidim/chatbot/settings_tab_spec.rb +21 -0
- data/spec/lib/decidim/chatbot/variable_interpolator_spec.rb +34 -0
- data/spec/lib/decidim/chatbot/whatsapp/status_mapper_spec.rb +64 -0
- data/spec/lib/decidim/chatbot_spec.rb +59 -0
- data/spec/models/decidim/chatbot/chatbot_spec.rb +23 -0
- data/spec/models/decidim/chatbot/item_spec.rb +88 -0
- data/spec/presenters/decidim/chatbot/admin_log/chatbot_presenter_spec.rb +64 -0
- data/spec/queries/decidim/chatbot/admin/proposal_vote_mode_spec.rb +74 -0
- data/spec/queries/decidim/chatbot/whatsapp_users_spec.rb +57 -0
- data/spec/requests/decidim/api/rest_full/chatbot/chatbot_menu_items_controller_spec.rb +344 -0
- data/spec/requests/decidim/api/rest_full/chatbot/chatbot_users_controller_spec.rb +140 -0
- data/spec/requests/decidim/api/rest_full/chatbot/chatbots_controller_spec.rb +195 -0
- data/spec/requests/decidim/chatbot/admin/chatbots/notifications_controller_spec.rb +44 -0
- data/spec/requests/decidim/chatbot/admin/tenant_isolation_spec.rb +133 -0
- data/spec/requests/decidim/chatbot/admin/unsubscribe_user_spec.rb +28 -0
- data/spec/serializers/decidim/api/rest_full/chatbot/chatbot_menu_item_serializer_spec.rb +321 -0
- data/spec/serializers/decidim/api/rest_full/chatbot/chatbot_serializer_spec.rb +49 -0
- data/spec/serializers/decidim/api/rest_full/chatbot/chatbot_user_serializer_spec.rb +40 -0
- data/spec/services/decidim/chatbot/chatbot_webhook_handler_spec.rb +43 -0
- data/spec/services/decidim/chatbot/notifications/bindings_spec.rb +86 -0
- data/spec/services/decidim/chatbot/whatsapp/body_parameters_spec.rb +22 -0
- data/spec/services/decidim/chatbot/whatsapp/graph_client_spec.rb +205 -0
- data/spec/services/decidim/chatbot/whatsapp/template_manager_url_spec.rb +33 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/support/allow_all_hosts.rb +9 -0
- data/spec/support/chatbot_admin.rb +16 -0
- data/spec/support/decidim_factories.rb +7 -0
- data/spec/support/decidim_system_factories.rb +3 -0
- data/spec/support/devise.rb +5 -0
- data/spec/support/rack_test_system_driver.rb +43 -0
- data/spec/support/whatsapp_graph.rb +15 -0
- data/spec/swagger_helper.rb +47 -0
- data/spec/system/decidim/chatbot/admin/admin_can_send_manual_when_ready_spec.rb +35 -0
- data/spec/system/decidim/chatbot/admin/admin_configures_vote_on_proposal_menu_item_spec.rb +84 -0
- data/spec/system/decidim/chatbot/admin/admin_confirms_send_now_recipient_count_spec.rb +40 -0
- data/spec/system/decidim/chatbot/admin/admin_creates_menu_item_with_demo_field_spec.rb +65 -0
- data/spec/system/decidim/chatbot/admin/admin_creates_phase_and_manual_notifications_spec.rb +52 -0
- data/spec/system/decidim/chatbot/admin/admin_does_not_see_other_org_processes_in_phase_select_spec.rb +27 -0
- data/spec/system/decidim/chatbot/admin/admin_does_not_see_other_organization_chatbots_spec.rb +25 -0
- data/spec/system/decidim/chatbot/admin/admin_is_redirected_when_chatbot_is_disabled_spec.rb +28 -0
- data/spec/system/decidim/chatbot/admin/admin_lists_organization_chatbots_spec.rb +36 -0
- data/spec/system/decidim/chatbot/admin/admin_manual_notification_sends_with_nickname_spec.rb +68 -0
- data/spec/system/decidim/chatbot/admin/admin_navigates_chatbot_main_tabs_spec.rb +52 -0
- data/spec/system/decidim/chatbot/admin/admin_phase_notification_sends_on_step_change_spec.rb +79 -0
- data/spec/system/decidim/chatbot/admin/admin_picks_published_blog_component_spec.rb +205 -0
- data/spec/system/decidim/chatbot/admin/admin_picks_published_participatory_space_spec.rb +45 -0
- data/spec/system/decidim/chatbot/admin/admin_reorders_chatbot_menu_items_spec.rb +29 -0
- data/spec/system/decidim/chatbot/admin/admin_sees_disabled_menu_item_faded_on_the_table_spec.rb +23 -0
- data/spec/system/decidim/chatbot/admin/admin_sees_disabled_notification_item_faded_on_the_table_spec.rb +40 -0
- data/spec/system/decidim/chatbot/admin/admin_sees_notification_facts_and_frozen_template_name_spec.rb +71 -0
- data/spec/system/decidim/chatbot/admin/admin_sees_propose_proposals_defaults_prefilled_spec.rb +119 -0
- data/spec/system/decidim/chatbot/admin/admin_sees_type_specific_fields_spec.rb +89 -0
- data/spec/system/decidim/chatbot/admin/admin_sees_whatsapp_facts_and_can_sync_spec.rb +48 -0
- data/spec/system/decidim/chatbot/admin/admin_sees_whatsapp_template_edit_link_spec.rb +37 -0
- data/spec/system/decidim/chatbot/admin/admin_tests_notification_spec.rb +125 -0
- data/spec/system/decidim/chatbot/admin/admin_unchecks_enabled_on_a_menu_item_spec.rb +30 -0
- data/spec/system/decidim/chatbot/admin/admin_unsubscribes_whatsapp_user_from_chatbot_spec.rb +35 -0
- data/spec/system/decidim/chatbot/admin/admin_updates_welcome_message_from_general_tab_spec.rb +84 -0
- data/spec/system/decidim/chatbot/system/admin_updates_organization_chatbot_settings_spec.rb +33 -0
- data/spec/tasks/chatbot_create_spec.rb +99 -0
- data/spec/tasks/chatbot_sync_spec.rb +90 -0
- data/website/.node-version +1 -0
- data/website/.nvmrc +1 -0
- data/website/docs/developer/_category_.json +4 -0
- data/website/docs/developer/contribute.md +87 -0
- data/website/docs/index.md +42 -0
- data/website/docs/integrate/_category_.json +4 -0
- data/website/docs/integrate/index.md +214 -0
- data/website/docusaurus.config.ts +93 -0
- data/website/package.json +37 -0
- data/website/sidebars.ts +7 -0
- data/website/src/css/custom.css +37 -0
- data/website/static/api-docs.html +2218 -0
- data/website/static/img/logo.svg +1 -0
- data/website/static/openapi.json +37801 -0
- data/website/tsconfig.json +6 -0
- data/website/yarn.lock +9782 -0
- data/yarn.lock +1003 -0
- metadata +424 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<%= render "decidim/chatbot/admin/shared/tabs_menu" %>
|
|
2
|
+
|
|
3
|
+
<div class="flex justify-end mb-4">
|
|
4
|
+
<%= link_to t("decidim.chatbot.admin.items.add"), new_chatbot_notification_path(chatbot), class: "button button__sm button__secondary" %>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<% if @items.any? %>
|
|
8
|
+
<div class="table-stacked">
|
|
9
|
+
<table class="table-list">
|
|
10
|
+
<thead>
|
|
11
|
+
<tr>
|
|
12
|
+
<th><%= t("decidim.chatbot.admin.items.headers.template_id") %></th>
|
|
13
|
+
<th><%= t("decidim.chatbot.admin.items.headers.type") %></th>
|
|
14
|
+
<th><%= t("decidim.chatbot.admin.items.headers.actions") %></th>
|
|
15
|
+
</tr>
|
|
16
|
+
</thead>
|
|
17
|
+
<tbody>
|
|
18
|
+
<% @items.each do |item| %>
|
|
19
|
+
<tr data-record-id="<%= item.id %>" style="<%= item_row_style(item) %>">
|
|
20
|
+
<td data-label="<%= t("decidim.chatbot.admin.items.headers.template_id") %>">
|
|
21
|
+
<%= translated_attribute(item.settings["template_id"]) %>
|
|
22
|
+
</td>
|
|
23
|
+
<td data-label="<%= t("decidim.chatbot.admin.items.headers.type") %>">
|
|
24
|
+
<%= t("decidim.chatbot.admin.manifests.notification.#{item.manifest_name}") %>
|
|
25
|
+
</td>
|
|
26
|
+
<td class="table-list__actions" data-label="<%= t("decidim.chatbot.admin.items.headers.actions") %>">
|
|
27
|
+
<%= render "decidim/chatbot/admin/shared/row_actions",
|
|
28
|
+
record: item,
|
|
29
|
+
edit_path: edit_chatbot_notification_path(chatbot, item),
|
|
30
|
+
test_path: test_chatbot_notification_path(chatbot, item),
|
|
31
|
+
destroy_path: chatbot_notification_path(chatbot, item) %>
|
|
32
|
+
</td>
|
|
33
|
+
</tr>
|
|
34
|
+
<% end %>
|
|
35
|
+
</tbody>
|
|
36
|
+
</table>
|
|
37
|
+
</div>
|
|
38
|
+
<% else %>
|
|
39
|
+
<%= cell("decidim/announcement", t("decidim.chatbot.admin.items.notification_empty_html"), callout_class: "secondary") %>
|
|
40
|
+
<% end %>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<%= render "decidim/chatbot/admin/shared/tabs_menu" %>
|
|
2
|
+
|
|
3
|
+
<% if @form %>
|
|
4
|
+
<%= render "form",
|
|
5
|
+
url: chatbot_notifications_path(chatbot),
|
|
6
|
+
form: @form,
|
|
7
|
+
heading: t("decidim.chatbot.admin.items.new_notification_item",
|
|
8
|
+
type: t("decidim.chatbot.admin.manifests.notification.#{@form.manifest_name}")) %>
|
|
9
|
+
<% else %>
|
|
10
|
+
<%= render "decidim/chatbot/admin/shared/type_picker", scope_name: :notification %>
|
|
11
|
+
<% end %>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<%= render "decidim/chatbot/admin/shared/tabs_menu" %>
|
|
2
|
+
|
|
3
|
+
<div class="item__edit item__edit-1col">
|
|
4
|
+
<div class="item__edit-form">
|
|
5
|
+
<%= decidim_form_for(@form, url: test_chatbot_notification_path(chatbot, item), method: :post, html: { class: "form form-defaults" }) do |f| %>
|
|
6
|
+
<div class="form__wrapper">
|
|
7
|
+
<div class="card">
|
|
8
|
+
<div class="card-divider">
|
|
9
|
+
<h2 class="card-title"><%= t("decidim.chatbot.admin.items.test_heading") %></h2>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="card-section">
|
|
12
|
+
<div class="row column">
|
|
13
|
+
<%= f.collection_select :locale, localized_locales(current_organization.available_locales), :id, :name %>
|
|
14
|
+
<p class="help-text"><%= t("decidim.chatbot.admin.items.test_locale_help") %></p>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="row column">
|
|
17
|
+
<%= f.text_field :phone_number, help_text: t("decidim.chatbot.admin.items.phone_number_help") %>
|
|
18
|
+
</div>
|
|
19
|
+
<% if f.object.phase? %>
|
|
20
|
+
<%= render "decidim/chatbot/admin/chatbots/notifications/phase_fields", form: f %>
|
|
21
|
+
<% else %>
|
|
22
|
+
<%= render "decidim/chatbot/admin/chatbots/notifications/manual_fields", form: f %>
|
|
23
|
+
<% end %>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="item__edit-sticky">
|
|
28
|
+
<div class="item__edit-sticky-container">
|
|
29
|
+
<%= link_to t("decidim.chatbot.admin.items.cancel"), chatbot_notifications_path(chatbot), class: "button button__sm button__transparent-secondary" %>
|
|
30
|
+
<%= f.submit t("decidim.chatbot.admin.items.send_button"), class: "button button__sm button__secondary" %>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<% end %>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<%# locals: (chatbot:) %>
|
|
2
|
+
<div class="table-stacked">
|
|
3
|
+
<table class="table-list">
|
|
4
|
+
<tbody>
|
|
5
|
+
<tr>
|
|
6
|
+
<th data-label="<%= t("decidim.chatbot.admin.chatbots.edit.phone_id") %>">
|
|
7
|
+
<%= t("decidim.chatbot.admin.chatbots.edit.phone_id") %>
|
|
8
|
+
</th>
|
|
9
|
+
<td data-label="<%= t("decidim.chatbot.admin.chatbots.edit.phone_id") %>">
|
|
10
|
+
<code><%= chatbot.whatsapp_phone_id %></code>
|
|
11
|
+
</td>
|
|
12
|
+
</tr>
|
|
13
|
+
<tr>
|
|
14
|
+
<th data-label="<%= t("decidim.chatbot.admin.chatbots.edit.display_name") %>">
|
|
15
|
+
<%= t("decidim.chatbot.admin.chatbots.edit.display_name") %>
|
|
16
|
+
</th>
|
|
17
|
+
<td data-label="<%= t("decidim.chatbot.admin.chatbots.edit.display_name") %>">
|
|
18
|
+
<%= chatbot.whatsapp_display_name.presence || t("decidim.chatbot.admin.not_available") %>
|
|
19
|
+
</td>
|
|
20
|
+
</tr>
|
|
21
|
+
<tr>
|
|
22
|
+
<th data-label="<%= t("decidim.chatbot.admin.chatbots.edit.phone_number") %>">
|
|
23
|
+
<%= t("decidim.chatbot.admin.chatbots.edit.phone_number") %>
|
|
24
|
+
</th>
|
|
25
|
+
<td data-label="<%= t("decidim.chatbot.admin.chatbots.edit.phone_number") %>">
|
|
26
|
+
<%= chatbot.whatsapp_phone_number.presence || t("decidim.chatbot.admin.not_available") %>
|
|
27
|
+
</td>
|
|
28
|
+
</tr>
|
|
29
|
+
<tr>
|
|
30
|
+
<th data-label="<%= t("decidim.chatbot.admin.chatbots.edit.status") %>">
|
|
31
|
+
<%= t("decidim.chatbot.admin.chatbots.edit.status") %>
|
|
32
|
+
</th>
|
|
33
|
+
<td data-label="<%= t("decidim.chatbot.admin.chatbots.edit.status") %>">
|
|
34
|
+
<span class="label"><%= t("decidim.chatbot.admin.chatbots.statuses.#{chatbot.whatsapp_phone_status}") %></span>
|
|
35
|
+
</td>
|
|
36
|
+
</tr>
|
|
37
|
+
<tr>
|
|
38
|
+
<th data-label="<%= t("decidim.chatbot.admin.chatbots.edit.synced_at") %>">
|
|
39
|
+
<%= t("decidim.chatbot.admin.chatbots.edit.synced_at") %>
|
|
40
|
+
</th>
|
|
41
|
+
<td data-label="<%= t("decidim.chatbot.admin.chatbots.edit.synced_at") %>"<% if chatbot.synced_at %> title="<%= l(chatbot.synced_at) %>"<% end %>>
|
|
42
|
+
<%= chatbot.synced_at.present? ? t("decidim.chatbot.admin.chatbots.edit.synced_at_ago", time: time_ago_in_words(chatbot.synced_at)) : t("decidim.chatbot.admin.not_available") %>
|
|
43
|
+
</td>
|
|
44
|
+
</tr>
|
|
45
|
+
</tbody>
|
|
46
|
+
</table>
|
|
47
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<%# locals: () %>
|
|
2
|
+
<div class="filters__section">
|
|
3
|
+
<div class="fcell search">
|
|
4
|
+
<%= search_form_for(query, url: url_for) do |form| %>
|
|
5
|
+
<%= applied_filters_hidden_field_tags %>
|
|
6
|
+
<div class="input-group">
|
|
7
|
+
<%= form.search_field(
|
|
8
|
+
search_field_predicate,
|
|
9
|
+
class: "input-group-field",
|
|
10
|
+
label: false,
|
|
11
|
+
placeholder: t(search_field_predicate,
|
|
12
|
+
collection: collection_name,
|
|
13
|
+
scope: "decidim.admin.filters.search_placeholder")
|
|
14
|
+
) %>
|
|
15
|
+
<div class="input-group-button">
|
|
16
|
+
<button type="submit" class="text-secondary" aria-label="<%= t("decidim.search.term_input_placeholder") %>">
|
|
17
|
+
<%= icon "search-line", class: "fill-secondary w-4 h-4" %>
|
|
18
|
+
</button>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<% end %>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<%= render "decidim/chatbot/admin/shared/tabs_menu" %>
|
|
2
|
+
|
|
3
|
+
<%= render "filters" %>
|
|
4
|
+
|
|
5
|
+
<% if @users.any? %>
|
|
6
|
+
<div class="table-stacked">
|
|
7
|
+
<table class="table-list">
|
|
8
|
+
<thead>
|
|
9
|
+
<tr>
|
|
10
|
+
<th><%= t("decidim.chatbot.admin.users.headers.name") %></th>
|
|
11
|
+
<th><%= t("decidim.chatbot.admin.users.headers.email") %></th>
|
|
12
|
+
<th><%= t("decidim.chatbot.admin.users.headers.phone") %></th>
|
|
13
|
+
<th><%= t("decidim.chatbot.admin.users.headers.subscribed") %></th>
|
|
14
|
+
<th><%= t("decidim.chatbot.admin.users.headers.actions") %></th>
|
|
15
|
+
</tr>
|
|
16
|
+
</thead>
|
|
17
|
+
<tbody>
|
|
18
|
+
<% @users.each do |member| %>
|
|
19
|
+
<tr data-user-id="<%= member.id %>">
|
|
20
|
+
<td data-label="<%= t("decidim.chatbot.admin.users.headers.name") %>"><%= member.name %></td>
|
|
21
|
+
<td data-label="<%= t("decidim.chatbot.admin.users.headers.email") %>"><%= member.email %></td>
|
|
22
|
+
<td data-label="<%= t("decidim.chatbot.admin.users.headers.phone") %>">
|
|
23
|
+
<%= member.extended_data["whatsapp_phone_number"] %>
|
|
24
|
+
</td>
|
|
25
|
+
<td data-label="<%= t("decidim.chatbot.admin.users.headers.subscribed") %>">
|
|
26
|
+
<%= t("decidim.chatbot.admin.users.subscribed.#{whatsapp_subscribed?(member)}") %>
|
|
27
|
+
</td>
|
|
28
|
+
<td class="table-list__actions" data-label="<%= t("decidim.chatbot.admin.users.headers.actions") %>">
|
|
29
|
+
<button type="button" data-controller="dropdown" data-target="actions-user-<%= member.id %>" aria-label="<%= t("decidim.admin.actions.actions_label", resource: member.name) %>">
|
|
30
|
+
<%= icon "more-fill", class: "text-secondary" %>
|
|
31
|
+
</button>
|
|
32
|
+
<div class="inline-block relative">
|
|
33
|
+
<ul id="actions-user-<%= member.id %>" class="dropdown dropdown__action" aria-hidden="true">
|
|
34
|
+
<% if whatsapp_subscribed?(member) %>
|
|
35
|
+
<li class="dropdown__item">
|
|
36
|
+
<%= button_to unsubscribe_chatbot_user_path(chatbot, member),
|
|
37
|
+
method: :patch,
|
|
38
|
+
data: { confirm: t("decidim.chatbot.admin.users.confirm_unsubscribe") },
|
|
39
|
+
class: "dropdown__button dropdown__button--danger" do %>
|
|
40
|
+
<%= icon "forbid-2-line" %>
|
|
41
|
+
<%= t("decidim.chatbot.admin.users.unsubscribe") %>
|
|
42
|
+
<% end %>
|
|
43
|
+
</li>
|
|
44
|
+
<% end %>
|
|
45
|
+
</ul>
|
|
46
|
+
</div>
|
|
47
|
+
</td>
|
|
48
|
+
</tr>
|
|
49
|
+
<% end %>
|
|
50
|
+
</tbody>
|
|
51
|
+
</table>
|
|
52
|
+
</div>
|
|
53
|
+
<%= decidim_paginate @users %>
|
|
54
|
+
<% else %>
|
|
55
|
+
<%= cell("decidim/announcement", t("decidim.chatbot.admin.users.empty_html"), callout_class: "secondary") %>
|
|
56
|
+
<% end %>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<%= render "decidim/chatbot/admin/shared/tabs_menu" %>
|
|
2
|
+
|
|
3
|
+
<%= render "decidim/chatbot/admin/chatbots/tabs/whatsapp", chatbot: %>
|
|
4
|
+
<%= button_to t("decidim.chatbot.admin.chatbots.whatsapp.sync"), sync_chatbot_whatsapp_path(chatbot),
|
|
5
|
+
method: :post, class: "button button__sm button__secondary mt-4" %>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<%# locals: (form:, url:, heading: nil, cancel_path: nil, send_now_path: nil, send_now_confirm: nil) %>
|
|
2
|
+
<% send_now = send_now_path.present? %>
|
|
3
|
+
<% form_html = { class: "form form-defaults" } %>
|
|
4
|
+
<% form_html[:id] = "chatbot-notification-item-form" if send_now %>
|
|
5
|
+
<div class="item__edit item__edit-1col">
|
|
6
|
+
<div class="item__edit-form">
|
|
7
|
+
<%= decidim_form_for(form, url:, method: form.persisted? ? :patch : :post, html: form_html) do |f| %>
|
|
8
|
+
<%= f.hidden_field :manifest_name %>
|
|
9
|
+
<div class="form__wrapper">
|
|
10
|
+
<div class="card">
|
|
11
|
+
<% if heading.present? %>
|
|
12
|
+
<div class="card-divider">
|
|
13
|
+
<h2 class="card-title"><%= heading %></h2>
|
|
14
|
+
</div>
|
|
15
|
+
<% end %>
|
|
16
|
+
<div class="card-section">
|
|
17
|
+
<div class="row column">
|
|
18
|
+
<%= f.check_box :enabled %>
|
|
19
|
+
</div>
|
|
20
|
+
<% if f.object.shows_title? %>
|
|
21
|
+
<div class="row column">
|
|
22
|
+
<%= f.translated :text_field, :title, data: { controller: "character-counter" } %>
|
|
23
|
+
</div>
|
|
24
|
+
<% end %>
|
|
25
|
+
<% if f.object.shows_introduction? %>
|
|
26
|
+
<div class="row column">
|
|
27
|
+
<%= f.translated :text_area, :introduction, rows: 4 %>
|
|
28
|
+
</div>
|
|
29
|
+
<% end %>
|
|
30
|
+
<%= render "decidim/chatbot/admin/shared/type_fields", form: f %>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<% unless send_now %>
|
|
35
|
+
<div class="item__edit-sticky">
|
|
36
|
+
<div class="item__edit-sticky-container">
|
|
37
|
+
<% if cancel_path.present? %>
|
|
38
|
+
<%= link_to t("decidim.chatbot.admin.items.cancel"), cancel_path, class: "button button__sm button__transparent-secondary" %>
|
|
39
|
+
<% end %>
|
|
40
|
+
<%= f.submit t("decidim.chatbot.admin.chatbots.edit.save"), class: "button button__sm button__secondary" %>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
<% end %>
|
|
44
|
+
<% end %>
|
|
45
|
+
</div>
|
|
46
|
+
<% if send_now %>
|
|
47
|
+
<div class="item__edit-sticky">
|
|
48
|
+
<div class="item__edit-sticky-container">
|
|
49
|
+
<% if cancel_path.present? %>
|
|
50
|
+
<%= link_to t("decidim.chatbot.admin.items.cancel"), cancel_path, class: "button button__sm button__transparent-secondary" %>
|
|
51
|
+
<% end %>
|
|
52
|
+
<%= button_to t("decidim.chatbot.admin.items.send_now_button"),
|
|
53
|
+
send_now_path,
|
|
54
|
+
method: :post,
|
|
55
|
+
class: "button button__sm button__secondary",
|
|
56
|
+
data: { confirm: send_now_confirm } %>
|
|
57
|
+
<%= button_tag t("decidim.chatbot.admin.chatbots.edit.save"),
|
|
58
|
+
type: "submit",
|
|
59
|
+
class: "button button__sm button__secondary",
|
|
60
|
+
form: "chatbot-notification-item-form" %>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
<% end %>
|
|
64
|
+
</div>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<%# locals: (record:, edit_path:, destroy_path:, test_path: nil) %>
|
|
2
|
+
<button type="button" data-controller="dropdown" data-target="actions-item-<%= record.id %>" aria-label="<%= t("decidim.admin.actions.actions_label", resource: record.id) %>">
|
|
3
|
+
<%= icon "more-fill", class: "text-secondary" %>
|
|
4
|
+
</button>
|
|
5
|
+
<div class="inline-block relative">
|
|
6
|
+
<ul id="actions-item-<%= record.id %>" class="dropdown dropdown__action" aria-hidden="true">
|
|
7
|
+
<li class="dropdown__item">
|
|
8
|
+
<%= link_to edit_path, class: "dropdown__button" do %>
|
|
9
|
+
<%= icon "pencil-line" %>
|
|
10
|
+
<%= t("decidim.chatbot.admin.actions.edit") %>
|
|
11
|
+
<% end %>
|
|
12
|
+
</li>
|
|
13
|
+
<% if test_path.present? %>
|
|
14
|
+
<li class="dropdown__item">
|
|
15
|
+
<%= link_to test_path, class: "dropdown__button" do %>
|
|
16
|
+
<%= icon "mail-send-line" %>
|
|
17
|
+
<%= t("decidim.chatbot.admin.actions.test") %>
|
|
18
|
+
<% end %>
|
|
19
|
+
</li>
|
|
20
|
+
<% end %>
|
|
21
|
+
<li class="dropdown__item">
|
|
22
|
+
<%= link_to destroy_path, method: :delete, data: { confirm: t("decidim.chatbot.admin.actions.confirm_destroy") }, class: "dropdown__button dropdown__button--danger" do %>
|
|
23
|
+
<%= icon "delete-bin-line" %>
|
|
24
|
+
<%= t("decidim.chatbot.admin.actions.destroy") %>
|
|
25
|
+
<% end %>
|
|
26
|
+
</li>
|
|
27
|
+
</ul>
|
|
28
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%# locals: () %>
|
|
2
|
+
<% add_decidim_page_title(chatbot_breadcrumb_label) %>
|
|
3
|
+
<div class="main-tabs-menu">
|
|
4
|
+
<div class="main-tabs-menu__tabs">
|
|
5
|
+
<%= admin_tabs(:admin_chatbot_menu).render %>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="main-tabs-menu__buttons">
|
|
8
|
+
<%= yield if block_given? %>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
<% if tab_onboarding.present? %>
|
|
12
|
+
<%= cell("decidim/announcement", tab_onboarding, callout_class: "secondary") %>
|
|
13
|
+
<% end %>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<%# locals: (scope_name:) %>
|
|
2
|
+
<%= cell("decidim/announcement", t("decidim.chatbot.admin.items.choose_type_html"), callout_class: "secondary") %>
|
|
3
|
+
<div class="grid grid-cols-2 gap-4 my-4">
|
|
4
|
+
<% Decidim::Chatbot.registry.for(scope_name).each do |manifest| %>
|
|
5
|
+
<%= link_to type_picker_path(scope_name, manifest.name),
|
|
6
|
+
class: "block p-4 border rounded-lg" do %>
|
|
7
|
+
<span class="text-lg font-normal">
|
|
8
|
+
<%= t("decidim.chatbot.admin.manifests.#{scope_name}.#{manifest.name}") %>
|
|
9
|
+
</span>
|
|
10
|
+
<span class="help-text">
|
|
11
|
+
<%= t("decidim.chatbot.admin.manifests.#{scope_name}.#{manifest.name}_help") %>
|
|
12
|
+
</span>
|
|
13
|
+
<% end %>
|
|
14
|
+
<% end %>
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<%# locals: (form:) %>
|
|
2
|
+
<div class="row column">
|
|
3
|
+
<%= form.text_field :redirect_path, help_text: t("decidim.chatbot.admin.items.redirect_path_help") %>
|
|
4
|
+
</div>
|
|
5
|
+
<div class="row column">
|
|
6
|
+
<%= form.translated :text_field, :response_label,
|
|
7
|
+
help_text: t("decidim.chatbot.admin.items.response_label_login_help") %>
|
|
8
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%# locals: (form:) %>
|
|
2
|
+
<div class="row column">
|
|
3
|
+
<%= form.translated :text_field, :template_id,
|
|
4
|
+
help_text: notification_template_id_help %>
|
|
5
|
+
<% if (edit_link = notification_template_edit_link(form)) %>
|
|
6
|
+
<p class="help-text"><%= edit_link %></p>
|
|
7
|
+
<% end %>
|
|
8
|
+
<p class="help-text"><%= t("decidim.chatbot.admin.items.template_meta_validation_help") %></p>
|
|
9
|
+
</div>
|
|
10
|
+
<% if form.object.shows_variables_json? %>
|
|
11
|
+
<div class="row column">
|
|
12
|
+
<%= form.translated :text_area, :variables_json,
|
|
13
|
+
rows: 4,
|
|
14
|
+
help_text: t("decidim.chatbot.admin.items.variables_help") %>
|
|
15
|
+
</div>
|
|
16
|
+
<% end %>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<%# locals: (form:) %>
|
|
2
|
+
<div class="row column">
|
|
3
|
+
<%= form.select :participatory_space_gid, form.object.space_choices,
|
|
4
|
+
{ include_blank: t("decidim.chatbot.admin.items.choose_space") },
|
|
5
|
+
{ required: true } %>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="row column">
|
|
8
|
+
<%= form.translated :text_field, :template_id,
|
|
9
|
+
help_text: notification_template_id_help %>
|
|
10
|
+
<% if (edit_link = notification_template_edit_link(form)) %>
|
|
11
|
+
<p class="help-text"><%= edit_link %></p>
|
|
12
|
+
<% end %>
|
|
13
|
+
<p class="help-text"><%= t("decidim.chatbot.admin.items.template_meta_validation_help") %></p>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="row column">
|
|
16
|
+
<fieldset>
|
|
17
|
+
<legend><%= t("decidim.chatbot.admin.items.variables_list") %></legend>
|
|
18
|
+
<% if form.object.errors[:phase_variables].any? %>
|
|
19
|
+
<span class="form-error is-visible"><%= form.object.errors.full_messages_for(:phase_variables).to_sentence %></span>
|
|
20
|
+
<% end %>
|
|
21
|
+
<div>
|
|
22
|
+
<%= form.check_box :use_space_name, label: false %>
|
|
23
|
+
<%= form.label :use_space_name do %>
|
|
24
|
+
<%= t("decidim.chatbot.admin.items.phase_variables.space_name_html") %>
|
|
25
|
+
<% end %>
|
|
26
|
+
</div>
|
|
27
|
+
<div>
|
|
28
|
+
<%= form.check_box :use_phase_name, label: false %>
|
|
29
|
+
<%= form.label :use_phase_name do %>
|
|
30
|
+
<%= t("decidim.chatbot.admin.items.phase_variables.phase_name_html") %>
|
|
31
|
+
<% end %>
|
|
32
|
+
</div>
|
|
33
|
+
<div>
|
|
34
|
+
<%= form.check_box :use_phase_start, label: false %>
|
|
35
|
+
<%= form.label :use_phase_start do %>
|
|
36
|
+
<%= t("decidim.chatbot.admin.items.phase_variables.phase_start_html") %>
|
|
37
|
+
<% end %>
|
|
38
|
+
</div>
|
|
39
|
+
<div>
|
|
40
|
+
<%= form.check_box :use_phase_end, label: false %>
|
|
41
|
+
<%= form.label :use_phase_end do %>
|
|
42
|
+
<%= t("decidim.chatbot.admin.items.phase_variables.phase_end_html") %>
|
|
43
|
+
<% end %>
|
|
44
|
+
</div>
|
|
45
|
+
</fieldset>
|
|
46
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<%# locals: (form:) %>
|
|
2
|
+
<%= render "decidim/chatbot/admin/shared/type_fields/component_id",
|
|
3
|
+
form:,
|
|
4
|
+
label: t("decidim.chatbot.admin.items.proposal_component") %>
|
|
5
|
+
<% Decidim::Chatbot::MenuItemLabelKeys::PROPOSE_PROPOSALS.each do |attr| %>
|
|
6
|
+
<div class="row column">
|
|
7
|
+
<%= form.translated :text_field, attr,
|
|
8
|
+
help_text: t("decidim.chatbot.admin.items.#{attr}_propose_proposals_help") %>
|
|
9
|
+
</div>
|
|
10
|
+
<% end %>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%# locals: (form:) %>
|
|
2
|
+
<%= render "decidim/chatbot/admin/shared/type_fields/component_id",
|
|
3
|
+
form:,
|
|
4
|
+
label: t("decidim.chatbot.admin.items.blog_component") %>
|
|
5
|
+
<div class="row column">
|
|
6
|
+
<%= form.translated :text_field, :menu_button_label,
|
|
7
|
+
help_text: t("decidim.chatbot.admin.items.menu_button_label_read_blogs_help") %>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="row column">
|
|
10
|
+
<%= form.translated :text_field, :read_more_button_label,
|
|
11
|
+
help_text: t("decidim.chatbot.admin.items.read_more_button_label_read_blogs_help") %>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="row column">
|
|
14
|
+
<%= form.translated :text_field, :nothing_to_read_label,
|
|
15
|
+
help_text: t("decidim.chatbot.admin.items.nothing_to_read_label_read_blogs_help") %>
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%# locals: (form:) %>
|
|
2
|
+
<%= render "decidim/chatbot/admin/shared/type_fields/component_id",
|
|
3
|
+
form:,
|
|
4
|
+
label: t("decidim.chatbot.admin.items.proposal_component") %>
|
|
5
|
+
<div class="row column">
|
|
6
|
+
<%= form.translated :text_field, :menu_button_label,
|
|
7
|
+
help_text: t("decidim.chatbot.admin.items.menu_button_label_read_proposals_help") %>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="row column">
|
|
10
|
+
<%= form.translated :text_field, :read_more_button_label,
|
|
11
|
+
help_text: t("decidim.chatbot.admin.items.read_more_button_label_read_proposals_help") %>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="row column">
|
|
14
|
+
<%= form.translated :text_field, :nothing_to_read_label,
|
|
15
|
+
help_text: t("decidim.chatbot.admin.items.nothing_to_read_label_read_proposals_help") %>
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<%# locals: (form:) %>
|
|
2
|
+
<%= render "decidim/chatbot/admin/shared/type_fields/component_id",
|
|
3
|
+
form:,
|
|
4
|
+
label: t("decidim.chatbot.admin.items.proposal_component") %>
|
|
5
|
+
<% if form.object.shows_vote_behavior_fields? %>
|
|
6
|
+
<%= render "decidim/chatbot/admin/shared/type_fields/vote/shows_votes_closed_warning", form: %>
|
|
7
|
+
<%= render "decidim/chatbot/admin/shared/type_fields/vote/shows_vote_label", form: %>
|
|
8
|
+
<%= render "decidim/chatbot/admin/shared/type_fields/vote/shows_weight_labels", form: %>
|
|
9
|
+
<%= render "decidim/chatbot/admin/shared/type_fields/vote/shows_abstention_label", form: %>
|
|
10
|
+
<% end %>
|
|
11
|
+
<div class="row column">
|
|
12
|
+
<%= form.translated :text_field, :action_prompt_label,
|
|
13
|
+
help_text: t("decidim.chatbot.admin.items.action_prompt_label_vote_on_proposal_help") %>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="row column">
|
|
16
|
+
<%= form.translated :text_field, :menu_button_label,
|
|
17
|
+
help_text: t("decidim.chatbot.admin.items.menu_button_label_vote_on_proposal_help") %>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="row column">
|
|
20
|
+
<%= form.translated :text_field, :menu_connector_label,
|
|
21
|
+
help_text: t("decidim.chatbot.admin.items.menu_connector_label_vote_on_proposal_help") %>
|
|
22
|
+
</div>
|
|
23
|
+
<div class="row column">
|
|
24
|
+
<%= form.translated :text_field, :skip_menu_button,
|
|
25
|
+
help_text: t("decidim.chatbot.admin.items.skip_menu_button_vote_on_proposal_help") %>
|
|
26
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<%# locals: (form:) %>
|
|
2
|
+
<% if form.object.shows_weight_labels? %>
|
|
3
|
+
<div class="row column">
|
|
4
|
+
<%= form.translated :text_field, :weight_1_label,
|
|
5
|
+
help_text: t("decidim.chatbot.admin.items.weight_1_label_help") %>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="row column">
|
|
8
|
+
<%= form.translated :text_field, :weight_2_label,
|
|
9
|
+
help_text: t("decidim.chatbot.admin.items.weight_2_label_help") %>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="row column">
|
|
12
|
+
<%= form.translated :text_field, :weight_3_label,
|
|
13
|
+
help_text: t("decidim.chatbot.admin.items.weight_3_label_help") %>
|
|
14
|
+
</div>
|
|
15
|
+
<% end %>
|
data/bin/check
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# RuboCop + erblint + Prettier + i18n-tasks + OpenAPI + RSpec.
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
cd "$(dirname "$0")/.."
|
|
5
|
+
unset DATABASE_URL
|
|
6
|
+
export RAILS_ENV=test
|
|
7
|
+
|
|
8
|
+
bundle exec rubocop .
|
|
9
|
+
bundle exec erb_lint --lint-all --enable-all-linters
|
|
10
|
+
yarn format:check
|
|
11
|
+
bundle exec i18n-tasks missing --config config/i18n-tasks.yml
|
|
12
|
+
./bin/gen-openapi --check
|
|
13
|
+
SIMPLECOV=1 bundle exec rspec "$@"
|
data/bin/ci-setup
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Mirrors GitLab CI ruby::rspec before_script. Runs inside ruby:3.4.7.
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
cd "$(dirname "$0")/.."
|
|
5
|
+
|
|
6
|
+
git config --global --add safe.directory "$(pwd)" || true
|
|
7
|
+
|
|
8
|
+
: "${NODE_MAJOR:=22}"
|
|
9
|
+
|
|
10
|
+
apt-get update -qq && apt-get install -y ca-certificates curl gnupg wget libvips42
|
|
11
|
+
wget -q -O /tmp/google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
12
|
+
apt-get install -y /tmp/google-chrome.deb || (apt-get -f install -y && apt-get install -y /tmp/google-chrome.deb)
|
|
13
|
+
rm -f /tmp/google-chrome.deb
|
|
14
|
+
|
|
15
|
+
mkdir -p /etc/apt/keyrings
|
|
16
|
+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
|
17
|
+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
|
18
|
+
apt-get update && apt-get install -y -qq nodejs
|
|
19
|
+
npm install -g yarn --force
|
|
20
|
+
|
|
21
|
+
gem install bundler
|
|
22
|
+
bundle config set path 'vendor'
|
|
23
|
+
RAILS_ENV=development bundle install -j "$(nproc)"
|
|
24
|
+
# Toggle passes organization:/tab:; RestFull git gem still declares locals: ().
|
|
25
|
+
find vendor -path '*rest_full*' -name '_organization_settings_tab.html.erb' \
|
|
26
|
+
-exec sed -i 's/<%# locals: () %>/<%# locals: (organization:, tab:) %>/' {} \;
|
|
27
|
+
bundle exec rake test_app
|
|
28
|
+
|
|
29
|
+
# CI=1 turns on dummy eager_load; dummy_signature_handler needs Initiatives first.
|
|
30
|
+
dummy_test="spec/decidim_dummy_app/config/environments/test.rb"
|
|
31
|
+
if [[ -f "$dummy_test" ]]; then
|
|
32
|
+
sed -i 's/config.eager_load = ENV\["CI"\].present?/config.eager_load = false/' "$dummy_test"
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# Dummy packs: compile assets. Do not fail on shakapacker exit (webpack warnings).
|
|
36
|
+
cd spec/decidim_dummy_app
|
|
37
|
+
unset DATABASE_URL
|
|
38
|
+
bin/shakapacker || true
|