decidim-accountability 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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/app/commands/decidim/accountability/admin/create_result.rb +3 -1
  3. data/app/commands/decidim/accountability/admin/update_result.rb +3 -1
  4. data/app/controllers/decidim/accountability/admin/results_controller.rb +10 -0
  5. data/app/controllers/decidim/accountability/admin/statuses_controller.rb +10 -0
  6. data/app/controllers/decidim/accountability/admin/timeline_entries_controller.rb +10 -0
  7. data/app/forms/decidim/accountability/admin/result_form.rb +2 -1
  8. data/app/models/decidim/accountability/result.rb +16 -2
  9. data/app/permissions/decidim/accountability/admin/permissions.rb +46 -0
  10. data/app/permissions/decidim/accountability/permissions.rb +16 -0
  11. data/app/services/decidim/accountability/result_stats_calculator.rb +1 -1
  12. data/app/views/decidim/accountability/admin/results/index.html.erb +5 -5
  13. data/app/views/decidim/accountability/admin/statuses/index.html.erb +3 -3
  14. data/app/views/decidim/accountability/admin/timeline_entries/index.html.erb +3 -3
  15. data/app/views/decidim/accountability/results/_linked_results.html.erb +0 -1
  16. data/app/views/decidim/accountability/results/_show_leaf.html.erb +1 -1
  17. data/app/views/decidim/accountability/results/_show_parent.html.erb +1 -1
  18. data/config/locales/ca.yml +9 -2
  19. data/config/locales/en.yml +9 -2
  20. data/config/locales/es.yml +9 -2
  21. data/config/locales/eu.yml +9 -2
  22. data/config/locales/fi.yml +9 -2
  23. data/config/locales/fr.yml +9 -2
  24. data/config/locales/gl.yml +9 -2
  25. data/config/locales/it.yml +9 -2
  26. data/config/locales/nl.yml +9 -2
  27. data/config/locales/pl.yml +11 -2
  28. data/config/locales/pt-BR.yml +9 -2
  29. data/config/locales/pt.yml +9 -2
  30. data/config/locales/ru.yml +51 -2
  31. data/config/locales/sv.yml +9 -2
  32. data/config/locales/uk.yml +11 -2
  33. data/db/migrate/20180508170210_add_weight_to_results.rb +7 -0
  34. data/db/migrate/20180508170647_add_external_id_to_results.rb +7 -0
  35. data/lib/decidim/accountability/component.rb +2 -1
  36. data/lib/decidim/accountability/version.rb +1 -1
  37. metadata +26 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e7c8c9e4ccd89572613111e08e1641635fb6d4be2e4a2c1742f555651aca82f
4
- data.tar.gz: 3dafb6d76fd6ab4458cc9717c90fa784ee4f6004148c5dcde36120af9c86c83d
3
+ metadata.gz: 4a65df5014a44d7d4823b90e57aa405fcd189d5b41642109e63e8df91651533f
4
+ data.tar.gz: 2b8a1b55271be035047b779685a77404283190de1b15cee67a75415757ed9658
5
5
  SHA512:
6
- metadata.gz: a86dcde9dc1acc763491537b368b50b09e03923d30f6732343588092154708f451ea41fa472ddd392103292dcee5d660f64d6ae617c4734f02ea06330e834bd0
7
- data.tar.gz: 673209eb1645e24857c7171db27f723ce3c07e366f67d0cd8f0e6f5d6641824a80e8a77c18f778f0d8d78e2892532d4235cbc23149637152690e09aea56860ca
6
+ metadata.gz: b85f61879c2363725b2bd2022ecf85e31d91d4918bf655da887e90727e97b3a788fe61a016bde1354cb60d50b5503aa991718a18de0699c2e26ff002aaea5052
7
+ data.tar.gz: 3b81f8ba6e0c6a742d5806a5f82cceea466d6f3ee7077053f617ccf3d4612c25d3c22814736865df46b8098f00f7b3d8da23df100100521459b20f59efd32821
@@ -44,7 +44,9 @@ module Decidim
44
44
  start_date: @form.start_date,
45
45
  end_date: @form.end_date,
46
46
  progress: @form.progress,
47
- decidim_accountability_status_id: @form.decidim_accountability_status_id
47
+ decidim_accountability_status_id: @form.decidim_accountability_status_id,
48
+ external_id: @form.external_id.presence,
49
+ weight: @form.weight
48
50
  )
49
51
  end
50
52
 
@@ -47,7 +47,9 @@ module Decidim
47
47
  start_date: @form.start_date,
48
48
  end_date: @form.end_date,
49
49
  progress: @form.progress,
50
- decidim_accountability_status_id: @form.decidim_accountability_status_id
50
+ decidim_accountability_status_id: @form.decidim_accountability_status_id,
51
+ external_id: @form.external_id.presence,
52
+ weight: @form.weight
51
53
  )
52
54
  end
53
55
 
@@ -8,11 +8,15 @@ module Decidim
8
8
  helper_method :results, :parent_result, :parent_results, :statuses
9
9
 
10
10
  def new
11
+ enforce_permission_to :create, :result
12
+
11
13
  @form = form(ResultForm).instance
12
14
  @form.parent_id = params[:parent_id]
13
15
  end
14
16
 
15
17
  def create
18
+ enforce_permission_to :create, :result
19
+
16
20
  @form = form(ResultForm).from_params(params)
17
21
 
18
22
  CreateResult.call(@form) do
@@ -29,10 +33,14 @@ module Decidim
29
33
  end
30
34
 
31
35
  def edit
36
+ enforce_permission_to :update, :result, result: result
37
+
32
38
  @form = form(ResultForm).from_model(result)
33
39
  end
34
40
 
35
41
  def update
42
+ enforce_permission_to :update, :result, result: result
43
+
36
44
  @form = form(ResultForm).from_params(params)
37
45
 
38
46
  UpdateResult.call(@form, result) do
@@ -49,6 +57,8 @@ module Decidim
49
57
  end
50
58
 
51
59
  def destroy
60
+ enforce_permission_to :destroy, :result, result: result
61
+
52
62
  DestroyResult.call(result, current_user) do
53
63
  on(:ok) do
54
64
  flash[:notice] = I18n.t("results.destroy.success", scope: "decidim.accountability.admin")
@@ -8,10 +8,14 @@ module Decidim
8
8
  helper_method :statuses
9
9
 
10
10
  def new
11
+ enforce_permission_to :create, :status
12
+
11
13
  @form = form(StatusForm).instance
12
14
  end
13
15
 
14
16
  def create
17
+ enforce_permission_to :create, :status
18
+
15
19
  @form = form(StatusForm).from_params(params)
16
20
 
17
21
  CreateStatus.call(@form) do
@@ -28,10 +32,14 @@ module Decidim
28
32
  end
29
33
 
30
34
  def edit
35
+ enforce_permission_to :update, :status, status: status
36
+
31
37
  @form = form(StatusForm).from_model(status)
32
38
  end
33
39
 
34
40
  def update
41
+ enforce_permission_to :update, :status, status: status
42
+
35
43
  @form = form(StatusForm).from_params(params)
36
44
 
37
45
  UpdateStatus.call(@form, status) do
@@ -48,6 +56,8 @@ module Decidim
48
56
  end
49
57
 
50
58
  def destroy
59
+ enforce_permission_to :destroy, :status, status: status
60
+
51
61
  status.destroy!
52
62
 
53
63
  flash[:notice] = I18n.t("statuses.destroy.success", scope: "decidim.accountability.admin")
@@ -8,10 +8,14 @@ module Decidim
8
8
  helper_method :result, :timeline_entries
9
9
 
10
10
  def new
11
+ enforce_permission_to :create, :timeline_entry
12
+
11
13
  @form = form(TimelineEntryForm).instance
12
14
  end
13
15
 
14
16
  def create
17
+ enforce_permission_to :create, :timeline_entry
18
+
15
19
  @form = form(TimelineEntryForm).from_params(params)
16
20
  @form.decidim_accountability_result_id = params[:result_id]
17
21
 
@@ -29,10 +33,14 @@ module Decidim
29
33
  end
30
34
 
31
35
  def edit
36
+ enforce_permission_to :update, :timeline_entry, timeline_entry: timeline_entry
37
+
32
38
  @form = form(TimelineEntryForm).from_model(timeline_entry)
33
39
  end
34
40
 
35
41
  def update
42
+ enforce_permission_to :update, :timeline_entry, timeline_entry: timeline_entry
43
+
36
44
  @form = form(TimelineEntryForm).from_params(params)
37
45
 
38
46
  UpdateTimelineEntry.call(@form, timeline_entry) do
@@ -49,6 +57,8 @@ module Decidim
49
57
  end
50
58
 
51
59
  def destroy
60
+ enforce_permission_to :destroy, :timeline_entry, timeline_entry: timeline_entry
61
+
52
62
  timeline_entry.destroy!
53
63
 
54
64
  flash[:notice] = I18n.t("timeline_entries.destroy.success", scope: "decidim.accountability.admin")
@@ -20,9 +20,10 @@ module Decidim
20
20
  attribute :progress, Float
21
21
  attribute :decidim_accountability_status_id, Integer
22
22
  attribute :parent_id, Integer
23
+ attribute :external_id, String
24
+ attribute :weight, Float
23
25
 
24
26
  validates :title, translatable_presence: true
25
- validates :description, translatable_presence: true
26
27
 
27
28
  validates :scope, presence: true, if: ->(form) { form.decidim_scope_id.present? }
28
29
  validates :category, presence: true, if: ->(form) { form.decidim_category_id.present? }
@@ -29,7 +29,7 @@ module Decidim
29
29
  def self.order_randomly(seed)
30
30
  transaction do
31
31
  connection.execute("SELECT setseed(#{connection.quote(seed)})")
32
- order("RANDOM()").load
32
+ order(Arel.sql("RANDOM()")).load
33
33
  end
34
34
  end
35
35
 
@@ -43,8 +43,15 @@ module Decidim
43
43
  parent.update_progress!
44
44
  end
45
45
 
46
+ # Public: There are two ways to update parent's progress:
47
+ # - using weights, in which case each progress is multiplied by the weigth and them summed
48
+ # - not using weights, and using the average of progress of each children
46
49
  def update_progress!
47
- self.progress = children.average(:progress)
50
+ self.progress = if children_use_weighted_progress?
51
+ children.sum { |result| (result.progress.presence || 0) * (result.weight.presence || 1) }
52
+ else
53
+ children.average(:progress)
54
+ end
48
55
  save!
