decidim-budgets 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/app/commands/decidim/budgets/add_line_item.rb +9 -1
  3. data/app/controllers/decidim/budgets/admin/projects_controller.rb +13 -1
  4. data/app/forms/decidim/budgets/admin/project_form.rb +5 -1
  5. data/app/models/decidim/budgets/order.rb +3 -0
  6. data/app/models/decidim/budgets/project.rb +9 -1
  7. data/app/services/decidim/budgets/project_search.rb +0 -5
  8. data/app/views/decidim/budgets/admin/projects/_form.html.erb +5 -3
  9. data/app/views/decidim/budgets/admin/projects/index.html.erb +9 -0
  10. data/app/views/decidim/budgets/line_items/update_budget.js.erb +1 -0
  11. data/app/views/decidim/budgets/projects/_filters.html.erb +2 -2
  12. data/app/views/decidim/budgets/projects/_filters_small_view.html.erb +18 -0
  13. data/app/views/decidim/budgets/projects/_project.html.erb +17 -2
  14. data/app/views/decidim/budgets/projects/_project_budget_button.html.erb +2 -2
  15. data/app/views/decidim/budgets/projects/_tags.html.erb +1 -1
  16. data/app/views/decidim/budgets/projects/index.html.erb +2 -1
  17. data/app/views/decidim/budgets/projects/show.html.erb +7 -1
  18. data/config/i18n-tasks.yml +1 -0
  19. data/config/locales/ca.yml +18 -3
  20. data/config/locales/en.yml +15 -0
  21. data/config/locales/es.yml +17 -2
  22. data/config/locales/eu.yml +97 -1
  23. data/config/locales/fi.yml +123 -0
  24. data/db/migrate/20170215132708_add_reference_to_projects.rb +7 -0
  25. data/lib/decidim/budgets/feature.rb +4 -2
  26. data/lib/decidim/budgets/seeds/Exampledocument.pdf +0 -0
  27. data/lib/decidim/budgets/seeds/city.jpeg +0 -0
  28. data/lib/decidim/budgets/test/factories.rb +21 -1
  29. metadata +17 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36a0cd87302d85abc1401b212ba7f792da11a7b2
4
- data.tar.gz: 0ba3e53eca08d996c1d7ef4e515b113e60246815
3
+ metadata.gz: e3e2656e58b1d375c6ed9cc32d4af823549aa19a
4
+ data.tar.gz: 1e3664e67a65acce779cf361bbd58dd305929b6d
5
5
  SHA512:
6
- metadata.gz: 4f290147ea2a65b093245248598014046266abdeb3ee57fda81051f66297129b19b5d899867f74af9a93bf9a9bdf4af0295ac51c9fa814010993bc0e1e496c14
7
- data.tar.gz: cefabce04a878a30200a62e6a5d4e28542f43bfd0e976324a6e45b6a0f6666f92e5e0edcfc713f3424b9c80cd65c4ebd79748e6aac158d0f7fb956906dd9b601
6
+ metadata.gz: d096815f3bf0747eea89df09a2a99b196451a826110015fcad984fd8af367b6eb3d80a7d3cbf64f65cb0c2e0768cce5034de72b3c57344293f45ea4007eb7bc2
7
+ data.tar.gz: 25da824f93001da298b80ecfaa5103a17d1aeee9a8f2478e383eff5ce0cff34a01d1afef9b5960f6e3023622222414929af0ed9543c1f112b3e62c5c87280bd5
@@ -22,7 +22,7 @@ module Decidim
22
22
  # Returns nothing.
23
23
  def call
24
24
  transaction do
25
- return broadcast(:invalid) if order.checked_out?
25
+ return broadcast(:invalid) if votes_disabled? || order.checked_out?
26
26
  add_line_item
27
27
  broadcast(:ok, order)
28
28
  end
@@ -40,6 +40,14 @@ module Decidim
40
40
  order.save!
41
41
  end
42
42
  end
43
+
44
+ def feature
45
+ @project.feature
46
+ end
47
+
48
+ def votes_disabled?
49
+ !feature.active_step_settings.votes_enabled?
50
+ end
43
51
  end
44
52
  end
45
53
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Admin
5
5
  # This controller allows an admin to manage projects from a Participatory Process
6
6
  class ProjectsController < Admin::ApplicationController
7
- helper_method :projects
7
+ helper_method :projects, :finished_orders, :pending_orders
8
8
 
9
9
  def new
10
10
  @form = form(ProjectForm).instance
@@ -60,6 +60,18 @@ module Decidim
60
60
  @projects ||= Project.where(feature: current_feature)
61
61
  end
62
62
 
63
+ def orders
64
+ @orders ||= Order.where(feature: current_feature)
65
+ end
66
+
67
+ def pending_orders
68
+ orders.pending
69
+ end
70
+
71
+ def finished_orders
72
+ orders.finished
73
+ end
74
+
63
75
  def project
64
76
  @project ||= projects.find(params[:id])
65
77
  end
@@ -26,12 +26,16 @@ module Decidim
26
26
  self.proposal_ids = model.linked_resources(:proposals, "included_proposals").pluck(:id)
27
27
  end
28
28
 
29
+ def process_scope
30
+ current_feature.participatory_process.scope
31
+ end
32
+
29
33
  def proposals
