decidim 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim might be problematic. Click here for more details.

Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1626 -0
  3. data/Gemfile.lock +82 -82
  4. data/decidim-admin/app/assets/stylesheets/decidim/admin/_variables.scss +2 -0
  5. data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_cards.scss +6 -0
  6. data/decidim-admin/app/assets/stylesheets/decidim/admin/modules/_typography.scss +4 -0
  7. data/decidim-admin/app/commands/decidim/admin/create_participatory_process_admin.rb +3 -5
  8. data/decidim-admin/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -1
  9. data/decidim-admin/app/controllers/decidim/admin/application_controller.rb +1 -1
  10. data/decidim-admin/app/controllers/decidim/admin/categories_controller.rb +9 -9
  11. data/decidim-admin/app/controllers/decidim/admin/concerns/participatory_process_admin.rb +1 -8
  12. data/decidim-admin/app/controllers/decidim/admin/exports_controller.rb +2 -2
  13. data/decidim-admin/app/controllers/decidim/admin/feature_permissions_controller.rb +2 -2
  14. data/decidim-admin/app/controllers/decidim/admin/features/base_controller.rb +0 -5
  15. data/decidim-admin/app/controllers/decidim/admin/features_controller.rb +4 -4
  16. data/decidim-admin/app/controllers/decidim/admin/moderations_controller.rb +1 -1
  17. data/decidim-admin/app/controllers/decidim/admin/participatory_process_attachments_controller.rb +2 -2
  18. data/decidim-admin/app/controllers/decidim/admin/participatory_process_copies_controller.rb +3 -9
  19. data/decidim-admin/app/controllers/decidim/admin/participatory_process_publications_controller.rb +4 -4
  20. data/decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb +2 -2
  21. data/decidim-admin/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb +2 -2
  22. data/decidim-admin/app/controllers/decidim/admin/participatory_process_steps_controller.rb +6 -6
  23. data/decidim-admin/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb +13 -15
  24. data/decidim-admin/app/controllers/decidim/admin/participatory_processes_controller.rb +16 -18
  25. data/decidim-admin/app/controllers/decidim/admin/users_controller.rb +4 -4
  26. data/decidim-admin/app/forms/decidim/admin/participatory_process_user_role_form.rb +2 -2
  27. data/decidim-admin/app/models/decidim/admin/abilities/{admin_user.rb → admin_ability.rb} +3 -6
  28. data/decidim-admin/app/models/decidim/admin/abilities/{base.rb → base_ability.rb} +1 -4
  29. data/decidim-admin/app/models/decidim/admin/abilities/{participatory_process_admin.rb → participatory_process_admin_ability.rb} +18 -28
  30. data/decidim-admin/app/models/decidim/admin/abilities/participatory_process_collaborator_ability.rb +19 -0
  31. data/decidim-admin/app/models/decidim/admin/abilities/participatory_process_moderator_ability.rb +23 -0
  32. data/decidim-admin/app/queries/decidim/admin/process_admins.rb +1 -1
  33. data/decidim-admin/app/views/decidim/admin/categories/index.html.erb +9 -9
  34. data/decidim-admin/app/views/decidim/admin/categories/new.html.erb +1 -1
  35. data/decidim-admin/app/views/decidim/admin/features/_form.html.erb +1 -1
  36. data/decidim-admin/app/views/decidim/admin/features/edit.html.erb +1 -1
  37. data/decidim-admin/app/views/decidim/admin/features/new.html.erb +1 -1
  38. data/decidim-admin/app/views/decidim/admin/participatory_process_copies/new.html.erb +1 -1
  39. data/decidim-admin/app/views/decidim/admin/participatory_process_groups/index.html.erb +5 -1
  40. data/decidim-admin/app/views/decidim/admin/participatory_process_steps/index.html.erb +9 -9
  41. data/decidim-admin/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +6 -6
  42. data/decidim-admin/app/views/decidim/admin/participatory_processes/edit.html.erb +6 -6
  43. data/decidim-admin/app/views/decidim/admin/participatory_processes/index.html.erb +11 -1
  44. data/decidim-admin/app/views/layouts/decidim/admin/participatory_process.html.erb +18 -18
  45. data/decidim-admin/config/locales/ca.yml +4 -3
  46. data/decidim-admin/config/locales/en.yml +1 -0
  47. data/decidim-admin/config/locales/es.yml +1 -2
  48. data/decidim-admin/db/migrate/20170714083651_rename_participatory_process_user_roles_table.rb +7 -0
  49. data/decidim-admin/lib/decidim/admin/engine.rb +8 -6
  50. data/decidim-admin/lib/decidim/admin/test/factories.rb +1 -1
  51. data/decidim-admin/spec/commands/create_participatory_process_admin_spec.rb +4 -4
  52. data/decidim-admin/spec/models/abilities/{admin_user_spec.rb → admin_ability_spec.rb} +1 -1
  53. data/decidim-admin/spec/models/abilities/{participatory_process_admin_spec.rb → participatory_process_admin_ability_spec.rb} +3 -3
  54. data/decidim-admin/spec/models/abilities/participatory_process_collaborator_ability_spec.rb +18 -0
  55. data/decidim-admin/spec/queries/process_admins_spec.rb +1 -1
  56. data/decidim-admin/spec/views/decidim/static_pages/_form.html.erb_spec.rb +1 -1
  57. data/decidim-budgets/config/locales/ca.yml +2 -2
  58. data/decidim-comments/app/models/decidim/comments/abilities/admin_ability.rb +19 -0
  59. data/decidim-comments/app/models/decidim/comments/abilities/{admin_user.rb → current_user_ability.rb} +4 -6
  60. data/decidim-comments/app/models/decidim/comments/abilities/participatory_process_admin_ability.rb +19 -0
  61. data/decidim-comments/app/models/decidim/comments/abilities/participatory_process_moderator_ability.rb +19 -0
  62. data/decidim-comments/lib/decidim/comments/admin_engine.rb +5 -2
  63. data/decidim-comments/lib/decidim/comments/engine.rb +6 -0
  64. data/decidim-comments/spec/models/abilities/{admin_user_spec.rb → admin_ability_spec.rb} +1 -1
  65. data/decidim-comments/spec/models/abilities/{process_admin_user_spec.rb → participatory_process_admin_ability_spec.rb} +3 -2
  66. data/decidim-meetings/app/controllers/decidim/meetings/meeting_widgets_controller.rb +1 -0
  67. data/decidim-meetings/app/controllers/decidim/meetings/meetings_controller.rb +2 -2
  68. data/decidim-meetings/app/views/decidim/meetings/meeting_widgets/show.html.erb +1 -1
  69. data/decidim-meetings/app/views/decidim/meetings/meetings/_meetings.html.erb +2 -0
  70. data/decidim-meetings/config/locales/ca.yml +1 -1
  71. data/decidim-meetings/spec/features/explore_meetings_spec.rb +11 -0
  72. data/decidim-proposals/app/controllers/decidim/proposals/proposals_controller.rb +2 -1
  73. data/decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb +1 -1
  74. data/decidim-proposals/app/helpers/decidim/proposals/application_helper.rb +23 -11
  75. data/decidim-proposals/app/models/decidim/proposals/abilities/{admin_user.rb → admin_ability.rb} +5 -12
  76. data/decidim-proposals/app/models/decidim/proposals/abilities/{current_user.rb → current_user_ability.rb} +1 -2
  77. data/decidim-proposals/app/models/decidim/proposals/abilities/{process_admin_user.rb → participatory_process_admin_ability.rb} +10 -22
  78. data/decidim-proposals/app/models/decidim/proposals/abilities/participatory_process_moderator_ability.rb +19 -0
  79. data/decidim-proposals/app/models/decidim/proposals/proposal.rb +8 -0
  80. data/decidim-proposals/app/services/decidim/proposals/proposal_search.rb +5 -2
  81. data/decidim-proposals/app/views/decidim/proposals/admin/proposal_answers/edit.html.erb +1 -1
  82. data/decidim-proposals/app/views/decidim/proposals/proposals/_filters.html.erb +1 -1
  83. data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal_badge.html.erb +1 -1
  84. data/decidim-proposals/app/views/decidim/proposals/proposals/_proposals.html.erb +10 -1
  85. data/decidim-proposals/config/locales/ca.yml +3 -0
  86. data/decidim-proposals/config/locales/en.yml +3 -0
  87. data/decidim-proposals/config/locales/es.yml +3 -0
  88. data/decidim-proposals/lib/decidim/proposals/admin_engine.rb +5 -2
  89. data/decidim-proposals/lib/decidim/proposals/engine.rb +1 -1
  90. data/decidim-proposals/lib/decidim/proposals/feature.rb +4 -0
  91. data/decidim-proposals/lib/decidim/proposals/proposal_serializer.rb +4 -0
  92. data/decidim-proposals/spec/features/proposals_spec.rb +12 -5
  93. data/decidim-proposals/spec/models/decidim/proposals/abilities/{admin_user_spec.rb → admin_ability_spec.rb} +1 -1
  94. data/decidim-proposals/spec/models/decidim/proposals/abilities/{process_admin_user_spec.rb → participatory_process_admin_ability.rb} +10 -2
  95. data/decidim-proposals/spec/services/decidim/proposals/proposal_serializer_spec.rb +7 -0
  96. data/decidim-proposals/spec/shared/manage_proposals_examples.rb +21 -0
  97. data/decidim-results/app/controllers/decidim/results/results_controller.rb +2 -1
  98. data/decidim-results/app/views/decidim/results/results/_results.html.erb +2 -0
  99. data/decidim-results/config/locales/ca.yml +1 -1
  100. data/decidim-results/spec/features/comments_spec.rb +1 -1
  101. data/decidim-results/spec/features/explore_results_spec.rb +11 -0
  102. data/decidim-surveys/app/models/decidim/surveys/abilities/admin_ability.rb +17 -0
  103. data/decidim-surveys/app/models/decidim/surveys/abilities/{current_user.rb → current_user_ability.rb} +1 -1
  104. data/decidim-surveys/app/models/decidim/surveys/abilities/participatory_process_admin_ability.rb +19 -0
  105. data/decidim-surveys/config/locales/ca.yml +1 -1
  106. data/decidim-surveys/lib/decidim/surveys/admin_engine.rb +4 -2
  107. data/decidim-surveys/lib/decidim/surveys/engine.rb +1 -1
  108. data/decidim-surveys/spec/models/decidim/surveys/abilities/{admin_user_spec.rb → admin_ability_spec.rb} +1 -1
  109. data/decidim-surveys/spec/models/decidim/surveys/abilities/{current_user_spec.rb → current_user_ability_spec.rb} +1 -1
  110. data/decidim-surveys/spec/models/decidim/surveys/abilities/{process_admin_user_spec.rb → participatory_process_admin_ability_spec.rb} +3 -2
  111. data/decidim-system/app/commands/decidim/system/register_organization.rb +2 -2
  112. data/decidim-system/spec/commands/decidim/system/register_organization_spec.rb +1 -1
  113. data/docs/getting_started.md +1 -1
  114. data/lib/generators/decidim/templates/initializer.rb +2 -2
  115. data/package.json +1 -3
  116. data/yarn.lock +21 -18
  117. metadata +52 -54
  118. data/decidim-admin/app/models/decidim/admin/abilities/collaborator_user.rb +0 -20
  119. data/decidim-admin/app/models/decidim/admin/participatory_process_user_role.rb +0 -15
  120. data/decidim-admin/app/queries/decidim/admin/manageable_participatory_processes_for_user.rb +0 -42
  121. data/decidim-admin/app/queries/decidim/admin/process_admin_roles_for_process.rb +0 -36
  122. data/decidim-admin/db/seeds.rb +0 -24
  123. data/decidim-admin/spec/models/abilities/collaborator_user_spec.rb +0 -67
  124. data/decidim-admin/spec/models/participatory_process_user_role_spec.rb +0 -39
  125. data/decidim-admin/spec/queries/manageable_participatory_processes_for_user_spec.rb +0 -39
  126. data/decidim-admin/spec/queries/process_admin_roles_for_process_spec.rb +0 -19
  127. data/decidim-comments/app/models/decidim/comments/abilities/process_admin_user.rb +0 -34
  128. data/decidim-meetings/app/views/decidim/meetings/meeting_widgets/.erb +0 -16
  129. data/decidim-surveys/app/models/decidim/surveys/abilities/admin_user.rb +0 -34
  130. data/decidim-surveys/app/models/decidim/surveys/abilities/process_admin_user.rb +0 -44
