decidim-core 0.18.1 → 0.19.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 +3 -0
- data/app/assets/javascripts/decidim/social_share.js +2 -0
- data/app/assets/stylesheets/decidim/extras/_social_share.css.scss +36 -0
- data/app/assets/stylesheets/decidim/modules/_input-gallery.scss +24 -0
- data/app/assets/stylesheets/decidim/modules/_navbar.scss +1 -1
- data/app/cells/decidim/activities_cell.rb +13 -8
- data/app/cells/decidim/activity_cell.rb +19 -5
- data/app/cells/decidim/address/details.erb +2 -2
- data/app/cells/decidim/amendable/amenders_list/show.erb +1 -1
- data/app/cells/decidim/amendable/amenders_list_cell.rb +5 -1
- data/app/cells/decidim/amendable/announcement_cell.rb +22 -9
- data/app/cells/decidim/amendable/wizard_step_form_cell.rb +121 -0
- data/app/cells/decidim/announcement_cell.rb +1 -0
- data/app/cells/decidim/author_cell.rb +7 -0
- data/app/cells/decidim/card_m_cell.rb +3 -1
- data/app/cells/decidim/coauthorships_cell.rb +3 -1
- data/app/cells/decidim/collapsible_authors_cell.rb +1 -0
- data/app/cells/decidim/collapsible_list_cell.rb +1 -0
- data/app/cells/decidim/content_blocks/highlighted_content_banner_cell.rb +1 -0
- data/app/cells/decidim/content_blocks/last_activity_cell.rb +3 -2
- data/app/cells/decidim/content_blocks/metrics_cell.rb +1 -0
- data/app/cells/decidim/content_blocks/stats_cell.rb +1 -0
- data/app/cells/decidim/content_blocks/sub_hero_cell.rb +1 -0
- data/app/cells/decidim/diff_cell.rb +1 -1
- data/app/cells/decidim/fingerprint/show.erb +1 -1
- data/app/cells/decidim/follow_button_cell.rb +3 -0
- data/app/cells/decidim/members_cell.rb +1 -0
- data/app/cells/decidim/notifications/show.erb +1 -1
- data/app/cells/decidim/profile_cell.rb +1 -0
- data/app/cells/decidim/profile_sidebar_cell.rb +4 -0
- data/app/cells/decidim/search_results_cell.rb +1 -0
- data/app/cells/decidim/search_results_section/show.erb +1 -1
- data/app/cells/decidim/tos_page_cell.rb +1 -0
- data/app/cells/decidim/user_group_pending_invitations_list_cell.rb +1 -0
- data/app/cells/decidim/user_group_pending_requests_list_cell.rb +1 -0
- data/app/cells/decidim/wizard_step_form/wizard_aside.erb +14 -0
- data/app/cells/decidim/wizard_step_form/wizard_header.erb +18 -0
- data/app/cells/decidim/wizard_step_form_cell.rb +112 -0
- data/app/commands/decidim/amendable/accept.rb +1 -1
- data/app/commands/decidim/amendable/create_draft.rb +70 -0
- data/app/commands/decidim/amendable/destroy_draft.rb +40 -0
- data/app/commands/decidim/amendable/promote.rb +13 -11
- data/app/commands/decidim/amendable/publish_draft.rb +76 -0
- data/app/commands/decidim/amendable/update_draft.rb +54 -0
- data/app/commands/decidim/amendable/withdraw.rb +31 -15
- data/app/commands/decidim/create_follow.rb +1 -0
- data/app/commands/decidim/create_omniauth_registration.rb +22 -4
- data/app/commands/decidim/create_registration.rb +5 -0
- data/app/commands/decidim/delete_follow.rb +1 -0
- data/app/commands/decidim/search.rb +1 -0
- data/app/controllers/concerns/decidim/action_authorization.rb +2 -0
- data/app/controllers/concerns/decidim/amendments_controller.rb +148 -28
- data/app/controllers/concerns/decidim/devise_controllers.rb +3 -2
- data/app/controllers/concerns/decidim/force_authentication.rb +38 -0
- data/app/controllers/concerns/decidim/impersonate_users.rb +1 -0
- data/app/controllers/concerns/decidim/locale_switcher.rb +44 -17
- data/app/controllers/concerns/decidim/needs_tos_accepted.rb +8 -0
- data/app/controllers/concerns/decidim/orderable.rb +36 -0
- data/app/controllers/concerns/decidim/participatory_space_context.rb +2 -0
- data/app/controllers/concerns/decidim/safe_redirect.rb +24 -0
- data/app/controllers/decidim/application_controller.rb +19 -2
- data/app/controllers/decidim/devise/confirmations_controller.rb +6 -0
- data/app/controllers/decidim/devise/invitations_controller.rb +8 -4
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +4 -1
- data/app/controllers/decidim/errors_controller.rb +3 -0
- data/app/controllers/decidim/follows_controller.rb +2 -2
- data/app/controllers/decidim/messaging/conversations_controller.rb +2 -2
- data/app/controllers/decidim/profiles_controller.rb +4 -1
- data/app/controllers/decidim/scopes_controller.rb +16 -4
- data/app/events/decidim/amendable/amendment_base_event.rb +4 -0
- data/app/forms/decidim/account_form.rb +1 -1
- data/app/forms/decidim/amendable/create_form.rb +3 -19
- data/app/forms/decidim/amendable/edit_form.rb +22 -0
- data/app/forms/decidim/amendable/form.rb +42 -20
- data/app/forms/decidim/amendable/promote_form.rb +4 -7
- data/app/forms/decidim/amendable/publish_form.rb +21 -0
- data/app/forms/decidim/amendable/reject_form.rb +1 -1
- data/app/forms/decidim/amendable/review_form.rb +9 -4
- data/app/forms/decidim/invite_user_form.rb +1 -0
- data/app/forms/decidim/notifications_settings_form.rb +1 -0
- data/app/forms/decidim/registration_form.rb +4 -3
- data/app/forms/decidim/user_group_form.rb +1 -0
- data/app/forms/decidim/user_interests_form.rb +1 -0
- data/app/helpers/decidim/amendments_helper.rb +33 -19
- data/app/helpers/decidim/cells_helper.rb +2 -0
- data/app/helpers/decidim/layout_helper.rb +1 -0
- data/app/helpers/decidim/map_helper.rb +1 -1
- data/app/helpers/decidim/meta_tags_helper.rb +1 -0
- data/app/helpers/decidim/resource_reference_helper.rb +1 -0
- data/app/jobs/decidim/event_publisher_job.rb +60 -0
- data/app/jobs/decidim/metric_job.rb +1 -0
- data/app/models/decidim/action_log.rb +12 -0
- data/app/models/decidim/amendment.rb +31 -2
- data/app/models/decidim/attachment.rb +2 -0
- data/app/models/decidim/authorization.rb +1 -0
- data/app/models/decidim/category.rb +1 -0
- data/app/models/decidim/component.rb +7 -0
- data/app/models/decidim/content_block.rb +1 -0
- data/app/models/decidim/follow.rb +3 -0
- data/app/models/decidim/identity.rb +1 -0
- data/app/models/decidim/impersonation_log.rb +2 -0
- data/app/models/decidim/newsletter.rb +1 -0
- data/app/models/decidim/participatory_process_user_role.rb +1 -0
- data/app/models/decidim/participatory_space_private_user.rb +1 -0
- data/app/models/decidim/permission_action.rb +2 -0
- data/app/models/decidim/report.rb +1 -0
- data/app/models/decidim/scope.rb +1 -0
- data/app/models/decidim/searchable_resource.rb +1 -1
- data/app/models/decidim/static_page.rb +1 -0
- data/app/models/decidim/user.rb +2 -0
- data/app/permissions/decidim/permissions.rb +18 -14
- data/app/permissions/decidim/user_manager_permissions.rb +9 -2
- data/app/presenters/decidim/admin_log/organization_presenter.rb +1 -0
- data/app/presenters/decidim/admin_log/participatory_space_private_user_presenter.rb +1 -1
- data/app/presenters/decidim/admin_log/user_presenter.rb +1 -1
- data/app/presenters/decidim/hashtag_presenter.rb +1 -1
- data/app/presenters/decidim/log/base_presenter.rb +1 -0
- data/app/presenters/decidim/log/diff_presenter.rb +1 -1
- data/app/presenters/decidim/log/value_types/area_presenter.rb +1 -0
- data/app/presenters/decidim/log/value_types/area_type_presenter.rb +1 -0
- data/app/presenters/decidim/log/value_types/currency_presenter.rb +1 -0
- data/app/presenters/decidim/log/value_types/date_presenter.rb +1 -0
- data/app/presenters/decidim/log/value_types/locale_presenter.rb +1 -0
- data/app/presenters/decidim/log/value_types/percentage_presenter.rb +1 -0
- data/app/presenters/decidim/log/value_types/scope_presenter.rb +1 -0
- data/app/presenters/decidim/log/value_types/scope_type_presenter.rb +1 -0
- data/app/presenters/decidim/metric_charts_presenter.rb +1 -0
- data/app/presenters/decidim/metric_object_presenter.rb +4 -0
- data/app/queries/decidim/metric_manage.rb +3 -0
- data/app/queries/decidim/metric_measure.rb +1 -0
- data/app/queries/decidim/metrics/followers_metric_manage.rb +3 -0
- data/app/queries/decidim/metrics/participants_metric_manage.rb +4 -0
- data/app/queries/decidim/similar_emendations.rb +56 -0
- data/app/resolvers/decidim/core/metric_resolver.rb +1 -0
- data/app/services/decidim/action_authorizer.rb +1 -0
- data/app/services/decidim/action_logger.rb +1 -0
- data/app/services/decidim/activity_search.rb +1 -0
- data/app/services/decidim/email_notification_generator.rb +4 -0
- data/app/services/decidim/notification_generator.rb +2 -0
- data/app/services/decidim/notification_generator_for_recipient.rb +0 -1
- data/app/services/decidim/resource_search.rb +1 -1
- data/app/services/decidim/traceability.rb +1 -0
- data/app/uploaders/decidim/application_uploader.rb +1 -0
- data/app/uploaders/decidim/attachment_uploader.rb +16 -0
- data/app/uploaders/decidim/avatar_uploader.rb +0 -2
- data/app/uploaders/decidim/data_portability_uploader.rb +1 -0
- data/app/uploaders/decidim/homepage_image_uploader.rb +0 -2
- data/app/uploaders/decidim/image_uploader.rb +15 -1
- data/app/uploaders/decidim/oauth_application_logo_uploader.rb +0 -1
- data/app/uploaders/decidim/official_image_footer_uploader.rb +0 -1
- data/app/uploaders/decidim/official_image_header_uploader.rb +0 -1
- data/app/uploaders/decidim/open_data_uploader.rb +1 -0
- data/app/validators/etiquette_validator.rb +5 -0
- data/app/views/decidim/account/delete.html.erb +2 -2
- data/app/views/decidim/account/show.html.erb +1 -1
- data/app/views/decidim/amendments/_edit_form_fields.html.erb +16 -13
- data/app/views/decidim/amendments/_similar_emendation.html.erb +24 -0
- data/app/views/decidim/amendments/compare_draft.html.erb +21 -0
- data/app/views/decidim/amendments/edit_draft.html.erb +31 -0
- data/app/views/decidim/amendments/new.html.erb +5 -17
- data/app/views/decidim/amendments/preview_draft.html.erb +32 -0
- data/app/views/decidim/amendments/review.html.erb +5 -3
- data/app/views/decidim/application/_document.html.erb +1 -1
- data/app/views/decidim/application/_photos.html.erb +1 -1
- data/app/views/decidim/data_portability/show.html.erb +1 -1
- data/app/views/decidim/devise/invitations/edit.html.erb +2 -2
- data/app/views/decidim/devise/sessions/new.html.erb +1 -1
- data/app/views/decidim/doorkeeper/authorizations/new.html.erb +3 -3
- data/app/views/decidim/export_mailer/data_portability_export.html.erb +1 -1
- data/app/views/decidim/searches/index.js.erb +6 -0
- data/app/views/decidim/shared/_address_details.html.erb +2 -2
- data/app/views/decidim/shared/_embed_modal.html.erb +1 -1
- data/app/views/decidim/shared/_share_modal.html.erb +7 -4
- data/app/views/layouts/decidim/_application.html.erb +0 -1
- data/app/views/layouts/decidim/_head.html.erb +13 -12
- data/app/views/layouts/decidim/_logo.html.erb +1 -1
- data/app/views/layouts/decidim/_social_media_links.html.erb +5 -5
- data/app/views/layouts/decidim/_user_menu.html.erb +1 -1
- data/app/views/layouts/decidim/_wrapper.html.erb +2 -2
- data/app/views/layouts/decidim/mailer.html.erb +2 -2
- data/config/locales/ar.yml +27 -17
- data/config/locales/ca.yml +79 -15
- data/config/locales/cs.yml +73 -14
- data/config/locales/de.yml +62 -12
- data/config/locales/en.yml +80 -16
- data/config/locales/eo-UY.yml +16 -0
- data/config/locales/es-MX.yml +73 -11
- data/config/locales/es-PY.yml +73 -11
- data/config/locales/es.yml +79 -15
- data/config/locales/eu.yml +6 -13
- data/config/locales/fi-plain.yml +75 -11
- data/config/locales/fi.yml +80 -16
- data/config/locales/fr.yml +70 -16
- data/config/locales/gl.yml +6 -13
- data/config/locales/hu.yml +80 -17
- data/config/locales/id-ID.yml +6 -12
- data/config/locales/it.yml +56 -14
- data/config/locales/nl.yml +76 -12
- data/config/locales/no.yml +11 -2
- data/config/locales/pl.yml +6 -15
- data/config/locales/pt-BR.yml +6 -13
- data/config/locales/pt.yml +6 -13
- data/config/locales/ru.yml +7 -2
- data/config/locales/sv.yml +34 -18
- data/config/locales/tr-TR.yml +15 -12
- data/config/locales/uk.yml +7 -2
- data/config/routes.rb +7 -0
- data/db/migrate/20180226140756_add_version_to_action_logs.rb +1 -0
- data/db/migrate/20180305132906_rename_features_to_components.rb +1 -0
- data/db/migrate/20190412131728_fix_user_names.rb +1 -1
- data/db/migrate/20190610093742_add_force_users_to_authenticate_before_access_organization.rb +10 -0
- data/db/migrate/20190618075906_add_confidential_to_doorkeeper_application.rb +13 -0
- data/db/migrate/{20190925091507_add_uniq_index_to_decidim_metrics.rb → 20190829092826_add_uniq_index_to_decidim_metrics.rb} +0 -0
- data/lib/decidim/amendable.rb +87 -13
- data/lib/decidim/attributes/localized_date.rb +5 -0
- data/lib/decidim/attributes/time_with_zone.rb +5 -0
- data/lib/decidim/authorable.rb +3 -0
- data/lib/decidim/authorization_form_builder.rb +2 -2
- data/lib/decidim/component_manifest.rb +2 -0
- data/lib/decidim/content_parsers.rb +2 -0
- data/lib/decidim/content_parsers/hashtag_parser.rb +1 -1
- data/lib/decidim/content_parsers/link_parser.rb +10 -0
- data/lib/decidim/content_parsers/newline_parser.rb +20 -0
- data/lib/decidim/content_parsers/user_parser.rb +1 -1
- data/lib/decidim/content_processor.rb +2 -0
- data/lib/decidim/content_renderers.rb +1 -0
- data/lib/decidim/content_renderers/hashtag_renderer.rb +1 -1
- data/lib/decidim/content_renderers/link_renderer.rb +24 -0
- data/lib/decidim/content_renderers/user_renderer.rb +2 -2
- data/lib/decidim/core.rb +11 -0
- data/lib/decidim/core/engine.rb +2 -28
- data/lib/decidim/core/test.rb +4 -1
- data/lib/decidim/core/test/factories.rb +35 -8
- data/lib/decidim/core/test/shared_examples/amendable/create_amendment_draft_examples.rb +50 -0
- data/lib/decidim/core/test/shared_examples/amendable/destroy_amendment_draft_examples.rb +39 -0
- data/lib/decidim/core/test/shared_examples/amendable/promote_amendment_examples.rb +27 -3
- data/lib/decidim/core/test/shared_examples/amendable/{create_amendment_examples.rb → publish_amendment_draft_examples.rb} +26 -17
- data/lib/decidim/core/test/shared_examples/amendable/update_amendment_draft_examples.rb +42 -0
- data/lib/decidim/core/test/shared_examples/amendable/withdraw_amendment_examples.rb +19 -11
- data/lib/decidim/core/test/shared_examples/has_attachment_collections.rb +1 -1
- data/lib/decidim/core/test/shared_examples/has_attachments.rb +1 -1
- data/lib/decidim/core/test/shared_examples/simple_event.rb +4 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/data_portability_file_zipper.rb +3 -0
- data/lib/decidim/events/author_event.rb +1 -0
- data/lib/decidim/events/base_event.rb +12 -22
- data/lib/decidim/events/coauthor_event.rb +1 -0
- data/lib/decidim/events/simple_event.rb +3 -0
- data/lib/decidim/exporters/csv.rb +1 -0
- data/lib/decidim/fingerprintable.rb +1 -0
- data/lib/decidim/followable.rb +8 -0
- data/lib/decidim/form_builder.rb +24 -3
- data/lib/decidim/gamification.rb +4 -0
- data/lib/decidim/gamification/badge_status.rb +1 -0
- data/lib/decidim/has_category.rb +2 -0
- data/lib/decidim/has_component.rb +2 -7
- data/lib/decidim/has_private_users.rb +8 -1
- data/lib/decidim/has_settings.rb +12 -8
- data/lib/decidim/hashtaggable.rb +4 -0
- data/lib/decidim/metric_operation_manifest.rb +1 -0
- data/lib/decidim/nicknamizable.rb +1 -0
- data/lib/decidim/participable.rb +1 -0
- data/lib/decidim/participatory_space_resourceable.rb +1 -0
- data/lib/decidim/randomable.rb +20 -0
- data/lib/decidim/search_resource_fields_mapper.rb +2 -0
- data/lib/decidim/searchable.rb +2 -0
- data/lib/decidim/settings_manifest.rb +10 -1
- data/lib/decidim/stats_registry.rb +1 -0
- data/lib/decidim/view_model.rb +1 -1
- data/lib/tasks/decidim_data_portability_tasks.rake +1 -0
- data/lib/tasks/decidim_metrics_tasks.rake +2 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.no.js +12 -12
- metadata +140 -82
- data/app/commands/decidim/amendable/create.rb +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aab7a2ae23c1348701c0e16ba32310cb9eb321255202fb5c24ea3f3a2d2b2685
|
4
|
+
data.tar.gz: d4e03e251ac0918d8ff0d891700aa3576e8a580739809c6ecd50d0f7816d90f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8fb7afc6566dedbd3884b5deb0d32c98baab6c1c7a1be1fcddabfb657167b47912967e68e558e6f7c9edc40133be57ccbd8c3668b5e95d19e89e7bb47ac2788
|
7
|
+
data.tar.gz: cbb63221866026d46fae8a8a22d355469cb14cdb2460886fbfd54a292f253ed04777d23123f75cfadbf384bf1c28a889303e7d8e679ad485637374d04a091a03
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/*
|
2
|
+
*= require social-share-button
|
3
|
+
*/
|
4
|
+
|
5
|
+
$size: 45px;
|
6
|
+
|
7
|
+
.share-link:hover{
|
8
|
+
text-decoration: underline;
|
9
|
+
cursor: pointer;
|
10
|
+
}
|
11
|
+
|
12
|
+
.social-share-button{
|
13
|
+
display: inline-block;
|
14
|
+
vertical-align: top;
|
15
|
+
|
16
|
+
.ssb-icon{
|
17
|
+
margin-right: 5px;
|
18
|
+
background-size: $size $size;
|
19
|
+
height: $size;
|
20
|
+
width: $size;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
a.ssb-icon.ssb-whatsapp_app{
|
25
|
+
display: none;
|
26
|
+
}
|
27
|
+
|
28
|
+
@media (hover: none) and (pointer: coarse){
|
29
|
+
a.ssb-icon.ssb-whatsapp_app{
|
30
|
+
display: inline-block;
|
31
|
+
}
|
32
|
+
|
33
|
+
a.ssb-icon.ssb-whatsapp_web{
|
34
|
+
display: none;
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
.gallery__container{
|
2
|
+
width: 100%;
|
3
|
+
|
4
|
+
.thumbnail{
|
5
|
+
max-height: 100px;
|
6
|
+
}
|
7
|
+
|
8
|
+
.gallery__item{
|
9
|
+
display: inline-block;
|
10
|
+
border: none;
|
11
|
+
margin-right: .5rem;
|
12
|
+
padding: 0;
|
13
|
+
|
14
|
+
.close-button{
|
15
|
+
right: 2px;
|
16
|
+
top: 2px;
|
17
|
+
width: 2rem;
|
18
|
+
height: 2rem;
|
19
|
+
background: rgba(var(--primary-rgb), .8);
|
20
|
+
color: $white;
|
21
|
+
border-radius: 50%;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
@@ -13,13 +13,6 @@ module Decidim
|
|
13
13
|
def show
|
14
14
|
return if activities.blank?
|
15
15
|
|
16
|
-
activities.map do |activity|
|
17
|
-
activity.organization_lazy
|
18
|
-
activity.resource_lazy
|
19
|
-
activity.participatory_space_lazy
|
20
|
-
activity.component_lazy
|
21
|
-
end
|
22
|
-
|
23
16
|
render
|
24
17
|
end
|
25
18
|
|
@@ -34,7 +27,19 @@ module Decidim
|
|
34
27
|
end
|
35
28
|
|
36
29
|
def activities
|
37
|
-
|
30
|
+
@activities ||= last_activities.select do |activity|
|
31
|
+
activity.visible_for?(current_user)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def last_activities
|
36
|
+
@last_activities ||= model.map do |activity|
|
37
|
+
activity.organization_lazy
|
38
|
+
activity.resource_lazy
|
39
|
+
activity.participatory_space_lazy
|
40
|
+
activity.component_lazy
|
41
|
+
activity
|
42
|
+
end
|
38
43
|
end
|
39
44
|
end
|
40
45
|
end
|
@@ -13,6 +13,7 @@ module Decidim
|
|
13
13
|
|
14
14
|
def show
|
15
15
|
return unless renderable?
|
16
|
+
|
16
17
|
render
|
17
18
|
end
|
18
19
|
|
@@ -72,10 +73,18 @@ module Decidim
|
|
72
73
|
I18n.l(model.created_at, format: :short)
|
73
74
|
end
|
74
75
|
|
76
|
+
def user
|
77
|
+
return resource.normalized_author if resource.respond_to?(:normalized_author)
|
78
|
+
return resource.author if resource.respond_to?(:author)
|
79
|
+
|
80
|
+
model.user_lazy if resource.respond_to?(:user)
|
81
|
+
end
|
82
|
+
|
75
83
|
private
|
76
84
|
|
77
85
|
def published?
|
78
86
|
return true unless resource.respond_to?(:published?)
|
87
|
+
|
79
88
|
resource.published?
|
80
89
|
end
|
81
90
|
|
@@ -87,13 +96,18 @@ module Decidim
|
|
87
96
|
model.organization_lazy
|
88
97
|
end
|
89
98
|
|
90
|
-
def user
|
91
|
-
model.user_lazy
|
92
|
-
end
|
93
|
-
|
94
99
|
def author
|
95
100
|
return unless show_author? && user.is_a?(UserBaseEntity)
|
96
|
-
|
101
|
+
|
102
|
+
presenter = if user.is_a?(Decidim::User)
|
103
|
+
UserPresenter.new(user)
|
104
|
+
elsif user.is_a?(Decidim::UserGroup)
|
105
|
+
UserGroupPresenter.new(user)
|
106
|
+
end
|
107
|
+
|
108
|
+
return unless presenter
|
109
|
+
|
110
|
+
cell "decidim/author", presenter
|
97
111
|
end
|
98
112
|
|
99
113
|
def participatory_space
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% if model.respond_to? :location %>
|
2
|
-
<strong><%= translated_attribute model.location %></strong><br
|
2
|
+
<strong><%= translated_attribute model.location %></strong><br>
|
3
3
|
<% end %>
|
4
|
-
<span><%= model.address %></span><br
|
4
|
+
<span><%= model.address %></span><br>
|
5
5
|
<% if model.respond_to? :location_hints %>
|
6
6
|
<span><%= translated_attribute model.location_hints %></span>
|
7
7
|
<% end %>
|
@@ -17,9 +17,13 @@ module Decidim::Amendable
|
|
17
17
|
model
|
18
18
|
end
|
19
19
|
|
20
|
+
def visible_amendments
|
21
|
+
amendable.visible_amendments_for(current_user).where.not(state: "draft")
|
22
|
+
end
|
23
|
+
|
20
24
|
# Returns a UserPresenter array
|
21
25
|
def amenders
|
22
|
-
@amenders ||=
|
26
|
+
@amenders ||= visible_amendments.map { |amendment| present(amendment.amender) }.uniq
|
23
27
|
end
|
24
28
|
|
25
29
|
def options
|
@@ -13,22 +13,35 @@ module Decidim::Amendable
|
|
13
13
|
|
14
14
|
def announcement
|
15
15
|
{
|
16
|
-
announcement: emendation_message,
|
16
|
+
announcement: emendation_message + promoted_message,
|
17
17
|
callout_class: state_classes
|
18
18
|
}
|
19
19
|
end
|
20
20
|
|
21
21
|
def emendation_message
|
22
|
-
|
22
|
+
message(model.state, amendable_type, proposal_link, announcement_date)
|
23
|
+
end
|
24
|
+
|
25
|
+
def promoted_message
|
26
|
+
return "" unless model.amendment.promoted?
|
27
|
+
|
28
|
+
proposal = model.linked_promoted_resource
|
29
|
+
text = message(:promoted, amendable_type)
|
30
|
+
%(<br><strong>#{proposal_link(proposal, text)}</strong>)
|
31
|
+
end
|
32
|
+
|
33
|
+
def message(state, type, link = nil, date = nil)
|
34
|
+
t(state,
|
23
35
|
scope: "decidim.amendments.emendation.announcement",
|
24
|
-
amendable_type:
|
25
|
-
|
26
|
-
|
36
|
+
amendable_type: type,
|
37
|
+
proposal_link: link,
|
38
|
+
date: date)
|
27
39
|
end
|
28
40
|
|
29
|
-
def
|
30
|
-
|
31
|
-
|
41
|
+
def proposal_link(resource = model.amendable, text = nil)
|
42
|
+
text ||= %(<strong>#{present(model.amendable).title}</strong>)
|
43
|
+
link_to resource_locator(resource).path do
|
44
|
+
text
|
32
45
|
end
|
33
46
|
end
|
34
47
|
|
@@ -41,7 +54,7 @@ module Decidim::Amendable
|
|
41
54
|
end
|
42
55
|
|
43
56
|
def state_classes
|
44
|
-
case model.
|
57
|
+
case model.state
|
45
58
|
when "accepted"
|
46
59
|
"success"
|
47
60
|
when "rejected"
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Amendable
|
5
|
+
# This cell functions as an intermediary cell that computes and passes the
|
6
|
+
# necessary information, as a Hash, to Decidim::WizardStepFormCell.
|
7
|
+
class WizardStepFormCell < Decidim::ViewModel
|
8
|
+
def show
|
9
|
+
cell("decidim/wizard_step_form", options_for_view)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
# Returns the current step as Integer.
|
15
|
+
def current_step
|
16
|
+
@current_step ||= case params[:action].to_sym
|
17
|
+
when :new, :create
|
18
|
+
1
|
19
|
+
when :compare_draft
|
20
|
+
2
|
21
|
+
when :edit_draft, :update_draft, :destroy_draft
|
22
|
+
3
|
23
|
+
when :preview_draft, :publish_draft
|
24
|
+
4
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns the translation for a given step.
|
29
|
+
def i18n_step(step_number)
|
30
|
+
t("decidim.amendments.wizard_step_form.steps.#{step_number}")
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns the name of the view we want to render, as Symbol.
|
34
|
+
def view
|
35
|
+
options[:view]
|
36
|
+
end
|
37
|
+
|
38
|
+
# Returns a Hash with all the data that will be needed in Decidim::WizardStepFormCell.
|
39
|
+
def options_for_view
|
40
|
+
common_options.merge(
|
41
|
+
send("#{view}_options")
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
# A Hash of data that is used in both :wizard_header and :wizard_aside views.
|
46
|
+
def common_options
|
47
|
+
{
|
48
|
+
view: view,
|
49
|
+
current_step: current_step,
|
50
|
+
total_steps: 4,
|
51
|
+
steps: {
|
52
|
+
"1": i18n_step(1),
|
53
|
+
"2": i18n_step(2),
|
54
|
+
"3": i18n_step(3),
|
55
|
+
"4": i18n_step(4)
|
56
|
+
}
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# A Hash of data needed for the :wizard_aside view.
|
61
|
+
def wizard_aside_options
|
62
|
+
{
|
63
|
+
wizard_aside_back_url: wizard_aside_back_url
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# A Hash of data needed for the :wizard_header view.
|
68
|
+
def wizard_header_options
|
69
|
+
{
|
70
|
+
wizard_header_title: wizard_header_title,
|
71
|
+
wizard_header_similar_resources_count: options[:similar_resources_count],
|
72
|
+
wizard_header_help_text: wizard_header_help_text
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
def amendable
|
77
|
+
@amendable ||= model
|
78
|
+
end
|
79
|
+
|
80
|
+
def amendment
|
81
|
+
@amendment ||= amendable.amendment
|
82
|
+
end
|
83
|
+
|
84
|
+
# Returns the link we want the back button to point to.
|
85
|
+
def wizard_aside_back_url
|
86
|
+
case current_step
|
87
|
+
when 1
|
88
|
+
Decidim::ResourceLocatorPresenter.new(amendable).path
|
89
|
+
when 3
|
90
|
+
Decidim::Core::Engine.routes.url_helpers.compare_draft_amend_path(amendment)
|
91
|
+
when 4
|
92
|
+
Decidim::Core::Engine.routes.url_helpers.edit_draft_amend_path(amendment)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Returns the translation of the header title.
|
97
|
+
def wizard_header_title
|
98
|
+
key = case current_step
|
99
|
+
when 1
|
100
|
+
:new
|
101
|
+
when 2
|
102
|
+
:compare_draft
|
103
|
+
when 3
|
104
|
+
:edit_draft
|
105
|
+
when 4
|
106
|
+
:preview_draft
|
107
|
+
end
|
108
|
+
|
109
|
+
t("decidim.amendments.#{key}.title")
|
110
|
+
end
|
111
|
+
|
112
|
+
# Returns a Hash that will be passed to a Decidim::AnnouncementCell.
|
113
|
+
def wizard_header_help_text
|
114
|
+
attribute = amendable.component.settings.amendments_wizard_help_text
|
115
|
+
{
|
116
|
+
announcement: translated_attribute(attribute).presence
|
117
|
+
}
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -49,6 +49,8 @@ module Decidim
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def withdraw_path
|
52
|
+
return decidim.withdraw_amend_path(from_context.amendment) if from_context.emendation?
|
53
|
+
|
52
54
|
from_context_path + "/withdraw"
|
53
55
|
end
|
54
56
|
|
@@ -57,6 +59,7 @@ module Decidim
|
|
57
59
|
return unless from_context
|
58
60
|
return unless proposals_controller? || collaborative_drafts_controller?
|
59
61
|
return unless show_action?
|
62
|
+
|
60
63
|
true
|
61
64
|
end
|
62
65
|
|
@@ -72,6 +75,7 @@ module Decidim
|
|
72
75
|
|
73
76
|
def commentable?
|
74
77
|
return unless posts_controller?
|
78
|
+
|
75
79
|
true
|
76
80
|
end
|
77
81
|
|
@@ -82,6 +86,7 @@ module Decidim
|
|
82
86
|
def actionable?
|
83
87
|
return false if options[:has_actions] == false
|
84
88
|
return true if user_author? && posts_controller?
|
89
|
+
|
85
90
|
true if withdrawable? || flagable?
|
86
91
|
end
|
87
92
|
|
@@ -90,6 +95,8 @@ module Decidim
|
|
90
95
|
end
|
91
96
|
|
92
97
|
def profile_path?
|
98
|
+
return false if options[:skip_profile_link] == true
|
99
|
+
|
93
100
|
profile_path.present?
|
94
101
|
end
|
95
102
|
|
@@ -40,6 +40,7 @@ module Decidim
|
|
40
40
|
|
41
41
|
def has_label?
|
42
42
|
return true if model.respond_to?("emendation?") && model.emendation?
|
43
|
+
|
43
44
|
context[:label].presence
|
44
45
|
end
|
45
46
|
|
@@ -90,6 +91,7 @@ module Decidim
|
|
90
91
|
classes = [base_card_class]
|
91
92
|
classes = classes.concat(["card--stack"]).join(" ") if has_children?
|
92
93
|
return classes unless has_state?
|
94
|
+
|
93
95
|
classes.concat(state_classes).join(" ")
|
94
96
|
end
|
95
97
|
|
@@ -141,7 +143,7 @@ module Decidim
|
|
141
143
|
end
|
142
144
|
|
143
145
|
def render_space?
|
144
|
-
context[:show_space].presence && model.respond_to?(:participatory_space)
|
146
|
+
context[:show_space].presence && model.respond_to?(:participatory_space) && model.participatory_space.present?
|
145
147
|
end
|
146
148
|
|
147
149
|
def render_top?
|