decidim-budgets 0.20.1 → 0.23.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +38 -3
- data/app/assets/images/decidim/budgets/icon.svg +1 -11
- data/app/assets/javascripts/decidim/budgets/projects.js.es6 +26 -4
- data/app/assets/stylesheets/decidim/budgets/budget/_budget-list.scss +152 -24
- data/app/cells/decidim/budgets/base_cell.rb +22 -0
- data/app/cells/decidim/budgets/budget_cell.rb +21 -0
- data/app/cells/decidim/budgets/budget_information_modal/show.erb +28 -0
- data/app/cells/decidim/budgets/budget_information_modal_cell.rb +22 -0
- data/app/cells/decidim/budgets/budget_list_item/show.erb +22 -0
- data/app/cells/decidim/budgets/budget_list_item_cell.rb +40 -0
- data/app/cells/decidim/budgets/budget_m/data.erb +12 -0
- data/app/cells/decidim/budgets/budget_m/footer.erb +5 -0
- data/app/cells/decidim/budgets/budget_m_cell.rb +16 -0
- data/app/cells/decidim/budgets/budgets_header/show.erb +7 -0
- data/app/cells/decidim/budgets/budgets_header_cell.rb +14 -0
- data/app/cells/decidim/budgets/budgets_list/card_list.erb +7 -0
- data/app/cells/decidim/budgets/budgets_list/highlighted.erb +11 -0
- data/app/cells/decidim/budgets/budgets_list/show.erb +20 -0
- data/app/cells/decidim/budgets/budgets_list/voted.erb +43 -0
- data/app/cells/decidim/budgets/budgets_list_cell.rb +39 -0
- data/app/cells/decidim/budgets/limit_announcement_cell.rb +52 -0
- data/app/cells/decidim/budgets/project_list_item/project_data.erb +19 -0
- data/app/cells/decidim/budgets/project_list_item/project_data_vote_button.erb +15 -0
- data/app/cells/decidim/budgets/project_list_item/project_image.erb +5 -0
- data/app/cells/decidim/budgets/project_list_item/project_text.erb +23 -0
- data/app/cells/decidim/budgets/project_list_item/show.erb +5 -0
- data/app/cells/decidim/budgets/project_list_item_cell.rb +66 -0
- data/app/cells/decidim/budgets/project_m/data.erb +3 -3
- data/app/cells/decidim/budgets/project_m/footer.erb +1 -1
- data/app/cells/decidim/budgets/project_m_cell.rb +4 -0
- data/app/cells/decidim/budgets/project_selected_status_cell.rb +28 -0
- data/app/cells/decidim/budgets/project_tags/show.erb +5 -0
- data/app/cells/decidim/budgets/project_tags_cell.rb +18 -0
- data/app/cells/decidim/budgets/project_voted_hint_cell.rb +33 -0
- data/app/cells/decidim/budgets/project_votes_count_cell.rb +44 -0
- data/app/commands/decidim/budgets/add_line_item.rb +7 -10
- data/app/commands/decidim/budgets/admin/create_budget.rb +48 -0
- data/app/commands/decidim/budgets/admin/create_project.rb +26 -11
- data/app/commands/decidim/budgets/admin/destroy_budget.rb +42 -0
- data/app/commands/decidim/budgets/admin/import_proposals_to_budgets.rb +26 -25
- data/app/commands/decidim/budgets/admin/update_budget.rb +48 -0
- data/app/commands/decidim/budgets/admin/update_project.rb +20 -2
- data/app/commands/decidim/budgets/checkout.rb +7 -6
- data/app/commands/decidim/budgets/remove_line_item.rb +3 -2
- data/app/controllers/concerns/decidim/budgets/needs_current_order.rb +18 -2
- data/app/controllers/concerns/decidim/budgets/orderable.rb +57 -0
- data/app/controllers/decidim/budgets/admin/application_controller.rb +10 -2
- data/app/controllers/decidim/budgets/admin/attachment_collections_controller.rb +1 -1
- data/app/controllers/decidim/budgets/admin/attachments_controller.rb +2 -2
- data/app/controllers/decidim/budgets/admin/budgets_controller.rb +82 -0
- data/app/controllers/decidim/budgets/admin/projects_controller.rb +15 -12
- data/app/controllers/decidim/budgets/admin/proposals_imports_controller.rb +10 -2
- data/app/controllers/decidim/budgets/application_controller.rb +23 -0
- data/app/controllers/decidim/budgets/budgets_controller.rb +24 -0
- data/app/controllers/decidim/budgets/line_items_controller.rb +10 -6
- data/app/controllers/decidim/budgets/orders_controller.rb +20 -6
- data/app/controllers/decidim/budgets/projects_controller.rb +28 -7
- data/app/forms/decidim/budgets/admin/budget_form.rb +39 -0
- data/app/forms/decidim/budgets/admin/component_form.rb +44 -0
- data/app/forms/decidim/budgets/admin/project_form.rb +25 -9
- data/app/forms/decidim/budgets/admin/project_import_proposals_form.rb +4 -0
- data/app/helpers/decidim/budgets/admin/application_helper.rb +13 -0
- data/app/helpers/decidim/budgets/application_helper.rb +11 -0
- data/app/helpers/decidim/budgets/projects_helper.rb +13 -0
- data/app/jobs/decidim/budgets/send_order_summary_job.rb +15 -0
- data/app/mailers/decidim/budgets/order_summary_mailer.rb +36 -0
- data/app/models/decidim/budgets/budget.rb +34 -0
- data/app/models/decidim/budgets/line_item.rb +4 -4
- data/app/models/decidim/budgets/order.rb +46 -16
- data/app/models/decidim/budgets/project.rb +37 -4
- data/app/permissions/decidim/budgets/admin/permissions.rb +23 -10
- data/app/permissions/decidim/budgets/permissions.rb +28 -6
- data/app/presenters/decidim/budgets/admin_log/budget_presenter.rb +42 -0
- data/app/queries/decidim/budgets/filtered_projects.rb +9 -1
- data/app/queries/decidim/budgets/metrics/budget_followers_metric_measure.rb +3 -2
- data/app/queries/decidim/budgets/metrics/budget_participants_metric_measure.rb +6 -5
- data/app/serializers/decidim/budgets/data_portability_budgets_order_serializer.rb +3 -2
- data/app/services/decidim/budgets/project_search.rb +13 -17
- data/app/types/decidim/budgets/budget_type.rb +24 -0
- data/app/types/decidim/budgets/budgets_type.rb +32 -0
- data/app/types/decidim/budgets/project_type.rb +26 -0
- data/app/views/decidim/budgets/admin/budgets/_form.html.erb +23 -0
- data/app/views/decidim/budgets/admin/budgets/edit.html.erb +7 -0
- data/app/views/decidim/budgets/admin/budgets/index.html.erb +58 -0
- data/app/views/decidim/budgets/admin/budgets/new.html.erb +7 -0
- data/app/views/decidim/budgets/admin/projects/_form.html.erb +15 -10
- data/app/views/decidim/budgets/admin/projects/edit.html.erb +2 -2
- data/app/views/decidim/budgets/admin/projects/index.html.erb +20 -7
- data/app/views/decidim/budgets/admin/projects/new.html.erb +2 -2
- data/app/views/decidim/budgets/admin/projects/proposals_picker.html.erb +1 -0
- data/app/views/decidim/budgets/admin/proposals_imports/new.html.erb +1 -1
- data/app/views/decidim/budgets/budgets/index.html.erb +5 -0
- data/app/views/decidim/budgets/order_summary_mailer/order_summary.html.erb +22 -0
- data/app/views/decidim/budgets/projects/_budget_confirm.html.erb +3 -3
- data/app/views/decidim/budgets/projects/_budget_summary.html.erb +26 -7
- data/app/views/decidim/budgets/projects/_filters.html.erb +15 -7
- data/app/views/decidim/budgets/projects/_linked_projects.html.erb +2 -2
- data/app/views/decidim/budgets/projects/_order_progress.html.erb +14 -18
- data/app/views/decidim/budgets/projects/_order_selected_projects.html.erb +3 -3
- data/app/views/decidim/budgets/projects/_project.html.erb +1 -57
- data/app/views/decidim/budgets/projects/_project_budget_button.html.erb +36 -7
- data/app/views/decidim/budgets/projects/_projects.html.erb +8 -1
- data/app/views/decidim/budgets/projects/index.html.erb +15 -7
- data/app/views/decidim/budgets/projects/index.js.erb +8 -0
- data/app/views/decidim/budgets/projects/show.html.erb +18 -11
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +3 -17
- data/config/locales/bg-BG.yml +7 -0
- data/config/locales/bg.yml +6 -0
- data/config/locales/ca.yml +126 -12
- data/config/locales/cs.yml +145 -31
- data/config/locales/da-DK.yml +1 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +115 -12
- data/config/locales/el.yml +169 -0
- data/config/locales/en.yml +126 -12
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +126 -12
- data/config/locales/es-PY.yml +126 -12
- data/config/locales/es.yml +126 -12
- data/config/locales/et-EE.yml +1 -0
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +4 -14
- data/config/locales/fi-plain.yml +127 -13
- data/config/locales/fi.yml +137 -23
- data/config/locales/fr-CA.yml +266 -0
- data/config/locales/fr.yml +125 -12
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +3 -13
- data/config/locales/hr-HR.yml +1 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +19 -13
- data/config/locales/id-ID.yml +3 -12
- data/config/locales/is-IS.yml +1 -12
- data/config/locales/is.yml +114 -0
- data/config/locales/it.yml +97 -13
- data/config/locales/ja-JP.yml +172 -0
- data/config/locales/ja.yml +262 -0
- data/config/locales/ko-KR.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt-LT.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +164 -0
- data/config/locales/mt-MT.yml +1 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +113 -13
- data/config/locales/no.yml +39 -13
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +175 -62
- data/config/locales/pt-BR.yml +4 -14
- data/config/locales/pt.yml +63 -47
- data/config/locales/ro-RO.yml +172 -0
- data/config/locales/ru.yml +3 -15
- data/config/locales/sk-SK.yml +180 -0
- data/config/locales/sk.yml +166 -0
- data/config/locales/sl.yml +1 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +27 -0
- data/config/locales/sv.yml +126 -12
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +3 -13
- data/config/locales/uk.yml +3 -15
- data/config/locales/vi-VN.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +260 -0
- data/config/locales/zh-TW.yml +1 -0
- data/db/migrate/20200617105120_create_decidim_budgets.rb +15 -0
- data/db/migrate/20200629072626_rename_budget_to_budget_ammount.rb +7 -0
- data/db/migrate/20200629134013_add_budget_reference_to_project.rb +7 -0
- data/db/migrate/20200706142609_add_budget_reference_to_order.rb +7 -0
- data/db/migrate/20200714103519_move_budgets_to_own_model.rb +109 -0
- data/db/migrate/20200717140012_add_scope_to_budgets.rb +7 -0
- data/db/migrate/20200728075039_add_selected_at_to_project.rb +7 -0
- data/db/migrate/20200804175222_votes_enabled_to_votes_choices.rb +35 -0
- data/db/migrate/20200827154129_add_commentable_counter_cache_to_projects.rb +9 -0
- data/lib/decidim/budgets.rb +1 -0
- data/lib/decidim/budgets/admin_engine.rb +12 -5
- data/lib/decidim/budgets/component.rb +94 -38
- data/lib/decidim/budgets/engine.rb +8 -6
- data/lib/decidim/budgets/seeds/city.jpeg +0 -0
- data/lib/decidim/budgets/test/factories.rb +71 -9
- data/lib/decidim/budgets/version.rb +1 -1
- data/lib/decidim/budgets/workflows.rb +17 -0
- data/lib/decidim/budgets/workflows/all.rb +20 -0
- data/lib/decidim/budgets/workflows/base.rb +132 -0
- data/lib/decidim/budgets/workflows/one.rb +33 -0
- metadata +121 -16
@@ -11,9 +11,10 @@ module Decidim
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def calculate
|
14
|
-
budgets = Decidim::Budgets::
|
14
|
+
budgets = Decidim::Budgets::Budget.where(component: @resource)
|
15
|
+
projects = Decidim::Budgets::Project.where(budget: budgets)
|
15
16
|
|
16
|
-
budgets_followers = Decidim::Follow.where(followable:
|
17
|
+
budgets_followers = Decidim::Follow.where(followable: projects).joins(:user)
|
17
18
|
.where("decidim_follows.created_at <= ?", end_time)
|
18
19
|
cumulative_users = budgets_followers.pluck(:decidim_user_id)
|
19
20
|
|
@@ -11,13 +11,14 @@ module Decidim
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def calculate
|
14
|
-
budgets = Decidim::Budgets::
|
15
|
-
|
16
|
-
|
14
|
+
budgets = Decidim::Budgets::Budget.where(component: @resource)
|
15
|
+
orders = Decidim::Budgets::Order.where(budget: budgets)
|
16
|
+
.finished
|
17
|
+
.where("decidim_budgets_orders.checked_out_at <= ?", end_time)
|
17
18
|
|
18
19
|
{
|
19
|
-
cumulative_users:
|
20
|
-
quantity_users:
|
20
|
+
cumulative_users: orders.pluck(:decidim_user_id),
|
21
|
+
quantity_users: orders.where("decidim_budgets_orders.checked_out_at >= ?", start_time).pluck(:decidim_user_id)
|
21
22
|
}
|
22
23
|
end
|
23
24
|
end
|
@@ -12,7 +12,8 @@ module Decidim
|
|
12
12
|
def serialize
|
13
13
|
{
|
14
14
|
id: order.id,
|
15
|
-
|
15
|
+
budget: order.budget.title,
|
16
|
+
component: order.budget.component.name,
|
16
17
|
checked_out_at: order.checked_out_at,
|
17
18
|
projects: all_projects,
|
18
19
|
created_at: order.created_at,
|
@@ -30,7 +31,7 @@ module Decidim
|
|
30
31
|
id: project.id,
|
31
32
|
title: project.title,
|
32
33
|
description: project.description,
|
33
|
-
|
34
|
+
budget_amount: project.budget_amount,
|
34
35
|
scope: project.try(:scope).try(:name),
|
35
36
|
reference: project.reference,
|
36
37
|
created_at: project.created_at,
|
@@ -6,37 +6,33 @@ module Decidim
|
|
6
6
|
# `current_component` param with a `Decidim::Component` in order to
|
7
7
|
# find the projects.
|
8
8
|
class ProjectSearch < ResourceSearch
|
9
|
+
text_search_fields :title, :description
|
10
|
+
|
9
11
|
# Public: Initializes the service.
|
10
12
|
# component - A Decidim::Component to get the projects from.
|
11
13
|
def initialize(options = {})
|
12
14
|
super(Project.all, options)
|
13
15
|
end
|
14
16
|
|
15
|
-
#
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
# Creates the SearchLight base query.
|
18
|
+
def base_query
|
19
|
+
raise "Missing budget" unless budget
|
20
|
+
raise "Missing component" unless component
|
21
|
+
|
22
|
+
@scope.where(budget: budget)
|
20
23
|
end
|
21
24
|
|
22
25
|
# Returns the random projects for the current page.
|
23
26
|
def results
|
24
|
-
Project.where(id: super.pluck(:id))
|
27
|
+
Project.where(id: super.pluck(:id)).includes([:scope, :component, :attachments, :category])
|
25
28
|
end
|
26
29
|
|
27
30
|
private
|
28
31
|
|
29
|
-
#
|
30
|
-
#
|
31
|
-
|
32
|
-
|
33
|
-
# Resource.where(localized_search_text_for(:title, text: "my_query"))
|
34
|
-
#
|
35
|
-
# The Hash with the `:text` key is required or it won't work.
|
36
|
-
def localized_search_text_in(field)
|
37
|
-
options[:organization].available_locales.map do |l|
|
38
|
-
"#{field} ->> '#{l}' ILIKE :text"
|
39
|
-
end.join(" OR ")
|
32
|
+
# Private: Since budget is not used by a search method we need
|
33
|
+
# to define the method manually.
|
34
|
+
def budget
|
35
|
+
options[:budget]
|
40
36
|
end
|
41
37
|
end
|
42
38
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Budgets
|
5
|
+
BudgetType = GraphQL::ObjectType.define do
|
6
|
+
interfaces [
|
7
|
+
-> { Decidim::Core::ScopableInterface },
|
8
|
+
-> { Decidim::Core::TraceableInterface }
|
9
|
+
]
|
10
|
+
|
11
|
+
name "Budget"
|
12
|
+
description "A budget"
|
13
|
+
|
14
|
+
field :id, !types.ID, "The internal ID of this budget"
|
15
|
+
field :title, !Decidim::Core::TranslatedFieldType, "The title for this budget"
|
16
|
+
field :description, !Decidim::Core::TranslatedFieldType, "The description for this budget"
|
17
|
+
field :total_budget, !types.Int, "The total budget"
|
18
|
+
field :createdAt, Decidim::Core::DateTimeType, "When this budget was created", property: :created_at
|
19
|
+
field :updatedAt, Decidim::Core::DateTimeType, "When this budget was updated", property: :updated_at
|
20
|
+
|
21
|
+
field :projects, !types[Decidim::Budgets::ProjectType], "The projects for this budget"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Budgets
|
5
|
+
BudgetsType = GraphQL::ObjectType.define do
|
6
|
+
interfaces [-> { Decidim::Core::ComponentInterface }]
|
7
|
+
|
8
|
+
name "Budgets"
|
9
|
+
description "A budget component of a participatory space."
|
10
|
+
|
11
|
+
connection :budgets, BudgetType.connection_type do
|
12
|
+
resolve ->(component, _args, _ctx) {
|
13
|
+
BudgetsTypeHelper.base_scope(component).includes(:component)
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
field(:budget, BudgetType) do
|
18
|
+
argument :id, !types.ID
|
19
|
+
|
20
|
+
resolve ->(component, args, _ctx) {
|
21
|
+
BudgetsTypeHelper.base_scope(component).find_by(id: args[:id])
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module BudgetsTypeHelper
|
27
|
+
def self.base_scope(component)
|
28
|
+
Budget.where(component: component)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Budgets
|
5
|
+
ProjectType = GraphQL::ObjectType.define do
|
6
|
+
interfaces [
|
7
|
+
-> { Decidim::Core::ScopableInterface },
|
8
|
+
-> { Decidim::Core::AttachableInterface },
|
9
|
+
-> { Decidim::Comments::CommentableInterface },
|
10
|
+
-> { Decidim::Core::CategorizableInterface }
|
11
|
+
]
|
12
|
+
|
13
|
+
name "Project"
|
14
|
+
description "A project"
|
15
|
+
|
16
|
+
field :id, !types.ID, "The internal ID for this project"
|
17
|
+
field :title, Decidim::Core::TranslatedFieldType, "The title for this project"
|
18
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description for this project"
|
19
|
+
field :budget_amount, types.Int, "The budget amount for this project"
|
20
|
+
field :selected, types.Boolean, "Whether this proposal is selected or not", property: :selected?
|
21
|
+
field :createdAt, Decidim::Core::DateTimeType, "When this project was created", property: :created_at
|
22
|
+
field :updatedAt, Decidim::Core::DateTimeType, "When this project was updated", property: :updated_at
|
23
|
+
field :reference, types.String, "The reference for this project"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<div class="card">
|
2
|
+
<div class="card-divider">
|
3
|
+
<h2 class="card-title"><%= title %></h2>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<div class="card-section">
|
7
|
+
<div class="row column">
|
8
|
+
<%= form.translated :text_field, :title, autofocus: true %>
|
9
|
+
|
10
|
+
<%= form.number_field :weight %>
|
11
|
+
|
12
|
+
<%= form.translated :editor, :description %>
|
13
|
+
|
14
|
+
<%= form.number_field :total_budget %>
|
15
|
+
|
16
|
+
<% if current_component.has_subscopes? %>
|
17
|
+
<div class="row column">
|
18
|
+
<%= scopes_picker_field form, :decidim_scope_id, root: current_component.scope %>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
</div>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<div class="card">
|
2
|
+
<div class="card-divider">
|
3
|
+
<h2 class="card-title">
|
4
|
+
<%= t(".title") %>
|
5
|
+
|
6
|
+
<%= link_to t("actions.new", scope: "decidim.budgets", name: t("models.budget.name", scope: "decidim.budgets.admin")), new_budget_path, class: "button tiny button--title" if allowed_to? :create, :budget %>
|
7
|
+
</h2>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="card-section">
|
11
|
+
<div class="table-scroll">
|
12
|
+
<table class="table-list">
|
13
|
+
<thead>
|
14
|
+
<tr>
|
15
|
+
<th><%= t("models.budget.fields.name", scope: "decidim.budgets") %></th>
|
16
|
+
<th><%= t("models.budget.fields.total_budget", scope: "decidim.budgets") %></th>
|
17
|
+
<th><%= t("models.budget.fields.projects_count", scope: "decidim.budgets") %></th>
|
18
|
+
<%= th_resource_scope_label %>
|
19
|
+
<th class="actions"><%= t("actions.title", scope: "decidim.budgets") %></th>
|
20
|
+
</tr>
|
21
|
+
</thead>
|
22
|
+
<tbody>
|
23
|
+
<% budgets.each do |budget| %>
|
24
|
+
<tr data-id="<%= budget.id %>">
|
25
|
+
<td>
|
26
|
+
<%= link_to translated_attribute(budget.title), resource_locator(budget).path %>
|
27
|
+
</td>
|
28
|
+
<td>
|
29
|
+
<%= number_to_currency budget.total_budget, unit: Decidim.currency_unit, precision: 0 %>
|
30
|
+
</td>
|
31
|
+
<td>
|
32
|
+
<%= link_to budget.projects.count, budget_projects_path(budget) %>
|
33
|
+
</td>
|
34
|
+
<%= td_resource_scope_for(budget.scope) %>
|
35
|
+
<td class="table-list__actions">
|
36
|
+
<%= icon_link_to "eye", resource_locator(budget).path, t("actions.preview", scope: "decidim.budgets"), class: "action-icon--preview", target: :blank %>
|
37
|
+
|
38
|
+
<%= icon_link_to "list", budget_projects_path(budget), t("actions.edit_projects", scope: "decidim.budgets"), class: "action-icon--edit-projects" %>
|
39
|
+
|
40
|
+
<% if allowed_to? :update, :budget, budget: budget %>
|
41
|
+
<%= icon_link_to "pencil", edit_budget_path(budget), t("actions.edit", scope: "decidim.budgets"), class: "action-icon--edit" %>
|
42
|
+
<% else %>
|
43
|
+
<%= icon "pencil", class: "action-icon action-icon--disabled", role: "img" %>
|
44
|
+
<% end %>
|
45
|
+
|
46
|
+
<% if allowed_to? :delete, :budget, budget: budget %>
|
47
|
+
<%= icon_link_to "circle-x", budget_path(budget), t("actions.destroy", scope: "decidim.budgets"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.budgets") } %>
|
48
|
+
<% else %>
|
49
|
+
<%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %>
|
50
|
+
<% end %>
|
51
|
+
</td>
|
52
|
+
</tr>
|
53
|
+
<% end %>
|
54
|
+
</tbody>
|
55
|
+
</table>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
</div>
|
@@ -1,6 +1,8 @@
|
|
1
1
|
<div class="card">
|
2
2
|
<div class="card-divider">
|
3
|
-
<h2 class="card-title"
|
3
|
+
<h2 class="card-title">
|
4
|
+
<%= title.html_safe %>
|
5
|
+
</h2>
|
4
6
|
</div>
|
5
7
|
|
6
8
|
<div class="card-section">
|
@@ -13,12 +15,12 @@
|
|
13
15
|
</div>
|
14
16
|
|
15
17
|
<div class="row column">
|
16
|
-
<%= form.number_field :
|
18
|
+
<%= form.number_field :budget_amount %>
|
17
19
|
</div>
|
18
20
|
|
19
|
-
<% if
|
21
|
+
<% if current_component.has_subscopes? %>
|
20
22
|
<div class="row column">
|
21
|
-
<%= scopes_picker_field form, :decidim_scope_id %>
|
23
|
+
<%= scopes_picker_field form, :decidim_scope_id, root: budget.scope %>
|
22
24
|
</div>
|
23
25
|
<% end %>
|
24
26
|
|
@@ -27,12 +29,15 @@
|
|
27
29
|
</div>
|
28
30
|
|
29
31
|
<div class="row column">
|
30
|
-
|
31
|
-
<%= form.select :proposal_ids,
|
32
|
-
@form.proposals,
|
33
|
-
{},
|
34
|
-
{ multiple: true, class: "chosen-select" } %>
|
35
|
-
<% end %>
|
32
|
+
<%= proposals_picker(form, :proposals, proposals_picker_projects_path) %>
|
36
33
|
</div>
|
34
|
+
|
35
|
+
<%= render partial: "decidim/admin/shared/gallery", locals: { form: form } %>
|
36
|
+
|
37
|
+
<% if form.object.persisted? %>
|
38
|
+
<div class="row column">
|
39
|
+
<%= form.check_box :selected %>
|
40
|
+
</div>
|
41
|
+
<% end %>
|
37
42
|
</div>
|
38
43
|
</div>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<%= decidim_form_for(@form, html: { class: "form edit_project" }) do |f| %>
|
2
|
-
<%= render partial: "form", object: f, locals: { title: t(".title") } %>
|
1
|
+
<%= decidim_form_for([budget, @form], html: { class: "form edit_project" }) do |f| %>
|
2
|
+
<%= render partial: "form", object: f, locals: { title: "#{translated_attribute(budget.title)} > #{t(".title")}" } %>
|
3
3
|
|
4
4
|
<div class="button--double form-general-submit">
|
5
5
|
<%= f.submit t(".update") %>
|
@@ -1,9 +1,10 @@
|
|
1
1
|
<div class="card">
|
2
2
|
<div class="card-divider">
|
3
3
|
<h2 class="card-title">
|
4
|
+
<%= link_to translated_attribute(budget.title), budgets_path %> >
|
4
5
|
<%= t(".title") %>
|
5
|
-
<%= link_to t("actions.new", scope: "decidim.budgets"),
|
6
|
-
<%= link_to t("actions.import", scope: "decidim.budgets", name: t("models.project.name", scope: "decidim.budgets.admin")),
|
6
|
+
<%= link_to t("actions.new", scope: "decidim.budgets", name: t("models.project.name", scope: "decidim.budgets.admin")), new_budget_project_path, class: "button tiny button--title new" if allowed_to? :create, :project %>
|
7
|
+
<%= link_to t("actions.import", scope: "decidim.budgets", name: t("models.project.name", scope: "decidim.budgets.admin")), new_budget_proposals_import_path(budget), class: "button tiny button--title" if allowed_to? :import_proposals, :project %>
|
7
8
|
</h2>
|
8
9
|
</div>
|
9
10
|
|
@@ -13,7 +14,9 @@
|
|
13
14
|
<thead>
|
14
15
|
<tr>
|
15
16
|
<th><%= t("models.project.fields.title", scope: "decidim.budgets") %></th>
|
16
|
-
<th
|
17
|
+
<th><%= t("index.confirmed_orders_count") %></th>
|
18
|
+
<th><%= t(".selected") %></th>
|
19
|
+
<%= th_resource_scope_label %>
|
17
20
|
<th class="actions"><%= t("actions.title", scope: "decidim.budgets") %></th>
|
18
21
|
</tr>
|
19
22
|
</thead>
|
@@ -23,14 +26,22 @@
|
|
23
26
|
<td>
|
24
27
|
<%= translated_attribute(project.title) %><br>
|
25
28
|
</td>
|
26
|
-
<td
|
29
|
+
<td>
|
27
30
|
<%= project.confirmed_orders_count %>
|
28
31
|
</td>
|
32
|
+
<td>
|
33
|
+
<% if project.selected? %>
|
34
|
+
<%= content_tag :strong, t(".selected"), class: "text-success" %>
|
35
|
+
<% else %>
|
36
|
+
<%= content_tag :span, "×", class: "text-muted" %>
|
37
|
+
<% end %>
|
38
|
+
</td>
|
39
|
+
<%= td_resource_scope_for(project.scope) %>
|
29
40
|
<td class="table-list__actions">
|
30
|
-
<%= icon_link_to "eye", resource_locator(project).path, t("actions.preview", scope: "decidim.budgets"), target: :blank, class: "action-icon--preview" %>
|
41
|
+
<%= icon_link_to "eye", resource_locator([budget, project]).path, t("actions.preview", scope: "decidim.budgets"), target: :blank, class: "action-icon--preview" %>
|
31
42
|
|
32
43
|
<% if allowed_to? :update, :project, project: project %>
|
33
|
-
<%= icon_link_to "pencil",
|
44
|
+
<%= icon_link_to "pencil", resource_locator([budget, project]).edit, t("actions.edit", scope: "decidim.budgets"), class: "action-icon--edit" %>
|
34
45
|
<% end %>
|
35
46
|
|
36
47
|
<% if allowed_to? :update, :project, project: project %>
|
@@ -44,7 +55,9 @@
|
|
44
55
|
<%= resource_permissions_link(project) %>
|
45
56
|
|
46
57
|
<% if allowed_to? :destroy, :project, project: project %>
|
47
|
-
<%= icon_link_to "circle-x",
|
58
|
+
<%= icon_link_to "circle-x", resource_locator([budget, project]).show, t("actions.destroy", scope: "decidim.budgets"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.budgets") } %>
|
59
|
+
<% else %>
|
60
|
+
<%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %>
|
48
61
|
<% end %>
|
49
62
|
</td>
|
50
63
|
</tr>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<%= decidim_form_for(@form, html: { class: "form new_project" }) do |f| %>
|
2
|
-
<%= render partial: "form", object: f, locals: { title: t(".title") } %>
|
1
|
+
<%= decidim_form_for([budget, @form], html: { class: "form new_project" }) do |f| %>
|
2
|
+
<%= render partial: "form", object: f, locals: { title: "#{translated_attribute(budget.title)} > #{t(".title")}" } %>
|
3
3
|
|
4
4
|
<div class="button--double form-general-submit">
|
5
5
|
<%= f.submit t(".create") %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= cell "decidim/proposals/proposals_picker", current_component %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= decidim_form_for(@form, url:
|
1
|
+
<%= decidim_form_for(@form, url: budget_proposals_import_path(budget), html: { class: "form import_proposals" }) do |f| %>
|
2
2
|
<% if @form.origin_components.any? %>
|
3
3
|
<div class="card">
|
4
4
|
<div class="card-divider">
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<% if @component.try(:scopes_enabled) %>
|
2
|
+
<%= t(
|
3
|
+
".voted_on_space_with_scope",
|
4
|
+
space_name: translated_attribute(@space.title),
|
5
|
+
scope_name: translated_attribute(@component.scope.name),
|
6
|
+
scope_type: translated_attribute(@component.scope.scope_type.name)
|
7
|
+
) %>
|
8
|
+
<% else %>
|
9
|
+
<%= t(
|
10
|
+
".voted_on_space",
|
11
|
+
budget_name: translated_attribute(@budget.title),
|
12
|
+
space_name: translated_attribute(@space.title)
|
13
|
+
) %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<p><%= t(".selected_projects") %></p>
|
17
|
+
|
18
|
+
<ul>
|
19
|
+
<% @order.projects.each do |project| %>
|
20
|
+
<li><%= translated_attribute(project.title) %></li>
|
21
|
+
<% end %>
|
22
|
+
</ul>
|