30
34
  @proposals ||= Decidim.find_resource_manifest(:proposals).try(:resource_scope, context.current_feature)&.order(title: :asc)&.pluck(:title, :id)
31
35
  end
32
36
 
33
37
  def scope
34
- @scope ||= context.current_feature.scopes.where(id: decidim_scope_id).first
38
+ @scope ||= process_scope || current_organization.scopes.where(id: decidim_scope_id).first
35
39
  end
36
40
 
37
41
  def category
@@ -24,6 +24,9 @@ module Decidim
24
24
  less_than_or_equal_to: :maximum_budget
25
25
  }
26
26
 
27
+ scope :finished, -> { where.not(checked_out_at: nil) }
28
+ scope :pending, -> { where(checked_out_at: nil) }
29
+
27
30
  # Public: Returns the sum of project budgets
28
31
  def total_budget
29
32
  projects.to_a.sum(&:budget)
@@ -9,9 +9,12 @@ module Decidim
9
9
  include Decidim::HasScope
10
10
  include Decidim::HasCategory
11
11
  include Decidim::HasAttachments
12
+ include Decidim::HasReference
12
13
  include Decidim::Comments::Commentable
13
14
 
14
15
  feature_manifest_name "budgets"
16
+ has_many :line_items, class_name: Decidim::Budgets::LineItem, foreign_key: "decidim_project_id", dependent: :destroy
17
+ has_many :orders, through: :line_items, foreign_key: "decidim_project_id", class_name: "Decidim::Budgets::Order"
15
18
 
16
19
  # Public: Overrides the `commentable?` Commentable concern method.
17
20
  def commentable?
@@ -20,13 +23,18 @@ module Decidim
20
23
 
21
24
  # Public: Overrides the `accepts_new_comments?` Commentable concern method.
22
25
  def accepts_new_comments?
23
- commentable? && !feature.active_step_settings.comments_blocked
26
+ commentable? && !feature.active_step_settings.comments_blocked
24
27
  end
25
28
 
26
29
  # Public: Overrides the `comments_have_votes?` Commentable concern method.
27
30
  def comments_have_votes?
28
31
  true
29
32
  end
33
+
34
+ # Public: Returns the number of times an specific project have been checked out.
35
+ def confirmed_orders_count
36
+ orders.finished.count
37
+ end
30
38
  end
31
39
  end
32
40
  end
@@ -19,11 +19,6 @@ module Decidim
19
19
  .or(query.where(localized_search_text_in(:description), text: "%#{search_text}%"))
20
20
  end
21
21
 
22
- # Handle the scope_id filter
23
- def search_scope_id
24
- query.where(decidim_scope_id: scope_id)
25
- end
26
-
27
22
  # Returns the random projects for the current page.
28
23
  def results
29
24
  @projects ||= Project.transaction do
@@ -10,9 +10,11 @@
10
10
  <%= form.number_field :budget %>
11
11
  </div>
12
12
 
13
- <div class="field" >
14
- <%= form.collection_select :decidim_scope_id, current_organization.scopes, :id, :name, include_blank: true %>
15
- </div>
13
+ <% if !current_participatory_process.scope %>
14
+ <div class="field" >
15
+ <%= form.collection_select :decidim_scope_id, organization_scopes, :id, :name %>
16
+ </div>
17
+ <% end %>
16
18
 
17
19
  <div class="field" >
18
20
  <%= form.categories_select :decidim_category_id, current_participatory_process.categories, include_blank: true, disable_parents: false %>
@@ -1,5 +1,10 @@
1
1
  <h2><%= t(".title") %></h2>
2
2
 
3
+ <dl>
4
+ <dt><%= t ".finished_orders" %>: </dt><dd><%= finished_orders.count %></dd>
5
+ <dt><%= t ".pending_orders" %>: </dt><dd><%= pending_orders.count %></dd>
6
+ </dl>
7
+
3
8
  <div class="actions title">
4
9
  <%= link_to t("actions.new", scope: "decidim.budgets", name: t("models.project.name", scope: "decidim.budgets.admin")), new_project_path, class: 'new' if can? :manage, current_feature %>
5
10
  </div>
@@ -8,6 +13,7 @@
8
13
  <thead>
9
14
  <tr>
10
15
  <th><%= t("models.project.fields.title", scope: "decidim.budgets") %></th>
16
+ <th class="center"><%= t("index.confirmed_orders_count") %></th>
11
17
  <th class="actions"><%= t("actions.title", scope: "decidim.budgets") %></th>
12
18
  </tr>
13
19
  </thead>
@@ -17,6 +23,9 @@
17
23
  <td>
18
24
  <%= link_to translated_attribute(project.title), decidim_budgets.project_path(id: project, feature_id: current_feature, participatory_process_id: current_participatory_process), target: :blank %><br />
19
25
  </td>
26
+ <td class='center'>
27
+ <%= project.confirmed_orders_count %>
28
+ </td>
20
29
  <td class="actions">
21
30
  <%= link_to t("actions.edit", scope: "decidim.budgets"), edit_project_path(project) if can? :update, current_feature %>
22
31
  <%= link_to t("actions.attachments", scope: "decidim.budgets"), project_attachments_path(project) if can? :update, current_feature %>
