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
@@ -99,6 +99,17 @@ describe "Explore meetings", type: :feature do
99
99
  end
100
100
  end
101
101
  end
102
+
103
+ context "when paginating" do
104
+ before do
105
+ Decidim::Meetings::Meeting.destroy_all
106
+ end
107
+
108
+ let!(:collection) { create_list :meeting, collection_size, feature: feature }
109
+ let!(:resource_selector) { ".card--meeting" }
110
+
111
+ it_behaves_like "a paginated resource"
112
+ end
102
113
  end
103
114
 
104
115
  context "show", :serves_map do
@@ -8,6 +8,7 @@ module Decidim
8
8
  include FormFactory
9
9
  include FilterResource
10
10
  include Orderable
11
+ include Paginable
11
12
 
12
13
  helper_method :geocoded_proposals
13
14
 
@@ -30,7 +31,7 @@ module Decidim
30
31
  []
31
32
  end
32
33
 
33
- @proposals = @proposals.page(params[:page]).per(12)
34
+ @proposals = paginate(@proposals)
34
35
  @proposals = reorder(@proposals)
35
36
  end
36
37
 
@@ -11,7 +11,7 @@ module Decidim
11
11
  translatable_attribute :answer, String
12
12
  attribute :state, String
13
13
 
14
- validates :state, presence: true, inclusion: { in: %w(accepted rejected) }
14
+ validates :state, presence: true, inclusion: { in: %w(accepted rejected evaluating) }
15
15
  validates :answer, translatable_presence: true, if: ->(form) { form.state == "rejected" }
16
16
  end
17
17
  end
@@ -17,15 +17,7 @@ module Decidim
17
17
  #
18
18
  # Returns a String.
19
19
  def humanize_proposal_state(state)
20
- value = if state == "accepted"
21
- "accepted"
22
- elsif state == "rejected"
23
- "rejected"
24
- else
25
- "not_answered"
26
- end
27
-
28
- I18n.t(value, scope: "decidim.proposals.answers")
20
+ I18n.t(state, scope: "decidim.proposals.answers", default: :not_answered)
29
21
  end
30
22
 
31
23
  # Public: The css class applied based on the proposal state.
@@ -34,14 +26,34 @@ module Decidim
34
26
  #
35
27
  # Returns a String.
36
28
  def proposal_state_css_class(state)
37
- if state == "accepted"
29
+ case state
30
+ when "accepted"
38
31
  "text-success"
39
- elsif state == "rejected"
32
+ when "rejected"
40
33
  "text-alert"
34
+ when "evaluating"
35
+ "text-info"
41
36
  else
42
37
  "text-warning"
43
38
  end
44
39
  end
40
+
41
+ # Public: The css class applied based on the proposal state to
42
+ # the proposal badge.
43
+ #
44
+ # state - The String state of the proposal.
45
+ #
46
+ # Returns a String.
47
+ def proposal_state_badge_css_class(state)
48
+ case state
49
+ when "accepted"
50
+ "success"
51
+ when "rejected"
52
+ "warning"
53
+ when "evaluating"
54
+ "secondary"
55
+ end
56
+ end
45
57
  end
46
58
  end
47
59
  end
@@ -5,16 +5,9 @@ module Decidim
5
5
  module Abilities
6
6
  # Defines the abilities related to proposals for a logged in admin user.
7
7
  # Intended to be used with `cancancan`.
8
- class AdminUser
9
- include CanCan::Ability
10
-
11
- attr_reader :user, :context
12
-
13
- def initialize(user, context)
14
- return unless user && user.role?(:admin)
15
-
16
- @user = user
17
- @context = context
8
+ class AdminAbility < Decidim::Abilities::AdminAbility
9
+ def define_abilities
10
+ super
18
11
 
19
12
  can :manage, Proposal
20
13
  can :unreport, Proposal
@@ -26,11 +19,11 @@ module Decidim
26
19
  private
27
20
 
28
21
  def current_settings
29
- context.fetch(:current_settings, nil)
22
+ @context.fetch(:current_settings, nil)
30
23
  end
31
24
 
32
25
  def feature_settings
33
- context.fetch(:feature_settings, nil)
26
+ @context.fetch(:feature_settings, nil)
34
27
  end
35
28
 
36
29
  def can_create_proposal?
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Abilities
6
6
  # Defines the abilities related to proposals for a logged in user.
7
7
  # Intended to be used with `cancancan`.
8
- class CurrentUser
8
+ class CurrentUserAbility
9
9
  include CanCan::Ability
10
10
 
