decidim-core 0.22.0 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim-core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/config/decidim_core_manifest.js +5 -0
- data/app/assets/javascripts/decidim.js.es6 +2 -0
- data/app/assets/javascripts/decidim/ajax_modals.js.es6 +3 -3
- data/app/assets/javascripts/decidim/confirm.js.es6 +3 -2
- data/app/assets/javascripts/decidim/core/bundle.js +1 -1
- data/app/assets/javascripts/decidim/core/bundle.js.map +1 -1
- data/app/assets/javascripts/decidim/diff_mode_dropdown.js.es6 +18 -4
- data/app/assets/javascripts/decidim/editor.js.es6 +3 -3
- data/app/assets/javascripts/decidim/geocoding.js.es6 +60 -0
- data/app/assets/javascripts/decidim/geocoding/attach_input.js.es6 +106 -0
- data/app/assets/javascripts/decidim/geocoding/format_address.js.es6 +29 -0
- data/app/assets/javascripts/decidim/geocoding/provider/here.js.es6 +107 -0
- data/app/assets/javascripts/decidim/geocoding/provider/photon.js.es6 +77 -0
- data/app/assets/javascripts/decidim/map.js.es6 +34 -124
- data/app/assets/javascripts/decidim/map/controller.js.es6 +92 -0
- data/app/assets/javascripts/decidim/map/controller/markers.js.es6 +65 -0
- data/app/assets/javascripts/decidim/map/controller/static.es6 +48 -0
- data/app/assets/javascripts/decidim/map/factory.js.es6 +51 -0
- data/app/assets/javascripts/decidim/map/icon.js.es6 +31 -0
- data/app/assets/javascripts/decidim/map/legacy.js.es6 +87 -0
- data/app/assets/javascripts/decidim/map/provider/default.js.es6 +22 -0
- data/app/assets/javascripts/decidim/map/provider/here.js.es6 +22 -0
- data/app/assets/javascripts/decidim/security/selfxss_warning.js.es6 +19 -0
- data/app/assets/stylesheets/decidim/_decidim.scss +2 -0
- data/app/assets/stylesheets/decidim/modules/_cards.scss +15 -0
- data/app/assets/stylesheets/decidim/modules/_forms.scss +14 -0
- data/app/assets/stylesheets/decidim/modules/_layout.scss +11 -3
- data/app/assets/stylesheets/decidim/modules/_map.scss +35 -0
- data/app/assets/stylesheets/decidim/modules/_progress-bar.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_reveal.scss +5 -0
- data/app/assets/stylesheets/decidim/modules/_status-labels.scss +2 -1
- data/app/cells/decidim/author/flag.erb +1 -1
- data/app/cells/decidim/author/profile_inline.erb +2 -2
- data/app/cells/decidim/author_cell.rb +5 -2
- data/app/cells/decidim/card_cell.rb +21 -7
- data/app/cells/decidim/card_m/show.erb +1 -1
- data/app/cells/decidim/card_m_cell.rb +6 -4
- data/app/cells/decidim/collapsible_authors_cell.rb +1 -1
- data/app/cells/decidim/diff/diff_mode_html.erb +5 -5
- data/app/cells/decidim/follow_button/show.erb +6 -6
- data/app/cells/decidim/follow_button_cell.rb +8 -0
- data/app/cells/decidim/progress_bar/show.erb +11 -4
- data/app/cells/decidim/progress_bar_cell.rb +20 -1
- data/app/cells/decidim/translation_bar/show.erb +6 -0
- data/app/cells/decidim/translation_bar_cell.rb +52 -0
- data/app/cells/decidim/version_cell.rb +1 -1
- data/app/cells/decidim/versions_list_cell.rb +1 -1
- data/app/commands/decidim/amendable/accept.rb +9 -3
- data/app/commands/decidim/amendable/create_draft.rb +2 -0
- data/app/commands/decidim/amendable/update_draft.rb +2 -0
- data/app/commands/decidim/attachment_methods.rb +12 -5
- data/app/commands/decidim/destroy_account.rb +1 -0
- data/app/commands/decidim/gallery_methods.rb +16 -9
- data/app/commands/decidim/messaging/reply_to_conversation.rb +1 -1
- data/app/commands/decidim/multiple_attachments_methods.rb +56 -0
- data/app/controllers/concerns/decidim/devise_controllers.rb +1 -0
- data/app/controllers/concerns/decidim/filter_resource.rb +24 -6
- data/app/controllers/concerns/decidim/flaggable.rb +20 -0
- data/app/controllers/concerns/decidim/force_authentication.rb +1 -0
- data/app/controllers/concerns/decidim/impersonate_users.rb +1 -1
- data/app/controllers/concerns/decidim/needs_snippets.rb +20 -0
- data/app/controllers/concerns/decidim/paginable.rb +5 -1
- data/app/controllers/concerns/decidim/withdrawable.rb +20 -0
- data/app/controllers/decidim/application_controller.rb +16 -0
- data/app/controllers/decidim/components/base_controller.rb +6 -1
- data/app/controllers/decidim/cookie_policy_controller.rb +6 -3
- data/app/controllers/decidim/messaging/conversations_controller.rb +5 -2
- data/app/forms/decidim/account_form.rb +5 -1
- data/app/forms/decidim/amendable/create_form.rb +1 -1
- data/app/forms/decidim/amendable/form.rb +44 -3
- data/app/forms/decidim/attachment_form.rb +5 -1
- data/app/forms/decidim/user_group_form.rb +5 -1
- data/app/helpers/decidim/cells_helper.rb +3 -15
- data/app/helpers/decidim/check_boxes_tree_helper.rb +21 -12
- data/app/helpers/decidim/cookies_helper.rb +1 -1
- data/app/helpers/decidim/decidim_form_helper.rb +1 -1
- data/app/helpers/decidim/filter_params_helper.rb +30 -0
- data/app/helpers/decidim/map_helper.rb +86 -23
- data/app/helpers/decidim/orders_helper.rb +6 -1
- data/app/helpers/decidim/paginate_helper.rb +3 -1
- data/app/helpers/decidim/scopes_helper.rb +4 -4
- data/app/helpers/decidim/translations_helper.rb +7 -1
- data/app/jobs/decidim/machine_translation_fields_job.rb +30 -0
- data/app/jobs/decidim/machine_translation_resource_job.rb +113 -0
- data/app/jobs/decidim/machine_translation_save_job.rb +33 -0
- data/app/mailers/decidim/reported_mailer.rb +8 -1
- data/app/models/decidim/action_log.rb +1 -1
- data/app/models/decidim/area.rb +3 -0
- data/app/models/decidim/area_type.rb +4 -0
- data/app/models/decidim/attachment.rb +30 -2
- data/app/models/decidim/attachment_collection.rb +3 -0
- data/app/models/decidim/authorization.rb +3 -0
- data/app/models/decidim/category.rb +4 -0
- data/app/models/decidim/component.rb +7 -0
- data/app/models/decidim/content_block.rb +11 -1
- data/app/models/decidim/contextual_help_section.rb +4 -0
- data/app/models/decidim/follow.rb +3 -1
- data/app/models/decidim/messaging/message.rb +1 -1
- data/app/models/decidim/moderation.rb +1 -1
- data/app/models/decidim/newsletter.rb +3 -0
- data/app/models/decidim/oauth_application.rb +2 -0
- data/app/models/decidim/organization.rb +53 -9
- data/app/models/decidim/scope.rb +4 -1
- data/app/models/decidim/scope_type.rb +3 -0
- data/app/models/decidim/share_token.rb +49 -0
- data/app/models/decidim/static_page.rb +4 -1
- data/app/models/decidim/static_page_topic.rb +3 -0
- data/app/models/decidim/user_base_entity.rb +6 -2
- data/app/permissions/decidim/permissions.rb +9 -0
- data/app/presenters/decidim/log/base_presenter.rb +1 -1
- data/app/presenters/decidim/log/value_types/default_presenter.rb +1 -1
- data/app/presenters/decidim/official_author_presenter.rb +36 -0
- data/app/presenters/decidim/resource_locator_presenter.rb +63 -12
- data/app/queries/decidim/similar_emendations.rb +4 -4
- data/app/scrubbers/decidim/user_input_scrubber.rb +1 -1
- data/app/serializers/decidim/importers/participatory_space_components_importer.rb +1 -1
- data/app/services/decidim/base_diff_renderer.rb +17 -0
- data/app/services/decidim/open_data_exporter.rb +2 -0
- data/app/services/decidim/resource_search.rb +95 -6
- data/app/services/decidim/static_map_generator.rb +10 -26
- data/app/uploaders/decidim/application_uploader.rb +15 -1
- data/app/uploaders/decidim/attachment_uploader.rb +23 -17
- data/app/uploaders/decidim/banner_image_uploader.rb +1 -1
- data/app/uploaders/decidim/hero_image_uploader.rb +1 -1
- data/app/uploaders/decidim/homepage_image_uploader.rb +1 -1
- data/app/uploaders/decidim/image_uploader.rb +6 -2
- data/app/uploaders/decidim/oauth_application_logo_uploader.rb +1 -1
- data/app/uploaders/decidim/official_image_footer_uploader.rb +1 -1
- data/app/uploaders/decidim/official_image_header_uploader.rb +1 -1
- data/app/uploaders/decidim/organization_logo_uploader.rb +1 -1
- data/app/uploaders/decidim/record_image_uploader.rb +15 -0
- data/app/validators/etiquette_validator.rb +0 -7
- data/app/validators/geocoding_validator.rb +9 -4
- data/app/validators/passthru_validator.rb +111 -0
- data/app/validators/scope_belongs_to_component_validator.rb +16 -0
- data/app/validators/uploader_content_type_validator.rb +44 -0
- data/app/views/decidim/authorization_modals/_content.html.erb +2 -2
- data/app/views/decidim/devise/registrations/new.html.erb +3 -1
- data/app/views/decidim/devise/sessions/new.html.erb +3 -1
- data/app/views/decidim/messaging/conversations/_error_modal.html.erb +21 -0
- data/app/views/decidim/messaging/conversations/error.js.erb +10 -0
- data/app/views/decidim/notification_mailer/event_received.html.erb +2 -2
- data/app/views/decidim/reported_mailer/report.html.erb +49 -3
- data/app/views/decidim/scopes/_scopes_picker_input.html.erb +15 -14
- data/app/views/decidim/searches/_filters.html.erb +1 -0
- data/app/views/decidim/shared/_login_modal.html.erb +14 -3
- data/app/views/decidim/shared/_static_map.html.erb +1 -1
- data/app/views/layouts/decidim/_head.html.erb +2 -0
- data/app/views/layouts/decidim/_js_configuration.html.erb +7 -1
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +3 -4
- data/config/locales/bg.yml +1508 -0
- data/config/locales/ca.yml +35 -8
- data/config/locales/cs.yml +34 -7
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +23 -4
- data/config/locales/el.yml +0 -4
- data/config/locales/en.yml +30 -3
- data/config/locales/eo.yml +92 -0
- data/config/locales/es-MX.yml +28 -1
- data/config/locales/es-PY.yml +28 -1
- data/config/locales/es.yml +44 -17
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +3 -4
- data/config/locales/fi-plain.yml +28 -1
- data/config/locales/fi.yml +29 -2
- data/config/locales/fr-CA.yml +32 -4
- data/config/locales/fr.yml +61 -33
- data/config/locales/ga-IE.yml +0 -8
- data/config/locales/gl.yml +3 -4
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +7 -4
- data/config/locales/id-ID.yml +3 -4
- data/config/locales/is-IS.yml +3 -9
- data/config/locales/is.yml +463 -0
- data/config/locales/it.yml +36 -8
- data/config/locales/ja-JP.yml +25 -16
- data/config/locales/ja.yml +1605 -0
- data/config/locales/ko-KR.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/{lv-LV.yml → lv.yml} +0 -4
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +25 -3
- data/config/locales/no.yml +133 -6
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +88 -71
- data/config/locales/pt-BR.yml +3 -4
- data/config/locales/pt.yml +10 -4
- data/config/locales/ro-RO.yml +10 -4
- data/config/locales/ru.yml +3 -10
- data/config/locales/sk.yml +3 -4
- data/config/locales/sl.yml +8 -7
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +0 -7
- data/config/locales/sv.yml +17 -6
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +3 -4
- data/config/locales/uk.yml +3 -11
- data/config/locales/vi-VN.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +1584 -0
- data/config/locales/zh-TW.yml +1 -0
- data/db/migrate/20200525184143_add_enable_machine_translation_to_decidim_organizations.rb +7 -0
- data/db/migrate/20200702073419_create_decidim_share_tokens.rb +16 -0
- data/db/migrate/20200707132401_add_comments_max_length_to_decidim_organization.rb +7 -0
- data/db/migrate/20200730142511_add_file_upload_settings_to_decidim_organizations.rb +36 -0
- data/db/migrate/20200806092109_add_machine_translation_display_priority_to_organizations.rb +17 -0
- data/db/migrate/20201004160335_remove_notifications_with_continuity_badge.rb +9 -0
- data/db/seeds.rb +5 -4
- data/lib/decidim/authorable.rb +22 -1
- data/lib/decidim/authorization_form_builder.rb +7 -0
- data/lib/decidim/coauthorable.rb +22 -0
- data/lib/decidim/component_manifest.rb +1 -1
- data/lib/decidim/content_processor.rb +52 -29
- data/lib/decidim/content_renderers/base_renderer.rb +1 -1
- data/lib/decidim/content_renderers/hashtag_renderer.rb +2 -0
- data/lib/decidim/content_renderers/link_renderer.rb +4 -1
- data/lib/decidim/content_renderers/user_group_renderer.rb +3 -1
- data/lib/decidim/content_renderers/user_renderer.rb +3 -1
- data/lib/decidim/core.rb +67 -12
- data/lib/decidim/core/engine.rb +60 -21
- data/lib/decidim/core/test.rb +6 -0
- data/lib/decidim/core/test/factories.rb +34 -8
- data/lib/decidim/core/test/shared_examples/amendable/accept_amendment_examples.rb +4 -4
- data/lib/decidim/core/test/shared_examples/amendable_proposals_interface_examples.rb +8 -8
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +52 -1
- data/lib/decidim/core/test/shared_examples/embed_resource_examples.rb +49 -0
- data/lib/decidim/core/test/shared_examples/follows_examples.rb +3 -3
- data/lib/decidim/core/test/shared_examples/manage_component_share_tokens.rb +83 -0
- data/lib/decidim/core/test/shared_examples/map_examples.rb +186 -0
- data/lib/decidim/core/test/shared_examples/preview_component_with_share_token_examples.rb +55 -0
- data/lib/decidim/core/test/shared_examples/resource_search_examples.rb +200 -0
- data/lib/decidim/core/test/shared_examples/scopable_resource_examples.rb +43 -0
- data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +12 -1
- data/lib/decidim/core/test/shared_examples/searchable_participatory_space_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +15 -2
- data/lib/decidim/core/test/shared_examples/simple_event.rb +7 -0
- data/lib/decidim/core/test/shared_examples/system_endorse_resource_examples.rb +1 -0
- data/lib/decidim/core/test/shared_examples/traceable_interface_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/uncommentable_component_examples.rb +1 -1
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/diffy_extension.rb +21 -0
- data/lib/decidim/events/base_event.rb +11 -9
- data/lib/decidim/exporters.rb +7 -0
- data/lib/decidim/exporters/csv.rb +15 -1
- data/lib/decidim/exporters/excel.rb +1 -1
- data/lib/decidim/exporters/export_manifest.rb +29 -0
- data/lib/decidim/exporters/pdf.rb +56 -0
- data/lib/decidim/file_validator_humanizer.rb +98 -0
- data/lib/decidim/form_builder.rb +65 -54
- data/lib/decidim/geocodable.rb +79 -0
- data/lib/decidim/has_attachments.rb +10 -0
- data/lib/decidim/has_upload_validations.rb +36 -0
- data/lib/decidim/map.rb +214 -0
- data/lib/decidim/map/autocomplete.rb +67 -0
- data/lib/decidim/map/dynamic_map.rb +89 -0
- data/lib/decidim/map/frontend.rb +97 -0
- data/lib/decidim/map/geocoding.rb +115 -0
- data/lib/decidim/map/provider.rb +12 -0
- data/lib/decidim/map/provider/autocomplete/here.rb +20 -0
- data/lib/decidim/map/provider/autocomplete/osm.rb +20 -0
- data/lib/decidim/map/provider/dynamic_map/here.rb +51 -0
- data/lib/decidim/map/provider/dynamic_map/osm.rb +13 -0
- data/lib/decidim/map/provider/geocoding/here.rb +58 -0
- data/lib/decidim/map/provider/geocoding/osm.rb +30 -0
- data/lib/decidim/map/provider/here.rb +21 -0
- data/lib/decidim/map/provider/osm.rb +22 -0
- data/lib/decidim/map/provider/static_map/here.rb +35 -0
- data/lib/decidim/map/provider/static_map/osm.rb +29 -0
- data/lib/decidim/map/static_map.rb +133 -0
- data/lib/decidim/map/utility.rb +38 -0
- data/lib/decidim/organization_settings.rb +267 -0
- data/lib/decidim/resource_manifest.rb +1 -1
- data/lib/decidim/scopable.rb +9 -6
- data/lib/decidim/scopable_component.rb +29 -1
- data/lib/decidim/scopable_participatory_space.rb +19 -0
- data/lib/decidim/scopable_resource.rb +21 -0
- data/lib/decidim/search_resource_fields_mapper.rb +15 -2
- data/lib/decidim/searchable.rb +4 -0
- data/lib/decidim/settings_manifest.rb +2 -1
- data/lib/decidim/shareable_with_token.rb +27 -0
- data/lib/decidim/snippets.rb +30 -0
- data/lib/decidim/translatable_attributes.rb +42 -4
- data/lib/decidim/translatable_resource.rb +78 -0
- data/lib/decidim/view_model.rb +1 -0
- data/lib/tasks/decidim_locales_tasks.rake +35 -0
- data/lib/tasks/decidim_tasks.rake +1 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.bg.js +14 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.da.js +14 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.eo.js +17 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.et.js +18 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.fr-CA.js +16 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.ga.js +15 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.hr.js +13 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.is.js +14 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.ja.js +16 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.lt.js +16 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.lv.js +17 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.mt.js +15 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.sl.js +14 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.sr.js +16 -0
- metadata +138 -26
- data/app/helpers/decidim/multi_translation_helper.rb +0 -0
- data/lib/decidim/hashtaggable.rb +0 -24
@@ -8,19 +8,19 @@
|
|
8
8
|
<ul class="dropdown menu" data-dropdown-menu>
|
9
9
|
<li class="is-dropdown-submenu-parent">
|
10
10
|
<a id="diff-view-selected">
|
11
|
-
<%= t("versions.dropdown.
|
11
|
+
<%= t("versions.dropdown.option_unescaped") %>
|
12
12
|
</a>
|
13
13
|
|
14
14
|
<ul class="menu">
|
15
15
|
<li>
|
16
|
-
<%= link_to "#
|
17
|
-
<%= t("versions.dropdown.
|
16
|
+
<%= link_to "#unescaped-html", class: "diff-view-html", id:"unescaped-html" do %>
|
17
|
+
<%= t("versions.dropdown.option_unescaped") %>
|
18
18
|
<% end %>
|
19
19
|
</li>
|
20
20
|
|
21
21
|
<li>
|
22
|
-
<%= link_to "#
|
23
|
-
<%= t("versions.dropdown.
|
22
|
+
<%= link_to "#escaped-html", class: "diff-view-html", id:"escaped-html" do %>
|
23
|
+
<%= t("versions.dropdown.option_escaped") %>
|
24
24
|
<% end %>
|
25
25
|
</li>
|
26
26
|
</ul>
|
@@ -4,8 +4,8 @@
|
|
4
4
|
<%= button_to decidim.follow_path, class: button_classes, params: { follow: { followable_gid: model.to_sgid.to_s, inline: inline? } }, data: { disable: true }, method: :delete, remote: true do %>
|
5
5
|
<span class="icon-wrap">
|
6
6
|
<%= icon "bell", icon_options %>
|
7
|
-
<span aria-hidden="true"><%=
|
8
|
-
<span class="show-for-sr"><%= t("decidim.followers.followers_count", count:
|
7
|
+
<span aria-hidden="true"><%= followers_count %></span>
|
8
|
+
<span class="show-for-sr"><%= t("decidim.followers.followers_count", count: followers_count) %></span>
|
9
9
|
</span>
|
10
10
|
<span class="text-wrap">
|
11
11
|
<%= t("follows.destroy.button", scope: "decidim") %>
|
@@ -16,8 +16,8 @@
|
|
16
16
|
<%= button_to decidim.follow_path, class: button_classes, params: { follow: { followable_gid: model.to_sgid.to_s, inline: inline? } }, data: { disable: true }, remote: true do %>
|
17
17
|
<span class="icon-wrap">
|
18
18
|
<%= icon "bell", icon_options %>
|
19
|
-
<span aria-hidden="true"><%=
|
20
|
-
<span class="show-for-sr"><%= t("decidim.followers.followers_count", count:
|
19
|
+
<span aria-hidden="true"><%= followers_count %></span>
|
20
|
+
<span class="show-for-sr"><%= t("decidim.followers.followers_count", count: followers_count) %></span>
|
21
21
|
</span>
|
22
22
|
<span class="text-wrap">
|
23
23
|
<% if current_user.follows?(model.try(:participatory_space)) %>
|
@@ -42,8 +42,8 @@
|
|
42
42
|
remote: true) do %>
|
43
43
|
<span class="icon-wrap">
|
44
44
|
<%= icon "bell", icon_options %>
|
45
|
-
<span aria-hidden="true"><%=
|
46
|
-
<span class="show-for-sr"><%= t("decidim.followers.followers_count", count:
|
45
|
+
<span aria-hidden="true"><%= followers_count %></span>
|
46
|
+
<span class="show-for-sr"><%= t("decidim.followers.followers_count", count: followers_count) %></span>
|
47
47
|
</span>
|
48
48
|
<span class="text-wrap">
|
49
49
|
<%= t("follows.create.button", scope: "decidim") %>
|
@@ -15,6 +15,14 @@ module Decidim
|
|
15
15
|
|
16
16
|
private
|
17
17
|
|
18
|
+
def followers_count
|
19
|
+
if model.respond_to?(:followers_count)
|
20
|
+
model.followers_count
|
21
|
+
else
|
22
|
+
model.followers.count
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
18
26
|
def button_classes
|
19
27
|
return "card__button secondary text-uppercase follow-button mb-none has-tip" if inline?
|
20
28
|
|
@@ -1,14 +1,21 @@
|
|
1
|
-
<div id="<%= element_id %>" class="
|
1
|
+
<div id="<%= element_id %>" class="<%= container_class %>">
|
2
2
|
<div class="progress__bar__title">
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
<% if horizontal? %>
|
5
|
+
<span class="progress__bar__text"><%= subtitle_text %></span>
|
6
|
+
<span class="progress__bar__number"><%= progress %></span><%= "/#{total}" if total != 0 %>
|
7
|
+
<% else %>
|
8
|
+
<span class="progress__bar__number"><%= progress %></span><%= "/#{total}" if total != 0 %>
|
9
|
+
<span class="progress__bar__text"><%= units_name_text %></span>
|
10
|
+
<% end %>
|
5
11
|
</div>
|
6
12
|
<% if total != 0 %>
|
7
13
|
<div class="progress progress__bar__bar" role="progressbar" tabindex="0" aria-valuenow="<%= percentage %>" aria-valuemin="0" aria-valuetext="<%= percentage %> percent" aria-valuemax="100">
|
8
14
|
<div class="progress-meter progress__bar__bar--complete" style="width: <%= percentage %>%"></div>
|
9
15
|
<div class="progress__bar__bar--incomplete" style="width:calc(100% - <%= percentage %>%);"></div>
|
10
16
|
</div>
|
11
|
-
|
17
|
+
|
18
|
+
<% if display_subtitle? %>
|
12
19
|
<div class="progress__bar__subtitle">
|
13
20
|
<%= subtitle_text %>
|
14
21
|
</div>
|
@@ -22,7 +22,7 @@ module Decidim
|
|
22
22
|
# Example:
|
23
23
|
#
|
24
24
|
# cell(
|
25
|
-
# "decidim/
|
25
|
+
# "decidim/progress_bar",
|
26
26
|
# 7,
|
27
27
|
# element_id: "my-id",
|
28
28
|
# units_name: "my.i18n.key",
|
@@ -49,10 +49,29 @@ module Decidim
|
|
49
49
|
options[:subtitle_text]
|
50
50
|
end
|
51
51
|
|
52
|
+
def container_class
|
53
|
+
container_class = "progress__bar"
|
54
|
+
container_class += " progress__bar--horizontal" if horizontal? && !small?
|
55
|
+
container_class += " progress__bar--vertical" if vertical?
|
56
|
+
container_class
|
57
|
+
end
|
58
|
+
|
59
|
+
def display_subtitle?
|
60
|
+
subtitle_text.present? && !small? && !horizontal?
|
61
|
+
end
|
62
|
+
|
52
63
|
def small?
|
53
64
|
options[:small].to_s == "true"
|
54
65
|
end
|
55
66
|
|
67
|
+
def vertical?
|
68
|
+
!small? && !horizontal?
|
69
|
+
end
|
70
|
+
|
71
|
+
def horizontal?
|
72
|
+
options[:horizontal].to_s == "true"
|
73
|
+
end
|
74
|
+
|
56
75
|
def progress
|
57
76
|
model
|
58
77
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# This cell is used to render a button to toggle machine translations. It will
|
5
|
+
# only render if the translations are enabled.
|
6
|
+
class TranslationBarCell < Decidim::ViewModel
|
7
|
+
include Decidim::TranslatableAttributes
|
8
|
+
|
9
|
+
def show
|
10
|
+
return unless renderable?
|
11
|
+
|
12
|
+
render
|
13
|
+
end
|
14
|
+
|
15
|
+
def renderable?
|
16
|
+
Decidim.config.enable_machine_translations &&
|
17
|
+
model.enable_machine_translations
|
18
|
+
end
|
19
|
+
|
20
|
+
def link
|
21
|
+
original_url = request.original_url
|
22
|
+
parsed_url = URI.parse(original_url)
|
23
|
+
query = parsed_url.query
|
24
|
+
new_query_params = "toggle_translations=true"
|
25
|
+
|
26
|
+
new_query = if RequestStore.store[:toggle_machine_translations]
|
27
|
+
query.gsub("toggle_translations=true", "")
|
28
|
+
elsif query.nil?
|
29
|
+
new_query_params
|
30
|
+
else
|
31
|
+
query + "&" + new_query_params
|
32
|
+
end
|
33
|
+
|
34
|
+
parsed_url.query = new_query
|
35
|
+
url = parsed_url.to_s
|
36
|
+
|
37
|
+
link_to button_text, url, class: "button small hollow"
|
38
|
+
end
|
39
|
+
|
40
|
+
def button_text
|
41
|
+
if must_render_translation?(model)
|
42
|
+
t("decidim.translation_bar.show_original")
|
43
|
+
else
|
44
|
+
t("decidim.translation_bar.show_translated")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def help_text
|
49
|
+
t("decidim.translation_bar.help_text")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -50,12 +50,18 @@ module Decidim
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def update_amendable!
|
53
|
-
@amendable = Decidim.traceability.
|
53
|
+
@amendable = Decidim.traceability.perform_action!(
|
54
|
+
:update,
|
54
55
|
@amendable,
|
55
56
|
@amender,
|
56
|
-
form.emendation_params,
|
57
57
|
visibility: "public-only"
|
58
|
-
)
|
58
|
+
) do
|
59
|
+
@amendable.assign_attributes(form.emendation_params)
|
60
|
+
@amendable.title = { I18n.locale => form.emendation_params.with_indifferent_access[:title] }
|
61
|
+
@amendable.body = { I18n.locale => form.emendation_params.with_indifferent_access[:body] }
|
62
|
+
@amendable.save!
|
63
|
+
@amendable
|
64
|
+
end
|
59
65
|
@amendable.add_coauthor(@amender, user_group: @user_group)
|
60
66
|
end
|
61
67
|
|
@@ -49,6 +49,8 @@ module Decidim
|
|
49
49
|
visibility: "public-only"
|
50
50
|
) do
|
51
51
|
emendation = amendable.class.new(form.emendation_params)
|
52
|
+
emendation.title = { I18n.locale => form.emendation_params.with_indifferent_access[:title] }
|
53
|
+
emendation.body = { I18n.locale => form.emendation_params.with_indifferent_access[:body] }
|
52
54
|
emendation.component = amendable.component
|
53
55
|
emendation.add_author(current_user, user_group)
|
54
56
|
emendation.save!
|
@@ -45,6 +45,8 @@ module Decidim
|
|
45
45
|
def update_draft
|
46
46
|
PaperTrail.request(enabled: false) do
|
47
47
|
emendation.assign_attributes(form.emendation_params)
|
48
|
+
emendation.title = { I18n.locale => form.emendation_params.with_indifferent_access[:title] }
|
49
|
+
emendation.body = { I18n.locale => form.emendation_params.with_indifferent_access[:body] }
|
48
50
|
emendation.add_author(current_user, user_group)
|
49
51
|
emendation.save!
|
50
52
|
end
|
@@ -5,11 +5,14 @@ module Decidim
|
|
5
5
|
module AttachmentMethods
|
6
6
|
private
|
7
7
|
|
8
|
-
def build_attachment
|
8
|
+
def build_attachment(attached_to = nil)
|
9
|
+
attached_to = @attached_to if attached_to.blank?
|
10
|
+
attached_to = form.current_organization if attached_to.blank? && form.respond_to?(:current_organization)
|
11
|
+
|
9
12
|
@attachment = Attachment.new(
|
10
|
-
title: @form.attachment.title,
|
11
|
-
|
12
|
-
|
13
|
+
title: { I18n.locale => @form.attachment.title },
|
14
|
+
attached_to: attached_to,
|
15
|
+
file: @form.attachment.file # Define attached_to before this
|
13
16
|
)
|
14
17
|
end
|
15
18
|
|
@@ -24,6 +27,10 @@ module Decidim
|
|
24
27
|
@form.attachment.file.present?
|
25
28
|
end
|
26
29
|
|
30
|
+
def attachment_file_uploaded?
|
31
|
+
!@form.attachment.file.is_a?(Decidim::ApplicationUploader)
|
32
|
+
end
|
33
|
+
|
27
34
|
def create_attachment
|
28
35
|
attachment.attached_to = @attached_to
|
29
36
|
attachment.save!
|
@@ -34,7 +41,7 @@ module Decidim
|
|
34
41
|
end
|
35
42
|
|
36
43
|
def process_attachments?
|
37
|
-
attachments_allowed? && attachment_present?
|
44
|
+
attachments_allowed? && attachment_present? && attachment_file_uploaded?
|
38
45
|
end
|
39
46
|
end
|
40
47
|
end
|
@@ -6,15 +6,15 @@ module Decidim
|
|
6
6
|
module GalleryMethods
|
7
7
|
private
|
8
8
|
|
9
|
-
def build_gallery
|
9
|
+
def build_gallery(attached_to = nil)
|
10
10
|
@gallery = []
|
11
11
|
@form.add_photos.each do |photo|
|
12
12
|
next unless image? photo
|
13
13
|
|
14
14
|
@gallery << Attachment.new(
|
15
|
-
title: photo.original_filename,
|
16
|
-
|
17
|
-
|
15
|
+
title: { I18n.locale => photo.original_filename },
|
16
|
+
attached_to: attached_to || gallery_attached_to,
|
17
|
+
file: photo # Define attached_to before this
|
18
18
|
)
|
19
19
|
end
|
20
20
|
end
|
@@ -26,7 +26,7 @@ module Decidim
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def gallery_invalid?
|
29
|
-
gallery.each do |photo|
|
29
|
+
@gallery.each do |photo|
|
30
30
|
if photo.invalid? && photo.errors.has_key?(:file)
|
31
31
|
@form.errors.add(:add_photos, photo.errors[:file])
|
32
32
|
return true
|
@@ -37,19 +37,19 @@ module Decidim
|
|
37
37
|
|
38
38
|
def create_gallery
|
39
39
|
@gallery.map! do |photo|
|
40
|
-
photo.attached_to =
|
40
|
+
photo.attached_to = gallery_attached_to
|
41
41
|
photo.save!
|
42
42
|
@form.photos << photo.id.to_s
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
def photo_cleanup!
|
47
|
-
|
47
|
+
gallery_attached_to.photos.each do |photo|
|
48
48
|
photo.destroy! if @form.photos.exclude? photo.id.to_s
|
49
49
|
end
|
50
50
|
# manually reset cached photos
|
51
|
-
|
52
|
-
|
51
|
+
gallery_attached_to.reload
|
52
|
+
gallery_attached_to.instance_variable_set(:@photos, nil)
|
53
53
|
end
|
54
54
|
|
55
55
|
# maybe a custom settings options would be nice
|
@@ -60,5 +60,12 @@ module Decidim
|
|
60
60
|
def process_gallery?
|
61
61
|
gallery_allowed? && @form.add_photos.any?
|
62
62
|
end
|
63
|
+
|
64
|
+
def gallery_attached_to
|
65
|
+
return @attached_to if @attached_to.present?
|
66
|
+
return form.current_organization if form.respond_to?(:current_organization)
|
67
|
+
|
68
|
+
form.current_component.organization if form.respond_to?(:current_component)
|
69
|
+
end
|
63
70
|
end
|
64
71
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module MultipleAttachmentsMethods
|
5
|
+
private
|
6
|
+
|
7
|
+
def build_attachments
|
8
|
+
@documents = []
|
9
|
+
@form.add_documents.each do |file|
|
10
|
+
@documents << Attachment.new(
|
11
|
+
title: { I18n.locale => file.original_filename },
|
12
|
+
attached_to: @attached_to || documents_attached_to,
|
13
|
+
file: file
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def attachments_invalid?
|
19
|
+
@documents.each do |file|
|
20
|
+
if file.invalid? && file.errors.has_key?(:file)
|
21
|
+
@form.errors.add(:add_documents, file.errors[:file])
|
22
|
+
return true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
false
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_attachments
|
29
|
+
@documents.map! do |file|
|
30
|
+
file.attached_to = documents_attached_to
|
31
|
+
file.save!
|
32
|
+
@form.documents << file.id.to_s
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def document_cleanup!
|
37
|
+
documents_attached_to.documents.each do |file|
|
38
|
+
file.destroy! if @form.documents.exclude? file.id.to_s
|
39
|
+
end
|
40
|
+
|
41
|
+
documents_attached_to.reload
|
42
|
+
documents_attached_to.instance_variable_set(:@documents, nil)
|
43
|
+
end
|
44
|
+
|
45
|
+
def process_attachments?
|
46
|
+
@form.add_documents.any?
|
47
|
+
end
|
48
|
+
|
49
|
+
def documents_attached_to
|
50
|
+
return @attached_to if @attached_to.present?
|
51
|
+
return form.current_organization if form.respond_to?(:current_organization)
|
52
|
+
|
53
|
+
form.current_component.organization if form.respond_to?(:current_component)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|