@@ -11,6 +11,7 @@ morphdom($orderProgress[0], '<%= j(render partial: 'decidim/budgets/projects/ord
11
11
  morphdom($budgetConfirm[0], '<%= j(render partial: 'decidim/budgets/projects/budget_confirm') %>')
12
12
 
13
13
  $("#order-progress").foundation();
14
+ $(".budget-summary__selected").foundation();
14
15
 
15
16
  if ($projectItem.length > 0) {
16
17
  morphdom($projectItem[0], '<%= j(render partial: 'decidim/budgets/projects/project', locals: { project: project }) %>');
@@ -12,8 +12,8 @@
12
12
  </div>
13
13
  </div>
14
14
 
15
- <% if current_organization.scopes.any? %>
16
- <%= form.collection_check_boxes :scope_id, current_organization.scopes, lambda {|scope| scope.id.to_s}, :name, legend_title: t('.scopes') %>
15
+ <% if current_organization.scopes.any? && !current_participatory_process.scope %>
16
+ <%= form.collection_check_boxes :scope_id, search_organization_scopes, lambda {|scope| scope.id.to_s}, :name, legend_title: t('.scopes') %>
17
17
  <% end %>
18
18
 
19
19
  <% if current_feature.categories.any? %>
@@ -0,0 +1,18 @@
1
+ <div class="filters-controls hide-for-mediumlarge">
2
+ <button data-open="filter-box" class="filters-controls__trigger">
3
+ <%= t ".filter" %>
4
+ <%= icon "caret-bottom", class: "icon--small float-right", aria_label: t('.unfold'), role: "img" %>
5
+ </button>
6
+ </div>
7
+
8
+ <div class="reveal" id="filter-box" data-reveal>
9
+ <div class="reveal__header">
10
+ <h3 class="reveal__title"><%= t ".filter_by" %>:</h3>
11
+ <button class="close-button" data-close aria-label="<%= t(".close_modal") %>" type="button">
12
+ <span aria-hidden="true">&times;</span>
13
+ </button>
14
+ </div>
15
+ <div class="filters">
16
+ <%= render partial: "filters" %>
17
+ </div>
18
+ </div>
@@ -15,18 +15,28 @@
15
15
  <span class="card--list__data__number budget-list__number">
16
16
  <%= budget_to_currency(project.budget) %>
17
17
  </span>
18
- <%= action_authorized_button_to "vote", order_line_item_path(project_id: project), method: :delete, remote: true, data: { disable: true, budget: project.budget }, disabled: current_order_checked_out?, class: "button tiny budget--list__action success" do %>
18
+ <%= action_authorized_button_to "vote", order_line_item_path(project_id: project), method: :delete, remote: true, data: { disable: true, budget: project.budget }, disabled: !current_settings.votes_enabled? || current_order_checked_out?, class: "button tiny budget--list__action success" do %>
19
19
  <%= icon("check", class: "icon--small", aria_label: t('.remove'), role: "img") %>
20
20
  <% end %>
21
+ <% if current_settings.show_votes? %>
22
+ <div class="card__support" style="width: 7em">
23
+ <span><%= t('.count', count: project.confirmed_orders_count) %></span>
24
+ </div>
25
+ <% end %>
21
26
  </div>
22
27
  <% else %>
23
28
  <div class="card--list__data budget-list__data">
24
29
  <span class="card--list__data__number budget-list__number">
25
30
  <%= budget_to_currency(project.budget) %>
26
31
  </span>
27
- <%= action_authorized_button_to "vote", order_line_item_path(project_id: project), method: :post, remote: true, data: { disable: true, budget: project.budget, add: true }, disabled: current_order_checked_out?, class: "button tiny hollow budget--list__action" do %>
32
+ <%= action_authorized_button_to "vote", order_line_item_path(project_id: project), method: :post, remote: true, data: { disable: true, budget: project.budget, add: true }, disabled: !current_settings.votes_enabled? || current_order_checked_out?, class: "button tiny hollow budget--list__action" do %>
28
33
  <%= icon("check", class: "icon--small", aria_label: t('.add'), role: "img") %>
29
34
  <% end %>
35
+ <% if current_settings.show_votes? %>
36
+ <div class="card__support" style="width: 7em">
37
+ <span><%= t('.count', count: project.confirmed_orders_count) %></span>
38
+ </div>
39
+ <% end %>
30
40
  </div>
31
41
  <% end %>
32
42
  <% else %>
@@ -37,6 +47,11 @@
37
47
  <a href="#" class="button tiny hollow budget--list__action disabled" data-toggle="loginModal">
38
48
  <%= icon("check", class: "icon--small", aria_label: t('.add'), role: "img") %>
39
49
  </a>
50
+ <% if current_settings.show_votes? %>
51
+ <div class="card__support" style="width: 7em">
52
+ <span><%= t('.count', count: project.confirmed_orders_count) %></span>
53
+ </div>
54
+ <% end %>
40
55
  </div>
41
56
  <% end %>
42
57
  </div>
@@ -1,8 +1,8 @@
1
1
  <% if current_user.present? %>
2
2
  <% if current_order && current_order.projects.include?(project) %>
3
- <%= action_authorized_button_to "vote", t('.added'), order_line_item_path(project_id: project), method: :delete, remote: true, data: { disable: true, budget: project.budget }, disabled: current_order_checked_out?, class: "button expanded button--sc success budget--list__action" %>
3
+ <%= action_authorized_button_to "vote", t('.added'), order_line_item_path(project_id: project), method: :delete, remote: true, data: { disable: true, budget: project.budget }, disabled: !current_settings.votes_enabled? || current_order_checked_out?, class: "button expanded button--sc success budget--list__action" %>
4
4
  <% else %>
5
- <%= action_authorized_button_to "vote", t('.add'), order_line_item_path(project_id: project), method: :post, remote: true, data: { disable: true, budget: project.budget, add: true }, disabled: current_order_checked_out?, class: "button expanded button--sc budget--list__action" %>
5
+ <%= action_authorized_button_to "vote", t('.add'), order_line_item_path(project_id: project), method: :post, remote: true, data: { disable: true, budget: project.budget, add: true }, disabled: !current_settings.votes_enabled? || current_order_checked_out?, class: "button expanded button--sc budget--list__action" %>
6
6
  <% end %>
7
7
  <% else %>
8
8
  <button class="button expanded button--sc disabled" data-toggle="loginModal"><%= t('.add') %></button>
@@ -3,7 +3,7 @@
3
3
  <% if project.category.present? %>
4
4
  <li><%= link_to translated_attribute(project.category.name), decidim_budgets.projects_path(filter: { category_id: project.category.id }) %></li>
5
5
  <% end %>
6
- <% if project.scope.present? %>
6
+ <% if project.scope.present? && !current_participatory_process.scope %>
7
7
  <li><%= link_to project.scope.name, decidim_budgets.projects_path(filter: { scope_id: [project.scope.id] }) %></li>
8
8
  <% end %>
9
9
  </ul>
@@ -1,4 +1,4 @@
1
- <% if current_user.present? %>
1
+ <% if current_user.present? && current_settings.votes_enabled? %>
2
2
  <div class="row column">
3
3
  <%= render partial: "budget_summary", locals: { include_heading: true } %>
4
4
  </div>
@@ -10,6 +10,7 @@
10
10
  </div>
11
11
  <div class="row">
12
12
  <div class="columns mediumlarge-4 large-3">
13
+ <%= render partial: "filters_small_view"%>
13
14
  <div class="card card--secondary show-for-mediumlarge" >
14
15
  <%= render partial: "filters" %>
15
16
  </div>
@@ -4,7 +4,7 @@
4
4
  ) %>
5
5
 
6
6
  <div class="row column view-header">
7
- <% if current_user.present? %>
7
+ <% if current_user.present? && current_settings.votes_enabled? %>
8
8
  <%= render partial: "budget_summary", locals: { include_heading: false } %>
9
9
  <% end %>
10
10
  <%= link_to projects_path, class: "muted-link" do %>
@@ -22,11 +22,17 @@
22
22
  <span class="definition-data__title"><%= t('.budget') %></span>
23
23
  <span class="definition-data__number"><%= budget_to_currency project.budget %></span>
24
24
  </div>
25
+ <% if current_settings.show_votes? %>
26
+ <div class="card__support__data">
27
+ <span><%= t('decidim.budgets.projects.project.count', count: project.confirmed_orders_count) %></span>
28
+ </div>
29
+ <% end %>
25
30
  <div id="project-<%= project.id %>-budget-button">
26
31
  <%= render partial: 'project_budget_button', locals: { project: project } %>
27
32
  </div>
28
33
  </div>
29
34
  </div>
35
+ <%= feature_reference(project) %>
30
36
  </div>
31
37
  <div class="columns mediumlarge-8 mediumlarge-pull-4">
32
38
  <div class="section">
@@ -3,4 +3,5 @@ locales: [en]
3
3
  ignore_unused:
4
4
  - "decidim.features.budgets.name"
5
5
  - "decidim.features.budgets.settings.*"
6
+ - "decidim.features.budgets.actions.*"
6
7
  - "activemodel.attributes.project.*"
@@ -31,6 +31,8 @@ ca:
31
31
  title: Editar projecte
32
32
  update: Actualitzar projecte
33
33
  index:
34
+ finished_orders: Vots finalitzats
35
+ pending_orders: Vots en procés
34
36
  title: Projectes
35
37
  new:
36
38
  create: Crear projecte
@@ -51,7 +53,7 @@ ca:
51
53
  title: Confirmar vot
52
54
  budget_excess:
53
55
  close: Tancar
54
- description: Aquest projecte sobrepassa el pressupost màxim i no es pot afegir. Si ho desitges, pots eliminar un projecte ja seleccionat per afegir aquest o votart amb les seves preferències.
56
+ description: Aquest projecte sobrepassa el pressupost màxim i no es pot afegir. Si ho desitges, pots eliminar un projecte ja seleccionat per afegir aquest o donar suport amb les seves preferències.
55
57
  ok: D'acord
56
58
  title: Pressupost superat
57
59
  budget_summary:
@@ -61,7 +63,7 @@ ca:
61
63
  checked_out:
62
64
  description: Ja has votat pel pressupost. Si has canviat d'idea, pots %{cancel_link}.
63
65
  title: Vot pels pressupostos completat
64
- description: En quins projectes creus que hem de destinar el pressupost? Has d'assignar com a mínim %{minimum_budget} als projectes que desitges i votar amb les teves preferències per definir el pressupost.
66
+ description: En quins projectes creus que hem de destinar el pressupost? Has d'assignar com a mínim %{minimum_budget} als projectes que desitges i donar suport amb les teves preferències per definir el pressupost.
65
67
  title: Tu decideixes el pressupost
66
68
  count:
67
69
  projects_count:
@@ -71,8 +73,13 @@ ca:
71
73
  category: Categoria
72
74
  scopes: Àmbits
73
75
  search: Cerca
76
+ filters_small_view:
77
+ close_modal: Tancar finestra
78
+ filter: Filtra
79
+ filter_by: Filtra per
80
+ unfold: Desplegar
74
81
  order_progress:
75
- vote: Votar
82
+ vote: Donar suport
76
83
  order_selected_projects:
77
84
  remove: Esborrar
78
85
  selected_projects:
@@ -81,6 +88,9 @@ ca:
81
88
  view: Veure
82
89
  project:
83
90
  add: Afegir
91
+ count:
92
+ one: 1 suport
93
+ other: "%{count} suports"
84
94
  remove: Esborrar
85
95
  project_budget_button:
86
96
  add: Afegir
@@ -90,6 +100,8 @@ ca:
90
100
  view_all_projects: Veure tots els projectes
91
101
  features:
92
102
  budgets:
103
+ actions:
104
+ vote: Donar suport
93
105
  name: Pressupostos
94
106
  settings:
95
107
  global:
@@ -98,6 +110,7 @@ ca:
98
110
  vote_threshold_percent: Percentatge del pressupost mínim per fer el vot
99
111
  step:
100
112
  comments_blocked: Comentaris bloquejats
113
+ votes_enabled: Suports habilitats
101
114
  orders:
102
115
  checkout:
103
116
  error: S'ha produït un error en processar el teu vot
@@ -105,4 +118,6 @@ ca:
105
118
  destroy:
106
119
  error: S'ha produït un error en cancel·lar el seu vot
107
120
  success: El seu vot ha estat cancel·lat correctament
121
+ index:
122
+ confirmed_orders_count: Nombre de vots
108
123
  total_budget: Pressupost total
@@ -32,6 +32,8 @@ en:
32
32
  title: Edit project
33
33
  update: Update project
34
34
  index:
35
+ finished_orders: Finished orders
36
+ pending_orders: Pending orders
35
37
  title: Projects
36
38
  new:
37
39
  create: Create project
@@ -78,6 +80,11 @@ en:
78
80
  category: Category
79
81
  scopes: Scopes
80
82
  search: Search
83
+ filters_small_view:
84
+ close_modal: Close modal
85
+ filter: Filter
86
+ filter_by: Filter by
87
+ unfold: Unfold
81
88
  order_progress:
82
89
  vote: Vote
83
90
  order_selected_projects:
@@ -88,6 +95,9 @@ en:
88
95
  view: View
89
96
  project:
90
97
  add: Add
98
+ count:
99
+ one: 1 support
100
+ other: "%{count} supports"
91
101
  remove: Remove
92
102
  project_budget_button:
93
103
  add: Add
@@ -97,6 +107,8 @@ en:
97
107
  view_all_projects: View all projects
98
108
  features:
99
109
  budgets:
110
+ actions:
111
+ vote: Vote
100
112
  name: Budgets
101
113
  settings:
102
114
  global:
@@ -105,6 +117,7 @@ en:
105
117
  vote_threshold_percent: Vote threshold percent
106
118
  step:
107
119
  comments_blocked: Comments blocked
120
+ votes_enabled: Votes enabled
108
121
  orders:
109
122
  checkout:
110
123
  error: An error ocurred while processing your vote
@@ -112,4 +125,6 @@ en:
112
125
  destroy:
113
126
  error: An error ocurred while canceling your vote
114
127
  success: Your vote has been canceled successfully
128
+ index:
129
+ confirmed_orders_count: Orders count
115
130
  total_budget: Total budget
@@ -31,6 +31,8 @@ es:
31
31
  title: Editar proyecto
32
32
  update: Actualizar proyecto
33
33
  index:
34
+ finished_orders: Votos finalizados
35
+ pending_orders: Votos pendientes
34
36
  title: Proyectos
35
37
  new:
36
38
  create: Crear proyecto
@@ -51,7 +53,7 @@ es:
51
53
  title: Confirmar voto
52
54
  budget_excess:
53
55
  close: Cerrar
54
- description: Este proyecto sobrepasa el presupuesto máximo y no se puede añadir. Si lo deseas, puede eliminar un proyecto que ya hayas seleccionado o votar con tus preferencias.
56
+ description: Este proyecto sobrepasa el presupuesto máximo y no se puede añadir. Si lo deseas, puede eliminar un proyecto que ya hayas seleccionado o dar apoyo con tus preferencias.
55
57
  ok: De acuerdo
56
58
  title: Presupuesto excedido
57
59
  budget_summary:
@@ -71,8 +73,13 @@ es:
71
73
  category: Categoría
72
74
  scopes: Ámbitos
73
75
  search: Buscar
76
+ filters_small_view:
77
+ close_modal: Cerrar ventana
78
+ filter: Filtrar
79
+ filter_by: Filtrar por
80
+ unfold: Desplegar
74
81
  order_progress:
75
- vote: Votar
82
+ vote: Dar apoyo
76
83
  order_selected_projects:
77
84
  remove: Eliminar
78
85
  selected_projects:
@@ -81,6 +88,9 @@ es:
81
88
  view: Ver
82
89
  project:
83
90
  add: Añadir
91
+ count:
92
+ one: 1 apoyo
93
+ other: "%{count} apoyos"
84
94
  remove: Eliminar
85
95
  project_budget_button:
86
96
  add: Añadir
@@ -90,6 +100,8 @@ es:
90
100
  view_all_projects: Ver todos los proyectos
91
101
  features:
92
102
  budgets:
103
+ actions:
104
+ vote: Dar apoyo
93
105
  name: Presupuestos
94
106
  settings:
95
107
  global:
@@ -98,6 +110,7 @@ es:
98
110
  vote_threshold_percent: Porcentaje mínimo del presupuesto
99
111
  step:
100
112
  comments_blocked: Comentarios bloqueados
113
+ votes_enabled: Votos habilitados
101
114
  orders:
102
115
  checkout:
103
116
  error: Se ha producido un error al procesar tu voto
@@ -105,4 +118,6 @@ es:
105
118
  destroy:
106
119
  error: Ha habido un error al cancelar tu voto
107
120
  success: Tu voto ha sido cancelado correctamente
121
+ index:
122
+ confirmed_orders_count: Número de votos
108
123
  total_budget: Presupuesto total
@@ -2,4 +2,100 @@ eu:
2
2
  activemodel:
3
3
  attributes:
4
4
  project:
5
- budget: Aurrekontua
5
+ budget: Aurrekontua
6
+ decidim_category_id: Kategoria
7
+ decidim_scope_id: Esparrua
8
+ description: Deskribapena
9
+ proposal_ids: Honekin lotutako proposamenak
10
+ title: Izenburua
11
+ decidim:
12
+ budgets:
13
+ actions:
14
+ attachments: Fitxategi erantsiak
15
+ confirm_destroy: Ziur zaude proiektu hau ezabatu nahi duzula?
16
+ destroy: Garbitu
17
+ edit: Editatu
18
+ new: '%{name} berria'
19
+ title: Ekintzak
20
+ admin:
21
+ models:
22
+ project:
23
+ name: Proiektua
24
+ projects:
25
+ create:
26
+ invalid: Arazo bat izan da proiektu hau sortzean
27
+ success: Proiektua ongi sortu da
28
+ destroy:
29
+ success: Proiektu ongi ezabatu da
30
+ edit:
31
+ title: Editatu proiektua
32
+ update: Eguneratu proiektua
33
+ index:
34
+ title: Proiektuak
35
+ new:
36
+ create: Sortu proiektua
37
+ title: Emaitza berria
38
+ update:
39
+ invalid: Arazo bat izan da proiektu hau eguneratzean
40
+ success: Proiektua zuzen eguneratu da
41
+ models:
42
+ project:
43
+ fields:
44
+ title: Izenburua
45
+ projects:
46
+ budget_confirm:
47
+ are_you_sure: Ados zaude? Behin zure botoa baieztatuta, ezin izanen duzu aldatu.'
48
+ cancel: Utzi
49
+ confirm: Baieztatu
50
+ description: Proiektu hauek hautatu dituzu aurrekontuan sartzeko
51
+ title: Baieztatu botoa
52
+ budget_excess:
53
+ close: Itxi
54
+ description: Proiektu honek gehieneko aurrekontua gainditzen du, eta ezin da gehitu. Nahi baduzu, jada hautatua duzun proiektu bat ezaba dezakezu edo botoa eman zure lehenespenekin bat.
55
+ ok: Ados
56
+ title: Aurrekontua gainditu da.
57
+ budget_summary:
58
+ are_you_sure: Ziur zaude zure botoa ezeztatu nahi duzula?
59
+ assigned: 'Esleituta:'
60
+ checked_out:
61
+ title: Botoa zuzen bidali da
62
+ description: Zure aburuz, proiektuetako zeinei esleitu behar diegu aurrekontua? Gutxienez, %{minimum_budget} esleitu nahi dituzun proiektuei, eta bozkatu aurrekontua zehazteko.
63
+ title: Zure esku dago aurrekontua erabakitzea
64
+ count:
65
+ projects_count:
66
+ one: Proiektu bat
67
+ other: "%{count} proiektu"
68
+ filters:
69
+ category: Kategoria
70
+ scopes: Esparruak
71
+ search: Bilatu
72
+ filters_small_view:
73
+ filter_by: 'Iragazi honen arabera:'
74
+ order_progress:
75
+ vote: Bozkatu
76
+ order_selected_projects:
77
+ remove: Kendu
78
+ selected_projects:
79
+ one: hautatutako proiektua
80
+ other: hautatutako proiektuak
81
+ view: Ikusi
82
+ project:
83
+ add: Gehitu
84
+ remove: Kendu
85
+ project_budget_button:
86
+ add: Gehitu
87
+ added: Erantsita
88
+ show:
89
+ budget: Aurrekontua
90
+ view_all_projects: Ikusi proiektu guztiak
91
+ features:
92
+ budgets:
93
+ name: Aurrekontuak
94
+ orders:
95
+ checkout:
96
+ error: Errorea gertatu da zure botoa prozesatzean
97
+ success: Zure botoa ongi bideratu da
98
+ destroy:
99
+ error: Errorea gertatu da zure botoa ezeztatzean
100
+ success: Zure botua zuzen ezeztatu da
101
+ total_budget: Guztizko aurrekontua
@@ -0,0 +1,123 @@
1
+ fi:
2
+ activemodel:
3
+ attributes:
4
+ project:
5
+ budget: Budjetti
6
+ decidim_category_id: Kategoria
7
+ decidim_scope_id: Konteksti
8
+ description: Kuvaus
9
+ proposal_ids: Liittyvät esitykset
10
+ title: Otsikko
11
+ decidim:
12
+ budgets:
13
+ actions:
14
+ attachments: Liitteet
15
+ confirm_destroy: Haluatko varmasti poistaa tämän projektin?
16
+ destroy: Poista
17
+ edit: Muokkaa
18
+ new: Uusi %{name}
19
+ title: Toiminnot
20
+ admin:
21
+ models:
22
+ project:
23
+ name: Projekti
24
+ projects:
25
+ create:
26
+ invalid: Tämän projektin lisäyksessä tapahtui virhe
27
+ success: Projekti lisätty onnistuneesti
28
+ destroy:
29
+ success: Projekti tuhottu onnistuneesti
30
+ edit:
31
+ title: Muokkaa projektia
32
+ update: Päivitä projektia
33
+ index:
34
+ finished_orders: Valmiit tilaukset
35
+ pending_orders: Odottavat tilaukset
36
+ title: Projektit
37
+ new:
38
+ create: Luo projekti
39
+ title: Uusi tulos
40
+ update:
41
+ invalid: Tämän projektin päivityksessä tapahtui virhe
42
+ success: Projekti päivitetty onnistuneesti
43
+ models:
44
+ project:
45
+ fields:
46
+ title: Otsikko
47
+ projects:
48
+ budget_confirm:
49
+ are_you_sure: Oletko samaa mieltä? Kun olet vahvistanut äänesi, et voi enää muuttaa sitä.
50
+ cancel: Peruuta
51
+ confirm: Vahvista
52
+ description: Olet valinnut nämä projektit osaksi budjettia.
53
+ title: Vahvista ääni
54
+ budget_excess:
55
+ close: Sulje
56
+ description: Tämä projekti ylittää maksimibudjetin, minkä takia sitä ei voida lisätä. Jos haluat, voit poistaa projektin, jonka olet jo valinnut lisättäväksi tai äänestää omien mieltymyksesi mukaisesti.
57
+ ok: OK
58
+ title: Maksimibudjetti ylitetty
59
+ budget_summary:
60
+ are_you_sure: Haluatko varmasti peruuttaa äänesi?
61
+ assigned: 'Varattu:'
62
+ cancel_order: poistaa äänesi ja aloittaa alusta
63
+ checked_out:
64
+ description: Olet jo äänestänyt tätä budjettia. Jos muutit mieltäsi, voit %{cancel_link}.
65
+ title: Budjetin äänestys suoritettu
66
+ description: Mitä projekteja varten sinun mielestäsi budjettia tulisi varata? Varaa vähintään %{minimum_budget} projekteille, jotka haluat toteutettavan ja äänestä mieltymystesi mukaisesti määrittääksesi budjetin.
67
+ title: Voit päättää budjetin
68
+ count:
69
+ projects_count:
70
+ one: 1 projekti
71
+ other: "%{count} projektia"
72
+ filters:
73
+ category: Kategoria
74
+ scopes: Konteksti
75
+ search: Haku
76
+ filters_small_view:
77
+ close_modal: Sulje ikkuna
78
+ filter: Suodata
79
+ filter_by: Suodata
80
+ unfold: Avaa
81
+ order_progress:
82
+ vote: Äänestä
83
+ order_selected_projects:
84
+ remove: Poista
85
+ selected_projects:
86
+ one: projekti valittu
87
+ other: projektia valittu
88
+ view: Näytä
89
+ project:
90
+ add: Lisää
91
+ count:
92
+ one: 1 kannatus
93
+ other: "%{count} kannatusta"
94
+ remove: Poista
95
+ project_budget_button:
96
+ add: Lisää
97
+ added: Lisätty
98
+ show:
99
+ budget: Budjetti
100
+ view_all_projects: Näytä kaikki projektit
101
+ features:
102
+ budgets:
103
+ actions:
104
+ vote: Äänestä
105
+ name: Budjetit
106
+ settings:
107
+ global:
108
+ comments_enabled: Kommentointi sallittu
109
+ total_budget: Koko budjetti
110
+ vote_threshold_percent: Äänestyskynnyksen prosentti
111
+ step:
112
+ comments_blocked: Kommentointi kielletty
113
+ votes_enabled: Äänestys sallittu
114
+ orders:
115
+ checkout:
116
+ error: Äänesi käsittelyssä tapahtui virhe
117
+ success: Äänesi on hyväksytty onnistuneesti
118
+ destroy:
119
+ error: Äänesi peruutuksen yhteydessä tapahtui virhe
120
+ success: Äänesi on peruttu onnistuneesti
121
+ index:
122
+ confirmed_orders_count: Tilauksien määrä
123
+ total_budget: Koko budjetti
@@ -0,0 +1,7 @@
1
+ class AddReferenceToProjects < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :decidim_budgets_projects, :reference, :string
4
+ Decidim::Budgets::Project.find_each(&:save)
5
+ change_column_null :decidim_budgets_projects, :reference, false
6
+ end
7
+ end
@@ -27,6 +27,8 @@ Decidim.register_feature(:budgets) do |feature|
27
27
 
28
28
  feature.settings(:step) do |settings|
29
29
  settings.attribute :comments_blocked, type: :boolean, default: false
30
+ settings.attribute :votes_enabled, type: :boolean, default: true
31
+ settings.attribute :show_votes, type: :boolean, default: false
30
32
  end
31
33
 
32
34
  feature.seeds do
@@ -54,13 +56,13 @@ Decidim.register_feature(:budgets) do |feature|
54
56
  Decidim::Attachment.create!(
55
57
  title: Decidim::Faker::Localized.sentence(2),
56
58
  description: Decidim::Faker::Localized.sentence(5),
57
- file: File.new(Decidim::Dev.asset("city.jpeg")),
59
+ file: File.new(File.join(File.dirname(__FILE__), "seeds", "city.jpeg")),
58
60
  attached_to: project
59
61
  )
60
62
  Decidim::Attachment.create!(
61
63
  title: Decidim::Faker::Localized.sentence(2),
62
64
  description: Decidim::Faker::Localized.sentence(5),
63
- file: File.new(Decidim::Dev.asset("Exampledocument.pdf")),
65
+ file: File.new(File.join(File.dirname(__FILE__), "seeds", "Exampledocument.pdf")),
64
66
  attached_to: project
65
67
  )
66
68
  Decidim::Comments::Seed.comments_for(project)
Binary file
@@ -6,7 +6,7 @@ FactoryGirl.define do
6
6
  factory :budget_feature, parent: :feature do
7
7
  name { Decidim::Features::Namer.new(participatory_process.organization.available_locales, :budgets).i18n_name }
8
8
  manifest_name :budgets
9
- participatory_process
9
+ participatory_process { create(:participatory_process, :with_steps) }
10
10
 
11
11
  trait :with_total_budget_and_vote_threshold_percent do
12
12
  transient do
@@ -21,6 +21,26 @@ FactoryGirl.define do
21
21
  }
