decidim-core 0.11.2 → 0.12.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/decidim/notifications.js.es6 +8 -6
- data/app/assets/javascripts/decidim/user_registrations.js.es6 +25 -1
- data/app/assets/stylesheets/decidim/application.scss.erb +4 -0
- data/app/assets/stylesheets/decidim/layouts/_home.scss +79 -0
- data/app/assets/stylesheets/decidim/modules/_author-avatar.scss +2 -1
- data/app/assets/stylesheets/decidim/modules/_cards.scss +82 -38
- data/app/assets/stylesheets/decidim/modules/_collapsible-list.scss +16 -0
- data/app/assets/stylesheets/decidim/modules/_definition-data.scss +27 -0
- data/app/assets/stylesheets/decidim/modules/_fingerprint.scss +8 -0
- data/app/assets/stylesheets/decidim/modules/_horizontal-tabs.scss +51 -0
- data/app/assets/stylesheets/decidim/modules/_inline-filters.scss +5 -3
- data/app/assets/stylesheets/decidim/modules/_margins.scss +6 -4
- data/app/assets/stylesheets/decidim/modules/_modules.scss +3 -0
- data/app/assets/stylesheets/decidim/modules/_navbar.scss +113 -7
- data/app/assets/stylesheets/decidim/modules/_signup.scss +22 -5
- data/app/assets/stylesheets/decidim/modules/_toggle.scss +9 -0
- data/app/assets/stylesheets/decidim/modules/_typography.scss +5 -1
- data/app/assets/stylesheets/decidim/utils/_helpers.scss +42 -0
- data/app/assets/stylesheets/decidim/utils/_mixins.scss +6 -0
- data/app/assets/stylesheets/decidim/utils/_settings.scss +3 -2
- data/app/cells/decidim/announcement/show.erb +11 -0
- data/app/cells/decidim/announcement_cell.rb +32 -0
- data/app/cells/decidim/author/comments.erb +6 -0
- data/app/cells/decidim/author/contact.erb +3 -0
- data/app/cells/decidim/author/date.erb +5 -0
- data/app/cells/decidim/author/flag.erb +5 -0
- data/app/cells/decidim/author/profile.erb +9 -0
- data/app/cells/decidim/{profile → author}/profile_inline.erb +1 -1
- data/app/cells/decidim/author/show.erb +18 -0
- data/app/cells/decidim/author/withdraw.erb +6 -0
- data/app/cells/decidim/author_cell.rb +109 -0
- data/app/cells/decidim/card/show.erb +18 -16
- data/app/cells/decidim/card_cell.rb +17 -4
- data/app/cells/decidim/card_m/author.erb +3 -0
- data/app/cells/decidim/card_m/badge.erb +1 -0
- data/app/cells/decidim/card_m/comments_counter.erb +3 -0
- data/app/cells/decidim/card_m/data.erb +0 -0
- data/app/cells/decidim/card_m/footer.erb +0 -0
- data/app/cells/decidim/card_m/header.erb +17 -0
- data/app/cells/decidim/card_m/image.erb +5 -0
- data/app/cells/decidim/card_m/label.erb +3 -0
- data/app/cells/decidim/card_m/show.erb +24 -0
- data/app/cells/decidim/card_m/status.erb +9 -0
- data/app/cells/decidim/card_m/tags.erb +0 -0
- data/app/cells/decidim/card_m_cell.rb +136 -0
- data/app/cells/decidim/collapsible_list/show.erb +20 -0
- data/app/cells/decidim/collapsible_list_cell.rb +66 -0
- data/app/cells/decidim/fingerprint/show.erb +22 -0
- data/app/cells/decidim/fingerprint_cell.rb +17 -0
- data/app/cells/decidim/follow_button/show.erb +34 -0
- data/app/cells/decidim/follow_button_cell.rb +40 -0
- data/app/cells/decidim/followers/show.erb +9 -0
- data/app/cells/decidim/followers_cell.rb +18 -0
- data/app/cells/decidim/following/show.erb +9 -0
- data/app/cells/decidim/following_cell.rb +24 -0
- data/app/cells/decidim/notifications/show.erb +48 -0
- data/app/cells/decidim/notifications_cell.rb +21 -0
- data/app/cells/decidim/progress_bar/show.erb +17 -0
- data/app/cells/decidim/progress_bar_cell.rb +68 -0
- data/app/cells/decidim/tags/category.erb +1 -0
- data/app/cells/decidim/tags/scope.erb +1 -0
- data/app/cells/decidim/tags/show.erb +5 -0
- data/app/cells/decidim/tags_cell.rb +62 -0
- data/app/cells/decidim/tos_page/announcement.erb +2 -0
- data/app/cells/decidim/tos_page/refuse_btn_modal.erb +23 -0
- data/app/cells/decidim/tos_page/sticky_form.erb +29 -0
- data/app/cells/decidim/tos_page_cell.rb +39 -0
- data/app/cells/decidim/user_profile/footer.erb +5 -0
- data/app/cells/decidim/user_profile/header.erb +20 -0
- data/app/cells/decidim/user_profile_cell.rb +26 -0
- data/app/commands/decidim/create_omniauth_registration.rb +1 -1
- data/app/commands/decidim/create_registration.rb +2 -1
- data/app/commands/decidim/search.rb +45 -0
- data/app/controllers/concerns/decidim/devise_controllers.rb +15 -12
- data/app/controllers/concerns/decidim/http_caching_disabler.rb +21 -0
- data/app/controllers/concerns/decidim/impersonate_users.rb +1 -6
- data/app/controllers/concerns/decidim/locale_switcher.rb +1 -1
- data/app/controllers/concerns/decidim/needs_permission.rb +70 -0
- data/app/controllers/concerns/decidim/needs_tos_accepted.rb +42 -0
- data/app/controllers/concerns/decidim/participatory_space_context.rb +1 -7
- data/app/controllers/concerns/decidim/user_profile.rb +3 -1
- data/app/controllers/decidim/account_controller.rb +4 -4
- data/app/controllers/decidim/application_controller.rb +17 -8
- data/app/controllers/decidim/components/base_controller.rb +14 -9
- data/app/controllers/decidim/cookie_policy_controller.rb +0 -2
- data/app/controllers/decidim/devise/confirmations_controller.rb +13 -0
- data/app/controllers/decidim/devise/invitations_controller.rb +3 -1
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +9 -3
- data/app/controllers/decidim/devise/passwords_controller.rb +1 -1
- data/app/controllers/decidim/devise/registrations_controller.rb +1 -7
- data/app/controllers/decidim/doorkeeper/authorizations_controller.rb +0 -2
- data/app/controllers/decidim/doorkeeper/credentials_controller.rb +0 -1
- data/app/controllers/decidim/errors_controller.rb +0 -2
- data/app/controllers/decidim/follows_controller.rb +4 -2
- data/app/controllers/decidim/locales_controller.rb +1 -1
- data/app/controllers/decidim/messaging/conversations_controller.rb +5 -5
- data/app/controllers/decidim/newsletters_controller.rb +0 -2
- data/app/controllers/decidim/notifications_controller.rb +3 -19
- data/app/controllers/decidim/notifications_settings_controller.rb +2 -2
- data/app/controllers/decidim/pages_controller.rb +12 -10
- data/app/controllers/decidim/profiles_controller.rb +10 -4
- data/app/controllers/decidim/reports_controller.rb +14 -1
- data/app/controllers/decidim/scopes_controller.rb +3 -3
- data/app/controllers/decidim/searches_controller.rb +39 -0
- data/app/controllers/decidim/static_map_controller.rb +0 -2
- data/app/controllers/decidim/tos_controller.rb +20 -0
- data/app/controllers/decidim/widgets_controller.rb +0 -1
- data/app/forms/decidim/follow_form.rb +1 -0
- data/app/forms/decidim/registration_form.rb +2 -1
- data/app/helpers/decidim/card_helper.rb +2 -0
- data/app/helpers/decidim/cells_paginate_helper.rb +16 -0
- data/app/helpers/decidim/cta_button_helper.rb +1 -1
- data/app/helpers/decidim/decidim_form_helper.rb +4 -0
- data/app/helpers/decidim/icon_helper.rb +2 -0
- data/app/helpers/decidim/resource_helper.rb +1 -2
- data/app/helpers/decidim/scopes_helper.rb +17 -10
- data/app/helpers/decidim/searches_helper.rb +16 -0
- data/app/helpers/decidim/tooltip_helper.rb +12 -0
- data/app/models/decidim/organization.rb +10 -0
- data/app/models/decidim/permission_action.rb +40 -0
- data/app/models/decidim/searchable_resource.rb +37 -0
- data/app/models/decidim/static_page.rb +4 -0
- data/app/models/decidim/user.rb +39 -3
- data/app/permissions/decidim/default_permissions.rb +61 -0
- data/app/permissions/decidim/permissions.rb +106 -0
- data/app/permissions/decidim/user_manager_permissions.rb +24 -0
- data/app/presenters/decidim/admin_log/organization_presenter.rb +2 -1
- data/app/presenters/decidim/home_stats_presenter.rb +2 -8
- data/app/presenters/decidim/user_presenter.rb +8 -0
- data/app/services/decidim/traceability.rb +6 -9
- data/app/types/decidim/core/user_type.rb +1 -1
- data/app/views/decidim/devise/invitations/edit.html.erb +56 -10
- data/app/views/decidim/devise/registrations/new.html.erb +36 -14
- data/app/views/decidim/devise/shared/_newsletter_modal.html.erb +25 -0
- data/app/views/decidim/follows/update_button.js.erb +2 -2
- data/app/views/decidim/messaging/conversations/_message.html.erb +1 -1
- data/app/views/{pages → decidim/pages}/decidim_page.html.erb +5 -0
- data/app/views/decidim/pages/home.html.erb +17 -0
- data/app/views/{pages → decidim/pages}/home/_extended.html.erb +0 -0
- data/app/views/{pages → decidim/pages}/home/_footer_sub_hero.html.erb +0 -0
- data/app/views/{pages → decidim/pages}/home/_hero.html.erb +0 -0
- data/app/views/{pages → decidim/pages}/home/_highlighted_content_banner.html.erb +0 -0
- data/app/views/{pages → decidim/pages}/home/_highlighted_processes.html.erb +0 -0
- data/app/views/{pages → decidim/pages}/home/_statistics.html.erb +0 -0
- data/app/views/{pages → decidim/pages}/home/_sub_hero.html.erb +0 -0
- data/app/views/decidim/profiles/_followers.html.erb +5 -0
- data/app/views/decidim/profiles/_following.html.erb +5 -0
- data/app/views/decidim/profiles/_notifications.html.erb +0 -0
- data/app/views/decidim/profiles/_user.html.erb +59 -0
- data/app/views/decidim/profiles/_user_follow.erb +32 -0
- data/app/views/decidim/profiles/show.html.erb +32 -59
- data/app/views/decidim/searches/_count.html.erb +1 -0
- data/app/views/decidim/searches/_filters.html.erb +20 -0
- data/app/views/decidim/searches/_filters_small_view.html.erb +18 -0
- data/app/views/decidim/searches/_results.html.erb +5 -0
- data/app/views/decidim/searches/index.html.erb +20 -0
- data/app/views/decidim/searches/index.js.erb +5 -0
- data/app/views/decidim/shared/_address_details.html.erb +7 -9
- data/app/views/decidim/shared/_announcement.html.erb +1 -6
- data/app/views/decidim/shared/_author_reference.html.erb +1 -1
- data/app/views/decidim/shared/_follow_button.html.erb +1 -34
- data/app/views/decidim/shared/_static_map.html.erb +3 -1
- data/app/views/decidim/shared/_tags.html.erb +1 -11
- data/app/views/kaminari/decidim/_paginator.html.erb +16 -15
- data/app/views/layouts/decidim/_head.html.erb +1 -0
- data/app/views/layouts/decidim/_topbar_search.html.erb +8 -0
- data/app/views/layouts/decidim/_user_menu.html.erb +2 -2
- data/app/views/layouts/decidim/_wrapper.html.erb +3 -2
- data/config/initializers/devise.rb +1 -1
- data/config/initializers/rack_attack.rb +28 -0
- data/config/locales/ca.yml +136 -55
- data/config/locales/en.yml +135 -54
- data/config/locales/es.yml +136 -55
- data/config/locales/eu.yml +136 -54
- data/config/locales/fi.yml +135 -54
- data/config/locales/fr.yml +136 -54
- data/config/locales/gl.yml +136 -54
- data/config/locales/it.yml +136 -54
- data/config/locales/nl.yml +136 -54
- data/config/locales/pl.yml +144 -54
- data/config/locales/pt-BR.yml +136 -54
- data/config/locales/pt.yml +136 -54
- data/config/locales/ru.yml +150 -60
- data/config/locales/sv.yml +136 -54
- data/config/locales/uk.yml +146 -57
- data/config/routes.rb +11 -1
- data/db/migrate/20180209122819_create_decidim_searchable_resource.rb +21 -0
- data/db/migrate/20180508111640_add_tos_version_to_organization.rb +19 -0
- data/db/migrate/20180508111710_add_accepted_tos_version_field_to_users.rb +25 -0
- data/db/seeds.rb +33 -26
- data/lib/decidim/component_manifest.rb +35 -27
- data/lib/decidim/content_processor.rb +21 -3
- data/lib/decidim/core.rb +27 -16
- data/lib/decidim/core/engine.rb +8 -19
- data/lib/decidim/core/test.rb +2 -0
- data/lib/decidim/core/test/factories.rb +34 -4
- data/lib/decidim/core/test/shared_examples/fingerprint_examples.rb +15 -0
- data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +27 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/events/base_event.rb +5 -1
- data/lib/decidim/fingerprint_calculator.rb +42 -0
- data/lib/decidim/fingerprintable.rb +63 -0
- data/lib/decidim/form_builder.rb +1 -0
- data/lib/decidim/manifest_registry.rb +4 -10
- data/lib/decidim/participable.rb +4 -0
- data/lib/decidim/participatory_space_manifest.rb +36 -0
- data/lib/decidim/participatory_space_resourceable.rb +11 -0
- data/lib/decidim/resource_manifest.rb +10 -11
- data/lib/decidim/resourceable.rb +3 -2
- data/lib/decidim/search_resource_fields_mapper.rb +93 -0
- data/lib/decidim/searchable.rb +85 -0
- data/lib/decidim/settings_manifest.rb +3 -2
- data/lib/decidim/traceable.rb +2 -0
- data/lib/decidim/view_model.rb +9 -0
- data/lib/tasks/decidim_tasks.rake +79 -1
- metadata +149 -76
- data/app/assets/stylesheets/decidim/extras/_register_form.scss +0 -9
- data/app/cells/decidim/author_box/show.erb +0 -10
- data/app/cells/decidim/author_box_cell.rb +0 -21
- data/app/cells/decidim/profile/show.erb +0 -13
- data/app/cells/decidim/profile_cell.rb +0 -17
- data/app/controllers/concerns/decidim/needs_authorization.rb +0 -46
- data/app/models/decidim/abilities/admin_ability.rb +0 -29
- data/app/models/decidim/abilities/base_ability.rb +0 -56
- data/app/models/decidim/abilities/everyone_ability.rb +0 -25
- data/app/models/decidim/abilities/participatory_process_admin_ability.rb +0 -28
- data/app/models/decidim/abilities/participatory_process_collaborator_ability.rb +0 -28
- data/app/models/decidim/abilities/participatory_process_moderator_ability.rb +0 -15
- data/app/models/decidim/abilities/user_manager_ability.rb +0 -35
- data/app/views/decidim/notifications/_notification.html.erb +0 -20
- data/app/views/decidim/notifications/index.html.erb +0 -36
- data/app/views/decidim/shared/_author.html.erb +0 -21
- data/app/views/pages/home.html.erb +0 -17
- data/db/migrate/20180613080638_rename_missing_features_to_components.rb +0 -15
- data/lib/decidim/abilities.rb +0 -7
- data/lib/decidim/abilities/participatory_process_role_ability.rb +0 -60
- data/lib/decidim/page_finder.rb +0 -49
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# This cell renders the author of a resource. It is intended to be used
|
5
|
-
# below resource titles to indicate its authorship & such, and is intended
|
6
|
-
# for resources that have a single author.
|
7
|
-
class AuthorBoxCell < Decidim::ViewModel
|
8
|
-
include LayoutHelper
|
9
|
-
include Messaging::ConversationHelper
|
10
|
-
|
11
|
-
def show
|
12
|
-
render
|
13
|
-
end
|
14
|
-
|
15
|
-
delegate :user_signed_in?, :current_user, to: :parent_controller
|
16
|
-
|
17
|
-
def author_box_classes
|
18
|
-
(["author-data"] + options[:extra_classes].to_a).join(" ")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<div class="author author--inline">
|
2
|
-
<% if model.profile_path.present? %>
|
3
|
-
<%= link_to model.profile_path do %>
|
4
|
-
<%= render :profile_inline %>
|
5
|
-
<% end %>
|
6
|
-
<% else %>
|
7
|
-
<%= render :profile_inline %>
|
8
|
-
<% end %>
|
9
|
-
|
10
|
-
<% if model.profile_path.present? %>
|
11
|
-
<%= link_to_current_or_new_conversation_with(model) %>
|
12
|
-
<% end %>
|
13
|
-
</div>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# This cell renders the avatar, name and nickname of
|
5
|
-
# the given user or user group, and adds some links
|
6
|
-
# to potential actions on the given profile.
|
7
|
-
class ProfileCell < Decidim::ViewModel
|
8
|
-
include LayoutHelper
|
9
|
-
include Messaging::ConversationHelper
|
10
|
-
|
11
|
-
def show
|
12
|
-
render
|
13
|
-
end
|
14
|
-
|
15
|
-
delegate :user_signed_in?, :current_user, to: :parent_controller
|
16
|
-
end
|
17
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "active_support/concern"
|
4
|
-
|
5
|
-
module Decidim
|
6
|
-
# Shared behaviour for controllers that need authorization to work.
|
7
|
-
module NeedsAuthorization
|
8
|
-
extend ActiveSupport::Concern
|
9
|
-
|
10
|
-
included do
|
11
|
-
check_authorization
|
12
|
-
|
13
|
-
rescue_from CanCan::AccessDenied, with: :user_not_authorized
|
14
|
-
rescue_from ActionAuthorization::Unauthorized, with: :user_not_authorized
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
# Overwrites `cancancan`'s method to point to the correct ability class,
|
19
|
-
# since the gem expects the ability class to be in the root namespace.
|
20
|
-
def current_ability
|
21
|
-
@current_ability ||= current_ability_klass.new(current_user, ability_context)
|
22
|
-
end
|
23
|
-
|
24
|
-
def ability_context
|
25
|
-
{
|
26
|
-
current_settings: try(:current_settings),
|
27
|
-
component_settings: try(:component_settings),
|
28
|
-
current_organization: try(:current_organization),
|
29
|
-
current_component: try(:current_component)
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
# Handles the case when a user visits a path that is not allowed to them.
|
34
|
-
# Redirects the user to the root path and shows a flash message telling
|
35
|
-
# them they are not authorized.
|
36
|
-
def user_not_authorized
|
37
|
-
flash[:alert] = t("actions.unauthorized", scope: "decidim.core")
|
38
|
-
redirect_to(request.referer || user_not_authorized_path)
|
39
|
-
end
|
40
|
-
|
41
|
-
def user_not_authorized_path
|
42
|
-
raise NotImplementedError
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Abilities
|
5
|
-
# Defines the abilities for an admin user. Intended to be used with `cancancan`.
|
6
|
-
class AdminAbility
|
7
|
-
include CanCan::Ability
|
8
|
-
|
9
|
-
attr_reader :user
|
10
|
-
|
11
|
-
def initialize(user, context)
|
12
|
-
@user = user
|
13
|
-
@context = context
|
14
|
-
|
15
|
-
define_abilities if admin?
|
16
|
-
end
|
17
|
-
|
18
|
-
def define_abilities
|
19
|
-
can :read, :admin_dashboard
|
20
|
-
can :read, Component
|
21
|
-
can :impersonate, :managed_users
|
22
|
-
end
|
23
|
-
|
24
|
-
def admin?
|
25
|
-
@user && @user.admin?
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Abilities
|
5
|
-
# Defines the abilities for a User. Intended to be used with `cancancan`.
|
6
|
-
class BaseAbility
|
7
|
-
include CanCan::Ability
|
8
|
-
|
9
|
-
# Initializes the ability class for the given user. Automatically merges
|
10
|
-
# injected abilities fmor the configuration. In order to inject more
|
11
|
-
# abilities, add this code in the `engine.rb` file of your own engine, for
|
12
|
-
# example, inside an initializer:
|
13
|
-
#
|
14
|
-
# Decidim.configure do |config|
|
15
|
-
# config.abilities << Decidim::MyEngine::Abilities::MyAbility
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# Note that, in development, this will force you to restart the server
|
19
|
-
# every time you change things in your ability classes.
|
20
|
-
#
|
21
|
-
# user - the User that needs its abilities checked.
|
22
|
-
# context - a Hash with some context related to the current request.
|
23
|
-
def initialize(user, context = {})
|
24
|
-
Decidim.abilities.each do |ability|
|
25
|
-
merge ability.constantize.new(user, context)
|
26
|
-
end
|
27
|
-
|
28
|
-
can :create, Authorization do |authorization|
|
29
|
-
authorization.user == user && not_already_active?(user, authorization)
|
30
|
-
end
|
31
|
-
|
32
|
-
can :update, Authorization do |authorization|
|
33
|
-
authorization.user == user && !authorization.granted?
|
34
|
-
end
|
35
|
-
|
36
|
-
can :manage, Follow do |follow|
|
37
|
-
follow.user == user
|
38
|
-
end
|
39
|
-
|
40
|
-
can :manage, Notification do |notification|
|
41
|
-
notification.user == user
|
42
|
-
end
|
43
|
-
|
44
|
-
can :manage, Messaging::Conversation do |conversation|
|
45
|
-
conversation.participants.include?(user)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def not_already_active?(user, authorization)
|
52
|
-
Verifications::Authorizations.new(organization: user.organization, user: user, name: authorization.name).none?
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Abilities
|
5
|
-
# Defines the base abilities for any user. Guest users will use these too.
|
6
|
-
# Intended to be used with `cancancan`.
|
7
|
-
class EveryoneAbility
|
8
|
-
include CanCan::Ability
|
9
|
-
|
10
|
-
def initialize(user, _context)
|
11
|
-
can :read, :public_pages
|
12
|
-
can :manage, :locales
|
13
|
-
|
14
|
-
can :read, Component, &:published?
|
15
|
-
|
16
|
-
can :search, Scope
|
17
|
-
can :pick, Scope
|
18
|
-
|
19
|
-
can :manage, User do |other|
|
20
|
-
other == user
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Abilities
|
5
|
-
# Defines the abilities for a participatory process admin. Intended to be
|
6
|
-
# used with `cancancan`.
|
7
|
-
# This ability will not apply to organization admins.
|
8
|
-
class ParticipatoryProcessAdminAbility < ParticipatoryProcessRoleAbility
|
9
|
-
# Overrides ParticipatoryProcessRoleAbility role method
|
10
|
-
def role
|
11
|
-
:admin
|
12
|
-
end
|
13
|
-
|
14
|
-
# Overrides ParticipatoryProcessRoleAbility define_participatory_process_abilities method
|
15
|
-
def define_participatory_process_abilities
|
16
|
-
super
|
17
|
-
|
18
|
-
can :read, ParticipatoryProcess do |process|
|
19
|
-
can_manage_process?(process)
|
20
|
-
end
|
21
|
-
|
22
|
-
can :read, Component do |component|
|
23
|
-
can_manage_process?(component.participatory_space)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Abilities
|
5
|
-
# Defines the abilities for a participatory process collaborator. Intended to be
|
6
|
-
# used with `cancancan`.
|
7
|
-
# This ability will not apply to organization admins.
|
8
|
-
class ParticipatoryProcessCollaboratorAbility < ParticipatoryProcessRoleAbility
|
9
|
-
# Overrides ParticipatoryProcessRoleAbility role method
|
10
|
-
def role
|
11
|
-
:collaborator
|
12
|
-
end
|
13
|
-
|
14
|
-
# Overrides ParticipatoryProcessRoleAbility define_participatory_process_abilities method
|
15
|
-
def define_participatory_process_abilities
|
16
|
-
super
|
17
|
-
|
18
|
-
can :read, ParticipatoryProcess do |process|
|
19
|
-
can_manage_process?(process)
|
20
|
-
end
|
21
|
-
|
22
|
-
can :read, Component do |component|
|
23
|
-
can_manage_process?(component.participatory_space)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Abilities
|
5
|
-
# Defines the abilities for a participatory process moderator. Intended to be
|
6
|
-
# used with `cancancan`.
|
7
|
-
# This ability will not apply to organization admins.
|
8
|
-
class ParticipatoryProcessModeratorAbility < ParticipatoryProcessRoleAbility
|
9
|
-
# Overrides ParticipatoryProcessRoleAbility role method
|
10
|
-
def role
|
11
|
-
:moderator
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Abilities
|
5
|
-
# Defines the abilities for an user with role 'user_manager'.
|
6
|
-
# Intended to be used with `cancancan`.
|
7
|
-
class UserManagerAbility
|
8
|
-
include CanCan::Ability
|
9
|
-
|
10
|
-
attr_reader :user
|
11
|
-
|
12
|
-
def initialize(user, context)
|
13
|
-
@user = user
|
14
|
-
@context = context
|
15
|
-
|
16
|
-
define_abilities if not_admin? && user_manager?
|
17
|
-
end
|
18
|
-
|
19
|
-
def define_abilities
|
20
|
-
can :read, :admin_dashboard
|
21
|
-
can :impersonate, :managed_users
|
22
|
-
end
|
23
|
-
|
24
|
-
# Whether the user is an admin or not.
|
25
|
-
def not_admin?
|
26
|
-
@user && !@user.admin?
|
27
|
-
end
|
28
|
-
|
29
|
-
# Whether the user has the user_manager role or not.
|
30
|
-
def user_manager?
|
31
|
-
@user.role? "user_manager"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<% if notification.resource %>
|
2
|
-
<div class="card--list__item">
|
3
|
-
<div class="card--list__text">
|
4
|
-
<%= link_to notification.event_class_instance.resource_path do %>
|
5
|
-
<%= resource_icon notification.resource, class: "icon--chat card--list__icon" %>
|
6
|
-
<% end %>
|
7
|
-
<div>
|
8
|
-
<h5 class="card--list__heading">
|
9
|
-
<%= notification.event_class_instance.notification_title %>
|
10
|
-
</h5>
|
11
|
-
<span class="text-small"><%= l notification.created_at.to_date, format: :long %></span>
|
12
|
-
</div>
|
13
|
-
</div>
|
14
|
-
<div class="card--list__data">
|
15
|
-
<%= link_to notification, class: "mark-as-read-button card--list__data__icon", remote: true, method: :delete do %>
|
16
|
-
<%= icon "check", class: "icon icon--chevron-right" %>
|
17
|
-
<% end %>
|
18
|
-
</div>
|
19
|
-
</div>
|
20
|
-
<% end %>
|
@@ -1,36 +0,0 @@
|
|
1
|
-
<main class="wrapper" id="notifications">
|
2
|
-
<div class="row">
|
3
|
-
<div class="columns">
|
4
|
-
<div class="title-action">
|
5
|
-
<h1 class="heading1 title-action__title"><%= t("title", scope: "layouts.decidim.notifications_dashboard") %></h1>
|
6
|
-
<% if notifications.any? %>
|
7
|
-
<%= link_to(
|
8
|
-
t("mark_all_as_read", scope: "layouts.decidim.notifications_dashboard"),
|
9
|
-
decidim.read_all_notifications_path,
|
10
|
-
class: "button title-action__action hollow mark-all-as-read-button",
|
11
|
-
method: :delete,
|
12
|
-
data: { disable: true },
|
13
|
-
remote: true
|
14
|
-
) %>
|
15
|
-
<% end %>
|
16
|
-
</div>
|
17
|
-
</div>
|
18
|
-
</div>
|
19
|
-
<div class="row">
|
20
|
-
<div class="columns mediumlarge-12 large-12">
|
21
|
-
<div class="empty-notifications hide callout secondary">
|
22
|
-
<p><%= t("no_notifications", scope: "layouts.decidim.notifications_dashboard") %></p>
|
23
|
-
</div>
|
24
|
-
<% if notifications.any? %>
|
25
|
-
<section class="section" id="notifications-list">
|
26
|
-
<div class="card card--list">
|
27
|
-
<%= render notifications %>
|
28
|
-
</div>
|
29
|
-
</section>
|
30
|
-
<%= decidim_paginate notifications %>
|
31
|
-
<% end %>
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
</main>
|
35
|
-
|
36
|
-
<%= javascript_include_tag "decidim/notifications" %>
|
@@ -1,21 +0,0 @@
|
|
1
|
-
<span class="author__avatar author__avatar--small">
|
2
|
-
<%= image_tag author.avatar_url %>
|
3
|
-
</span>
|
4
|
-
|
5
|
-
<% if author.deleted? %>
|
6
|
-
<span class="label label--small label--basic">
|
7
|
-
<%= t(".deleted") %>
|
8
|
-
</span>
|
9
|
-
<% else %>
|
10
|
-
<span class="author__name"><%= author.name %></span>
|
11
|
-
|
12
|
-
<% if author.badge.present? %>
|
13
|
-
<span class="author__badge">
|
14
|
-
<%= icon author.badge %>
|
15
|
-
</span>
|
16
|
-
<% end %>
|
17
|
-
|
18
|
-
<% if author.nickname.present? %>
|
19
|
-
<span class="author__nickname"><%= author.nickname %></span>
|
20
|
-
<% end %>
|
21
|
-
<% end %>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<%= render partial: "pages/home/hero" %>
|
2
|
-
|
3
|
-
<% if !translated_attribute(current_organization.description).blank? %>
|
4
|
-
<%= render partial: "pages/home/sub_hero" %>
|
5
|
-
<% end %>
|
6
|
-
|
7
|
-
<%= render partial: "pages/home/highlighted_content_banner" %>
|
8
|
-
|
9
|
-
<%= render partial: "pages/home/highlighted_processes" %>
|
10
|
-
|
11
|
-
<%= render partial: "pages/home/extended" %>
|
12
|
-
|
13
|
-
<% if current_organization.show_statistics? %>
|
14
|
-
<%= render partial: "pages/home/statistics" %>
|
15
|
-
<% end %>
|
16
|
-
|
17
|
-
<%= render partial: "pages/home/footer_sub_hero" %>
|