decidim-core 0.10.1 → 0.11.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -11
- data/app/assets/images/decidim/icons.svg +25 -6
- data/app/assets/javascripts/decidim/account_form.js.es6 +8 -8
- data/app/assets/javascripts/decidim/append_elements.js.es6 +1 -1
- data/app/assets/javascripts/decidim/append_redirect_url_to_modals.js.es6 +5 -5
- data/app/assets/javascripts/decidim/data_picker.js.es6 +10 -10
- data/app/assets/javascripts/decidim/editor.js.es6 +37 -22
- data/app/assets/javascripts/decidim/filters.js.es6 +1 -1
- data/app/assets/javascripts/decidim/form_filter.component.js.es6 +15 -15
- data/app/assets/javascripts/decidim/form_filter.component.test.js +29 -29
- data/app/assets/javascripts/decidim/impersonation.js.es6 +3 -3
- data/app/assets/javascripts/decidim/input_mentions.js.es6 +100 -0
- data/app/assets/javascripts/decidim/input_tags.js.es6 +12 -0
- data/app/assets/javascripts/decidim/{map.js.es6.erb → map.js.es6} +9 -9
- data/app/assets/javascripts/decidim/notifications.js.es6 +10 -10
- data/app/assets/javascripts/decidim/orders.js.es6 +5 -5
- data/app/assets/javascripts/decidim/user_registrations.js.es6 +4 -4
- data/app/assets/javascripts/decidim/widget.js.es6 +1 -1
- data/app/assets/javascripts/decidim.js.es6 +10 -0
- data/app/assets/stylesheets/decidim/application.scss.erb +1 -1
- data/app/assets/stylesheets/decidim/modules/_author-avatar.scss +39 -0
- data/app/assets/stylesheets/decidim/modules/_cards.scss +158 -3
- data/app/assets/stylesheets/decidim/modules/_definition-data.scss +6 -0
- data/app/assets/stylesheets/decidim/modules/_extra.scss +1 -3
- data/app/assets/stylesheets/decidim/modules/_icons.scss +14 -6
- data/app/assets/stylesheets/decidim/modules/_inline-filters.scss +61 -0
- data/app/assets/stylesheets/decidim/modules/_input-mentions.scss +124 -0
- data/app/assets/stylesheets/decidim/modules/_input-tags.scss +55 -0
- data/app/assets/stylesheets/decidim/modules/_modules.scss +3 -0
- data/app/assets/stylesheets/decidim/modules/_status-labels.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_typography.scss +16 -0
- data/app/assets/stylesheets/decidim/utils/_helpers.scss +29 -0
- data/app/assets/stylesheets/decidim/utils/_mixins.scss +6 -0
- data/app/cells/decidim/author_box/show.erb +10 -0
- data/app/cells/decidim/author_box_cell.rb +21 -0
- data/app/cells/decidim/card/show.erb +17 -0
- data/app/cells/decidim/card_cell.rb +29 -0
- data/app/cells/decidim/profile/profile_inline.erb +21 -0
- data/app/cells/decidim/profile/show.erb +13 -0
- data/app/cells/decidim/profile_cell.rb +17 -0
- data/app/commands/decidim/create_omniauth_registration.rb +3 -2
- data/app/commands/decidim/create_report.rb +1 -1
- data/app/commands/decidim/invite_user.rb +2 -0
- data/app/constraints/decidim/current_component.rb +41 -0
- data/app/controllers/concerns/decidim/action_authorization.rb +3 -3
- data/app/controllers/concerns/decidim/devise_controllers.rb +2 -1
- data/app/controllers/concerns/decidim/filter_resource.rb +1 -1
- data/app/controllers/concerns/decidim/form_factory.rb +1 -1
- data/app/controllers/concerns/decidim/impersonate_users.rb +6 -2
- data/app/controllers/concerns/decidim/needs_authorization.rb +2 -2
- data/app/controllers/concerns/decidim/participatory_space_context.rb +15 -0
- data/app/controllers/concerns/decidim/settings.rb +5 -5
- data/app/controllers/decidim/application_controller.rb +2 -1
- data/app/controllers/decidim/{features → components}/base_controller.rb +16 -8
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +3 -1
- data/app/controllers/decidim/devise/registrations_controller.rb +1 -3
- data/app/controllers/decidim/doorkeeper/authorizations_controller.rb +16 -0
- data/app/controllers/decidim/doorkeeper/credentials_controller.rb +46 -0
- data/app/controllers/decidim/doorkeeper/token_info_controller.rb +9 -0
- data/app/controllers/decidim/doorkeeper/tokens_controller.rb +9 -0
- data/app/controllers/decidim/widgets_controller.rb +1 -1
- data/app/forms/decidim/follow_form.rb +1 -1
- data/app/forms/decidim/form.rb +1 -1
- data/app/forms/decidim/omniauth_registration_form.rb +1 -0
- data/app/forms/decidim/registration_form.rb +5 -5
- data/app/helpers/decidim/card_helper.rb +16 -0
- data/app/helpers/decidim/component_path_helper.rb +36 -0
- data/app/helpers/decidim/icon_helper.rb +7 -7
- data/app/helpers/decidim/messaging/conversation_helper.rb +4 -3
- data/app/helpers/decidim/paginate_helper.rb +1 -1
- data/app/helpers/decidim/resource_helper.rb +2 -2
- data/app/jobs/decidim/export_job.rb +3 -3
- data/app/mailers/decidim/messaging/conversation_mailer.rb +0 -2
- data/app/middleware/decidim/current_organization.rb +2 -2
- data/app/models/decidim/abilities/admin_ability.rb +1 -1
- data/app/models/decidim/abilities/everyone_ability.rb +1 -1
- data/app/models/decidim/abilities/participatory_process_admin_ability.rb +2 -2
- data/app/models/decidim/abilities/participatory_process_collaborator_ability.rb +2 -2
- data/app/models/decidim/action_log.rb +7 -5
- data/app/models/decidim/area.rb +7 -0
- data/app/models/decidim/authorization.rb +14 -0
- data/app/models/decidim/{feature.rb → component.rb} +15 -15
- data/app/models/decidim/moderation.rb +1 -1
- data/app/models/decidim/oauth_application.rb +24 -0
- data/app/models/decidim/organization.rb +5 -0
- data/app/models/decidim/participatory_space_link.rb +20 -0
- data/app/models/decidim/participatory_space_private_user.rb +19 -0
- data/app/models/decidim/user.rb +7 -0
- data/app/presenters/decidim/admin_log/area_presenter.rb +38 -0
- data/app/presenters/decidim/admin_log/{feature_presenter.rb → component_presenter.rb} +5 -5
- data/app/presenters/decidim/admin_log/newsletter_resource_presenter.rb +1 -1
- data/app/presenters/decidim/admin_log/oauth_application_presenter.rb +50 -0
- data/app/presenters/decidim/admin_log/oauth_application_resource_presenter.rb +18 -0
- data/app/presenters/decidim/home_stats_presenter.rb +7 -7
- data/app/presenters/decidim/log/value_types/area_presenter.rb +1 -1
- data/app/presenters/decidim/log/value_types/area_type_presenter.rb +28 -0
- data/app/presenters/decidim/log/value_types/currency_presenter.rb +20 -0
- data/app/presenters/decidim/log/value_types/scope_presenter.rb +1 -1
- data/app/presenters/decidim/log/value_types/scope_type_presenter.rb +1 -1
- data/app/presenters/decidim/resource_locator_presenter.rb +3 -3
- data/app/services/decidim/action_authorizer.rb +9 -9
- data/app/services/decidim/action_logger.rb +9 -7
- data/app/services/decidim/email_notification_generator.rb +1 -1
- data/app/services/decidim/notification_generator_for_recipient.rb +1 -1
- data/app/services/decidim/resource_search.rb +8 -8
- data/app/services/decidim/settings_change.rb +5 -5
- data/app/services/decidim/static_map_generator.rb +1 -1
- data/app/types/decidim/core/attachment_type.rb +14 -0
- data/app/types/decidim/core/category_type.rb +16 -0
- data/app/types/decidim/core/coordinates_type.rb +19 -0
- data/app/types/decidim/core/scope_api_type.rb +16 -0
- data/app/uploaders/decidim/oauth_application_logo_uploader.rb +9 -0
- data/app/validators/geocoding_validator.rb +2 -2
- data/app/views/decidim/account/delete.html.erb +7 -7
- data/app/views/decidim/application/_collection.html.erb +1 -1
- data/app/views/decidim/application/_document.html.erb +1 -1
- data/app/views/decidim/application/_photos.html.erb +1 -1
- data/app/views/decidim/devise/invitations/edit.html.erb +1 -1
- data/app/views/decidim/devise/omniauth_registrations/new.html.erb +1 -1
- data/app/views/decidim/devise/registrations/new.html.erb +1 -1
- data/app/views/decidim/devise/sessions/new.html.erb +2 -2
- data/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +1 -1
- data/app/views/decidim/devise/shared/_omniauth_buttons_mini.html.erb +1 -1
- data/app/views/decidim/doorkeeper/authorizations/new.html.erb +58 -0
- data/app/views/decidim/messaging/conversations/_show.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/index.html.erb +1 -1
- data/app/views/decidim/notifications/index.html.erb +1 -1
- data/app/views/decidim/notifications_settings/show.html.erb +2 -2
- data/app/views/decidim/own_user_groups/index.html.erb +3 -3
- data/app/views/decidim/scopes/_scopes_picker_input.html.erb +4 -4
- data/app/views/decidim/scopes/picker.html.erb +3 -3
- data/app/views/decidim/shared/_action_authorization_modal.html.erb +1 -1
- data/app/views/decidim/shared/_author.html.erb +1 -1
- data/app/views/decidim/shared/_author_reference.html.erb +1 -12
- data/app/views/decidim/shared/{_feature_announcement.html.erb → _component_announcement.html.erb} +2 -2
- data/app/views/decidim/shared/_embed_modal.html.erb +1 -1
- data/app/views/decidim/shared/_flag_modal.html.erb +5 -5
- data/app/views/decidim/shared/_login_modal.html.erb +3 -3
- data/app/views/decidim/shared/_private_participatory_space.html.erb +5 -0
- data/app/views/decidim/shared/_share_modal.html.erb +1 -1
- data/app/views/decidim/shared/_tags.html.erb +1 -1
- data/app/views/decidim/shared/_version_author.html.erb +1 -1
- data/app/views/decidim/widgets/_data_picker.html.erb +4 -4
- data/app/views/devise/mailer/confirmation_instructions.html.erb +3 -3
- data/app/views/devise/mailer/invite_private_user.html.erb +17 -0
- data/app/views/devise/mailer/invite_private_user.text.erb +15 -0
- data/app/views/devise/mailer/password_change.html.erb +2 -2
- data/app/views/devise/mailer/reset_password_instructions.html.erb +5 -5
- data/app/views/kaminari/decidim/_first_page.html.erb +2 -3
- data/app/views/kaminari/decidim/_gap.html.erb +2 -3
- data/app/views/kaminari/decidim/_last_page.html.erb +2 -3
- data/app/views/kaminari/decidim/_next_page.html.erb +2 -3
- data/app/views/kaminari/decidim/_page.html.erb +2 -3
- data/app/views/kaminari/decidim/_paginator.html.erb +1 -2
- data/app/views/kaminari/decidim/_prev_page.html.erb +2 -3
- data/app/views/layouts/decidim/_application.html.erb +4 -4
- data/app/views/layouts/decidim/_component_authorization_modals.html.erb +5 -0
- data/app/views/layouts/decidim/_cookie_warning.html.erb +2 -2
- data/app/views/layouts/decidim/_head.html.erb +4 -4
- data/app/views/layouts/decidim/_impersonation_warning.html.erb +4 -4
- data/app/views/layouts/decidim/_language_chooser.html.erb +1 -1
- data/app/views/layouts/decidim/_social_media_links.html.erb +5 -5
- data/app/views/layouts/decidim/_wrapper.html.erb +5 -5
- data/app/views/layouts/decidim/mailer.html.erb +1 -1
- data/app/views/layouts/decidim/widget.html.erb +5 -5
- data/app/views/pages/home/_hero.html.erb +1 -1
- data/app/views/pages/home.html.erb +6 -6
- data/config/locales/ca.yml +66 -27
- data/config/locales/en.yml +69 -30
- data/config/locales/es.yml +66 -27
- data/config/locales/eu.yml +69 -30
- data/config/locales/fi.yml +69 -30
- data/config/locales/fr.yml +85 -46
- data/config/locales/gl.yml +69 -30
- data/config/locales/it.yml +69 -30
- data/config/locales/nl.yml +122 -83
- data/config/locales/pl.yml +69 -30
- data/config/locales/pt-BR.yml +69 -30
- data/config/locales/pt.yml +69 -30
- data/config/locales/ru.yml +0 -7
- data/config/locales/sv.yml +69 -30
- data/config/locales/uk.yml +0 -13
- data/config/routes.rb +8 -0
- data/db/migrate/20180206183235_create_participatory_space_private_users.rb +15 -0
- data/db/migrate/20180221101934_fix_nickname_index.rb +5 -6
- data/db/migrate/20180226140756_add_version_to_action_logs.rb +5 -1
- data/db/migrate/20180227131727_create_participatory_space_links.rb +12 -0
- data/db/migrate/20180305132906_rename_features_to_components.rb +13 -0
- data/db/migrate/20180308113207_doorkeeper_models.rb +85 -0
- data/db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb +2 -2
- data/db/migrate/{20180326075746_change_event_name_and_class_to_rename_to_publish_proposal_event.rb → 20180323102631_change_event_name_and_class_to_rename_to_publish_proposal_event.rb} +0 -0
- data/db/seeds.rb +12 -2
- data/lib/decidim/api/attachable_interface.rb +13 -0
- data/lib/decidim/api/authorable_interface.rb +13 -0
- data/lib/decidim/api/categorizable_interface.rb +13 -0
- data/lib/decidim/api/participatory_space_interface.rb +4 -4
- data/lib/decidim/api/scopable_interface.rb +13 -0
- data/lib/decidim/authorable.rb +8 -0
- data/lib/decidim/{feature_manifest.rb → component_manifest.rb} +24 -21
- data/lib/decidim/{feature_validator.rb → component_validator.rb} +6 -6
- data/lib/decidim/{features → components}/export_manifest.rb +4 -4
- data/lib/decidim/components/namer.rb +35 -0
- data/lib/decidim/components.rb +9 -0
- data/lib/decidim/content_parsers/user_parser.rb +1 -1
- data/lib/decidim/core/api.rb +13 -0
- data/lib/decidim/core/engine.rb +76 -3
- data/lib/decidim/core/test/factories.rb +43 -10
- data/lib/decidim/core/test/shared_examples/announcements_examples.rb +9 -9
- data/lib/decidim/core/test/shared_examples/attachable_interface_examples.rb +16 -0
- data/lib/decidim/core/test/shared_examples/authorable_interface_examples.rb +33 -0
- data/lib/decidim/core/test/shared_examples/categorizable_interface_examples.rb +19 -0
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +3 -3
- data/lib/decidim/core/test/shared_examples/follows_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/has_component.rb +21 -0
- data/lib/decidim/core/test/shared_examples/has_reference.rb +2 -2
- data/lib/decidim/core/test/shared_examples/localised_email.rb +1 -1
- data/lib/decidim/core/test/shared_examples/paginated_resource_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/reportable.rb +8 -6
- data/lib/decidim/core/test/shared_examples/reports_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/scopable_interface_examples.rb +19 -0
- data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +8 -3
- data/lib/decidim/core/test/shared_examples/simple_event.rb +1 -1
- data/lib/decidim/core/test/shared_examples/user_localised_email_examples.rb +1 -1
- data/lib/decidim/core/test.rb +1 -1
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +35 -37
- data/lib/decidim/events/base_event.rb +5 -5
- data/lib/decidim/events/simple_event.rb +8 -8
- data/lib/decidim/form_builder.rb +48 -3
- data/lib/decidim/has_attachment_collections.rb +1 -1
- data/lib/decidim/has_attachments.rb +1 -1
- data/lib/decidim/has_category.rb +2 -2
- data/lib/decidim/has_component.rb +23 -0
- data/lib/decidim/has_private_users.rb +26 -0
- data/lib/decidim/has_reference.rb +3 -3
- data/lib/decidim/page_finder.rb +1 -1
- data/lib/decidim/participatory_space_manifest.rb +3 -3
- data/lib/decidim/participatory_space_resourceable.rb +80 -0
- data/lib/decidim/publicable.rb +2 -2
- data/lib/decidim/query_extensions.rb +2 -2
- data/lib/decidim/rectify_ext.rb +32 -0
- data/lib/decidim/reportable.rb +1 -1
- data/lib/decidim/resource_manifest.rb +13 -13
- data/lib/decidim/resourceable.rb +8 -8
- data/lib/decidim/scopable.rb +1 -1
- data/lib/decidim/{scopable_feature.rb → scopable_component.rb} +1 -1
- data/lib/decidim/settings_manifest.rb +1 -1
- data/lib/decidim/stats_registry.rb +1 -1
- data/lib/decidim/view_model.rb +9 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.fr.js +4 -1
- data/vendor/assets/javascripts/form_datepicker.js.es6 +10 -10
- data/vendor/assets/javascripts/quill.min.js +2 -2
- data/vendor/assets/javascripts/quill.min.js.map +1 -1
- data/vendor/assets/javascripts/tagsinput.js +683 -0
- data/vendor/assets/javascripts/tribute.js +1607 -0
- data/vendor/assets/stylesheets/quill.bubble.css +30 -16
- data/vendor/assets/stylesheets/quill.core.css +19 -9
- data/vendor/assets/stylesheets/quill.snow.css +30 -16
- data/vendor/assets/stylesheets/tagsinput.css +55 -0
- data/vendor/assets/stylesheets/tribute.css +27 -0
- metadata +164 -27
- data/app/constraints/decidim/current_feature.rb +0 -41
- data/app/helpers/decidim/feature_path_helper.rb +0 -36
- data/app/views/layouts/decidim/_feature_authorization_modals.html.erb +0 -5
- data/lib/decidim/core/test/shared_examples/has_feature.rb +0 -21
- data/lib/decidim/features/namer.rb +0 -35
- data/lib/decidim/features.rb +0 -9
- data/lib/decidim/has_feature.rb +0 -23
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Log
|
5
|
+
module ValueTypes
|
6
|
+
# This class presents the given value as a Decidim::AreaType. Check
|
7
|
+
# the `DefaultPresenter` for more info on how value
|
8
|
+
# presenters work.
|
9
|
+
class AreaTypePresenter < DefaultPresenter
|
10
|
+
# Public: Presents the value as an AreaType. If the area type can
|
11
|
+
# be found, it shows its title. Otherwise it shows its ID.
|
12
|
+
#
|
13
|
+
# Returns an HTML-safe String.
|
14
|
+
def present
|
15
|
+
return unless value
|
16
|
+
return h.translated_attribute(area_type.name) if area_type
|
17
|
+
I18n.t("not_found", id: value, scope: "decidim.log.value_types.area_type_presenter")
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def area_type
|
23
|
+
@area_type ||= Decidim::AreaType.find_by(id: value)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Log
|
5
|
+
module ValueTypes
|
6
|
+
# This class presents the given value as a currency. Check
|
7
|
+
# the `DefaultPresenter` for more info on how value
|
8
|
+
# presenters work.
|
9
|
+
class CurrencyPresenter < DefaultPresenter
|
10
|
+
# Public: Presents the value as a currency.
|
11
|
+
#
|
12
|
+
# Returns an HTML-safe String.
|
13
|
+
def present
|
14
|
+
return unless value
|
15
|
+
h.number_to_currency(value, unit: Decidim.currency_unit)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -59,8 +59,8 @@ module Decidim
|
|
59
59
|
resource.class.try(:participatory_space_manifest)
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
63
|
-
resource.
|
62
|
+
def component
|
63
|
+
resource.component if resource.respond_to?(:component)
|
64
64
|
end
|
65
65
|
|
66
66
|
def member_route_name
|
@@ -72,7 +72,7 @@ module Decidim
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def route_proxy
|
75
|
-
@route_proxy ||= EngineRouter.main_proxy(
|
75
|
+
@route_proxy ||= EngineRouter.main_proxy(component || resource)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -2,30 +2,30 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
# This class is used to authorize a user against an action in the context of a
|
5
|
-
#
|
5
|
+
# component.
|
6
6
|
class ActionAuthorizer
|
7
7
|
#
|
8
8
|
# Initializes the ActionAuthorizer.
|
9
9
|
#
|
10
10
|
# user - The user to authorize against.
|
11
|
-
#
|
11
|
+
# component - The component to authenticate against.
|
12
12
|
# action - The action to authenticate.
|
13
13
|
#
|
14
|
-
def initialize(user,
|
14
|
+
def initialize(user, component, action)
|
15
15
|
@user = user
|
16
|
-
@
|
16
|
+
@component = component
|
17
17
|
@action = action.to_s if action
|
18
18
|
end
|
19
19
|
|
20
20
|
#
|
21
|
-
# Authorize user to perform an action in the context of a
|
21
|
+
# Authorize user to perform an action in the context of a component.
|
22
22
|
#
|
23
23
|
# Returns:
|
24
24
|
# :ok an empty hash - When there is no authorization handler related to the action.
|
25
25
|
# result of authorization handler check - When there is an authorization handler related to the action. Check Decidim::Verifications::DefaultActionAuthorizer class docs.
|
26
26
|
#
|
27
27
|
def authorize
|
28
|
-
raise AuthorizationError, "Missing data" unless
|
28
|
+
raise AuthorizationError, "Missing data" unless component && action
|
29
29
|
|
30
30
|
status_code, data = if authorization_handler_name
|
31
31
|
authorization_handler.authorize(authorization, permission_options)
|
@@ -38,7 +38,7 @@ module Decidim
|
|
38
38
|
|
39
39
|
private
|
40
40
|
|
41
|
-
attr_reader :user, :
|
41
|
+
attr_reader :user, :component, :action
|
42
42
|
|
43
43
|
def authorization
|
44
44
|
return nil unless user && authorization_handler_name
|
@@ -61,9 +61,9 @@ module Decidim
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def permission
|
64
|
-
return nil unless
|
64
|
+
return nil unless component && action
|
65
65
|
|
66
|
-
@permission ||=
|
66
|
+
@permission ||= component.permissions&.fetch(action, nil)
|
67
67
|
end
|
68
68
|
|
69
69
|
class AuthorizationStatus
|
@@ -48,8 +48,10 @@ module Decidim
|
|
48
48
|
organization: organization,
|
49
49
|
action: action,
|
50
50
|
resource: resource,
|
51
|
+
resource_id: resource.id,
|
52
|
+
resource_type: resource.class.name,
|
51
53
|
participatory_space: participatory_space,
|
52
|
-
|
54
|
+
component: component,
|
53
55
|
version_id: version_id,
|
54
56
|
extra: extra_data
|
55
57
|
)
|
@@ -63,12 +65,12 @@ module Decidim
|
|
63
65
|
user.organization
|
64
66
|
end
|
65
67
|
|
66
|
-
def
|
67
|
-
resource.
|
68
|
+
def component
|
69
|
+
resource.component if resource.respond_to?(:component)
|
68
70
|
end
|
69
71
|
|
70
72
|
def participatory_space
|
71
|
-
return
|
73
|
+
return component.participatory_space if component.respond_to?(:participatory_space)
|
72
74
|
resource.participatory_space if resource.respond_to?(:participatory_space)
|
73
75
|
end
|
74
76
|
|
@@ -86,9 +88,9 @@ module Decidim
|
|
86
88
|
# Returns a Hash.
|
87
89
|
def extra_data
|
88
90
|
{
|
89
|
-
|
90
|
-
manifest_name:
|
91
|
-
title: title_for(
|
91
|
+
component: {
|
92
|
+
manifest_name: component.try(:manifest_name),
|
93
|
+
title: title_for(component)
|
92
94
|
}.compact,
|
93
95
|
participatory_space: {
|
94
96
|
manifest_name: participatory_space_manifest_name,
|
@@ -45,7 +45,7 @@ module Decidim
|
|
45
45
|
#
|
46
46
|
# Returns nothing.
|
47
47
|
def send_email_to(recipient_id)
|
48
|
-
recipient = Decidim::User.
|
48
|
+
recipient = Decidim::User.find_by(id: recipient_id)
|
49
49
|
return unless recipient
|
50
50
|
return unless recipient.email_on_notification?
|
51
51
|
|
@@ -16,12 +16,12 @@ module Decidim
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# Creates the SearchLight base query.
|
19
|
-
# Check if the option
|
19
|
+
# Check if the option component was provided.
|
20
20
|
def base_query
|
21
21
|
# raise order_start_time.inspect
|
22
|
-
raise "Missing
|
22
|
+
raise "Missing component" unless component
|
23
23
|
|
24
|
-
@scope.where(
|
24
|
+
@scope.where(component: component)
|
25
25
|
end
|
26
26
|
|
27
27
|
# Handle the category_id filter
|
@@ -57,17 +57,17 @@ module Decidim
|
|
57
57
|
# Private: Creates an array of category ids.
|
58
58
|
# It contains categories' subcategories ids as well.
|
59
59
|
def category_ids
|
60
|
-
|
60
|
+
component
|
61
61
|
.categories
|
62
62
|
.where(id: category_id)
|
63
|
-
.or(
|
63
|
+
.or(component.categories.where(parent_id: category_id))
|
64
64
|
.pluck(:id)
|
65
65
|
end
|
66
66
|
|
67
|
-
# Private: Since
|
67
|
+
# Private: Since component is not used by a search method we need
|
68
68
|
# to define the method manually.
|
69
|
-
def
|
70
|
-
options[:
|
69
|
+
def component
|
70
|
+
options[:component]
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Decidim
|
4
|
-
# This is a helper class in order to publish
|
4
|
+
# This is a helper class in order to publish component and settings changes
|
5
5
|
# so that components can react to these changes and send notifications to users.
|
6
6
|
class SettingsChange
|
7
7
|
# Publishes a change to ActiveSupport::Notifications.
|
8
8
|
#
|
9
|
-
#
|
9
|
+
# component - The Decidim::Component where the changes have been applied.
|
10
10
|
# previous_settings - A Hash or a Decidim::SettingsManifest schema with the settings before changing them.
|
11
11
|
# current_settings - A Hash or a Decidim::SettingsManifest schema with the current settings.
|
12
|
-
def self.publish(
|
12
|
+
def self.publish(component, previous_settings, current_settings)
|
13
13
|
ActiveSupport::Notifications.publish(
|
14
|
-
"decidim.settings_change.#{
|
15
|
-
|
14
|
+
"decidim.settings_change.#{component.manifest_name}",
|
15
|
+
component_id: component.id,
|
16
16
|
previous_settings: previous_settings.to_h.deep_symbolize_keys,
|
17
17
|
current_settings: current_settings.to_h.deep_symbolize_keys
|
18
18
|
)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Core
|
5
|
+
AttachmentType = GraphQL::ObjectType.define do
|
6
|
+
name "Attachment"
|
7
|
+
description "A file attachment"
|
8
|
+
|
9
|
+
field :url, !types.String, "The url of this attachment"
|
10
|
+
field :type, !types.String, "The type of this attachment", property: :file_type
|
11
|
+
field :thumbnail, types.String, "A thumbnail of this attachment, if it's an image.", property: :thumbnail_url
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Core
|
5
|
+
CategoryType = GraphQL::ObjectType.define do
|
6
|
+
name "Category"
|
7
|
+
description "A category that can be applied to other resources."
|
8
|
+
|
9
|
+
field :id, !types.ID
|
10
|
+
field :name, !TranslatedFieldType, "The name of this category."
|
11
|
+
|
12
|
+
field :subcategories, !types[Decidim::Core::CategoryType], "Subcategories of this category."
|
13
|
+
field :parent, Decidim::Core::CategoryType, "This category's parent category."
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Core
|
5
|
+
# This type represents a Decidim's global property.
|
6
|
+
CoordinatesType = GraphQL::ObjectType.define do
|
7
|
+
name "Coordinates"
|
8
|
+
description "Physical coordinates for a location"
|
9
|
+
|
10
|
+
field :latitude, !types.Float, "Latitude of this coordinate" do
|
11
|
+
resolve ->(coordinates, _args, _ctx) { coordinates[0] }
|
12
|
+
end
|
13
|
+
|
14
|
+
field :longitude, !types.Float, "Longitude of this coordinate" do
|
15
|
+
resolve ->(coordinates, _args, _ctx) { coordinates[1] }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Core
|
5
|
+
ScopeApiType = GraphQL::ObjectType.define do
|
6
|
+
name "Scope"
|
7
|
+
description "A scope"
|
8
|
+
|
9
|
+
field :id, !types.ID
|
10
|
+
field :name, !TranslatedFieldType, "The name of this scope."
|
11
|
+
|
12
|
+
field :children, !types[Decidim::Core::ScopeApiType], "Descendants of this scope"
|
13
|
+
field :parent, Decidim::Core::ScopeApiType, "This scope's parent scope."
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -4,8 +4,8 @@
|
|
4
4
|
# an existing address and computes its coordinates.
|
5
5
|
class GeocodingValidator < ActiveModel::EachValidator
|
6
6
|
def validate_each(record, attribute, value)
|
7
|
-
if Decidim.geocoder.present? && record.
|
8
|
-
organization = record.
|
7
|
+
if Decidim.geocoder.present? && record.component.present?
|
8
|
+
organization = record.component.organization
|
9
9
|
Geocoder.configure(Geocoder.config.merge(http_headers: { "Referer" => organization.host }))
|
10
10
|
coordinates = Geocoder.coordinates(value)
|
11
11
|
|
@@ -1,27 +1,27 @@
|
|
1
1
|
<div class="row">
|
2
2
|
<div class="columns large-8 end">
|
3
3
|
<div class="callout alert">
|
4
|
-
<p><%= t(
|
4
|
+
<p><%= t(".alert") %></p>
|
5
5
|
</div>
|
6
|
-
<p><%= t(
|
6
|
+
<p><%= t(".explanation") %></p>
|
7
7
|
<%= decidim_form_for(@form, url: account_path, method: :delete, html: { class: "user-form delete-account" }) do |f| %>
|
8
8
|
<div>
|
9
9
|
<label>
|
10
|
-
<span class="user-form__label"><%= t(
|
10
|
+
<span class="user-form__label"><%= t("activemodel.attributes.account.delete_reason") %></span>
|
11
11
|
<%= f.text_area :delete_reason, rows: 2, label: false %>
|
12
12
|
</label>
|
13
13
|
</div>
|
14
|
-
<input type="submit" class="button open-modal-button" value="<%= t(
|
14
|
+
<input type="submit" class="button open-modal-button" value="<%= t(".confirm.title") %>" />
|
15
15
|
<% end %>
|
16
16
|
<div class="tiny reveal" id="deleteConfirm" data-reveal>
|
17
17
|
<%= decidim_form_for(@form, url: account_path, method: :delete, html: { class: "user-form delete-account-modal" }) do |f| %>
|
18
18
|
<%= f.hidden_field :delete_reason %>
|
19
19
|
|
20
|
-
<p><%= t(
|
20
|
+
<p><%= t(".confirm.question") %></p>
|
21
21
|
|
22
|
-
<input type="submit" class="button expanded" value="<%= t(
|
22
|
+
<input type="submit" class="button expanded" value="<%= t(".confirm.ok") %>" />
|
23
23
|
|
24
|
-
<button class="close-button" data-close aria-label="<%= t(
|
24
|
+
<button class="close-button" data-close aria-label="<%= t(".confirm.close") %>" type="button">
|
25
25
|
<span aria-hidden="true">×</span>
|
26
26
|
</button>
|
27
27
|
<% end %>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<small>(<%= attachment_collection.attachments.count %> <%= t(".documents", count: attachment_collection.attachments.count) %>)</small>
|
6
6
|
</h6>
|
7
7
|
<div id="docs-collection-<%= attachment_collection.id %>" class="docs__content hide" data-toggler=".hide">
|
8
|
-
<p><%= translated_attribute(attachment_collection.description)
|
8
|
+
<p><%= translated_attribute(attachment_collection.description) %></p>
|
9
9
|
<div class="card card--list">
|
10
10
|
<%= render partial: "document", collection: documents %>
|
11
11
|
</div>
|
@@ -12,7 +12,7 @@
|
|
12
12
|
</div>
|
13
13
|
</div>
|
14
14
|
<div class="card--list__data">
|
15
|
-
<%= link_to document.url, class: "card--list__data__icon" do %>
|
15
|
+
<%= link_to document.url, target: "_blank", class: "card--list__data__icon" do %>
|
16
16
|
<%= icon "cloud-download" %>
|
17
17
|
<% end %>
|
18
18
|
</div>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<% photos.in_groups_of(3, false).each do |group| %>
|
6
6
|
<% group.each_with_index do |photo, index| %>
|
7
7
|
<div class="columns small-6 medium-4 <%= (index == 2 || photo == group.last ? "end" : "") %>">
|
8
|
-
<%= link_to photo.big_url do %>
|
8
|
+
<%= link_to photo.big_url, target: "_blank" do %>
|
9
9
|
<%= image_tag photo.thumbnail_url, class:"thumbnail", alt: strip_tags(translated_attribute(photo.description)) %>
|
10
10
|
<% end %>
|
11
11
|
</div>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<%= decidim_form_for resource, as: resource_name, url: invitation_path(resource_name, invite_redirect: params[:invite_redirect]), html: { method: :put, class: "register-form new_user" } do |f| %>
|
14
14
|
<%= f.hidden_field :invitation_token %>
|
15
15
|
|
16
|
-
<%= f.text_field :nickname, help_text: t("devise.invitations.edit.nickname_help") %>
|
16
|
+
<%= f.text_field :nickname, help_text: t("devise.invitations.edit.nickname_help", organization: current_organization.name) %>
|
17
17
|
|
18
18
|
<% if f.object.class.require_password_on_accepting %>
|
19
19
|
<%= f.password_field :password %></p>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<div class="columns large-8 large-centered text-center page-title">
|
7
7
|
<h1 class="heading1"><%= t("devise.sessions.new.sign_in") %></h1>
|
8
8
|
<p>
|
9
|
-
<%= t(
|
9
|
+
<%= t(".are_you_new?") %>
|
10
10
|
<%= link_to t(".register"), new_user_registration_path %>
|
11
11
|
</p>
|
12
12
|
</div>
|
@@ -18,7 +18,7 @@
|
|
18
18
|
<%= decidim_form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "register-form new_user" }) do |f| %>
|
19
19
|
<div>
|
20
20
|
<div class="field">
|
21
|
-
<%= f.email_field :email, autofocus: true
|
21
|
+
<%= f.email_field :email, autofocus: true %>
|
22
22
|
</div>
|
23
23
|
<div class="field">
|
24
24
|
<%= f.password_field :password, autocomplete: "off" %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div class="row">
|
3
3
|
<div class="columns large-4 mediumlarge-6 medium-8 medium-centered">
|
4
4
|
<span class="register__separator">
|
5
|
-
<span class="register__separator__text"><%= t(
|
5
|
+
<span class="register__separator__text"><%= t(".or") %></span>
|
6
6
|
</span>
|
7
7
|
<%- resource_class.omniauth_providers.each do |provider| %>
|
8
8
|
<% if social_provider_enabled? provider %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div class="row">
|
3
3
|
<div class="columns medium-8 medium-centered">
|
4
4
|
<span class="register__separator">
|
5
|
-
<span class="register__separator__text"><%= t(
|
5
|
+
<span class="register__separator__text"><%= t("or", scope: "decidim.devise.shared.omniauth_buttons") %></span>
|
6
6
|
</span>
|
7
7
|
<div class="text-center">
|
8
8
|
<%- Decidim::User.omniauth_providers.each do |provider| %>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<main class="wrapper">
|
2
|
+
<div class="row collapse">
|
3
|
+
<div class="row">
|
4
|
+
<div class="columns large-8 medium-centered">
|
5
|
+
<div class="card">
|
6
|
+
<div class="card__content">
|
7
|
+
<div class="row">
|
8
|
+
<div class="columns medium-2 text-center">
|
9
|
+
<img src="<%= oauth_application.organization_logo.url %>" alt="<%= oauth_application.organization_name %>" width="75" height="75" />
|
10
|
+
</div>
|
11
|
+
<div class="columns medium-10">
|
12
|
+
<h3 class="heading3"><%= t(".wants_to_use_your_account_html", application_name: oauth_application.name) %>
|
13
|
+
<br />
|
14
|
+
<%= t(".by_organization_link_html", link: link_to(oauth_application.organization_name, oauth_application.organization_url)) %>
|
15
|
+
</h3>
|
16
|
+
<br />
|
17
|
+
<p class="lead"><%= t(".connect_your_account_html", organization: current_organization.name) %></p>
|
18
|
+
<div>
|
19
|
+
<p><strong><%= t(".this_application_will_be_able_to") %></strong></p>
|
20
|
+
<ul>
|
21
|
+
<li><%= t(".see_name") %></li>
|
22
|
+
<li><%= t(".see_username") %></li>
|
23
|
+
<li><%= t(".see_email") %></li>
|
24
|
+
</ul>
|
25
|
+
</div>
|
26
|
+
<div>
|
27
|
+
<p><strong class="primary"><%= t(".this_application_will_not_be_able_to") %></strong></p>
|
28
|
+
<ul>
|
29
|
+
<li><%= t(".update_profile") %></li>
|
30
|
+
<li><%= t(".publish_content") %></li>
|
31
|
+
</ul>
|
32
|
+
</div>
|
33
|
+
<div class="row">
|
34
|
+
<%= form_tag oauth_authorization_path, method: :post, class: "column medium-5 small-7 medium-5" do %>
|
35
|
+
<%= hidden_field_tag :client_id, @pre_auth.client.uid %>
|
36
|
+
<%= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri %>
|
37
|
+
<%= hidden_field_tag :state, @pre_auth.state %>
|
38
|
+
<%= hidden_field_tag :response_type, @pre_auth.response_type %>
|
39
|
+
<%= hidden_field_tag :scope, @pre_auth.scope %>
|
40
|
+
<button class="column button button--nomargin secondary light" type="submit" name="authorize"><%= t(".authorize") %></button>
|
41
|
+
<% end %>
|
42
|
+
<%= form_tag oauth_authorization_path, method: :delete, class: "column small-4 medium-3 small-push-1 end" do %>
|
43
|
+
<%= hidden_field_tag :client_id, @pre_auth.client.uid %>
|
44
|
+
<%= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri %>
|
45
|
+
<%= hidden_field_tag :state, @pre_auth.state %>
|
46
|
+
<%= hidden_field_tag :response_type, @pre_auth.response_type %>
|
47
|
+
<%= hidden_field_tag :scope, @pre_auth.scope %>
|
48
|
+
<button class="column button button--nomargin" type="submit" name="cancel"><%= t(".cancel") %></button>
|
49
|
+
<% end %>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
</main>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<main class="wrapper">
|
2
2
|
<div class="row">
|
3
3
|
<div class="columns">
|
4
|
-
<div class="title-action"
|
4
|
+
<div class="title-action">
|
5
5
|
<h1 class="heading1 title-action__title">
|
6
6
|
<%= link_to decidim.conversations_path, class: "card--list__data__icon card--list__data__icon--back" do %>
|
7
7
|
<%= icon "chevron-left" %>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<main class="wrapper" id="notifications">
|
2
2
|
<div class="row">
|
3
3
|
<div class="columns">
|
4
|
-
<div class="title-action"
|
4
|
+
<div class="title-action">
|
5
5
|
<h1 class="heading1 title-action__title"><%= t("title", scope: "layouts.decidim.notifications_dashboard") %></h1>
|
6
6
|
<% if notifications.any? %>
|
7
7
|
<%= link_to(
|
@@ -4,14 +4,14 @@
|
|
4
4
|
<label>
|
5
5
|
<%= f.check_box :email_on_notification, label: false, class: "switch-input" %>
|
6
6
|
<span class="switch-paddle"></span>
|
7
|
-
<span class="switch-label"><%= t(
|
7
|
+
<span class="switch-label"><%= t(".email_on_notification") %></span>
|
8
8
|
</label>
|
9
9
|
</div>
|
10
10
|
<div class="switch tiny switch-with-label newsletter_notifications">
|
11
11
|
<label>
|
12
12
|
<%= f.check_box :newsletter_notifications, label: false, class: "switch-input" %>
|
13
13
|
<span class="switch-paddle"></span>
|
14
|
-
<span class="switch-label"><%= t(
|
14
|
+
<span class="switch-label"><%= t(".newsletter_notifications") %></span>
|
15
15
|
</label>
|
16
16
|
</div>
|
17
17
|
<%= f.submit t(".update_notifications_settings"), disable_with: true %>
|
@@ -10,13 +10,13 @@
|
|
10
10
|
</h5>
|
11
11
|
<span class="text-small"><%= l(user_group.created_at, format: :long) %></span>
|
12
12
|
<% if user_group.verified? %>
|
13
|
-
<span class="success label"><%= t(
|
13
|
+
<span class="success label"><%= t(".verified") %></span>
|
14
14
|
<% end %>
|
15
15
|
<% if user_group.rejected? %>
|
16
|
-
<span class="alert label"><%= t(
|
16
|
+
<span class="alert label"><%= t(".rejected") %></span>
|
17
17
|
<% end %>
|
18
18
|
<% if user_group.pending? %>
|
19
|
-
<span class="warning label"><%= t(
|
19
|
+
<span class="warning label"><%= t(".pending") %></span>
|
20
20
|
<% end %>
|
21
21
|
</div>
|
22
22
|
</div>
|