22
22
  end
23
23
  end
24
+
25
+ trait :with_votes_disabled do
26
+ step_settings do
27
+ {
28
+ participatory_process.active_step.id => {
29
+ votes_enabled: false
30
+ }
31
+ }
32
+ end
33
+ end
34
+
35
+ trait :with_show_votes_enabled do
36
+ step_settings do
37
+ {
38
+ participatory_process.active_step.id => {
39
+ show_votes: true
40
+ }
41
+ }
42
+ end
43
+ end
24
44
  end
25
45
 
26
46
  factory :project, class: Decidim::Budgets::Project do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-budgets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
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: 2017-02-17 00:00:00.000000000 Z
13
+ date: 2017-03-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-core
@@ -18,28 +18,28 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.0.5
21
+ version: 0.0.6
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.0.5
28
+ version: 0.0.6
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: decidim-comments
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.0.5
35
+ version: 0.0.6
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.0.5
42
+ version: 0.0.6
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rectify
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -88,42 +88,42 @@ dependencies:
88
88
  requirements:
89
89
  - - '='
90
90
  - !ruby/object:Gem::Version
91
- version: 0.0.5
91
+ version: 0.0.6
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.0.5
98
+ version: 0.0.6
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: decidim-proposals
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - '='
104
104
  - !ruby/object:Gem::Version