@@ -14,10 +14,10 @@ module Decidim
14
14
 
15
15
  validates :email, :role, presence: true
16
16
  validates :name, presence: true
17
- validates :role, inclusion: { in: ParticipatoryProcessUserRole::ROLES }
17
+ validates :role, inclusion: { in: Decidim::ParticipatoryProcessUserRole::ROLES }
18
18
 
19
19
  def roles
20
- Decidim::Admin::ParticipatoryProcessUserRole::ROLES.map do |role|
20
+ Decidim::ParticipatoryProcessUserRole::ROLES.map do |role|
21
21
  [
22
22
  I18n.t(role, scope: "decidim.admin.models.participatory_process_user_role.roles"),
23
23
  role
@@ -5,11 +5,9 @@ module Decidim
5
5
  module Abilities
6
6
  # Defines the abilities for a user in the admin section. Intended to be
7
7
  # used with `cancancan`.
8
- class AdminUser
9
- include CanCan::Ability
10
-
11
- def initialize(user, _context)
12
- return unless user && user.role?(:admin)
8
+ class AdminAbility < Decidim::Abilities::AdminAbility
9
+ def define_abilities
10
+ super
13
11
 
14
12
  can :manage, ParticipatoryProcess
15
13
  can :manage, ParticipatoryProcessGroup
@@ -27,7 +25,6 @@ module Decidim
27
25
  end
28
26
 
29
27
  can :manage, Feature
30
- can :read, :admin_dashboard
31
28
  can :manage, :admin_users
32
29
  can :manage, Moderation
33
30
  can :manage, Attachment
@@ -7,13 +7,10 @@ module Decidim
7
7
  # used with `cancancan`. Extended by both the base `Decidim::Ability`
8
8
  # class and other engine-only abilities, like the
9
9
  # `ParticipatoryProcessAdmin` ability class.
10
- class Base
10
+ class BaseAbility
11
11
  include CanCan::Ability
12
12
 
13
13
  def initialize(user, context)
14
- merge ::Decidim::Ability.new(user, context)
15
- merge ParticipatoryProcessAdmin.new(user, context)
16
-
17
14
  Decidim.admin_abilities.each do |ability|
18
15
  merge ability.constantize.new(user, context)
19
16
  end
@@ -9,55 +9,45 @@ module Decidim
9
9
  # Admin engine.
10
10
  #
11
11
  # This ability will not apply to organization admins.
12
- class ParticipatoryProcessAdmin
13
- include CanCan::Ability
14
-
15
- def initialize(user, _context)
16
- @user = user
17
-
18
- return unless user && !user.role?(:admin) && !user.role?(:collaborator)
19
-
20
- can :read, :admin_dashboard do
21
- participatory_processes.any?
22
- end
12
+ class ParticipatoryProcessAdminAbility < Decidim::Abilities::ParticipatoryProcessAdminAbility
13
+ def define_abilities
14
+ super
23
15
 
24
16
  can :manage, ParticipatoryProcess do |process|
25
- participatory_processes.include?(process)
17
+ can_manage_process?(process)
26
18
  end
27
19
 
28
20
  cannot :create, ParticipatoryProcess
29
21
  cannot :destroy, ParticipatoryProcess
22
+ end
30
23
 
31
- cannot :manage, :admin_users
24
+ def define_participatory_process_abilities
25
+ super
32
26
 
33
- can :manage, ParticipatoryProcessUserRole do |role|
34
- role.user != user
27
+ can :manage, Feature do |feature|
28
+ can_manage_process?(feature.participatory_process)
35
29
  end
36
30
 
37
- can :manage, Moderation do |moderation|
38
- participatory_processes.include?(moderation.participatory_process)
31
+ can :manage, Category do |category|
32
+ can_manage_process?(category.participatory_process)
39
33
  end
40
34
 
41
35
  can :manage, Attachment do |attachment|
42
- participatory_processes.include?(attachment.attached_to)
36
+ attachment.attached_to.is_a?(Decidim::ParticipatoryProcess) && can_manage_process?(attachment.attached_to)
43
37
  end
44
38
 
45
- can :manage, ParticipatoryProcessStep do |step|
46
- participatory_processes.include?(step.participatory_process)
39
+ can :manage, ParticipatoryProcessUserRole do |role|
40
+ can_manage_process?(role.participatory_process) && role.user != @user
47
41
  end
48
42
 
49
- can :manage, Feature do |feature|
50
- participatory_processes.include?(feature.participatory_process)
43
+ can :manage, Moderation do |moderation|
44
+ can_manage_process?(moderation.participatory_process)
51
45
  end
52
46
 
53
- can :manage, Category do |category|
54
- participatory_processes.include?(category.participatory_process)
47
+ can :manage, ParticipatoryProcessStep do |step|
48
+ can_manage_process?(step.participatory_process)
55
49
  end
56
50
  end
57
-
58
- def participatory_processes
59
- @participatory_processes ||= ManageableParticipatoryProcessesForUser.for(@user)
60
- end
61
51
  end
62
52
  end
63
53
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Admin
5
+ module Abilities
6
+ # Defines the abilities for a collaborator user in the admin
7
+ # section. Intended to be used with `cancancan`.
8
+ class ParticipatoryProcessCollaboratorAbility < Decidim::Abilities::ParticipatoryProcessCollaboratorAbility
9
+ def define_abilities
10
+ super
11
+
12
+ can [:read, :preview], ParticipatoryProcess do |process|
13
+ can_manage_process?(process)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Admin
5
+ module Abilities
6
+ # Defines the abilities for a moderator user in the admin
7
+ # section. Intended to be used with `cancancan`.
8
+ class ParticipatoryProcessModeratorAbility < Decidim::Abilities::ParticipatoryProcessModeratorAbility
9
+ def define_abilities
10
+ super
11
+
12
+ can [:read], ParticipatoryProcess do |process|
13
+ can_manage_process?(process)
14
+ end
15
+
16
+ can :manage, Moderation do |moderation|
17
+ can_manage_process?(moderation.participatory_process)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -35,7 +35,7 @@ module Decidim
35
35
  end
36
36
 
37
37
  def process_admins
38
- Decidim::Admin::ParticipatoryProcessUserRole
38
+ Decidim::ParticipatoryProcessUserRole
39
39
  .where(participatory_process: process, role: :admin)
40
40
  .pluck(:decidim_user_id)
41
41
  end
@@ -3,13 +3,13 @@
3
3
  <h2 class='card-title'>
4
4
  <%= t(".categories_title", scope: "decidim.admin") %>
5
5
  <% if can? :create, Decidim::Category %>
6
- <%= link_to t("actions.new", scope: "decidim.admin", name: t("models.category.name", scope: "decidim.admin")), new_participatory_process_category_path(participatory_process), class: 'button tiny button--title new' %>
6
+ <%= link_to t("actions.new", scope: "decidim.admin", name: t("models.category.name", scope: "decidim.admin")), new_participatory_process_category_path(current_participatory_process), class: 'button tiny button--title new' %>
7
7
  <% end %>
8
8
  </h2>
9
9
  </div>
10
10
 
11
11
  <div class="card-section">
12
- <% if participatory_process.categories.any? %>
12
+ <% if current_participatory_process.categories.any? %>
13
13
  <div class="table-scroll">
14
14
  <table class="table-list">
15
15
  <thead>
@@ -19,19 +19,19 @@
19
19
  </tr>
20
20
  </thead>
21
21
  <tbody>
22
- <% participatory_process.categories.first_class.each do |category| %>
22
+ <% current_participatory_process.categories.first_class.each do |category| %>
23
23
  <tr>
24
24
  <td>
25
- <%= link_to translated_attribute(category.name), edit_participatory_process_category_path(participatory_process, category) %><br />
25
+ <%= link_to translated_attribute(category.name), edit_participatory_process_category_path(current_participatory_process, category) %><br />
26
26
  </td>
27
27
  <td class="table-list__actions">
28
28
  <% if can? :update, category %>
29
- <%= icon_link_to "pencil", edit_participatory_process_category_path(participatory_process, category), t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %>
29
+ <%= icon_link_to "pencil", edit_participatory_process_category_path(current_participatory_process, category), t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %>
30
30
  <% end %>
31
31
 
32
32
  <% if can? :destroy, category %>
33
33
  <% if category.unused? %>
34
- <%= icon_link_to "circle-x", participatory_process_category_path(participatory_process, category), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
34
+ <%= icon_link_to "circle-x", participatory_process_category_path(current_participatory_process, category), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
35
35
  <% else %>
36
36
  <span class="action-icon" title="<%= t('.category_used') %>" data-tooltip="true" data-disable-hover="false">
37
37
  <%= icon "circle-x", class: "action-icon action-icon--disabled" %>
@@ -43,15 +43,15 @@
43
43
  <% category.subcategories.each do |subcategory| %>
44
44
  <tr class="extra__table-list__subcategory">
45
45
  <td>
46
- <%= link_to translated_attribute(subcategory.name), edit_participatory_process_category_path(participatory_process, subcategory) %><br />
46
+ <%= link_to translated_attribute(subcategory.name), edit_participatory_process_category_path(current_participatory_process, subcategory) %><br />
47
47
  </td>
48
48
  <td class="table-list__actions">
49
49
  <% if can? :update, subcategory %>
50
- <%= icon_link_to "pencil", edit_participatory_process_category_path(participatory_process, subcategory), t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %>
50
+ <%= icon_link_to "pencil", edit_participatory_process_category_path(current_participatory_process, subcategory), t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %>
51
51
  <% end %>
52
52
 
53
53
  <% if can? :destroy, subcategory %>
54
- <%= icon_link_to "circle-x", participatory_process_category_path(participatory_process, subcategory), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
54
+ <%= icon_link_to "circle-x", participatory_process_category_path(current_participatory_process, subcategory), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
55
55
  <% end %>
56
56
  </td>
57
57
  </tr>
@@ -1,4 +1,4 @@
1
- <%= decidim_form_for(@form, url: participatory_process_categories_path(participatory_process), html: { class: "form new_participatory_process_category" }) do |f| %>
1
+ <%= decidim_form_for(@form, url: participatory_process_categories_path(current_participatory_process), html: { class: "form new_participatory_process_category" }) do |f| %>
2
2
  <%= render partial: 'form', object: f, locals: { title: t('.title') } %>
3
3
 
4
4
  <div class="button--double form-general-submit">
@@ -35,7 +35,7 @@
35
35
  <legend><%= t ".step_settings" %></legend>
36
36
  </div>
37
37
  <div class="card-section">
38
- <% participatory_process.steps.each do |step| %>
38
+ <% current_participatory_process.steps.each do |step| %>
39
39
  <fieldset class="step-settings-<%= step.id %>">
40
40
  <legend><%= step.position + 1 %>. <%= translated_attribute step.title %></legend>
41
41
  <% step_settings = form.object.step_settings[step.id.to_s] %>
@@ -1,4 +1,4 @@
1
- <%= decidim_form_for([participatory_process, @form], url: participatory_process_feature_path(participatory_process, @feature), method: "put", html: { class: "form edit_feature" }) do |form| %>
1
+ <%= decidim_form_for([current_participatory_process, @form], url: participatory_process_feature_path(current_participatory_process, @feature), method: "put", html: { class: "form edit_feature" }) do |form| %>
2
2
  <%= render partial: 'form', object: form, locals: { feature: @feature, title: t(".title", name: t("#{@feature.manifest.name}.name", scope: "decidim.features"))} %>
3
3
 
4
4
  <div class="button--double form-general-submit">
@@ -1,5 +1,5 @@
1
1
 
2
- <%= decidim_form_for([participatory_process, @form], url: participatory_process_features_path(type: params[:type]), method: "post", html: { class: "form new_feature" }) do |form| %>
2
+ <%= decidim_form_for([current_participatory_process, @form], url: participatory_process_features_path(type: params[:type]), method: "post", html: { class: "form new_feature" }) do |form| %>
3
3
  <%= render partial: 'form', object: form, locals: { feature: @feature, title: t(".title", name: t("#{manifest.name}.name", scope: "decidim.features"))} %>
4
4
 
5
5
  <div class="button--double form-general-submit">
@@ -1,4 +1,4 @@
1
- <%= decidim_form_for(@form, url: participatory_process_copies_path(participatory_process), method: :post, html: { class: "form copy_participatory_process" }) do |f| %>
1
+ <%= decidim_form_for(@form, url: participatory_process_copies_path(current_participatory_process), method: :post, html: { class: "form copy_participatory_process" }) do |f| %>
2
2
  <%= render partial: 'form', object: f, locals: { title: t('.title'), select: t('.select')} %>
3
3
 
4
4
  <div class="button--double form-general-submit">
@@ -18,7 +18,11 @@
18
18
  <% collection.each do |group| %>
19
19
  <tr>
20
20
  <td>
21
- <%= link_to translated_attribute(group.name), ['edit', group] %><br />
21
+ <% if can? :update, group %>
22
+ <%= link_to translated_attribute(group.name), ['edit', group] %><br />
23
+ <% else %>
24
+ <%= translated_attribute(group.name) %>
25
+ <% end %>
22
26
  </td>
23
27
  <td class="table-list__actions">
24
28
  <% if can? :update, group %>
@@ -3,14 +3,14 @@
3
3
  <h2 class="card-title">
4
4
  <%= t(".steps_title", scope: "decidim.admin") %>
5
5
  <% if can? :create, Decidim::ParticipatoryProcessStep %>
6
- <%= link_to t("actions.new", scope: "decidim.admin", name: t("models.participatory_process_step.name", scope: "decidim.admin")), new_participatory_process_step_path(participatory_process), class: 'button tiny button--title' %>
6
+ <%= link_to t("actions.new", scope: "decidim.admin", name: t("models.participatory_process_step.name", scope: "decidim.admin")), new_participatory_process_step_path(current_participatory_process), class: 'button tiny button--title' %>
7
7
  <% end %>
8
8
  </h2>
9
9
  </div>
10
10
 
11
11
  <div class="card-section">
12
12
  <div class="table-scroll">
13
- <% if participatory_process.steps.any? %>
13
+ <% if current_participatory_process.steps.any? %>
14
14
  <table class="table-list">
15
15
  <thead>
16
16
  <tr>
@@ -20,15 +20,15 @@
20
20
  <th class="actions"></th>
21
21
  </tr>
22
22
  </thead>
23
- <tbody class="sortable" data-sort-url="<%= ordering_participatory_process_steps_path(participatory_process) %>">
24
- <% participatory_process.steps.each do |step| %>
23
+ <tbody class="sortable" data-sort-url="<%= ordering_participatory_process_steps_path(current_participatory_process) %>">
24
+ <% current_participatory_process.steps.each do |step| %>
25
25
  <tr data-id="<%= step.id %>">
26
26
  <td>
27
- <span class="table-list__actions"><%= icon("move", class: "action-icon") %></span>
27
+ <span class="table-list__actions"><%= icon("move", class: "action-icon") %></span>
28
28
  <% if step.active? %>
29
29
  <span class="icon-active"></span>
30
30
  <% end %>
31
- <%= link_to translated_attribute(step.title), edit_participatory_process_step_path(participatory_process, step) %><br />
31
+ <%= link_to translated_attribute(step.title), edit_participatory_process_step_path(current_participatory_process, step) %><br />
32
32
  </td>
33
33
  <td>
34
34
  <% if step.start_date %>
@@ -42,15 +42,15 @@
42
42
  </td>
43
43
  <td class="table-list__actions">
44
44
  <% if can?(:activate, step) && !step.active? %>
45
- <%= icon_link_to "circle-check", participatory_process_step_activate_path(participatory_process, step), t("actions.activate", scope: "decidim.admin"), class: "action-icon--activate", method: :post %>
45
+ <%= icon_link_to "circle-check", participatory_process_step_activate_path(current_participatory_process, step), t("actions.activate", scope: "decidim.admin"), class: "action-icon--activate", method: :post %>
46
46
  <% end %>
47
47
 
48
48
  <% if can? :update, step %>
49
- <%= icon_link_to "pencil", edit_participatory_process_step_path(participatory_process, step), t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %>
49
+ <%= icon_link_to "pencil", edit_participatory_process_step_path(current_participatory_process, step), t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %>
50
50
  <% end %>
51
51
 
52
52
  <% if can? :destroy, step %>
53
- <%= icon_link_to "circle-x", participatory_process_step_path(participatory_process, step), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
53
+ <%= icon_link_to "circle-x", participatory_process_step_path(current_participatory_process, step), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
54
54
  <% end %>
55
55
  </td>
56
56
  </tr>
@@ -2,8 +2,8 @@
2
2
  <div class="card-divider">
3
3
  <h2 class="card-title">
4
4
  <%= t(".process_admins_title", scope: "decidim.admin") %>
5
- <% if can? :create, Decidim::Admin::ParticipatoryProcessUserRole %>
6
- <%= link_to t("actions.new", scope: "decidim.admin", name: t("models.participatory_process_user_role.name", scope: "decidim.admin")), new_participatory_process_user_role_path(participatory_process), class: 'button tiny button--title new' %>
5
+ <% if can? :create, Decidim::ParticipatoryProcessUserRole %>
6
+ <%= link_to t("actions.new", scope: "decidim.admin", name: t("models.participatory_process_user_role.name", scope: "decidim.admin")), new_participatory_process_user_role_path(current_participatory_process), class: 'button tiny button--title new' %>
7
7
  <% end %>
8
8
  </h2>
9
9
  </div>
@@ -22,7 +22,7 @@
22
22
  </tr>
23
23
  </thead>
24
24
  <tbody>
25
- <% process_admin_roles.each do |role| %>
25
+ <% @participatory_process_user_roles.each do |role| %>
26
26
  <tr>
27
27
  <td>
28
28
  <%= role.user.name %><br />
@@ -45,15 +45,15 @@
45
45
  </td>
46
46
  <td class="table-list__actions">
47
47
  <% if can?(:invite, role) && role.user.invited_to_sign_up? %>
48
- <%= icon_link_to "reload", resend_invitation_participatory_process_user_role_path(participatory_process, role), t("actions.resend_invitation", scope: "decidim.admin"), class: "resend-invitation", method: :post %>
48
+ <%= icon_link_to "reload", resend_invitation_participatory_process_user_role_path(current_participatory_process, role), t("actions.resend_invitation", scope: "decidim.admin"), class: "resend-invitation", method: :post %>
49
49
  <% end %>
50
50
 
51
51
  <% if can? :update, role %>
52
- <%= icon_link_to "pencil", edit_participatory_process_user_role_path(participatory_process, role), t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %>
52
+ <%= icon_link_to "pencil", edit_participatory_process_user_role_path(current_participatory_process, role), t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %>
53
53
  <% end %>
54
54
 
55
55
  <% if can? :destroy, role %>
56
- <%= icon_link_to "circle-x", participatory_process_user_role_path(participatory_process, role), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
56
+ <%= icon_link_to "circle-x", participatory_process_user_role_path(current_participatory_process, role), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
57
57
  <% end %>
58
58
  </td>
59
59
  </tr>
@@ -3,16 +3,16 @@
3
3
  <div class="button--double form-general-submit">
4
4
  <%= f.submit t(".update"), class: "button" %>
5
5
 
6
- <% if can? :publish, participatory_process %>
7
- <% if participatory_process.published? %>
8
- <%= link_to t("actions.unpublish", scope: "decidim.admin"), participatory_process_publish_path(participatory_process), method: :delete, class: "button muted" %>
6
+ <% if can? :publish, current_participatory_process %>
7
+ <% if current_participatory_process.published? %>
8
+ <%= link_to t("actions.unpublish", scope: "decidim.admin"), participatory_process_publish_path(current_participatory_process), method: :delete, class: "button muted" %>
9
9
  <% else %>
10
- <%= link_to t("actions.publish", scope: "decidim.admin"), participatory_process_publish_path(participatory_process), method: :post, class: "button hollow" %>
10
+ <%= link_to t("actions.publish", scope: "decidim.admin"), participatory_process_publish_path(current_participatory_process), method: :post, class: "button hollow" %>
11
11
  <% end %>
12
12
  <% end %>
13
13
 
14
- <% if can? :destroy, participatory_process %>
15
- <%= link_to t("decidim.admin.actions.destroy"), participatory_process, method: :delete, class: "alert button", data: { confirm: t("decidim.admin.actions.confirm_destroy") } %>
14
+ <% if can? :destroy, current_participatory_process %>
15
+ <%= link_to t("decidim.admin.actions.destroy"), current_participatory_process, method: :delete, class: "alert button", data: { confirm: t("decidim.admin.actions.confirm_destroy") } %>
16
16
  <% end %>
17
17
  </div>
18
18
  <% end %>
@@ -24,7 +24,15 @@
24
24
  <%= icon "star" %>
25
25
  </span>
26
26
  <% end %>
27
- <%= link_to translated_attribute(process.title), edit_participatory_process_path(process) %><br />
27
+ <% if can? :update, process %>
28
+ <%= link_to translated_attribute(process.title), edit_participatory_process_path(process) %><br />
29
+ <% elsif can? :preview, process %>
30
+ <%= link_to translated_attribute(process.title), decidim.participatory_process_path(process) %><br />
31
+ <% elsif can? :read, Decidim::Moderation %>
32
+ <%= link_to translated_attribute(process.title), decidim_admin.participatory_process_moderations_path(process) %><br />
33
+ <% else %>
34
+ <%= translated_attribute(process.title) %>
35
+ <% end %>
28
36
  </td>
29
37
  <td>
30
38
  <%= l process.created_at, format: :short %>
@@ -37,7 +45,9 @@
37
45
  <% end %>
38
46
  </td>
39
47
  <td class="table-list__actions">
48
+ <% if can? :create, process %>
40
49
  <%= icon_link_to "clipboard", new_participatory_process_copy_path(process), t("actions.duplicate", scope: "decidim.admin"), class: "action-icon--copy" %>
50
+ <% end %>
41
51
 
42
52
  <% if can? :update, process %>
43
53
  <%= icon_link_to "pencil", edit_participatory_process_path(process), t("actions.configure", scope: "decidim.admin"), class: "action-icon--new" %>
@@ -1,21 +1,21 @@
1
1
  <% content_for :secondary_nav do %>
2
2
  <div class="secondary-nav secondary-nav--subnav">
3
3
  <ul>
4
- <% if can? :update, participatory_process %>
5
- <li <% if is_active_link?(decidim_admin.edit_participatory_process_path(participatory_process)) %> class="is-active" <% end %>>
6
- <%= aria_selected_link_to t("info", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.edit_participatory_process_path(participatory_process) %>
4
+ <% if can? :update, current_participatory_process %>
5
+ <li <% if is_active_link?(decidim_admin.edit_participatory_process_path(current_participatory_process)) %> class="is-active" <% end %>>
6
+ <%= aria_selected_link_to t("info", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.edit_participatory_process_path(current_participatory_process) %>
7
7
  </li>
8
8
  <% end %>
9
9
  <% if can? :read, Decidim::ParticipatoryProcessStep %>
10
- <li <% if is_active_link?(decidim_admin.participatory_process_steps_path(participatory_process)) %> class="is-active" <% end %>>
11
- <%= aria_selected_link_to t("steps", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_steps_path(participatory_process) %>
10
+ <li <% if is_active_link?(decidim_admin.participatory_process_steps_path(current_participatory_process)) %> class="is-active" <% end %>>
11
+ <%= aria_selected_link_to t("steps", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_steps_path(current_participatory_process) %>
12
12
  </li>
13
13
  <% end %>
14
14
  <% if can? :read, Decidim::Feature %>
15
- <li <% if is_active_link?(decidim_admin.participatory_process_features_path(participatory_process)) %> class="is-active" <% end %>>
16
- <%= aria_selected_link_to t("features", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_features_path(participatory_process) %>
15
+ <li <% if is_active_link?(decidim_admin.participatory_process_features_path(current_participatory_process)) %> class="is-active" <% end %>>
16
+ <%= aria_selected_link_to t("features", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_features_path(current_participatory_process) %>
17
17
  <ul>
18
- <% participatory_process.features.each do |feature| %>
18
+ <% current_participatory_process.features.each do |feature| %>
19
19
  <% if feature.manifest.admin_engine %>
20
20
  <li <% if is_active_link?(manage_feature_path(feature)) %> class="is-active" <% end %>>
21
21
  <%= link_to manage_feature_path(feature) do %>
@@ -31,23 +31,23 @@
31
31
  </li>
32
32
  <% end %>
33
33
  <% if can? :read, Decidim::Category %>
34
- <li <% if is_active_link?(decidim_admin.participatory_process_categories_path(participatory_process)) %> class="is-active" <% end %>>
35
- <%= aria_selected_link_to t("categories", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_categories_path(participatory_process) %>
34
+ <li <% if is_active_link?(decidim_admin.participatory_process_categories_path(current_participatory_process)) %> class="is-active" <% end %>>
35
+ <%= aria_selected_link_to t("categories", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_categories_path(current_participatory_process) %>
36
36
  </li>
37
37
  <% end %>
38
38
  <% if can? :read, Decidim::Attachment %>
39
- <li <% if is_active_link?(decidim_admin.participatory_process_attachments_path(participatory_process.id)) %> class="is-active" <% end %>>
40
- <%= aria_selected_link_to t("attachments", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_attachments_path(participatory_process.id) %>
39
+ <li <% if is_active_link?(decidim_admin.participatory_process_attachments_path(current_participatory_process.id)) %> class="is-active" <% end %>>
40
+ <%= aria_selected_link_to t("attachments", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_attachments_path(current_participatory_process.id) %>
41
41
  </li>
42
42
  <% end %>
43
- <% if can? :read, Decidim::Admin::ParticipatoryProcessUserRole %>
44
- <li <% if is_active_link?(decidim_admin.participatory_process_user_roles_path(participatory_process)) %> class="is-active" <% end %>>
45
- <%= aria_selected_link_to t("process_admins", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_user_roles_path(participatory_process) %>
43
+ <% if can? :read, Decidim::ParticipatoryProcessUserRole %>
44
+ <li <% if is_active_link?(decidim_admin.participatory_process_user_roles_path(current_participatory_process)) %> class="is-active" <% end %>>
45
+ <%= aria_selected_link_to t("process_admins", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_user_roles_path(current_participatory_process) %>
46
46
  </li>
47
47
  <% end %>
48
48
  <% if can? :read, Decidim::Moderation %>
49
- <li <% if is_active_link?(decidim_admin.participatory_process_moderations_path(participatory_process.id)) %> class="is-active" <% end %>>
50
- <%= aria_selected_link_to t("moderations", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_moderations_path(participatory_process.id) %>
49
+ <li <% if is_active_link?(decidim_admin.participatory_process_moderations_path(current_participatory_process.id)) %> class="is-active" <% end %>>
50
+ <%= aria_selected_link_to t("moderations", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_moderations_path(current_participatory_process.id) %>
51
51
  </li>
52
52
  <% end %>
53
53
  </ul>
@@ -57,7 +57,7 @@
57
57
  <%= render "layouts/decidim/admin/application" do %>
58
58
  <div class="process-title">
59
59
  <div class="process-title-content">
60
- <%= translated_attribute(participatory_process.title) %>
60
+ <%= translated_attribute(current_participatory_process.title) %>
61
61
  </div>
62
62
  </div>
63
63
  <%= yield %>