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.
Files changed (238) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/decidim/notifications.js.es6 +8 -6
  3. data/app/assets/javascripts/decidim/user_registrations.js.es6 +25 -1
  4. data/app/assets/stylesheets/decidim/application.scss.erb +4 -0
  5. data/app/assets/stylesheets/decidim/layouts/_home.scss +79 -0
  6. data/app/assets/stylesheets/decidim/modules/_author-avatar.scss +2 -1
  7. data/app/assets/stylesheets/decidim/modules/_cards.scss +82 -38
  8. data/app/assets/stylesheets/decidim/modules/_collapsible-list.scss +16 -0
  9. data/app/assets/stylesheets/decidim/modules/_definition-data.scss +27 -0
  10. data/app/assets/stylesheets/decidim/modules/_fingerprint.scss +8 -0
  11. data/app/assets/stylesheets/decidim/modules/_horizontal-tabs.scss +51 -0
  12. data/app/assets/stylesheets/decidim/modules/_inline-filters.scss +5 -3
  13. data/app/assets/stylesheets/decidim/modules/_margins.scss +6 -4
  14. data/app/assets/stylesheets/decidim/modules/_modules.scss +3 -0
  15. data/app/assets/stylesheets/decidim/modules/_navbar.scss +113 -7
  16. data/app/assets/stylesheets/decidim/modules/_signup.scss +22 -5
  17. data/app/assets/stylesheets/decidim/modules/_toggle.scss +9 -0
  18. data/app/assets/stylesheets/decidim/modules/_typography.scss +5 -1
  19. data/app/assets/stylesheets/decidim/utils/_helpers.scss +42 -0
  20. data/app/assets/stylesheets/decidim/utils/_mixins.scss +6 -0
  21. data/app/assets/stylesheets/decidim/utils/_settings.scss +3 -2
  22. data/app/cells/decidim/announcement/show.erb +11 -0
  23. data/app/cells/decidim/announcement_cell.rb +32 -0
  24. data/app/cells/decidim/author/comments.erb +6 -0
  25. data/app/cells/decidim/author/contact.erb +3 -0
  26. data/app/cells/decidim/author/date.erb +5 -0
  27. data/app/cells/decidim/author/flag.erb +5 -0
  28. data/app/cells/decidim/author/profile.erb +9 -0
  29. data/app/cells/decidim/{profile → author}/profile_inline.erb +1 -1
  30. data/app/cells/decidim/author/show.erb +18 -0
  31. data/app/cells/decidim/author/withdraw.erb +6 -0
  32. data/app/cells/decidim/author_cell.rb +109 -0
  33. data/app/cells/decidim/card/show.erb +18 -16
  34. data/app/cells/decidim/card_cell.rb +17 -4
  35. data/app/cells/decidim/card_m/author.erb +3 -0
  36. data/app/cells/decidim/card_m/badge.erb +1 -0
  37. data/app/cells/decidim/card_m/comments_counter.erb +3 -0
  38. data/app/cells/decidim/card_m/data.erb +0 -0
  39. data/app/cells/decidim/card_m/footer.erb +0 -0
  40. data/app/cells/decidim/card_m/header.erb +17 -0
  41. data/app/cells/decidim/card_m/image.erb +5 -0
  42. data/app/cells/decidim/card_m/label.erb +3 -0
  43. data/app/cells/decidim/card_m/show.erb +24 -0
  44. data/app/cells/decidim/card_m/status.erb +9 -0
  45. data/app/cells/decidim/card_m/tags.erb +0 -0
  46. data/app/cells/decidim/card_m_cell.rb +136 -0
  47. data/app/cells/decidim/collapsible_list/show.erb +20 -0
  48. data/app/cells/decidim/collapsible_list_cell.rb +66 -0
  49. data/app/cells/decidim/fingerprint/show.erb +22 -0
  50. data/app/cells/decidim/fingerprint_cell.rb +17 -0
  51. data/app/cells/decidim/follow_button/show.erb +34 -0
  52. data/app/cells/decidim/follow_button_cell.rb +40 -0
  53. data/app/cells/decidim/followers/show.erb +9 -0
  54. data/app/cells/decidim/followers_cell.rb +18 -0
  55. data/app/cells/decidim/following/show.erb +9 -0
  56. data/app/cells/decidim/following_cell.rb +24 -0
  57. data/app/cells/decidim/notifications/show.erb +48 -0
  58. data/app/cells/decidim/notifications_cell.rb +21 -0
  59. data/app/cells/decidim/progress_bar/show.erb +17 -0
  60. data/app/cells/decidim/progress_bar_cell.rb +68 -0
  61. data/app/cells/decidim/tags/category.erb +1 -0
  62. data/app/cells/decidim/tags/scope.erb +1 -0
  63. data/app/cells/decidim/tags/show.erb +5 -0
  64. data/app/cells/decidim/tags_cell.rb +62 -0
  65. data/app/cells/decidim/tos_page/announcement.erb +2 -0
  66. data/app/cells/decidim/tos_page/refuse_btn_modal.erb +23 -0
  67. data/app/cells/decidim/tos_page/sticky_form.erb +29 -0
  68. data/app/cells/decidim/tos_page_cell.rb +39 -0
  69. data/app/cells/decidim/user_profile/footer.erb +5 -0
  70. data/app/cells/decidim/user_profile/header.erb +20 -0
  71. data/app/cells/decidim/user_profile_cell.rb +26 -0
  72. data/app/commands/decidim/create_omniauth_registration.rb +1 -1
  73. data/app/commands/decidim/create_registration.rb +2 -1
  74. data/app/commands/decidim/search.rb +45 -0
  75. data/app/controllers/concerns/decidim/devise_controllers.rb +15 -12
  76. data/app/controllers/concerns/decidim/http_caching_disabler.rb +21 -0
  77. data/app/controllers/concerns/decidim/impersonate_users.rb +1 -6
  78. data/app/controllers/concerns/decidim/locale_switcher.rb +1 -1
  79. data/app/controllers/concerns/decidim/needs_permission.rb +70 -0
  80. data/app/controllers/concerns/decidim/needs_tos_accepted.rb +42 -0
  81. data/app/controllers/concerns/decidim/participatory_space_context.rb +1 -7
  82. data/app/controllers/concerns/decidim/user_profile.rb +3 -1
  83. data/app/controllers/decidim/account_controller.rb +4 -4
  84. data/app/controllers/decidim/application_controller.rb +17 -8
  85. data/app/controllers/decidim/components/base_controller.rb +14 -9
  86. data/app/controllers/decidim/cookie_policy_controller.rb +0 -2
  87. data/app/controllers/decidim/devise/confirmations_controller.rb +13 -0
  88. data/app/controllers/decidim/devise/invitations_controller.rb +3 -1
  89. data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +9 -3
  90. data/app/controllers/decidim/devise/passwords_controller.rb +1 -1
  91. data/app/controllers/decidim/devise/registrations_controller.rb +1 -7
  92. data/app/controllers/decidim/doorkeeper/authorizations_controller.rb +0 -2
  93. data/app/controllers/decidim/doorkeeper/credentials_controller.rb +0 -1
  94. data/app/controllers/decidim/errors_controller.rb +0 -2
  95. data/app/controllers/decidim/follows_controller.rb +4 -2
  96. data/app/controllers/decidim/locales_controller.rb +1 -1
  97. data/app/controllers/decidim/messaging/conversations_controller.rb +5 -5
  98. data/app/controllers/decidim/newsletters_controller.rb +0 -2
  99. data/app/controllers/decidim/notifications_controller.rb +3 -19
  100. data/app/controllers/decidim/notifications_settings_controller.rb +2 -2
  101. data/app/controllers/decidim/pages_controller.rb +12 -10
  102. data/app/controllers/decidim/profiles_controller.rb +10 -4
  103. data/app/controllers/decidim/reports_controller.rb +14 -1
  104. data/app/controllers/decidim/scopes_controller.rb +3 -3
  105. data/app/controllers/decidim/searches_controller.rb +39 -0
  106. data/app/controllers/decidim/static_map_controller.rb +0 -2
  107. data/app/controllers/decidim/tos_controller.rb +20 -0
  108. data/app/controllers/decidim/widgets_controller.rb +0 -1
  109. data/app/forms/decidim/follow_form.rb +1 -0
  110. data/app/forms/decidim/registration_form.rb +2 -1
  111. data/app/helpers/decidim/card_helper.rb +2 -0
  112. data/app/helpers/decidim/cells_paginate_helper.rb +16 -0
  113. data/app/helpers/decidim/cta_button_helper.rb +1 -1
  114. data/app/helpers/decidim/decidim_form_helper.rb +4 -0
  115. data/app/helpers/decidim/icon_helper.rb +2 -0
  116. data/app/helpers/decidim/resource_helper.rb +1 -2
  117. data/app/helpers/decidim/scopes_helper.rb +17 -10
  118. data/app/helpers/decidim/searches_helper.rb +16 -0
  119. data/app/helpers/decidim/tooltip_helper.rb +12 -0
  120. data/app/models/decidim/organization.rb +10 -0
  121. data/app/models/decidim/permission_action.rb +40 -0
  122. data/app/models/decidim/searchable_resource.rb +37 -0
  123. data/app/models/decidim/static_page.rb +4 -0
  124. data/app/models/decidim/user.rb +39 -3
  125. data/app/permissions/decidim/default_permissions.rb +61 -0
  126. data/app/permissions/decidim/permissions.rb +106 -0
  127. data/app/permissions/decidim/user_manager_permissions.rb +24 -0
  128. data/app/presenters/decidim/admin_log/organization_presenter.rb +2 -1
  129. data/app/presenters/decidim/home_stats_presenter.rb +2 -8
  130. data/app/presenters/decidim/user_presenter.rb +8 -0
  131. data/app/services/decidim/traceability.rb +6 -9
  132. data/app/types/decidim/core/user_type.rb +1 -1
  133. data/app/views/decidim/devise/invitations/edit.html.erb +56 -10
  134. data/app/views/decidim/devise/registrations/new.html.erb +36 -14
  135. data/app/views/decidim/devise/shared/_newsletter_modal.html.erb +25 -0
  136. data/app/views/decidim/follows/update_button.js.erb +2 -2
  137. data/app/views/decidim/messaging/conversations/_message.html.erb +1 -1
  138. data/app/views/{pages → decidim/pages}/decidim_page.html.erb +5 -0
  139. data/app/views/decidim/pages/home.html.erb +17 -0
  140. data/app/views/{pages → decidim/pages}/home/_extended.html.erb +0 -0
  141. data/app/views/{pages → decidim/pages}/home/_footer_sub_hero.html.erb +0 -0
  142. data/app/views/{pages → decidim/pages}/home/_hero.html.erb +0 -0
  143. data/app/views/{pages → decidim/pages}/home/_highlighted_content_banner.html.erb +0 -0
  144. data/app/views/{pages → decidim/pages}/home/_highlighted_processes.html.erb +0 -0
  145. data/app/views/{pages → decidim/pages}/home/_statistics.html.erb +0 -0
  146. data/app/views/{pages → decidim/pages}/home/_sub_hero.html.erb +0 -0
  147. data/app/views/decidim/profiles/_followers.html.erb +5 -0
  148. data/app/views/decidim/profiles/_following.html.erb +5 -0
  149. data/app/views/decidim/profiles/_notifications.html.erb +0 -0
  150. data/app/views/decidim/profiles/_user.html.erb +59 -0
  151. data/app/views/decidim/profiles/_user_follow.erb +32 -0
  152. data/app/views/decidim/profiles/show.html.erb +32 -59
  153. data/app/views/decidim/searches/_count.html.erb +1 -0
  154. data/app/views/decidim/searches/_filters.html.erb +20 -0
  155. data/app/views/decidim/searches/_filters_small_view.html.erb +18 -0
  156. data/app/views/decidim/searches/_results.html.erb +5 -0
  157. data/app/views/decidim/searches/index.html.erb +20 -0
  158. data/app/views/decidim/searches/index.js.erb +5 -0
  159. data/app/views/decidim/shared/_address_details.html.erb +7 -9
  160. data/app/views/decidim/shared/_announcement.html.erb +1 -6
  161. data/app/views/decidim/shared/_author_reference.html.erb +1 -1
  162. data/app/views/decidim/shared/_follow_button.html.erb +1 -34
  163. data/app/views/decidim/shared/_static_map.html.erb +3 -1
  164. data/app/views/decidim/shared/_tags.html.erb +1 -11
  165. data/app/views/kaminari/decidim/_paginator.html.erb +16 -15
  166. data/app/views/layouts/decidim/_head.html.erb +1 -0
  167. data/app/views/layouts/decidim/_topbar_search.html.erb +8 -0
  168. data/app/views/layouts/decidim/_user_menu.html.erb +2 -2
  169. data/app/views/layouts/decidim/_wrapper.html.erb +3 -2
  170. data/config/initializers/devise.rb +1 -1
  171. data/config/initializers/rack_attack.rb +28 -0
  172. data/config/locales/ca.yml +136 -55
  173. data/config/locales/en.yml +135 -54
  174. data/config/locales/es.yml +136 -55
  175. data/config/locales/eu.yml +136 -54
  176. data/config/locales/fi.yml +135 -54
  177. data/config/locales/fr.yml +136 -54
  178. data/config/locales/gl.yml +136 -54
  179. data/config/locales/it.yml +136 -54
  180. data/config/locales/nl.yml +136 -54
  181. data/config/locales/pl.yml +144 -54
  182. data/config/locales/pt-BR.yml +136 -54
  183. data/config/locales/pt.yml +136 -54
  184. data/config/locales/ru.yml +150 -60
  185. data/config/locales/sv.yml +136 -54
  186. data/config/locales/uk.yml +146 -57
  187. data/config/routes.rb +11 -1
  188. data/db/migrate/20180209122819_create_decidim_searchable_resource.rb +21 -0
  189. data/db/migrate/20180508111640_add_tos_version_to_organization.rb +19 -0
  190. data/db/migrate/20180508111710_add_accepted_tos_version_field_to_users.rb +25 -0
  191. data/db/seeds.rb +33 -26
  192. data/lib/decidim/component_manifest.rb +35 -27
  193. data/lib/decidim/content_processor.rb +21 -3
  194. data/lib/decidim/core.rb +27 -16
  195. data/lib/decidim/core/engine.rb +8 -19
  196. data/lib/decidim/core/test.rb +2 -0
  197. data/lib/decidim/core/test/factories.rb +34 -4
  198. data/lib/decidim/core/test/shared_examples/fingerprint_examples.rb +15 -0
  199. data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +27 -0
  200. data/lib/decidim/core/version.rb +1 -1
  201. data/lib/decidim/events/base_event.rb +5 -1
  202. data/lib/decidim/fingerprint_calculator.rb +42 -0
  203. data/lib/decidim/fingerprintable.rb +63 -0
  204. data/lib/decidim/form_builder.rb +1 -0
  205. data/lib/decidim/manifest_registry.rb +4 -10
  206. data/lib/decidim/participable.rb +4 -0
  207. data/lib/decidim/participatory_space_manifest.rb +36 -0
  208. data/lib/decidim/participatory_space_resourceable.rb +11 -0
  209. data/lib/decidim/resource_manifest.rb +10 -11
  210. data/lib/decidim/resourceable.rb +3 -2
  211. data/lib/decidim/search_resource_fields_mapper.rb +93 -0
  212. data/lib/decidim/searchable.rb +85 -0
  213. data/lib/decidim/settings_manifest.rb +3 -2
  214. data/lib/decidim/traceable.rb +2 -0
  215. data/lib/decidim/view_model.rb +9 -0
  216. data/lib/tasks/decidim_tasks.rake +79 -1
  217. metadata +149 -76
  218. data/app/assets/stylesheets/decidim/extras/_register_form.scss +0 -9
  219. data/app/cells/decidim/author_box/show.erb +0 -10
  220. data/app/cells/decidim/author_box_cell.rb +0 -21
  221. data/app/cells/decidim/profile/show.erb +0 -13
  222. data/app/cells/decidim/profile_cell.rb +0 -17
  223. data/app/controllers/concerns/decidim/needs_authorization.rb +0 -46
  224. data/app/models/decidim/abilities/admin_ability.rb +0 -29
  225. data/app/models/decidim/abilities/base_ability.rb +0 -56
  226. data/app/models/decidim/abilities/everyone_ability.rb +0 -25
  227. data/app/models/decidim/abilities/participatory_process_admin_ability.rb +0 -28
  228. data/app/models/decidim/abilities/participatory_process_collaborator_ability.rb +0 -28
  229. data/app/models/decidim/abilities/participatory_process_moderator_ability.rb +0 -15
  230. data/app/models/decidim/abilities/user_manager_ability.rb +0 -35
  231. data/app/views/decidim/notifications/_notification.html.erb +0 -20
  232. data/app/views/decidim/notifications/index.html.erb +0 -36
  233. data/app/views/decidim/shared/_author.html.erb +0 -21
  234. data/app/views/pages/home.html.erb +0 -17
  235. data/db/migrate/20180613080638_rename_missing_features_to_components.rb +0 -15
  236. data/lib/decidim/abilities.rb +0 -7
  237. data/lib/decidim/abilities/participatory_process_role_ability.rb +0 -60
  238. data/lib/decidim/page_finder.rb +0 -49
@@ -1,9 +0,0 @@
1
- .lopd-text{
2
- padding: .5rem;
3
- border: 1px solid #e8e8e8;
4
- margin: 1rem 0;
5
- max-height: 10rem;
6
- overflow: auto;
7
- font-size: .8rem;
8
- font-style: italic;
9
- }
@@ -1,10 +0,0 @@
1
- <div class="<%= author_box_classes %>">
2
- <div class="author-data__main">
3
- <%= cell "decidim/profile", model %>
4
- </div>
5
- <% if @options[:extra] %>
6
- <div class="author-data__extra">
7
- <%= options[:extra] %>
8
- </div>
9
- <% end %>
10
- </div>
@@ -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" %>