105
- version: 0.0.5
105
+ version: 0.0.6
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.0.5
112
+ version: 0.0.6
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: decidim-admin
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - '='
118
118
  - !ruby/object:Gem::Version
119
- version: 0.0.5
119
+ version: 0.0.6
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.0.5
126
+ version: 0.0.6
127
127
  description: ''
128
128
  email:
129
129
  - josepjaume@gmail.com
@@ -175,6 +175,7 @@ files:
175
175
  - app/views/decidim/budgets/projects/_budget_summary.html.erb
176
176
  - app/views/decidim/budgets/projects/_count.html.erb
177
177
  - app/views/decidim/budgets/projects/_filters.html.erb
178
+ - app/views/decidim/budgets/projects/_filters_small_view.html.erb
178
179
  - app/views/decidim/budgets/projects/_linked_projects.html.erb
179
180
  - app/views/decidim/budgets/projects/_order_progress.html.erb
180
181
  - app/views/decidim/budgets/projects/_order_selected_projects.html.erb
@@ -191,15 +192,19 @@ files:
191
192
  - config/locales/en.yml
192
193
  - config/locales/es.yml
193
194
  - config/locales/eu.yml
195
+ - config/locales/fi.yml
194
196
  - db/migrate/20170127114122_create_projects.rb
195
197
  - db/migrate/20170130095615_create_orders.rb
196
198
  - db/migrate/20170130101825_create_line_items.rb
197
199
  - db/migrate/20170207101750_remove_short_description_from_decidim_projects.rb
200
+ - db/migrate/20170215132708_add_reference_to_projects.rb
198
201
  - lib/decidim/budgets.rb
199
202
  - lib/decidim/budgets/admin.rb
200
203
  - lib/decidim/budgets/admin_engine.rb
201
204
  - lib/decidim/budgets/feature.rb
202
205
  - lib/decidim/budgets/list_engine.rb
206
+ - lib/decidim/budgets/seeds/Exampledocument.pdf
207
+ - lib/decidim/budgets/seeds/city.jpeg
203
208
  - lib/decidim/budgets/test/factories.rb
204
209
  homepage: https://github.com/AjuntamentdeBarcelona/decidim
205
210
  licenses: