decidim-budgets 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/decidim/budgets/icon.svg +16 -4
  3. data/app/assets/javascripts/decidim/budgets/progressFixed.js.es6 +23 -0
  4. data/app/assets/javascripts/decidim/budgets/projects.js.es6 +5 -4
  5. data/app/assets/stylesheets/decidim/budgets/budget/_budget-list.scss +1 -1
  6. data/app/commands/decidim/budgets/add_line_item.rb +4 -2
  7. data/app/commands/decidim/budgets/admin/create_project.rb +0 -1
  8. data/app/commands/decidim/budgets/admin/update_project.rb +0 -1
  9. data/app/commands/decidim/budgets/checkout.rb +7 -3
  10. data/app/controllers/decidim/budgets/admin/application_controller.rb +9 -0
  11. data/app/controllers/decidim/budgets/admin/attachments_controller.rb +29 -0
  12. data/app/controllers/decidim/budgets/line_items_controller.rb +2 -0
  13. data/app/controllers/decidim/budgets/orders_controller.rb +2 -0
  14. data/app/forms/decidim/budgets/admin/project_form.rb +1 -2
  15. data/app/models/decidim/budgets/order.rb +16 -1
  16. data/app/models/decidim/budgets/project.rb +17 -0
  17. data/app/services/decidim/budgets/project_search.rb +0 -1
  18. data/app/views/decidim/budgets/admin/projects/_form.html.erb +0 -4
  19. data/app/views/decidim/budgets/admin/projects/edit.html.erb +1 -1
  20. data/app/views/decidim/budgets/admin/projects/index.html.erb +1 -0
  21. data/app/views/decidim/budgets/admin/projects/new.html.erb +1 -1
  22. data/app/views/decidim/budgets/line_items/update_budget.js.erb +9 -7
  23. data/app/views/decidim/budgets/projects/_budget_confirm.html.erb +27 -25
  24. data/app/views/decidim/budgets/projects/_budget_summary.html.erb +4 -13
  25. data/app/views/decidim/budgets/projects/_order_progress.html.erb +23 -21
  26. data/app/views/decidim/budgets/projects/_order_selected_projects.html.erb +25 -23
  27. data/app/views/decidim/budgets/projects/_order_total_budget.html.erb +3 -1
  28. data/app/views/decidim/budgets/projects/_project.html.erb +32 -30
  29. data/app/views/decidim/budgets/projects/_project_budget_button.html.erb +2 -2
  30. data/app/views/decidim/budgets/projects/_projects.html.erb +1 -3
  31. data/app/views/decidim/budgets/projects/index.html.erb +0 -3
  32. data/app/views/decidim/budgets/projects/show.html.erb +7 -12
  33. data/config/i18n-tasks.yml +2 -0
  34. data/config/locales/ca.yml +30 -6
  35. data/config/locales/en.yml +27 -7
  36. data/config/locales/es.yml +28 -4
  37. data/config/locales/eu.yml +5 -0
  38. data/db/migrate/20170207101750_remove_short_description_from_decidim_projects.rb +5 -0
  39. data/lib/decidim/budgets/admin_engine.rb +4 -1
  40. data/lib/decidim/budgets/feature.rb +17 -6
  41. data/lib/decidim/budgets/test/factories.rb +2 -3
  42. metadata +28 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa8f0db3125a7ddb93f9076d6e4fff7256cb1934
4
- data.tar.gz: 109c2f3e91977e116a7d5baccf9fa142a78e100f
3
+ metadata.gz: 36a0cd87302d85abc1401b212ba7f792da11a7b2
4
+ data.tar.gz: 0ba3e53eca08d996c1d7ef4e515b113e60246815
5
5
  SHA512:
6
- metadata.gz: 673eb952dde2972556bdcb286255d7a456f9f738764901f0c832adea7b8ea3d606b248cf4f6a33fc166ef4ed21b95f53c71d4f112745be53228e445acb7f04fd
7
- data.tar.gz: 4e22d0bb6a0acc9a3c8820ef305eefb3a273521063908895e84f0b6a2c65c9a692e05986047949c5faaa54e396e2c9c522642be4e331d869552cfd7e215a8779
6
+ metadata.gz: 4f290147ea2a65b093245248598014046266abdeb3ee57fda81051f66297129b19b5d899867f74af9a93bf9a9bdf4af0295ac51c9fa814010993bc0e1e496c14
7
+ data.tar.gz: cefabce04a878a30200a62e6a5d4e28542f43bfd0e976324a6e45b6a0f6666f92e5e0edcfc713f3424b9c80cd65c4ebd79748e6aac158d0f7fb956906dd9b601
@@ -1,4 +1,16 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8">
2
- <path d="M2 0v1h-.75c-.68 0-1.25.57-1.25 1.25v.5c0 .68.44 1.24 1.09 1.41l2.56.66c.14.04.34.29.34.44v.5c0 .14-.11.25-.25.25h-2.5c-.12 0-.21-.04-.25-.06v-.94h-1v1c0 .34.2.63.44.78.23.16.52.22.81.22h.75v1h1v-1h.75c.69 0 1.25-.56 1.25-1.25v-.5c0-.68-.44-1.24-1.09-1.41l-2.56-.66c-.14-.04-.34-.29-.34-.44v-.5c0-.14.11-.25.25-.25h2.5c.11 0 .21.04.25.06v.94h1v-1c0-.34-.2-.63-.44-.78-.23-.16-.52-.22-.81-.22h-.75v-1h-1z"
3
- transform="translate(1)" />
4
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 36 36" style="enable-background:new 0 0 36 36;" xml:space="preserve">
5
+ <g>
6
+ <path d="M18,36C8.1,36,0,27.9,0,18S8.1,0,18,0s18,8.1,18,18S27.9,36,18,36z M18,2C9.2,2,2,9.2,2,18s7.2,16,16,16s16-7.2,16-16
7
+ S26.8,2,18,2z"/>
8
+ </g>
9
+ <g>
10
+ <g>
11
+ <path d="M17.1,28.3c-5.3,0-9.9-4.4-9.9-9.8c0-5.5,4.9-9.5,9.3-9.5H18v9h9v0.9C27,23.2,22.7,28.3,17.1,28.3z M16,10.7
12
+ c-4,0.6-6.5,3.7-6.5,7.6c0,4.3,3.6,8,7.7,8c3.9,0,7-3.3,7.6-6.3H16V10.7z"/>
13
+ </g>
14
+ <path d="M30,16H20V6h0.6c4.5,0,9.4,4.4,9.4,8.9V16z M22,14h5.5C27,11,24,8.6,22,8V14z"/>
15
+ </g>
16
+ </svg>
@@ -0,0 +1,23 @@
1
+ $(() => {
2
+ const checkProgressPosition = () => {
3
+ let progressFix = document.querySelector("[data-progressbox-fixed]"),
4
+ progressRef = document.querySelector("[data-progress-reference]"),
5
+ progressVisibleClass = "is-progressbox-visible";
6
+
7
+ if (!progressRef) {
8
+ return;
9
+ }
10
+
11
+ let progressPosition = progressRef.getBoundingClientRect().bottom;
12
+ if (progressPosition > 0) {
13
+ progressFix.classList.remove(progressVisibleClass);
14
+ } else {
15
+ progressFix.classList.add(progressVisibleClass);
16
+ }
17
+ }
18
+
19
+ window.addEventListener("scroll", checkProgressPosition);
20
+
21
+ window.DecidimBudgets = window.DecidimBudgets || {};
22
+ window.DecidimBudgets.checkProgressPosition = checkProgressPosition;
23
+ });
@@ -1,3 +1,4 @@
1
+ // = require ./progressFixed
1
2
  // = require_self
2
3
 
3
4
  $(() => {
@@ -5,7 +6,7 @@ $(() => {
5
6
  const $budgetSummaryTotal = $('.budget-summary__total');
6
7
  const $budgetExceedModal = $('#budget-excess');
7
8
 
8
- const totalBudget = $budgetSummaryTotal.data('total-budget');
9
+ const totalBudget = parseInt($budgetSummaryTotal.attr('data-total-budget'), 10);
9
10
 
10
11
  const cancelEvent = (event) => {
11
12
  event.stopPropagation();
@@ -13,14 +14,14 @@ $(() => {
13
14
  };
14
15
 
15
16
  $projects.on('click', '.budget--list__action', (event) => {
16
- const currentBudget = $('.budget-summary__progressbox').data('current-budget');
17
+ const currentBudget = parseInt($('.budget-summary__progressbox').attr('data-current-budget'), 10);
17
18
  const $currentTarget = $(event.currentTarget);
18
- const projectBudget = $currentTarget.data('budget');
19
+ const projectBudget = parseInt($currentTarget.attr('data-budget'), 10);
19
20
 
20
21
  if ($currentTarget.attr('disabled')) {
21
22
  cancelEvent(event);
22
23
 
23
- } else if ($currentTarget.data('add') && ((currentBudget + projectBudget) > totalBudget)) {
24
+ } else if ($currentTarget.attr('data-add') && ((currentBudget + projectBudget) > totalBudget)) {
24
25
  $budgetExceedModal.foundation('toggle');
25
26
  cancelEvent(event);
26
27
  }
@@ -11,7 +11,7 @@
11
11
  }
12
12
  }
13
13
  .budget-list__data--added{
14
- background-color: mix(white, $success, 80%);
14
+ background-color: tint($success, 80%);
15
15
  }
16
16
 
17
17
  .budget-list__number{
@@ -35,8 +35,10 @@ module Decidim
35
35
  end
36
36
 
37
37
  def add_line_item
38
- order.projects << @project
39
- order.save!
38
+ order.with_lock do
39
+ order.projects << @project
40
+ order.save!
41
+ end
40
42
  end
41
43
  end
42
44
  end
@@ -33,7 +33,6 @@ module Decidim
33
33
  category: @form.category,
34
34
  feature: @form.current_feature,
35
35
  title: @form.title,
36
- short_description: @form.short_description,
37
36
  description: @form.description,
38
37
  budget: @form.budget
39
38
  )
@@ -37,7 +37,6 @@ module Decidim
37
37
  scope: form.scope,
38
38
  category: form.category,
39
39
  title: form.title,
40
- short_description: form.short_description,
41
40
  description: form.description,
42
41
  budget: form.budget
43
42
  )
@@ -19,15 +19,19 @@ module Decidim
19
19
  #
20
20
  # Returns nothing.
21
21
  def call
22
- return broadcast(:invalid) unless @order&.can_checkout?
23
- checkout!
22
+ return broadcast(:invalid, @order) unless checkout!
24
23
  broadcast(:ok, @order)
25
24
  end
26
25
 
27
26
  private
28
27
 
29
28
  def checkout!
30
- @order.update_attributes!(checked_out_at: Time.current)
29
+ return unless @order
30
+
31
+ @order.with_lock do
32
+ @order.checked_out_at = Time.current
33
+ @order.save
34
+ end
31
35
  end
32
36
  end
33
37
  end
@@ -8,6 +8,15 @@ module Decidim
8
8
  # Note that it inherits from `Decidim::Features::BaseController`, which
9
9
  # override its layout and provide all kinds of useful methods.
10
10
  class ApplicationController < Decidim::Admin::Features::BaseController
11
+ helper_method :projects, :project
12
+
13
+ def projects
14
+ @projects ||= Project.where(feature: current_feature)
15
+ end
16
+
17
+ def project
18
+ @project ||= projects.find(params[:id])
19
+ end
11
20
  end
12
21
  end
13
22
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ module Budgets
4
+ module Admin
5
+ # Controller that allows managing all the attachments for a participatory
6
+ # process.
7
+ #
8
+ class AttachmentsController < Admin::ApplicationController
9
+ include Decidim::Admin::Concerns::HasAttachments
10
+
11
+ def after_destroy_path
12
+ projects_path
13
+ end
14
+
15
+ def attached_to
16
+ project
17
+ end
18
+
19
+ def project
20
+ @project ||= projects.find(params[:project_id])
21
+ end
22
+
23
+ def authorization_object
24
+ project.feature
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -9,6 +9,8 @@ module Decidim
9
9
  helper_method :project
10
10
 
11
11
  def create
12
+ authorize_action! "vote"
13
+
12
14
  AddLineItem.call(current_order, project, current_user) do
13
15
  on(:ok) do |order|
14
16
  self.current_order = order
@@ -7,6 +7,8 @@ module Decidim
7
7
  include NeedsCurrentOrder
8
8
 
9
9
  def checkout
10
+ authorize_action! "vote"
11
+
10
12
  Checkout.call(current_order, current_feature) do
11
13
  on(:ok) do
12
14
  flash[:notice] = I18n.t("orders.checkout.success", scope: "decidim")
@@ -8,15 +8,14 @@ module Decidim
8
8
  include TranslationsHelper
9
9
 
10
10
  translatable_attribute :title, String
11
- translatable_attribute :short_description, String
12
11
  translatable_attribute :description, String
12
+
13
13
  attribute :budget, Integer
14
14
  attribute :decidim_scope_id, Integer
15
15
  attribute :decidim_category_id, Integer
16
16
  attribute :proposal_ids, Array[Integer]
17
17
 
18
18
  validates :title, translatable_presence: true
19
- validates :short_description, translatable_presence: true
20
19
  validates :description, translatable_presence: true
21
20
  validates :budget, presence: true, numericality: { greater_than: 0 }
22
21
 
@@ -16,9 +16,17 @@ module Decidim
16
16
  validates :user, presence: true, uniqueness: { scope: :feature }
17
17
  validate :user_belongs_to_organization
18
18
 
19
+ validates :total_budget, numericality: {
20
+ greater_than_or_equal_to: :minimum_budget
21
+ }, if: :checked_out?
22
+
23
+ validates :total_budget, numericality: {
24
+ less_than_or_equal_to: :maximum_budget
25
+ }
26
+
19
27
  # Public: Returns the sum of project budgets
20
28
  def total_budget
21
- @total_budget ||= projects.sum(&:budget)
29
+ projects.to_a.sum(&:budget)
22
30
  end
23
31
 
24
32
  # Public: Returns true if the order has been checked out
@@ -38,9 +46,16 @@ module Decidim
38
46
 
39
47
  # Public: Returns the required minimum budget to checkout
40
48
  def minimum_budget
49
+ return 0 unless feature
41
50
  feature.settings.total_budget.to_f * (feature.settings.vote_threshold_percent.to_f / 100)
42
51
  end
43
52
 
53
+ # Public: Returns the required maximum budget to checkout
54
+ def maximum_budget
55
+ return 0 unless feature
56
+ feature.settings.total_budget.to_f
57
+ end
58
+
44
59
  private
45
60
 
46
61
  def user_belongs_to_organization
@@ -8,8 +8,25 @@ module Decidim
8
8
  include Decidim::HasFeature
9
9
  include Decidim::HasScope
10
10
  include Decidim::HasCategory
11
+ include Decidim::HasAttachments
12
+ include Decidim::Comments::Commentable
11
13
 
12
14
  feature_manifest_name "budgets"
15
+
16
+ # Public: Overrides the `commentable?` Commentable concern method.
17
+ def commentable?
18
+ feature.settings.comments_enabled?
19
+ end
20
+
21
+ # Public: Overrides the `accepts_new_comments?` Commentable concern method.
22
+ def accepts_new_comments?
23
+ commentable? && !feature.active_step_settings.comments_blocked
24
+ end
25
+
26
+ # Public: Overrides the `comments_have_votes?` Commentable concern method.
27
+ def comments_have_votes?
28
+ true
29
+ end
13
30
  end
14
31
  end
15
32
  end
@@ -17,7 +17,6 @@ module Decidim
17
17
  query
18
18
  .where(localized_search_text_in(:title), text: "%#{search_text}%")
19
19
  .or(query.where(localized_search_text_in(:description), text: "%#{search_text}%"))
20
- .or(query.where(localized_search_text_in(:short_description), text: "%#{search_text}%"))
21
20
  end
22
21
 
23
22
  # Handle the scope_id filter
@@ -2,10 +2,6 @@
2
2
  <%= form.translated :text_field, :title, autofocus: true %>
3
3
  </div>
4
4
 
5
- <div class="field" >
6
- <%= form.translated :editor, :short_description %>
7
- </div>
8
-
9
5
  <div class="field" >
10
6
  <%= form.translated :editor, :description %>
11
7
  </div>
@@ -1,6 +1,6 @@
1
1
  <h3><%= t ".title" %></h3>
2
2
 
3
- <%= form_for(@form) do |f| %>
3
+ <%= decidim_form_for(@form) do |f| %>
4
4
  <%= render partial: 'form', object: f %>
5
5
 
6
6
  <div class="actions">
@@ -19,6 +19,7 @@
19
19
  </td>
20
20
  <td class="actions">
21
21
  <%= link_to t("actions.edit", scope: "decidim.budgets"), edit_project_path(project) if can? :update, current_feature %>
22
+ <%= link_to t("actions.attachments", scope: "decidim.budgets"), project_attachments_path(project) if can? :update, current_feature %>
22
23
  <%= link_to t("actions.destroy", scope: "decidim.budgets"), project_path(project), method: :delete, class: "small alert button", data: { confirm: t("actions.confirm_destroy", scope: "decidim.budgets") } if can? :destroy, current_feature %>
23
24
  </td>
24
25
  </tr>
@@ -1,6 +1,6 @@
1
1
  <h3><%= t ".title" %></h3>
2
2
 
3
- <%= form_for(@form) do |f| %>
3
+ <%= decidim_form_for(@form) do |f| %>
4
4
  <%= render partial: 'form', object: f %>
5
5
 
6
6
  <div class="actions">
@@ -5,17 +5,19 @@ var $projectItem = $('#project-<%= project.id %>-item');
5
5
  var $projectBudgetButton = $('#project-<%= project.id %>-budget-button');
6
6
  var $budgetConfirm = $('#budget-confirm');
7
7
 
8
- $orderTotalBudget.html('<%= j(render partial: 'decidim/budgets/projects/order_total_budget') %>');
9
- $orderSelectedProjects.html('<%= j(render partial: 'decidim/budgets/projects/order_selected_projects') %>');
10
- $orderProgress.html('<%= j(render partial: 'decidim/budgets/projects/order_progress') %>');
11
- $budgetConfirm.html('<%= j(render partial: 'decidim/budgets/projects/budget_confirm') %>')
8
+ morphdom($orderTotalBudget[0], '<%= j(render partial: 'decidim/budgets/projects/order_total_budget') %>');
9
+ morphdom($orderSelectedProjects[0], '<%= j(render partial: 'decidim/budgets/projects/order_selected_projects') %>');
10
+ morphdom($orderProgress[0], '<%= j(render partial: 'decidim/budgets/projects/order_progress') %>');
11
+ morphdom($budgetConfirm[0], '<%= j(render partial: 'decidim/budgets/projects/budget_confirm') %>')
12
12
 
13
- $(document).foundation();
13
+ $("#order-progress").foundation();
14
14
 
15
15
  if ($projectItem.length > 0) {
16
- $projectItem.html('<%= j(render partial: 'decidim/budgets/projects/project', locals: { project: project }) %>');
16
+ morphdom($projectItem[0], '<%= j(render partial: 'decidim/budgets/projects/project', locals: { project: project }) %>');
17
17
  }
18
18
 
19
19
  if ($projectBudgetButton.length > 0) {
20
- $projectBudgetButton.html('<%= j(render partial: 'decidim/budgets/projects/project_budget_button', locals: { project: project }) %>');
20
+ morphdom($projectBudgetButton[0], '<%= j(render partial: 'decidim/budgets/projects/project_budget_button', locals: { project: project }) %>');
21
21
  }
22
+
23
+ window.DecidimBudgets.checkProgressPosition();
@@ -1,30 +1,32 @@
1
- <% if current_order.present? %>
2
- <div class="reveal__header">
3
- <h3 class="reveal__title"><%= t('.title') %></h3>
4
- <button class="close-button" data-close aria-label="<%= t('.cancel') %>" type="button">
5
- <span aria-hidden="true">&times;</span>
6
- </button>
7
- </div>
8
- <p><%= t('.description') %></p>
9
- <div class="card card--secondary">
10
- <ul class="card__content">
11
- <% current_order.projects.each do |project| %>
12
- <li class="budget-summary__selected-item">
13
- <%= link_to translated_attribute(project.title), project %>
14
- <strong class="budget-summary__selected-number">
15
- <%= budget_to_currency project.budget %>
16
- </strong>
17
- </li>
18
- <% end %>
19
- </ul>
20
- </div>
21
- <p class="text-center"><%= t('.are_you_sure') %></p>
1
+ <div class="reveal" data-reveal id="budget-confirm">
2
+ <% if current_order.present? %>
3
+ <div class="reveal__header">
4
+ <h3 class="reveal__title"><%= t('.title') %></h3>
5
+ <button class="close-button" data-close aria-label="<%= t('.cancel') %>" type="button">
6
+ <span aria-hidden="true">&times;</span>
7
+ </button>
8
+ </div>
9
+ <p><%= t('.description') %></p>
10
+ <div class="card card--secondary">
11
+ <ul class="card__content">
12
+ <% current_order.projects.each do |project| %>
13
+ <li class="budget-summary__selected-item">
14
+ <%= link_to translated_attribute(project.title), project %>
15
+ <strong class="budget-summary__selected-number">
16
+ <%= budget_to_currency project.budget %>
17
+ </strong>
18
+ </li>
19
+ <% end %>
20
+ </ul>
21
+ </div>
22
+ <p class="text-center"><%= t('.are_you_sure') %></p>
22
23
  <div class="row">
23
24
  <div class="columns medium-8 medium-offset-2">
24
25
  <%= button_to t('.confirm'), checkout_order_path, class: "button expanded" %>
25
26
  </div>
26
27
  </div>
27
- <div class="text-center">
28
- <button class="link" data-close><%= t('.cancel') %></button>
29
- </div>
30
- <% end %>
28
+ <div class="text-center">
29
+ <button class="link" data-close><%= t('.cancel') %></button>
30
+ </div>
31
+ <% end %>
32
+ </div>
@@ -20,27 +20,18 @@
20
20
  </span>
21
21
  </div>
22
22
 
23
- <div id="order-progress">
24
- <%= render partial: 'order_progress' %>
25
- </div>
23
+ <%= render partial: 'order_progress' %>
26
24
 
27
25
  <div>
28
26
  <span class="mini-title">
29
27
  <%= t('.assigned') %>
30
- <strong id="order-total-budget" class="mini-title__strong">
31
- <%= render partial: 'order_total_budget' %>
32
- </strong>
28
+ <%= render partial: 'order_total_budget' %>
33
29
  </span>
34
30
  </div>
35
31
  </div>
36
32
 
37
- <div id="order-selected-projects">
38
- <%= render partial: 'order_selected_projects' %>
39
- </div>
33
+ <%= render partial: 'order_selected_projects' %>
40
34
  </div>
41
35
 
42
36
  <%= render partial: "budget_excess" %>
43
-
44
- <div class="reveal" data-reveal id="budget-confirm">
45
- <%= render partial: "budget_confirm" %>
46
- </div>
37
+ <%= render partial: "budget_confirm" %>
@@ -1,24 +1,8 @@
1
- <div class="budget-summary__progressbox" data-current-budget="<%= current_order ? current_order.total_budget : 0 %>">
2
- <div class="progress budget-progress" role="progressbar" tabindex="0" aria-valuenow="<%= current_order_budget_percent %>" aria-valuemin="<%= feature_settings.vote_threshold_percent %>" aria-valuetext="<%= current_order_budget_percent %>%" aria-valuemax="100">
3
- <div class="progress-meter progress-meter--minimum" style="width: <%= 100 - current_order_budget_percent %>%"></div>
4
- <!--Change width and text dynamically.-->
5
- <div class="progress-meter budget-progress__meter" style="width: <%= current_order_budget_percent %>%">
6
- <p class="progress-meter-text progress-meter-text--right"><%= current_order_budget_percent %>%</p>
7
- </div>
8
- </div>
9
- <% unless current_order_checked_out? %>
10
- <% if current_order_can_be_checked_out? %>
11
- <button class="button small button--sc" data-toggle="budget-confirm"><%= t('.vote') %></button>
12
- <% else %>
13
- <button class="button small button--sc" data-toggle="budget-confirm" disabled><%= t('.vote') %></button>
14
- <% end %>
15
- <% end %>
16
- </div>
17
-
18
- <div class="progressbox-fixed-wrapper" data-progressbox-fixed>
19
- <div class="budget-summary__progressbox budget-summary__progressbox--fixed">
20
- <div class="progress budget-progress budget-progress--fixed" role="progressbar" tabindex="0" aria-valuenow="<%= current_order_budget_percent %>" aria-valuemin="<%= feature_settings.vote_threshold_percent %>" aria-valuetext="<%= current_order_budget_percent %>%" aria-valuemax="100">
1
+ <div id="order-progress">
2
+ <div class="budget-summary__progressbox" data-current-budget="<%= current_order ? current_order.total_budget : 0 %>">
3
+ <div class="progress budget-progress" role="progressbar" tabindex="0" aria-valuenow="<%= current_order_budget_percent %>" aria-valuemin="<%= feature_settings.vote_threshold_percent %>" aria-valuetext="<%= current_order_budget_percent %>%" aria-valuemax="100">
21
4
  <div class="progress-meter progress-meter--minimum" style="width: <%= 100 - current_order_budget_percent %>%"></div>
5
+ <!--Change width and text dynamically.-->
22
6
  <div class="progress-meter budget-progress__meter" style="width: <%= current_order_budget_percent %>%">
23
7
  <p class="progress-meter-text progress-meter-text--right"><%= current_order_budget_percent %>%</p>
24
8
  </div>
@@ -31,4 +15,22 @@
31
15
  <% end %>
32
16
  <% end %>
33
17
  </div>
34
- </div>
18
+
19
+ <div class="progressbox-fixed-wrapper" data-progressbox-fixed>
20
+ <div class="budget-summary__progressbox budget-summary__progressbox--fixed">
21
+ <div class="progress budget-progress budget-progress--fixed" role="progressbar" tabindex="0" aria-valuenow="<%= current_order_budget_percent %>" aria-valuemin="<%= feature_settings.vote_threshold_percent %>" aria-valuetext="<%= current_order_budget_percent %>%" aria-valuemax="100">
22
+ <div class="progress-meter progress-meter--minimum" style="width: <%= 100 - current_order_budget_percent %>%"></div>
23
+ <div class="progress-meter budget-progress__meter" style="width: <%= current_order_budget_percent %>%">
24
+ <p class="progress-meter-text progress-meter-text--right"><%= current_order_budget_percent %>%</p>
25
+ </div>
26
+ </div>
27
+ <% unless current_order_checked_out? %>
28
+ <% if current_order_can_be_checked_out? %>
29
+ <button class="button small button--sc" data-toggle="budget-confirm"><%= t('.vote') %></button>
30
+ <% else %>
31
+ <button class="button small button--sc" data-toggle="budget-confirm" disabled><%= t('.vote') %></button>
32
+ <% end %>
33
+ <% end %>
34
+ </div>
35
+ </div>
36
+ </div>
@@ -1,25 +1,27 @@
1
- <% if current_order&.projects&.any? %>
2
- <div class="card__content budget-summary__selected">
3
- <button data-toggle="reveal-selected">
4
- <strong><%= current_order.projects.size %> </strong><%= t('.selected_projects', count: current_order.projects.size) %>
5
- <%= icon("caret-bottom", class:"icon--small", aria_label: t('.view'), role: "img") %>
6
- </button>
7
- <div id="reveal-selected" class="hide" data-toggler=".hide">
8
- <ul class="budget-summary__selected-list">
9
- <% current_order.projects.each do |project| %>
10
- <li class="budget-summary__selected-item">
11
- <%= link_to translated_attribute(project.title), project %>
12
- <strong class="budget-summary__selected-number">
13
- <%= budget_to_currency project.budget %>
14
- </strong>
15
- <% unless current_order_checked_out? %>
16
- <%= button_to order_line_item_path(project_id: project), method: :delete, remote: true, data: { disable: true }, form: { style: "display: inline" } do %>
17
- <%= icon("trash", aria_label: t('.remove'), role: "img") %>
1
+ <div id="order-selected-projects">
2
+ <% if current_order&.projects&.any? %>
3
+ <div class="card__content budget-summary__selected">
4
+ <button data-toggle="reveal-selected">
5
+ <strong><%= current_order.projects.size %> </strong><%= t('.selected_projects', count: current_order.projects.size) %>
6
+ <%= icon("caret-bottom", class:"icon--small", aria_label: t('.view'), role: "img") %>
7
+ </button>
8
+ <div id="reveal-selected" class="hide" data-toggler=".hide">
9
+ <ul class="budget-summary__selected-list">
10
+ <% current_order.projects.each do |project| %>
11
+ <li class="budget-summary__selected-item">
12
+ <%= link_to translated_attribute(project.title), project %>
13
+ <strong class="budget-summary__selected-number">
14
+ <%= budget_to_currency project.budget %>
15
+ </strong>
16
+ <% unless current_order_checked_out? %>
17
+ <%= button_to order_line_item_path(project_id: project), method: :delete, remote: true, data: { disable: true }, form: { style: "display: inline" } do %>
18
+ <%= icon("trash", aria_label: t('.remove'), role: "img") %>
19
+ <% end %>
18
20
  <% end %>
19
- <% end %>
20
- </li>
21
- <% end %>
22
- </ul>
21
+ </li>
22
+ <% end %>
23
+ </ul>
24
+ </div>
23
25
  </div>
24
- </div>
25
- <% end %>
26
+ <% end %>
27
+ </div>
@@ -1 +1,3 @@
1
- <%= budget_to_currency current_order&.total_budget.to_f %>
1
+ <strong id="order-total-budget" class="mini-title__strong">
2
+ <%= budget_to_currency current_order&.total_budget.to_f %>
3
+ </strong>
@@ -1,40 +1,42 @@
1
- <div class="card--list__text">
2
- <div>
3
- <%= link_to project, class: "card__link" do %>
4
- <h5 class="card__title budget-list__title">
5
- <%= translated_attribute project.title %>
6
- </h5>
7
- <% end %>
8
- <%= render partial: "decidim/budgets/projects/tags", locals: { project: project } %>
9
- </div>
10
- </div>
11
- <% if current_user.present? %>
12
- <% if current_order && current_order.projects.include?(project) %>
13
- <div class="card--list__data budget-list__data budget-list__data--added">
14
- <span class="card--list__data__number budget-list__number">
15
- <%= budget_to_currency(project.budget) %>
16
- </span>
17
- <%= button_to 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
- <%= icon("check", class: "icon--small", aria_label: t('.remove'), role: "img") %>
1
+ <div id="project-<%= project.id %>-item" class="card--list__item">
2
+ <div class="card--list__text">
3
+ <div>
4
+ <%= link_to project, class: "card__link" do %>
5
+ <h5 class="card__title budget-list__title">
6
+ <%= translated_attribute project.title %>
7
+ </h5>
19
8
  <% end %>
9
+ <%= render partial: "decidim/budgets/projects/tags", locals: { project: project } %>
20
10
  </div>
11
+ </div>
12
+ <% if current_user.present? %>
13
+ <% if current_order && current_order.projects.include?(project) %>
14
+ <div class="card--list__data budget-list__data budget-list__data--added">
15
+ <span class="card--list__data__number budget-list__number">
16
+ <%= budget_to_currency(project.budget) %>
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 %>
19
+ <%= icon("check", class: "icon--small", aria_label: t('.remove'), role: "img") %>
20
+ <% end %>
21
+ </div>
22
+ <% else %>
23
+ <div class="card--list__data budget-list__data">
24
+ <span class="card--list__data__number budget-list__number">
25
+ <%= budget_to_currency(project.budget) %>
26
+ </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 %>
28
+ <%= icon("check", class: "icon--small", aria_label: t('.add'), role: "img") %>
29
+ <% end %>
30
+ </div>
31
+ <% end %>
21
32
  <% else %>
22
33
  <div class="card--list__data budget-list__data">
23
34
  <span class="card--list__data__number budget-list__number">
24
35
  <%= budget_to_currency(project.budget) %>
25
36
  </span>
26
- <%= button_to 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 %>
37
+ <a href="#" class="button tiny hollow budget--list__action disabled" data-toggle="loginModal">
27
38
  <%= icon("check", class: "icon--small", aria_label: t('.add'), role: "img") %>
28
- <% end %>
39
+ </a>
29
40
  </div>
30
41
  <% end %>
31
- <% else %>
32
- <div class="card--list__data budget-list__data">
33
- <span class="card--list__data__number budget-list__number">
34
- <%= budget_to_currency(project.budget) %>
35
- </span>
36
- <a href="#" class="button tiny hollow budget--list__action disabled" data-toggle="loginModal">
37
- <%= icon("check", class: "icon--small", aria_label: t('.add'), role: "img") %>
38
- </a>
39
- </div>
40
- <% end %>
42
+ </div>
@@ -1,8 +1,8 @@
1
1
  <% if current_user.present? %>
2
2
  <% if current_order && current_order.projects.include?(project) %>
3
- <%= button_to 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_order_checked_out?, class: "button expanded button--sc success budget--list__action" %>
4
4
  <% else %>
5
- <%= button_to 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_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>
@@ -1,8 +1,6 @@
1
1
  <div class="card card--list budget-list">
2
2
  <% projects.each do |project| %>
3
- <div id="project-<%= project.id %>-item" class="card--list__item">
4
- <%= render partial: 'project', locals: { project: project } %>
5
- </div>
3
+ <%= render partial: 'project', locals: { project: project } %>
6
4
  <% end %>
7
5
  </div>
8
6
  <%= decidim_paginate projects, random_seed: random_seed %>
@@ -1,5 +1,3 @@
1
- <% content_for(:title, t(".title")) %>
2
-
3
1
  <% if current_user.present? %>
4
2
  <div class="row column">
5
3
  <%= render partial: "budget_summary", locals: { include_heading: true } %>
@@ -23,4 +21,3 @@
23
21
 
24
22
  <%= javascript_include_tag("decidim/filters") %>
25
23
  <%= javascript_include_tag("decidim/budgets/projects") %>
26
- <%= render partial: "decidim/shared/login_modal" %>
@@ -1,4 +1,7 @@
1
- <% content_for(:title, translated_attribute(project.title)) %>
1
+ <% add_decidim_meta_tags(
2
+ title: translated_attribute(project.title),
3
+ description: translated_attribute(project.description)
4
+ ) %>
2
5
 
3
6
  <div class="row column view-header">
4
7
  <% if current_user.present? %>
@@ -27,22 +30,14 @@
27
30
  </div>
28
31
  <div class="columns mediumlarge-8 mediumlarge-pull-4">
29
32
  <div class="section">
30
- <%== translated_attribute project.short_description %>
31
- <%= render partial: "tags", locals: { project: project } %>
32
- </div>
33
- <div class="section">
34
- <h3 class="section-heading"><%= t(".project_description") %></h3>
35
33
  <%== translated_attribute project.description %>
34
+ <%= render partial: "tags", locals: { project: project } %>
36
35
  </div>
37
36
  <%= linked_resources_for project, :proposals, "included_proposals" %>
38
37
  </div>
39
38
  </div>
40
39
 
41
- <%= content_for :expanded do %>
42
- <% if feature_settings.comments_always_enabled || current_settings.comments_enabled %>
43
- <%= comments_for project, votable: true %>
44
- <% end %>
45
- <% end %>
40
+ <%= comments_for project %>
46
41
 
42
+ <%= attachments_for project %>
47
43
  <%= javascript_include_tag("decidim/budgets/projects") %>
48
- <%= render partial: "decidim/shared/login_modal" %>
@@ -2,3 +2,5 @@ base_locale: en
2
2
  locales: [en]
3
3
  ignore_unused:
4
4
  - "decidim.features.budgets.name"
5
+ - "decidim.features.budgets.settings.*"
6
+ - "activemodel.attributes.project.*"
@@ -1,7 +1,17 @@
1
1
  ca:
2
+ activemodel:
3
+ attributes:
4
+ project:
5
+ budget: Pressupost
6
+ decidim_category_id: Categoria
7
+ decidim_scope_id: Àmbit
8
+ description: Descripció
9
+ proposal_ids: Propostes relacionades
10
+ title: Títol
2
11
  decidim:
3
12
  budgets:
4
13
  actions:
14
+ attachments: Adjunts
5
15
  confirm_destroy: Estàs segur que vols eliminar aquest projecte?
6
16
  destroy: Esborrar
7
17
  edit: Editar
@@ -15,6 +25,8 @@ ca:
15
25
  create:
16
26
  invalid: Hi ha hagut un problema creant aquest projecte
17
27
  success: Projecte creat correctament
28
+ destroy:
29
+ success: Projecte eliminat correctament
18
30
  edit:
19
31
  title: Editar projecte
20
32
  update: Actualitzar projecte
@@ -32,7 +44,7 @@ ca:
32
44
  title: Títol
33
45
  projects:
34
46
  budget_confirm:
35
- are_you_sure: Estàs d'acord? Un cop hagis confirmat el teu vot, no podràs canviar-lo.
47
+ are_you_sure: Hi estàs d'acord? Un cop hagis confirmat el teu vot, no podràs canviar-lo.
36
48
  cancel: Cancel·lar
37
49
  confirm: Confirmar
38
50
  description: Aquests són els projectes que has seleccionat per formar part del pressupost.
@@ -43,12 +55,13 @@ ca:
43
55
  ok: D'acord
44
56
  title: Pressupost superat
45
57
  budget_summary:
58
+ are_you_sure: Estàs segur de que vols cancel·lar el teu vot?
46
59
  assigned: 'Assignat:'
47
60
  cancel_order: eliminar el teu vot i començar de nou
48
61
  checked_out:
49
- description: Ja has votat pel pressupost. Si ha canviat d'idea, pots %{cancel_link}.
62
+ description: Ja has votat pel pressupost. Si has canviat d'idea, pots %{cancel_link}.
50
63
  title: Vot pels pressupostos completat
51
- 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."
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.
52
65
  title: Tu decideixes el pressupost
53
66
  count:
54
67
  projects_count:
@@ -58,8 +71,6 @@ ca:
58
71
  category: Categoria
59
72
  scopes: Àmbits
60
73
  search: Cerca
61
- index:
62
- title: Títol
63
74
  order_progress:
64
75
  vote: Votar
65
76
  order_selected_projects:
@@ -76,9 +87,22 @@ ca:
76
87
  added: Afegit
77
88
  show:
78
89
  budget: Pressupost
79
- project_description: Descripció del projecte
80
90
  view_all_projects: Veure tots els projectes
81
91
  features:
82
92
  budgets:
83
93
  name: Pressupostos
94
+ settings:
95
+ global:
96
+ comments_enabled: Comentaris habilitats
97
+ total_budget: Pressupost total
98
+ vote_threshold_percent: Percentatge del pressupost mínim per fer el vot
99
+ step:
100
+ comments_blocked: Comentaris bloquejats
101
+ orders:
102
+ checkout:
103
+ error: S'ha produït un error en processar el teu vot
104
+ success: El teu vot s'ha tramitat amb èxit
105
+ destroy:
106
+ error: S'ha produït un error en cancel·lar el seu vot
107
+ success: El seu vot ha estat cancel·lat correctament
84
108
  total_budget: Pressupost total
@@ -1,8 +1,18 @@
1
1
  ---
2
2
  en:
3
+ activemodel:
4
+ attributes:
5
+ project:
6
+ budget: Budget
7
+ decidim_category_id: Category
8
+ decidim_scope_id: Scope
9
+ description: Description
10
+ proposal_ids: Related proposals
11
+ title: Title
3
12
  decidim:
4
13
  budgets:
5
14
  actions:
15
+ attachments: Attachments
6
16
  confirm_destroy: Are you sure you want to delete this project?
7
17
  destroy: Delete
8
18
  edit: Edit
@@ -35,14 +45,17 @@ en:
35
45
  title: Title
36
46
  projects:
37
47
  budget_confirm:
38
- are_you_sure: Do you agree? Once you have confirmed your vote, you can not change it.
48
+ are_you_sure: Do you agree? Once you have confirmed your vote, you can not
49
+ change it.
39
50
  cancel: Cancel
40
51
  confirm: Confirm
41
52
  description: These are the projects you have chosen to be part of the budget.
42
53
  title: Confirm vote
43
54
  budget_excess:
44
55
  close: Close
45
- description: This project exceeds the maximum budget and can not be added. If you want, you can delete a project you have already selected to add, or make your vote with your preferences.
56
+ description: This project exceeds the maximum budget and can not be added.
57
+ If you want, you can delete a project you have already selected to add,
58
+ or make your vote with your preferences.
46
59
  ok: OK
47
60
  title: Maximum budget exceeded
48
61
  budget_summary:
@@ -50,9 +63,12 @@ en:
50
63
  assigned: 'Assigned:'
51
64
  cancel_order: delete your vote and start over
52
65
  checked_out:
53
- description: You've already voted for the budget. If you've changed your mind, you can %{cancel_link}.
66
+ description: You've already voted for the budget. If you've changed your
67
+ mind, you can %{cancel_link}.
54
68
  title: Budget vote completed
55
- description: "What projects do you think we should allocate budget for? Assign at least %{minimum_budget} to the projects you want and vote with your preferences to define the budget."
69
+ description: What projects do you think we should allocate budget for? Assign
70
+ at least %{minimum_budget} to the projects you want and vote with your
71
+ preferences to define the budget.
56
72
  title: You decide the budget
57
73
  count:
58
74
  projects_count:
@@ -62,8 +78,6 @@ en:
62
78
  category: Category
63
79
  scopes: Scopes
64
80
  search: Search
65
- index:
66
- title: Title
67
81
  order_progress:
68
82
  vote: Vote
69
83
  order_selected_projects:
@@ -80,11 +94,17 @@ en:
80
94
  added: Added
81
95
  show:
82
96
  budget: Budget
83
- project_description: Project description
84
97
  view_all_projects: View all projects
85
98
  features:
86
99
  budgets:
87
100
  name: Budgets
101
+ settings:
102
+ global:
103
+ comments_enabled: Comments enabled
104
+ total_budget: Total budget
105
+ vote_threshold_percent: Vote threshold percent
106
+ step:
107
+ comments_blocked: Comments blocked
88
108
  orders:
89
109
  checkout:
90
110
  error: An error ocurred while processing your vote
@@ -1,7 +1,17 @@
1
1
  es:
2
+ activemodel:
3
+ attributes:
4
+ project:
5
+ budget: Presupuesto
6
+ decidim_category_id: Categoría
7
+ decidim_scope_id: Ámbito
8
+ description: Descripción
9
+ proposal_ids: Propuestas relacionadas
10
+ title: Título
2
11
  decidim:
3
12
  budgets:
4
13
  actions:
14
+ attachments: Archivos adjuntos
5
15
  confirm_destroy: '¿Estás seguro de que deseas eliminar este proyecto?'
6
16
  destroy: Borrar
7
17
  edit: Editar
@@ -15,6 +25,8 @@ es:
15
25
  create:
16
26
  invalid: Ha habido un problema al crear este proyecto
17
27
  success: Proyecto creado con éxito
28
+ destroy:
29
+ success: Proyecto eliminado exitosamente
18
30
  edit:
19
31
  title: Editar proyecto
20
32
  update: Actualizar proyecto
@@ -43,12 +55,13 @@ es:
43
55
  ok: De acuerdo
44
56
  title: Presupuesto excedido
45
57
  budget_summary:
58
+ are_you_sure: '¿Estás seguro de que deseas cancelar tu voto?'
46
59
  assigned: 'Asignado:'
47
60
  cancel_order: eliminar tu voto y empezar de nuevo
48
61
  checked_out:
49
62
  description: Ya has votado para el presupuesto. Si has cambiado de idea, puedes %{cancel_link}.
50
63
  title: Voto enviado correctamente
51
- description: "¿Qué proyectos crees que deberíamos asignar el presupuesto? Asigna por lo menos %{minimum_budget} a los proyectos que desees y vota para definir el presupuesto."
64
+ description: '¿Qué proyectos crees que deberíamos asignar el presupuesto? Asigna por lo menos %{minimum_budget} a los proyectos que desees y vota para definir el presupuesto.'
52
65
  title: Tú decides el presupuesto
53
66
  count:
54
67
  projects_count:
@@ -58,8 +71,6 @@ es:
58
71
  category: Categoría
59
72
  scopes: Ámbitos
60
73
  search: Buscar
61
- index:
62
- title: Título
63
74
  order_progress:
64
75
  vote: Votar
65
76
  order_selected_projects:
@@ -76,9 +87,22 @@ es:
76
87
  added: Añadido
77
88
  show:
78
89
  budget: Presupuesto
79
- project_description: Descripción del proyecto
80
90
  view_all_projects: Ver todos los proyectos
81
91
  features:
82
92
  budgets:
83
93
  name: Presupuestos
94
+ settings:
95
+ global:
96
+ comments_enabled: Comentarios habilitados
97
+ total_budget: Presupuesto total
98
+ vote_threshold_percent: Porcentaje mínimo del presupuesto
99
+ step:
100
+ comments_blocked: Comentarios bloqueados
101
+ orders:
102
+ checkout:
103
+ error: Se ha producido un error al procesar tu voto
104
+ success: Tu voto se ha tramitado con éxito
105
+ destroy:
106
+ error: Ha habido un error al cancelar tu voto
107
+ success: Tu voto ha sido cancelado correctamente
84
108
  total_budget: Presupuesto total
@@ -0,0 +1,5 @@
1
+ eu:
2
+ activemodel:
3
+ attributes:
4
+ project:
5
+ budget: Aurrekontua
@@ -0,0 +1,5 @@
1
+ class RemoveShortDescriptionFromDecidimProjects < ActiveRecord::Migration[5.0]
2
+ def change
3
+ remove_column :decidim_budgets_projects, :short_description
4
+ end
5
+ end
@@ -10,7 +10,10 @@ module Decidim
10
10
  paths["db/migrate"] = nil
11
11
 
12
12
  routes do
13
- resources :projects
13
+ resources :projects do
14
+ resources :attachments
15
+ end
16
+
14
17
  root to: "projects#index"
15
18
  end
16
19
 
@@ -8,6 +8,8 @@ Decidim.register_feature(:budgets) do |feature|
8
8
  feature.icon = "decidim/budgets/icon.svg"
9
9
  feature.stylesheet = "decidim/budgets/budgets"
10
10
 
11
+ feature.actions = %(vote)
12
+
11
13
  feature.on(:before_destroy) do |instance|
12
14
  raise StandardError, "Can't remove this feature" if Decidim::Budgets::Project.where(feature: instance).any?
13
15
  end
@@ -20,11 +22,11 @@ Decidim.register_feature(:budgets) do |feature|
20
22
  feature.settings(:global) do |settings|
21
23
  settings.attribute :total_budget, type: :integer, default: 100_000_000
22
24
  settings.attribute :vote_threshold_percent, type: :integer, default: 70
23
- settings.attribute :comments_always_enabled, type: :boolean, default: true
25
+ settings.attribute :comments_enabled, type: :boolean, default: true
24
26
  end
25
27
 
26
28
  feature.settings(:step) do |settings|
27
- settings.attribute :comments_enabled, type: :boolean, default: true
29
+ settings.attribute :comments_blocked, type: :boolean, default: false
28
30
  end
29
31
 
30
32
  feature.seeds do
@@ -34,6 +36,7 @@ Decidim.register_feature(:budgets) do |feature|
34
36
  feature = Decidim::Feature.create!(
35
37
  name: Decidim::Features::Namer.new(process.organization.available_locales, :budgets).i18n_name,
36
38
  manifest_name: :budgets,
39
+ published_at: Time.current,
37
40
  participatory_process: process
38
41
  )
39
42
 
@@ -46,12 +49,20 @@ Decidim.register_feature(:budgets) do |feature|
46
49
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
47
50
  Decidim::Faker::Localized.paragraph(3)
48
51
  end,
49
- short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
50
- Decidim::Faker::Localized.paragraph(3)
51
- end,
52
52
  budget: Faker::Number.number(8)
53
53
  )
54
-
54
+ Decidim::Attachment.create!(
55
+ title: Decidim::Faker::Localized.sentence(2),
56
+ description: Decidim::Faker::Localized.sentence(5),
57
+ file: File.new(Decidim::Dev.asset("city.jpeg")),
58
+ attached_to: project
59
+ )
60
+ Decidim::Attachment.create!(
61
+ title: Decidim::Faker::Localized.sentence(2),
62
+ description: Decidim::Faker::Localized.sentence(5),
63
+ file: File.new(Decidim::Dev.asset("Exampledocument.pdf")),
64
+ attached_to: project
65
+ )
55
66
  Decidim::Comments::Seed.comments_for(project)
56
67
  end
57
68
  end
@@ -3,7 +3,7 @@ require "decidim/faker/localized"
3
3
  require "decidim/dev"
4
4
 
5
5
  FactoryGirl.define do
6
- factory :budget_feature, class: Decidim::Feature do
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
9
  participatory_process
@@ -26,9 +26,8 @@ FactoryGirl.define do
26
26
  factory :project, class: Decidim::Budgets::Project do
27
27
  title { Decidim::Faker::Localized.sentence(3) }
28
28
  description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(4) } }
29
- short_description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(4) } }
30
29
  budget { Faker::Number.number(8) }
31
- feature { create(:budget_feature) }
30
+ feature { create(:budget_feature) }
32
31
  end
33
32
 
34
33
  factory :order, class: Decidim::Budgets::Order 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.3
4
+ version: 0.0.5
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-02 00:00:00.000000000 Z
13
+ date: 2017-02-17 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.3
21
+ version: 0.0.5
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.3
28
+ version: 0.0.5
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.3
35
+ version: 0.0.5
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.3
42
+ version: 0.0.5
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rectify
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -88,28 +88,42 @@ dependencies:
88
88
  requirements:
89
89
  - - '='
90
90
  - !ruby/object:Gem::Version
91
- version: 0.0.3
91
+ version: 0.0.5
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.3
98
+ version: 0.0.5
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.3
105
+ version: 0.0.5
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.3
112
+ version: 0.0.5
113
+ - !ruby/object:Gem::Dependency
114
+ name: decidim-admin
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - '='
118
+ - !ruby/object:Gem::Version
119
+ version: 0.0.5
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - '='
125
+ - !ruby/object:Gem::Version
126
+ version: 0.0.5
113
127
  description: ''
114
128
  email:
115
129
  - josepjaume@gmail.com
@@ -123,6 +137,7 @@ files:
123
137
  - Rakefile
124
138
  - app/assets/config/decidim_budgets_manifest.js
125
139
  - app/assets/images/decidim/budgets/icon.svg
140
+ - app/assets/javascripts/decidim/budgets/progressFixed.js.es6
126
141
  - app/assets/javascripts/decidim/budgets/projects.js.es6
127
142
  - app/assets/stylesheets/decidim/budgets/_budgets.scss
128
143
  - app/assets/stylesheets/decidim/budgets/budget/_budget-list.scss
@@ -136,6 +151,7 @@ files:
136
151
  - app/commands/decidim/budgets/remove_line_item.rb
137
152
  - app/controllers/concerns/decidim/budgets/needs_current_order.rb
138
153
  - app/controllers/decidim/budgets/admin/application_controller.rb
154
+ - app/controllers/decidim/budgets/admin/attachments_controller.rb
139
155
  - app/controllers/decidim/budgets/admin/projects_controller.rb
140
156
  - app/controllers/decidim/budgets/application_controller.rb
141
157
  - app/controllers/decidim/budgets/line_items_controller.rb
@@ -174,9 +190,11 @@ files:
174
190
  - config/locales/ca.yml
175
191
  - config/locales/en.yml
176
192
  - config/locales/es.yml
193
+ - config/locales/eu.yml
177
194
  - db/migrate/20170127114122_create_projects.rb
178
195
  - db/migrate/20170130095615_create_orders.rb
179
196
  - db/migrate/20170130101825_create_line_items.rb
197
+ - db/migrate/20170207101750_remove_short_description_from_decidim_projects.rb
180
198
  - lib/decidim/budgets.rb
181
199
  - lib/decidim/budgets/admin.rb
182
200
  - lib/decidim/budgets/admin_engine.rb