49
56
  end
50
57
 
@@ -67,6 +74,13 @@ module Decidim
67
74
  def comments_have_votes?
68
75
  true
69
76
  end
77
+
78
+ private
79
+
80
+ # Private: When a row uses weight 1 and there's more than one, weight shouldn't be considered
81
+ def children_use_weighted_progress?
82
+ children.length == 1 || children.pluck(:weight).none? { |weight| weight == 1.0 }
83
+ end
70
84
  end
71
85
  end
72
86
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Accountability
5
+ module Admin
6
+ class Permissions < Decidim::DefaultPermissions
7
+ def permissions
8
+ return permission_action if permission_action.scope != :admin
9
+
10
+ permission_action.allow! if can_perform_actions_on?(:result, result)
11
+ permission_action.allow! if can_perform_actions_on?(:status, status)
12
+ permission_action.allow! if can_perform_actions_on?(:timeline_entry, timeline_entry)
13
+
14
+ permission_action
15
+ end
16
+
17
+ private
18
+
19
+ def result
20
+ @result ||= context.fetch(:result, nil)
21
+ end
22
+
23
+ def status
24
+ @status ||= context.fetch(:status, nil)
25
+ end
26
+
27
+ def timeline_entry
28
+ @timeline_entry ||= context.fetch(:timeline_entry, nil)
29
+ end
30
+
31
+ def can_perform_actions_on?(subject, resource)
32
+ return unless permission_action.subject == subject
33
+
34
+ case permission_action.action
35
+ when :create
36
+ true
37
+ when :update, :destroy
38
+ resource.present?
39
+ else
40
+ false
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Accountability
5
+ class Permissions < Decidim::DefaultPermissions
6
+ def permissions
7
+ return permission_action unless user
8
+
9
+ # Delegate the admin permission checks to the admin permissions class
10
+ return Decidim::Accountability::Admin::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :admin
11
+
12
+ permission_action
13
+ end
14
+ end
15
+ end
16
+ end
@@ -19,7 +19,7 @@ module Decidim
19
19
  end
20
20
 
21
21
  def comments_count
22
- Decidim::Comments::Comment.where(commentable: proposals).count
22
+ Decidim::Comments::Comment.where(commentable: proposals.to_a).count
23
23
  end
24
24
 
25
25
  def attendees_count
@@ -4,7 +4,7 @@
4
4
  <%= link_to "#{translated_attribute(parent_result.title)} > ", edit_result_path(parent_result) if parent_result %>
5
5
  <%= t(".title") %>
6
6
  <div class="button--title">
7
- <%= link_to t("actions.new", scope: "decidim.accountability", name: t("models.result.name", scope: "decidim.accountability.admin")), new_result_path(parent_id: parent_result), class: "button tiny button--simple" if can? :manage, current_component %>
7
+ <%= link_to t("actions.new", scope: "decidim.accountability", name: t("models.result.name", scope: "decidim.accountability.admin")), new_result_path(parent_id: parent_result), class: "button tiny button--simple" if allowed_to? :create, :result %>
8
8
  <%= render partial: "decidim/accountability/admin/shared/subnav" unless parent_result %>
9
9
  <%= export_dropdown %>
10
10
  </div>
@@ -29,19 +29,19 @@
29
29
  <td class="table-list__actions">
30
30
  <%= icon_link_to "eye", resource_locator(result).path, t("actions.preview", scope: "decidim.accountability"), class: "action-icon--preview", target: :blank %>
31
31
 
32
- <% if can? :update, current_component %>
32
+ <% if allowed_to? :update, :result, result: result %>
33
33
  <%= icon_link_to "plus", results_path(parent_id: result.id), t("actions.new", scope: "decidim.accountability", name: t("models.result.name", scope: "decidim.accountability.admin")), class: "action-icon--plus" %>
34
34
  <% end %>
35
35
 
36
- <% if can? :update, current_component %>
36
+ <% if allowed_to? :update, :result, result: result %>
37
37
  <%= icon_link_to "clock", result_timeline_entries_path(result), t("actions.timeline_entries", scope: "decidim.accountability"), class: "action-icon--clock" %>
38
38
  <% end %>
39
39
 
40
- <% if can? :update, current_component %>
40
+ <% if allowed_to? :update, :result, result: result %>
41
41
  <%= icon_link_to "pencil", edit_result_path(result), t("actions.edit", scope: "decidim.accountability"), class: "action-icon--edit" %>
42
42
  <% end %>
43
43
 
44
- <% if can? :destroy, current_component %>
44
+ <% if allowed_to? :destroy, :result, result: result %>
45
45
  <%= icon_link_to "circle-x", result_path(result), t("actions.destroy", scope: "decidim.accountability"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.accountability", name: t("models.result.name", scope: "decidim.accountability.admin")) } %>
46
46
  <% end %>
47
47
  </td>
@@ -2,7 +2,7 @@
2
2
  <div class="card-divider">
3
3
  <h2 class="card-title">
4
4
  <%= t(".title") %>
5
- <%= link_to t("actions.new", scope: "decidim.accountability", name: t("models.status.name", scope: "decidim.accountability.admin")), new_status_path, class: "button tiny button--title" if can? :manage, current_component %>
5
+ <%= link_to t("actions.new", scope: "decidim.accountability", name: t("models.status.name", scope: "decidim.accountability.admin")), new_status_path, class: "button tiny button--title" if allowed_to? :create, :status %>
6
6
  <%= render partial: "decidim/accountability/admin/shared/subnav" %>
7
7
  </h2>
8
8
  </div>
@@ -27,11 +27,11 @@
27
27
  <td><%= truncate translated_attribute(status.description), lenght: 50 %></td>
28
28
  <td><%= status.progress %></td>
29
29
  <td class="table-list__actions">
30
- <% if can? :update, current_component %>
30
+ <% if allowed_to? :update, :status, status: status %>
31
31
  <%= icon_link_to "pencil", edit_status_path(status), t("actions.edit", scope: "decidim.accountability"), class: "action-icon--edit" %>
32
32
  <% end %>
33
33
 
34
- <% if can? :destroy, current_component %>
34
+ <% if allowed_to? :destroy, :status, status: status %>
35
35
  <%= icon_link_to "circle-x", status_path(status), t("actions.destroy", scope: "decidim.accountability"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.accountability", name: t("models.status.name", scope: "decidim.accountability.admin")) } %>
36
36
  <% end %>
37
37
  </td>
@@ -3,7 +3,7 @@
3
3
  <h2 class="card-title">
4
4
  <%= link_to "#{translated_attribute(result.title)} > ", edit_result_path(result) %>
5
5
  <%= t(".title") %>
6
- <%= link_to t("actions.new", scope: "decidim.accountability", name: t("models.timeline_entry.name", scope: "decidim.accountability.admin")), new_result_timeline_entry_path(result), class: "button tiny button--title" if can? :manage, current_component %>
6
+ <%= link_to t("actions.new", scope: "decidim.accountability", name: t("models.timeline_entry.name", scope: "decidim.accountability.admin")), new_result_timeline_entry_path(result), class: "button tiny button--title" if allowed_to? :create, :timeline_entry %>
7
7
  </h2>
8
8
  </div>
9
9
 
@@ -23,11 +23,11 @@
23
23
  <td><%= timeline_entry.entry_date %><br /></td>
24
24
  <td><%= translated_attribute(timeline_entry.description) %></td>
25
25
  <td class="table-list__actions">
26
- <% if can? :update, current_component %>
26
+ <% if allowed_to? :update, :timeline_entry, timeline_entry: timeline_entry %>
27
27
  <%= icon_link_to "pencil", edit_result_timeline_entry_path(timeline_entry.result, timeline_entry), t("actions.edit", scope: "decidim.accountability"), class: "action-icon--edit" %>
28
28
  <% end %>
29
29
 
30
- <% if can? :destroy, current_component %>
30
+ <% if allowed_to? :destroy, :timeline_entry, timeline_entry: timeline_entry %>
31
31
  <%= icon_link_to "circle-x", result_timeline_entry_path(timeline_entry.result, timeline_entry), t("actions.destroy", scope: "decidim.accountability"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.accountability") } %>
32
32
  <% end %>
33
33
  </td>
@@ -1,6 +1,5 @@
1
1
  <div class="card card--action card--list">
2
2
  <% resources.each do |result| %>
3
- <% next unless result.component.published? %>
4
3
  <div class="card--list__item">
5
4
  <%= icon "actions", class: "card--list__icon", remove_icon_class: true %>
6
5
  <%= link_to resource_locator(result).path, class: "card--list__text card__link card__link--block" do %>
@@ -63,7 +63,7 @@
63
63
  <div class="small-12 mediumlarge-8 large-9 columns">
64
64
  <div class="section result-description">
65
65
  <%== translated_attribute result.description %>
66
- <%= render partial: "decidim/shared/tags", locals: { resource: result, tags_class_extra: "tags--result" } %>
66
+ <%= cell "decidim/tags", result, context: {extra_classes: ["tags--result"]} %>
67
67
  </div>
68
68
  </div>
69
69
 
@@ -12,7 +12,7 @@
12
12
  <div class="description">
13
13
  <%== translated_attribute result.description %>
14
14
  </div>
15
- <%= render partial: "decidim/shared/tags", locals: { resource: result, tags_class_extra: "tags--result" } %>
15
+ <%= cell "decidim/tags", result, context: {extra_classes: ["tags--result"]} %>
16
16
 
17
17
  <%= render partial: "results_leaf", locals: { results: result.children.page(1).per(result.children_count), total_count: result.children_count } %>
18
18
  </div>
@@ -21,6 +21,13 @@ ca:
21
21
  timeline_entry:
22
22
  description: Descripció
23
23
  entry_date: Data
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Proposta inclosa en un resultat
26
+ activerecord:
27
+ models:
28
+ decidim/accountability/result:
29
+ one: Resultat
30
+ other: Resultats
24
31
  decidim:
25
32
  accountability:
26
33
  actions:
@@ -202,6 +209,6 @@ ca:
202
209
  see_all_results: Veure tots els resultats
203
210
  resource_links:
204
211
  included_projects:
205
- result_projects: Projectes inclosos en aquest resultat
212
+ result_project: Projectes inclosos en aquest resultat
206
213
  included_proposals:
207
- result_proposals: Propostes incloses en aquest resultat
214
+ result_proposal: Propostes incloses en aquest resultat
@@ -22,6 +22,13 @@ en:
22
22
  timeline_entry:
23
23
  description: Description
24
24
  entry_date: Date
25
+ models:
26
+ decidim/accountability/proposal_linked_event: Proposal included in a result
27
+ activerecord:
28
+ models:
29
+ decidim/accountability/result:
30
+ one: Result
31
+ other: Results
25
32
  decidim:
26
33
  accountability:
27
34
  actions:
@@ -203,6 +210,6 @@ en:
203
210
  see_all_results: See all results
204
211
  resource_links:
205
212
  included_projects:
206
- result_projects: Projects included in this result
213
+ result_project: Projects included in this result
207
214
  included_proposals:
208
- result_proposals: Proposals included in this result
215
+ result_proposal: Proposals included in this result
@@ -21,6 +21,13 @@ es:
21
21
  timeline_entry:
22
22
  description: Descripción
23
23
  entry_date: Fecha
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Propuesta incluida en un resultado
26
+ activerecord:
27
+ models:
28
+ decidim/accountability/result:
29
+ one: Resultado
30
+ other: Resultados
24
31
  decidim:
25
32
  accountability:
26
33
  actions:
@@ -202,6 +209,6 @@ es:
202
209
  see_all_results: Ver todos los resultados
203
210
  resource_links:
204
211
  included_projects:
205
- result_projects: Proyectos incluidos en este resultado
212
+ result_project: Proyectos incluidos en este resultado
206
213
  included_proposals:
207
- result_proposals: Propuestas incluidas en este resultado
214
+ result_proposal: Propuestas incluidas en este resultado
@@ -21,6 +21,13 @@ eu:
21
21
  timeline_entry:
22
22
  description: Descripción
23
23
  entry_date: Data
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Emaitza batean sartutako proposamena
26
+ activerecord:
27
+ models:
28
+ decidim/accountability/result:
29
+ one: Emaitza
30
+ other: Emaitzak
24
31
  decidim:
25
32
  accountability:
26
33
  actions:
@@ -202,6 +209,6 @@ eu:
202
209
  see_all_results: Ikusi emaitza guztiak
203
210
  resource_links:
204
211
  included_projects:
205
- result_projects: Emaitza honetan sartutako proiektuak
212
+ result_project: Emaitza honetan sartutako proiektuak
206
213
  included_proposals:
207
- result_proposals: Emaitza honetan jasotako proposamenak
214
+ result_proposal: Emaitza honetan jasotako proposamenak
@@ -21,6 +21,13 @@ fi:
21
21
  timeline_entry:
22
22
  description: Kuvaus
23
23
  entry_date: Päivämäärä
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Ehdotus sisältyy tulokseen
26
+ activerecord:
27
+ models:
28
+ decidim/accountability/result:
29
+ one: Tulos
30
+ other: tulokset
24
31
  decidim:
25
32
  accountability:
26
33
  actions:
@@ -202,6 +209,6 @@ fi:
202
209
  see_all_results: Katso kaikki tulokset
203
210
  resource_links:
204
211
  included_projects:
205
- result_projects: Tähän tulokseen liittyvät hankkeet
212
+ result_project: Tähän tulokseen liittyvät hankkeet
206
213
  included_proposals:
207
- result_proposals: Tähän tulokseen liittyvät ehdotukset
214
+ result_proposal: Tähän tulokseen liittyvät ehdotukset
@@ -21,6 +21,13 @@ fr:
21
21
  timeline_entry:
22
22
  description: Description
23
23
  entry_date: Date
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Proposition incluse dans un résultat
26
+ activerecord:
27
+ models:
28
+ decidim/accountability/result:
29
+ one: Résultat
30
+ other: Résultats
24
31
  decidim:
25
32
  accountability:
26
33
  actions:
@@ -202,6 +209,6 @@ fr:
202
209
  see_all_results: Voir tous les résultats
203
210
  resource_links:
204
211
  included_projects:
205
- result_projects: Projets inclus dans ce résultat
212
+ result_project: Projets inclus dans ce résultat
206
213
  included_proposals:
207
- result_proposals: Propositions incluses dans ce résultat
214
+ result_proposal: Propositions incluses dans ce résultat
@@ -21,6 +21,13 @@ gl:
21
21
  timeline_entry:
22
22
  description: Descrición
23
23
  entry_date: Data
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Proposta incluída nun resultado
26
+ activerecord:
27
+ models:
28
+ decidim/accountability/result:
29
+ one: Resultado
30
+ other: Resultados
24
31
  decidim:
25
32
  accountability:
26
33
  actions:
@@ -202,6 +209,6 @@ gl:
202
209
  see_all_results: Ver todos os resultados
203
210
  resource_links:
204
211
  included_projects:
205
- result_projects: Proxectos incluídos neste resultado
212
+ result_project: Proxectos incluídos neste resultado
206
213
  included_proposals:
207
- result_proposals: Propostas incluídas neste resultado
214
+ result_proposal: Propostas incluídas neste resultado
@@ -21,6 +21,13 @@ it:
21
21
  timeline_entry:
22
22
  description: Descrizione
23
23
  entry_date: Data
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Proposta inclusa in un risultato
26
+ activerecord:
27
+ models:
28
+ decidim/accountability/result:
29
+ one: Risultato
30
+ other: risultati
24
31
  decidim:
25
32
  accountability:
26
33
  actions:
@@ -202,6 +209,6 @@ it:
202
209
  see_all_results: Vedi tutti i risultati
203
210
  resource_links:
204
211
  included_projects:
205
- result_projects: Progetti inclusi in questo risultato
212
+ result_project: Progetti inclusi in questo risultato
206
213
  included_proposals:
207
- result_proposals: Proposte incluse in questo risultato
214
+ result_proposal: Proposte incluse in questo risultato
@@ -21,6 +21,13 @@ nl:
21
21
  timeline_entry:
22
22
  description: Beschrijving
23
23
  entry_date: Datum
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Voorstel opgenomen in een resultaat
26
+ activerecord:
27
+ models:
28
+ decidim/accountability/result:
29
+ one: Resultaat
30
+ other: resultaten
24
31
  decidim:
25
32
  accountability:
26
33
  actions:
@@ -202,6 +209,6 @@ nl:
202
209
  see_all_results: Bekijk alle resultaten
203
210
  resource_links:
204
211
  included_projects:
205
- result_projects: Projecten opgenomen in dit resultaat
212
+ result_project: Projecten opgenomen in dit resultaat
206
213
  included_proposals:
207
- result_proposals: Voorstellen opgenomen in dit resultaat
214
+ result_proposal: Voorstellen opgenomen in dit resultaat
@@ -21,6 +21,15 @@ pl:
21
21
  timeline_entry:
22
22
  description: Opis
23
23
  entry_date: Data
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Wniosek zawarty w wyniku
26
+ activerecord:
27
+ models:
28
+ decidim/accountability/result:
29
+ one: Wynik
30
+ few: Wyniki
31
+ many: Wyniki
32
+ other: Wyniki
24
33
  decidim:
25
34
  accountability:
26
35
  actions:
@@ -204,6 +213,6 @@ pl:
204
213
  see_all_results: Zobacz wszystkie wyniki
205
214
  resource_links:
206
215
  included_projects:
207
- result_projects: Projekty uwzględnione w tym wyniku
216
+ result_project: Projekty uwzględnione w tym wyniku
208
217
  included_proposals:
209
- result_proposals: Propozycje zawarte w tym wyniku
218
+ result_proposal: Propozycje zawarte w tym wyniku
@@ -21,6 +21,13 @@ pt-BR:
21
21
  timeline_entry:
22
22
  description: Descrição
23
23
  entry_date: Encontro
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Proposta incluída em um resultado
26
+ activerecord:
27
+ models:
28
+ decidim/accountability/result:
29
+ one: Resultado
30
+ other: Resultados
24
31
  decidim:
25
32
  accountability:
26
33
  actions:
@@ -202,6 +209,6 @@ pt-BR:
202
209
  see_all_results: Ver todos os resultados
203
210
  resource_links:
204
211
  included_projects:
205
- result_projects: Projetos incluídos neste resultado
212
+ result_project: Projetos incluídos neste resultado
206
213
  included_proposals:
207
- result_proposals: Propostas incluídas neste resultado
214
+ result_proposal: Propostas incluídas neste resultado
@@ -21,6 +21,13 @@ pt:
21
21
  timeline_entry:
22
22
  description: Descrição
23
23
  entry_date: Encontro
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Proposta incluída em um resultado
26
+ activerecord:
27
+ models:
28
+ decidim/accountability/result:
29
+ one: Resultado
30
+ other: Resultados
24
31
  decidim:
25
32
  accountability:
26
33
  actions:
@@ -202,6 +209,6 @@ pt:
202
209
  see_all_results: Ver todos os resultados
203
210
  resource_links:
204
211
  included_projects:
205
- result_projects: Projetos incluídos neste resultado
212
+ result_project: Projetos incluídos neste resultado
206
213
  included_proposals:
207
- result_proposals: Propostas incluídas neste resultado
214
+ result_proposal: Propostas incluídas neste resultado
@@ -2,14 +2,17 @@ ru:
2
2
  activemodel:
3
3
  attributes:
4
4
  result:
5
+ decidim_accountability_status_id: Состояние
5
6
  decidim_category_id: Разряд
6
7
  decidim_scope_id: Охват
7
8
  description: Описание
8
9
  end_date: Дата завершения
9
10
  progress: Продвижение
10
11
  project_ids: Включенные проекты
12
+ proposals: Включенные предложения
11
13
  start_date: Дата начала
12
14
  title: Название
15
+ updated_at: 'Обновлено:'
13
16
  status:
14
17
  description: Описание
15
18
  key: Ключ
@@ -18,6 +21,15 @@ ru:
18
21
  timeline_entry:
19
22
  description: Описание
20
23
  entry_date: Дата
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Предложение, включенное в этот итог
26
+ activerecord:
27
+ models:
28
+ decidim/accountability/result:
29
+ one: Итог
30
+ few: Итога
31
+ many: Итогов
32
+ other: Итогов
21
33
  decidim:
22
34
  accountability:
23
35
  actions:
@@ -47,11 +59,17 @@ ru:
47
59
  edit:
48
60
  title: Редактировать итог
49
61
  update: Обновить итог
62
+ form:
63
+ add_proposal: Добавить предложение
50
64
  index:
51
65
  title: Итоги
52
66
  new:
53
67
  create: Создать итог
54
68
  title: Добавить итог
69
+ proposals:
70
+ close: Закрыть
71
+ current_selection: Текущий выбор
72
+ select: Выбрать
55
73
  update:
56
74
  invalid: При попытке обновить этот итог произошла ошибка
57
75
  success: Итог успешно обновлен
@@ -92,6 +110,14 @@ ru:
92
110
  update:
93
111
  invalid: При попытке обновить эту запись произошла ошибка
94
112
  success: Запись успешно обновлена
113
+ admin_log:
114
+ result:
115
+ create: "%{user_name} создал итог %{resource_name} в %{space_name}"
116
+ delete: "%{user_name} удалил итог %{resource_name} в %{space_name}"
117
+ update: "%{user_name} обновил итог %{resource_name} в %{space_name}"
118
+ value_types:
119
+ parent_presenter:
120
+ not_found: 'Родительский объект не найден в базе данных (ID: %{id})'
95
121
  models:
96
122
  result:
97
123
  fields:
@@ -158,12 +184,35 @@ ru:
158
184
  version_index: Версия %{index}
159
185
  components:
160
186
  accountability:
187
+ name: Отчетность
161
188
  settings:
162
189
  global:
163
190
  categories_label: Название для "Разряды"
191
+ comments_enabled: Комментарии включены
192
+ display_progress_enabled: Показывать ход выполнения
193
+ heading_leaf_level_results: Название для "Проекты"
194
+ heading_parent_level_results: Название для "Итоги"
195
+ intro: Вступление
164
196
  subcategories_label: Название для "Подразряды"
197
+ step:
198
+ comments_blocked: Комментарии выключены
199
+ events:
200
+ accountability:
201
+ proposal_linked:
202
+ email_intro: 'Предложение «%{proposal_title}» было включено в итоги. Вы можете посмотреть его на странице:'
203
+ email_outro: Вы получили это уведомление, потому что вы следите за "%{proposal_title}". Вы можете отписаться от уведомлений, перейдя по приведенной выше ссылке.
204
+ email_subject: Обновление %{proposal_title}
205
+ notification_title: Предложение <a href="%{proposal_path}">%{proposal_title}</a> было включено в итог <a href="%{resource_path}">%{resource_title}</a>.
206
+ participatory_processes:
207
+ participatory_process_groups:
208
+ highlighted_results:
209
+ results: Итоги
210
+ participatory_spaces:
211
+ highlighted_results:
212
+ results: Итоги
213
+ see_all_results: Просмотреть все итоги
165
214
  resource_links:
166
215
  included_projects:
167
- result_projects: Проекты, включенные в эти итоги
216
+ result_project: Проекты, включенные в эти итоги
168
217
  included_proposals:
169
- result_proposals: Предложения, включенные в этот итог
218
+ result_proposal: Предложения, включенные в этот итог
@@ -21,6 +21,13 @@ sv:
21
21
  timeline_entry:
22
22
  description: Beskrivning
23
23
  entry_date: Datum
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Förslaget ingår i ett resultat
26
+ activerecord:
27
+ models:
28
+ decidim/accountability/result:
29
+ one: Resultat
30
+ other: Resultat
24
31
  decidim:
25
32
  accountability:
26
33
  actions:
@@ -202,6 +209,6 @@ sv:
202
209
  see_all_results: Se alla resultat
203
210
  resource_links:
204
211
  included_projects:
205
- result_projects: Projekt som ingår i detta resultat
212
+ result_project: Projekt som ingår i detta resultat
206
213
  included_proposals:
207
- result_proposals: Förslag som ingår i detta resultat
214
+ result_proposal: Förslag som ingår i detta resultat
@@ -21,6 +21,15 @@ uk:
21
21
  timeline_entry:
22
22
  description: Опис
23
23
  entry_date: Дата
24
+ models:
25
+ decidim/accountability/proposal_linked_event: Пропозиція, включена до підсумку
26
+ activerecord:
27
+ models:
28
+ decidim/accountability/result:
29
+ one: Підсумок
30
+ few: Підсумки
31
+ many: Підсумків
32
+ other: Підсумків
24
33
  decidim:
25
34
  accountability:
26
35
  actions:
@@ -204,6 +213,6 @@ uk:
204
213
  see_all_results: Переглянути всі підсумки
205
214
  resource_links:
206
215
  included_projects:
207
- result_projects: Задуми, включені до цих підсумків
216
+ result_project: Задуми, включені до цих підсумків
208
217
  included_proposals:
209
- result_proposals: Пропозиції, включені до цих підсумків
218
+ result_proposal: Пропозиції, включені до цих підсумків
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddWeightToResults < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_column :decidim_accountability_results, :weight, :float, default: 1.0
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddExternalIdToResults < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_column :decidim_accountability_results, :external_id, :string, index: true
6
+ end
7
+ end
@@ -7,12 +7,13 @@ Decidim.register_component(:accountability) do |component|
7
7
  component.admin_engine = Decidim::Accountability::AdminEngine
8
8
  component.icon = "decidim/accountability/icon.svg"
9
9
  component.stylesheet = "decidim/accountability/accountability"
10
+ component.permissions_class_name = "Decidim::Accountability::Permissions"
10
11
 
11
12
  component.on(:before_destroy) do |instance|
12
13
  raise StandardError, "Can't remove this component" if Decidim::Accountability::Result.where(component: instance).any?
13
14
  end
14
15
 
15
- component.register_resource do |resource|
16
+ component.register_resource(:result) do |resource|
16
17
  resource.model_class_name = "Decidim::Accountability::Result"
17
18
  resource.template = "decidim/accountability/results/linked_results"
18
19
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds decidim-accountability version.
5
5
  module Accountability
6
6
  def self.version
7
- "0.11.2"
7
+ "0.12.0.pre"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-accountability
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.12.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-06-13 00:00:00.000000000 Z
13
+ date: 2018-06-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-comments
@@ -18,28 +18,28 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.11.2
21
+ version: 0.12.0.pre
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 0.11.2
28
+ version: 0.12.0.pre
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: decidim-core
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.11.2
35
+ version: 0.12.0.pre
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.11.2
42
+ version: 0.12.0.pre
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: kaminari
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -74,98 +74,98 @@ dependencies:
74
74
  requirements:
75
75
  - - '='
76
76
  - !ruby/object:Gem::Version
77
- version: 0.11.2
77
+ version: 0.12.0.pre
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - '='
83
83
  - !ruby/object:Gem::Version
84
- version: 0.11.2
84
+ version: 0.12.0.pre
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: decidim-assemblies
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - '='
90
90
  - !ruby/object:Gem::Version
91
- version: 0.11.2
91
+ version: 0.12.0.pre
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - '='
97
97
  - !ruby/object:Gem::Version
98
- version: 0.11.2
98
+ version: 0.12.0.pre
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: decidim-comments
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - '='
104
104
  - !ruby/object:Gem::Version
105
- version: 0.11.2
105
+ version: 0.12.0.pre
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - '='
111
111
  - !ruby/object:Gem::Version
112
- version: 0.11.2
112
+ version: 0.12.0.pre
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: decidim-dev
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - '='
118
118
  - !ruby/object:Gem::Version
119
- version: 0.11.2
119
+ version: 0.12.0.pre
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - '='
125
125
  - !ruby/object:Gem::Version
126
- version: 0.11.2
126
+ version: 0.12.0.pre
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: decidim-meetings
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - '='
132
132
  - !ruby/object:Gem::Version
133
- version: 0.11.2
133
+ version: 0.12.0.pre
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - '='
139
139
  - !ruby/object:Gem::Version
140
- version: 0.11.2
140
+ version: 0.12.0.pre
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: decidim-participatory_processes
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - '='
146
146
  - !ruby/object:Gem::Version
147
- version: 0.11.2
147
+ version: 0.12.0.pre
148
148
  type: :development
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - '='
153
153
  - !ruby/object:Gem::Version
154
- version: 0.11.2
154
+ version: 0.12.0.pre
155
155
  - !ruby/object:Gem::Dependency
156
156
  name: decidim-proposals
157
157
  requirement: !ruby/object:Gem::Requirement
158
158
  requirements:
159
159
  - - '='
160
160
  - !ruby/object:Gem::Version
161
- version: 0.11.2
161
+ version: 0.12.0.pre
162
162
  type: :development
163
163
  prerelease: false
164
164
  version_requirements: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - '='
167
167
  - !ruby/object:Gem::Version
168
- version: 0.11.2
168
+ version: 0.12.0.pre
169
169
  description: An accountability component for decidim's participatory spaces.
170
170
  email:
171
171
  - josepjaume@gmail.com
@@ -214,6 +214,8 @@ files:
214
214
  - app/models/decidim/accountability/result.rb
215
215
  - app/models/decidim/accountability/status.rb
216
216
  - app/models/decidim/accountability/timeline_entry.rb
217
+ - app/permissions/decidim/accountability/admin/permissions.rb
218
+ - app/permissions/decidim/accountability/permissions.rb
217
219
  - app/presenters/decidim/accountability/admin_log/result_presenter.rb
218
220
  - app/presenters/decidim/accountability/admin_log/value_types/parent_presenter.rb
219
221
  - app/services/decidim/accountability/diff_renderer.rb
@@ -282,6 +284,8 @@ files:
282
284
  - db/migrate/20170623144902_add_children_counter_cache_to_results.rb
283
285
  - db/migrate/20170928073905_migrate_old_results.rb
284
286
  - db/migrate/20180305133145_rename_features_to_components_at_accountability.rb
287
+ - db/migrate/20180508170210_add_weight_to_results.rb
288
+ - db/migrate/20180508170647_add_external_id_to_results.rb
285
289
  - lib/decidim/accountability.rb
286
290
  - lib/decidim/accountability/admin.rb
287
291
  - lib/decidim/accountability/admin_engine.rb
@@ -306,9 +310,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
306
310
  version: '2.3'
307
311
  required_rubygems_version: !ruby/object:Gem::Requirement
308
312
  requirements:
309
- - - ">="
313
+ - - ">"
310
314
  - !ruby/object:Gem::Version
311
- version: '0'
315
+ version: 1.3.1
312
316
  requirements: []
313
317
  rubyforge_project:
314
318
  rubygems_version: 2.7.6