11
11
  attr_reader :user, :context
@@ -27,7 +27,6 @@ module Decidim
27
27
  can :create, Proposal if authorized?(:create) && creation_enabled?
28
28
 
29
29
  can :report, Proposal
30
- can :report, Decidim::Comments::Comment
31
30
  end
32
31
 
33
32
  private
@@ -5,22 +5,14 @@ module Decidim
5
5
  module Abilities
6
6
  # Defines the abilities related to proposals for a logged in process admin user.
7
7
  # Intended to be used with `cancancan`.
8
- class ProcessAdminUser
9
- include CanCan::Ability
8
+ class ParticipatoryProcessAdminAbility < Decidim::Abilities::ParticipatoryProcessAdminAbility
9
+ def define_participatory_process_abilities
10
+ super
10
11
 
11
- attr_reader :user, :context
12
-
13
- def initialize(user, context)
14
- return unless user && !user.role?(:admin)
15
-
16
- @user = user
17
- @context = context
18
-
19
- can :manage, Proposal do |proposal|
20
- participatory_processes.include?(proposal.feature.participatory_process)
12
+ can [:manage, :unreport, :hide], Proposal do |proposal|
13
+ can_manage_process?(proposal.feature.participatory_process)
21
14
  end
22
- can :unreport, Proposal
23
- can :hide, Proposal
15
+
24
16
  cannot :create, Proposal unless can_create_proposal?
25
17
  cannot :update, Proposal unless can_update_proposal?
26
18
  end
@@ -28,31 +20,27 @@ module Decidim
28
20
  private
29
21
 
30
22
  def current_settings
31
- context.fetch(:current_settings, nil)
23
+ @context.fetch(:current_settings, nil)
32
24
  end
33
25
 
34
26
  def feature_settings
35
- context.fetch(:feature_settings, nil)
27
+ @context.fetch(:feature_settings, nil)
36
28
  end
37
29
 
38
30
  def current_feature
39
- context.fetch(:current_feature, nil)
31
+ @context.fetch(:current_feature, nil)
40
32
  end
41
33
 
42
34
  def can_create_proposal?
43
35
  current_settings.try(:creation_enabled?) &&
44
36
  feature_settings.try(:official_proposals_enabled) &&
45
- participatory_processes.include?(current_feature.try(:participatory_process))
37
+ can_manage_process?(current_feature.try(:participatory_process))
46
38
  end
47
39
 
48
40
  def can_update_proposal?
49
41
  current_settings.try(:proposal_answering_enabled) &&
50
42
  feature_settings.try(:proposal_answering_enabled)
51
43
  end
52
-
53
- def participatory_processes
54
- @participatory_processes ||= Decidim::Admin::ManageableParticipatoryProcessesForUser.for(@user)
55
- end
56
44
  end
57
45
  end
58
46
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Proposals
5
+ module Abilities
6
+ # Defines the abilities related to proposals for a logged in process admin user.
7
+ # Intended to be used with `cancancan`.
8
+ class ParticipatoryProcessModeratorAbility < Decidim::Abilities::ParticipatoryProcessModeratorAbility
9
+ def define_participatory_process_abilities
10
+ super
11
+
12
+ can [:unreport, :hide], Proposal do |proposal|
13
+ can_manage_process?(proposal.feature.participatory_process)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -23,6 +23,7 @@ module Decidim
23
23
 
24
24
  scope :accepted, -> { where(state: "accepted") }
25
25
  scope :rejected, -> { where(state: "rejected") }
26
+ scope :evaluating, -> { where(state: "evaluating") }
26
27
 
27
28
  def self.order_randomly(seed)
28
29
  transaction do
@@ -67,6 +68,13 @@ module Decidim
67
68
  state == "rejected"
68
69
  end
69
70
 
71
+ # Public: Checks if the organization has marked the proposal as evaluating it.
72
+ #
73
+ # Returns Boolean.
74
+ def evaluating?
75
+ state == "evaluating"
76
+ end
77
+
70
78
  # Public: Overrides the `commentable?` Commentable concern method.
71
79
  def commentable?
72
80
  feature.settings.comments_enabled?
@@ -47,10 +47,13 @@ module Decidim
47
47
 
48
48
  # Handle the state filter
49
49
  def search_state
50
- if state == "accepted"
50
+ case state
51
+ when "accepted"
51
52
  query.accepted
52
- elsif state == "rejected"
53
+ when "rejected"
53
54
  query.rejected
55
+ when "evaluating"
56
+ query.evaluating
54
57
  else # Assume 'all'
55
58
  query
56
59
  end
@@ -6,7 +6,7 @@
6
6
 
7
7
  <div class="card-section">
8
8
  <div class="row column">
9
- <%= f.collection_radio_buttons :state, [["accepted", t('.accepted')], ["rejected", t('.rejected')]], :first, :last, prompt: true %>
9
+ <%= f.collection_radio_buttons :state, [["accepted", t('.accepted')], ["rejected", t('.rejected')], ["evaluating", t('.evaluating')]], :first, :last, prompt: true %>
10
10
  </div>
11
11
 
12
12
  <div class="row column">
@@ -17,7 +17,7 @@
17
17
  <% end %>
18
18
 
19
19
  <% if feature_settings.proposal_answering_enabled && current_settings.proposal_answering_enabled %>
20
- <%= form.collection_radio_buttons :state, [["all", t('.all')], ["accepted", t('.accepted')], ["rejected", t('.rejected')]], :first, :last, legend_title: t('.state') %>
20
+ <%= form.collection_radio_buttons :state, [["all", t('.all')], ["accepted", t('.accepted')], ["rejected", t('.rejected')], ["evaluating", t('.evaluating')]], :first, :last, legend_title: t('.state') %>
21
21
  <% end %>
22
22
 
23
23
  <% if linked_classes_for(Decidim::Proposals::Proposal).any? %>
@@ -1,3 +1,3 @@
1
1
  <% if proposal.answered? %>
2
- <span class="<%= (proposal.accepted? ? 'success' : 'warning') %> label proposal-status"><%= humanize_proposal_state proposal.state %></span>
2
+ <span class="<%= proposal_state_badge_css_class(proposal.state) %> label proposal-status"><%= humanize_proposal_state proposal.state %></span>
3
3
  <% end %>
@@ -1,4 +1,13 @@
1
- <%= order_selector available_orders, i18n_scope: "decidim.proposals.proposals.orders" %>
1
+ <div class="collection-sort-controls row small-up-1 medium-up-3 card-grid">
2
+ <div class="column">
3
+ <%= order_selector available_orders, i18n_scope: "decidim.proposals.proposals.orders" %>
4
+ </div>
5
+
6
+ <div class="column">
7
+ <%= render partial: "decidim/shared/results_per_page" %>
8
+ </div>
9
+ </div>
10
+
2
11
  <div class="row small-up-1 medium-up-2 card-grid">
3
12
  <%= render @proposals %>
4
13
  </div>
@@ -48,6 +48,7 @@ ca:
48
48
  edit:
49
49
  accepted: Acceptada
50
50
  answer_proposal: Resposta
51
+ evaluating: En avaluació
51
52
  rejected: Rebutjada
52
53
  title: Respondre a la proposta %{title}
53
54
  proposals:
@@ -66,6 +67,7 @@ ca:
66
67
  title: Crear proposta
67
68
  answers:
68
69
  accepted: Acceptada
70
+ evaluating: En avaluació
69
71
  not_answered: No resposta
70
72
  rejected: Rebutjada
71
73
  create:
@@ -97,6 +99,7 @@ ca:
97
99
  category: Categoria
98
100
  category_prompt: Selecciona una categoria
99
101
  citizenship: Ciutadania
102
+ evaluating: En avaluació
100
103
  official: Oficial
101
104
  origin: Origen
102
105
  rejected: Rebutjades
@@ -50,6 +50,7 @@ en:
50
50
  edit:
51
51
  accepted: Accepted
52
52
  answer_proposal: Answer
53
+ evaluating: Evaluating
53
54
  rejected: Rejected
54
55
  title: Answer for proposal %{title}
55
56
  proposals:
@@ -68,6 +69,7 @@ en:
68
69
  title: Create proposal
69
70
  answers:
70
71
  accepted: Accepted
72
+ evaluating: Evaluating
71
73
  not_answered: Not answered
72
74
  rejected: Rejected
73
75
  create:
@@ -99,6 +101,7 @@ en:
99
101
  category: Category
100
102
  category_prompt: Select a category
101
103
  citizenship: Citizenship
104
+ evaluating: Evaluating
102
105
  official: Official
103
106
  origin: Origin
104
107
  rejected: Rejected
@@ -48,6 +48,7 @@ es:
48
48
  edit:
49
49
  accepted: Aceptada
50
50
  answer_proposal: Respuesta
51
+ evaluating: En evaluación
51
52
  rejected: Rechazada
52
53
  title: Responder a la propuesta %{title}
53
54
  proposals:
@@ -66,6 +67,7 @@ es:
66
67
  title: Crear propuesta
67
68
  answers:
68
69
  accepted: Aceptadas
70
+ evaluating: En evaluación
69
71
  not_answered: No contestada
70
72
  rejected: Rechazada
71
73
  create:
@@ -97,6 +99,7 @@ es:
97
99
  category: Categoría
98
100
  category_prompt: Selecciona una categoría
99
101
  citizenship: Ciudadanía
102
+ evaluating: En evaluación
100
103
  official: Oficial
101
104
  origin: Origen
102
105
  rejected: Rechazadas
@@ -18,8 +18,11 @@ module Decidim
18
18
 
19
19
  initializer "decidim_proposals.inject_abilities_to_user" do |_app|
20
20
  Decidim.configure do |config|
21
- config.admin_abilities += ["Decidim::Proposals::Abilities::AdminUser"]
22
- config.admin_abilities += ["Decidim::Proposals::Abilities::ProcessAdminUser"]
21
+ config.admin_abilities += [
22
+ "Decidim::Proposals::Abilities::AdminAbility",
23
+ "Decidim::Proposals::Abilities::ParticipatoryProcessAdminAbility",
24
+ "Decidim::Proposals::Abilities::ParticipatoryProcessModeratorAbility"
25
+ ]
23
26
  end
24
27
  end
25
28
 
@@ -25,7 +25,7 @@ module Decidim
25
25
 
26
26
  initializer "decidim_proposals.inject_abilities_to_user" do |_app|
27
27
  Decidim.configure do |config|
28
- config.abilities += ["Decidim::Proposals::Abilities::CurrentUser"]
28
+ config.abilities += ["Decidim::Proposals::Abilities::CurrentUserAbility"]
29
29
  end
30
30
  end
31
31
  end
@@ -114,6 +114,10 @@ Decidim.register_feature(:proposals) do |feature|
114
114
  proposal.answered_at = Time.current
115
115
  proposal.answer = Decidim::Faker::Localized.sentence(10)
116
116
  proposal.save!
117
+ elsif n > 6
118
+ proposal.state = "evaluating"
119
+ proposal.answered_at = Time.current
120
+ proposal.save!
117
121
  end
118
122
 
119
123
  rand(3).times do |m|
@@ -21,6 +21,10 @@ module Decidim
21
21
  id: @proposal.category.try(:id),
22
22
  name: @proposal.category.try(:name)
23
23
  },
24
+ scope: {
25
+ id: @proposal.scope.try(:id),
26
+ name: @proposal.scope.try(:name)
27
+ },
24
28
  title: @proposal.title,
25
29
  body: @proposal.body,
26
30
  votes: @proposal.proposal_votes_count,
@@ -411,9 +411,9 @@ describe "Proposals", type: :feature do
411
411
  visit_feature
412
412
 
413
413
  expect(page).to have_selector("a", text: "Random")
414
- expect(page).to have_selector("#proposals .card-grid .column", count: 2)
415
- expect(page).to have_selector("#proposals .card-grid .column", text: lucky_proposal.title)
416
- expect(page).to have_selector("#proposals .card-grid .column", text: unlucky_proposal.title)
414
+ expect(page).to have_selector(".card--proposal", count: 2)
415
+ expect(page).to have_selector(".card--proposal", text: lucky_proposal.title)
416
+ expect(page).to have_selector(".card--proposal", text: unlucky_proposal.title)
417
417
  end
418
418
  end
419
419
 
@@ -487,13 +487,13 @@ describe "Proposals", type: :feature do
487
487
 
488
488
  context "when there are a lot of proposals" do
489
489
  before do
490
- create_list(:proposal, 17, feature: feature)
490
+ create_list(:proposal, Decidim::Paginable::OPTIONS.first + 5, feature: feature)
491
491
  end
492
492
 
493
493
  it "paginates them" do
494
494
  visit_feature
495
495
 
496
- expect(page).to have_css(".card--proposal", count: 12)
496
+ expect(page).to have_css(".card--proposal", count: Decidim::Paginable::OPTIONS.first)
497
497
 
498
498
  click_link "Next"
499
499
 
@@ -751,5 +751,12 @@ describe "Proposals", type: :feature do
751
751
  end
752
752
  end
753
753
  end
754
+
755
+ context "when paginating" do
756
+ let!(:collection) { create_list :proposal, collection_size, feature: feature }
757
+ let!(:resource_selector) { ".card--proposal" }
758
+
759
+ it_behaves_like "a paginated resource"
760
+ end
754
761
  end
755
762
  end