decidim-budgets 0.27.9 → 0.28.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/stylesheets/decidim/budgets/budget/_budget-vote-button.scss +5 -5
- data/app/cells/decidim/budgets/base_cell.rb +1 -1
- data/app/cells/decidim/budgets/budget_cell.rb +6 -1
- data/app/cells/decidim/budgets/budget_information_modal/show.erb +14 -26
- data/app/cells/decidim/budgets/budget_list_item/projects_count.erb +6 -0
- data/app/cells/decidim/budgets/budget_list_item/show.erb +35 -30
- data/app/cells/decidim/budgets/budget_list_item/vote_action.erb +13 -0
- data/app/cells/decidim/budgets/budget_list_item_cell.rb +24 -1
- data/app/cells/decidim/budgets/budget_metadata_cell.rb +29 -0
- data/app/cells/decidim/budgets/budget_s_cell.rb +15 -0
- data/app/cells/decidim/budgets/budgets_header/show.erb +2 -6
- data/app/cells/decidim/budgets/budgets_list/card_list.erb +8 -13
- data/app/cells/decidim/budgets/budgets_list/main_list.erb +5 -0
- data/app/cells/decidim/budgets/budgets_list/show.erb +12 -16
- data/app/cells/decidim/budgets/budgets_list/voted.erb +8 -44
- data/app/cells/decidim/budgets/budgets_list_cell.rb +34 -0
- data/app/cells/decidim/budgets/limit_announcement/show.erb +3 -0
- data/app/cells/decidim/budgets/limit_announcement_cell.rb +2 -2
- data/app/cells/decidim/budgets/order_activity_cell.rb +1 -4
- data/app/cells/decidim/budgets/project_cell.rb +6 -1
- data/app/cells/decidim/budgets/project_l/extra_data.erb +6 -0
- data/app/cells/decidim/budgets/project_l/metadata.erb +4 -0
- data/app/cells/decidim/budgets/project_l_cell.rb +38 -0
- data/app/cells/decidim/budgets/project_metadata_cell.rb +78 -0
- data/app/cells/decidim/budgets/project_s_cell.rb +21 -0
- data/app/cells/decidim/budgets/project_tags/show.erb +1 -0
- data/app/cells/decidim/budgets/project_vote_button/show.erb +21 -15
- data/app/cells/decidim/budgets/project_vote_button_cell.rb +69 -1
- data/app/cells/decidim/budgets/project_voted_hint_cell.rb +1 -1
- data/app/cells/decidim/budgets/project_votes_count_cell.rb +9 -8
- data/app/commands/decidim/budgets/admin/create_project.rb +0 -1
- data/app/commands/decidim/budgets/admin/import_proposals_to_budgets.rb +1 -1
- data/app/commands/decidim/budgets/admin/update_project.rb +1 -2
- data/app/commands/decidim/budgets/admin/update_project_scope.rb +1 -1
- data/app/commands/decidim/budgets/admin/update_project_selection.rb +1 -1
- data/app/commands/decidim/budgets/admin/update_projects_budget.rb +57 -0
- data/app/controllers/concerns/decidim/budgets/admin/filterable.rb +1 -1
- data/app/controllers/concerns/decidim/budgets/needs_current_order.rb +2 -2
- data/app/controllers/decidim/budgets/admin/budgets_controller.rb +5 -5
- data/app/controllers/decidim/budgets/admin/projects_controller.rb +52 -10
- data/app/controllers/decidim/budgets/admin/proposals_imports_controller.rb +1 -1
- data/app/controllers/decidim/budgets/application_controller.rb +0 -4
- data/app/controllers/decidim/budgets/budgets_controller.rb +9 -0
- data/app/controllers/decidim/budgets/line_items_controller.rb +10 -16
- data/app/controllers/decidim/budgets/orders_controller.rb +7 -2
- data/app/controllers/decidim/budgets/projects_controller.rb +51 -4
- data/app/forms/decidim/budgets/admin/project_form.rb +1 -1
- data/app/helpers/decidim/budgets/application_helper.rb +4 -0
- data/app/helpers/decidim/budgets/projects_helper.rb +89 -33
- data/app/jobs/decidim/budgets/send_vote_reminder_job.rb +1 -1
- data/app/mailers/decidim/budgets/order_summary_mailer.rb +1 -1
- data/app/mailers/decidim/budgets/vote_reminder_mailer.rb +1 -1
- data/app/models/decidim/budgets/budget.rb +1 -0
- data/app/models/decidim/budgets/project.rb +17 -7
- data/app/packs/entrypoints/decidim_budgets.js +2 -0
- data/app/packs/src/decidim/budgets/exit_handler.js +11 -8
- data/app/packs/src/decidim/budgets/progressFixed.js +25 -11
- data/app/packs/src/decidim/budgets/projects.js +15 -10
- data/app/packs/stylesheets/budgets.scss +273 -0
- data/app/presenters/decidim/budgets/admin_log/budget_presenter.rb +2 -2
- data/app/presenters/decidim/budgets/admin_log/project_presenter.rb +2 -2
- data/app/services/decidim/budgets/order_reminder_generator.rb +4 -4
- data/app/views/decidim/budgets/admin/budgets/_form.html.erb +17 -12
- data/app/views/decidim/budgets/admin/budgets/edit.html.erb +16 -6
- data/app/views/decidim/budgets/admin/budgets/index.html.erb +58 -64
- data/app/views/decidim/budgets/admin/budgets/new.html.erb +16 -6
- data/app/views/decidim/budgets/admin/projects/_bulk-actions.html.erb +19 -10
- data/app/views/decidim/budgets/admin/projects/_form.html.erb +31 -35
- data/app/views/decidim/budgets/admin/projects/_project-tr.html.erb +15 -13
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_budget-change.html.erb +22 -0
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_change-selected.html.erb +3 -3
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_dropdown.html.erb +8 -2
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_recategorize.html.erb +3 -3
- data/app/views/decidim/budgets/admin/projects/bulk_actions/_scope-change.html.erb +5 -8
- data/app/views/decidim/budgets/admin/projects/edit.html.erb +16 -6
- data/app/views/decidim/budgets/admin/projects/index.html.erb +26 -31
- data/app/views/decidim/budgets/admin/projects/new.html.erb +16 -6
- data/app/views/decidim/budgets/admin/projects/update_attribute.js.erb +8 -4
- data/app/views/decidim/budgets/admin/proposals_imports/new.html.erb +40 -28
- data/app/views/decidim/budgets/budgets/index.html.erb +21 -3
- data/app/views/decidim/budgets/budgets/index.js.erb +6 -0
- data/app/views/decidim/budgets/line_items/update_budget.js.erb +21 -11
- data/app/views/decidim/budgets/projects/_addition_selector.html.erb +16 -0
- data/app/views/decidim/budgets/projects/_budget_confirm.html.erb +42 -31
- data/app/views/decidim/budgets/projects/_budget_excess.html.erb +12 -12
- data/app/views/decidim/budgets/projects/_budget_summary.html.erb +2 -75
- data/app/views/decidim/budgets/projects/_exit_modal.html.erb +15 -18
- data/app/views/decidim/budgets/projects/_linked_projects.html.erb +3 -12
- data/app/views/decidim/budgets/projects/_order.html.erb +1 -0
- data/app/views/decidim/budgets/projects/_order_progress_progressbar_marks_right.html.erb +10 -0
- data/app/views/decidim/budgets/projects/_order_progress_summary_content.html.erb +113 -0
- data/app/views/decidim/budgets/projects/_order_total_budget.html.erb +6 -7
- data/app/views/decidim/budgets/projects/_project.html.erb +2 -1
- data/app/views/decidim/budgets/projects/_project_budget_button.html.erb +11 -19
- data/app/views/decidim/budgets/projects/_projects.html.erb +8 -6
- data/app/views/decidim/budgets/projects/_projects_count.html.erb +5 -0
- data/app/views/decidim/budgets/projects/_projects_list.html.erb +3 -0
- data/app/views/decidim/budgets/projects/index.html.erb +58 -55
- data/app/views/decidim/budgets/projects/index.js.erb +5 -4
- data/app/views/decidim/budgets/projects/show.html.erb +78 -51
- data/config/assets.rb +0 -1
- data/config/locales/ar.yml +0 -50
- data/config/locales/bg.yml +0 -381
- data/config/locales/ca.yml +75 -84
- data/config/locales/cs.yml +73 -82
- data/config/locales/de.yml +76 -85
- data/config/locales/el.yml +34 -72
- data/config/locales/en.yml +79 -88
- data/config/locales/es-MX.yml +73 -82
- data/config/locales/es-PY.yml +73 -82
- data/config/locales/es.yml +75 -84
- data/config/locales/eu.yml +74 -86
- data/config/locales/fi-plain.yml +75 -84
- data/config/locales/fi.yml +79 -88
- data/config/locales/fr-CA.yml +74 -86
- data/config/locales/fr.yml +78 -90
- data/config/locales/ga-IE.yml +0 -12
- data/config/locales/gl.yml +0 -58
- data/config/locales/hu.yml +58 -81
- data/config/locales/id-ID.yml +0 -38
- data/config/locales/is-IS.yml +0 -22
- data/config/locales/it.yml +0 -84
- data/config/locales/ja.yml +69 -81
- data/config/locales/ko.yml +0 -54
- data/config/locales/lb.yml +0 -85
- data/config/locales/lt.yml +59 -82
- data/config/locales/lv.yml +0 -44
- data/config/locales/nl.yml +0 -96
- data/config/locales/no.yml +0 -84
- data/config/locales/pl.yml +0 -167
- data/config/locales/pt-BR.yml +9 -141
- data/config/locales/pt.yml +0 -85
- data/config/locales/ro-RO.yml +0 -95
- data/config/locales/ru.yml +0 -41
- data/config/locales/sk.yml +0 -44
- data/config/locales/sq-AL.yml +0 -52
- data/config/locales/sr-CS.yml +0 -4
- data/config/locales/sv.yml +42 -150
- data/config/locales/tr-TR.yml +2 -82
- data/config/locales/uk.yml +0 -41
- data/config/locales/zh-CN.yml +0 -65
- data/config/locales/zh-TW.yml +13 -59
- data/lib/decidim/budgets/admin_engine.rb +3 -2
- data/lib/decidim/budgets/component.rb +4 -90
- data/lib/decidim/budgets/engine.rb +30 -10
- data/lib/decidim/budgets/project_serializer.rb +3 -3
- data/lib/decidim/budgets/seeds.rb +69 -0
- data/lib/decidim/budgets/test/factories.rb +23 -37
- data/lib/decidim/budgets/version.rb +1 -1
- data/lib/decidim/budgets/workflows/base.rb +1 -1
- metadata +46 -42
- data/app/cells/decidim/budgets/budget_m/data.erb +0 -12
- data/app/cells/decidim/budgets/budget_m/footer.erb +0 -5
- data/app/cells/decidim/budgets/budget_m_cell.rb +0 -16
- data/app/cells/decidim/budgets/project_list_item/project_data.erb +0 -19
- data/app/cells/decidim/budgets/project_list_item/project_image.erb +0 -5
- data/app/cells/decidim/budgets/project_list_item/project_text.erb +0 -23
- data/app/cells/decidim/budgets/project_list_item/show.erb +0 -5
- data/app/cells/decidim/budgets/project_list_item_cell.rb +0 -70
- data/app/cells/decidim/budgets/project_m/data.erb +0 -12
- data/app/cells/decidim/budgets/project_m/footer.erb +0 -5
- data/app/cells/decidim/budgets/project_m_cell.rb +0 -22
- data/app/packs/stylesheets/decidim/budgets/_budgets.scss +0 -3
- data/app/packs/stylesheets/decidim/budgets/budget/_budget-list.scss +0 -198
- data/app/packs/stylesheets/decidim/budgets/budget/_budget-meter.scss +0 -83
- data/app/packs/stylesheets/decidim/budgets/budget/_progress.scss +0 -19
- data/app/views/decidim/budgets/admin/projects/proposals_picker.html.erb +0 -1
- data/app/views/decidim/budgets/projects/_filters.html.erb +0 -30
- data/app/views/decidim/budgets/projects/_filters_small_view.html.erb +0 -18
- data/app/views/decidim/budgets/projects/_order_progress.html.erb +0 -32
- data/app/views/decidim/budgets/projects/_order_selected_projects.html.erb +0 -27
- data/config/locales/he-IL.yml +0 -1
- data/decidim-budgets.gemspec +0 -34
- data/lib/decidim/budgets/seeds/city.jpeg +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 040e6569d57ec31a084de567cf3745c278b1e871b4b65c1f6c74193b25a5869a
|
4
|
+
data.tar.gz: 6fef0d93ae7c58c114c7f2ca7c04d266a870828055baf00be01640088d932012
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbbc7b01a81c4c170850e8a2513b231eb3b5b66b6870af26776f0520810cd86cd63b8f1dc200f47d00d11101107ffed28870d09faae190b8365c37d1295c9d95
|
7
|
+
data.tar.gz: dc79f3ccf7dcd1a986ab3916370959459e61245ceff5f69c732bd5fba6060d8cfb1291a6d99ae3445107d02d442c7a7261a7b09ccf1b089f5653b68187098bbf
|
data/README.md
CHANGED
@@ -30,7 +30,7 @@ bundle
|
|
30
30
|
|
31
31
|
## Budget Workflows
|
32
32
|
|
33
|
-
A budget workflow,
|
33
|
+
A budget workflow, lets an admin pick, at the component level, how a user can participate in it.
|
34
34
|
By default there are two workflows included in this module, `:one` and `:all` that can be found in the `lib/decidim/budgets/workflows/` directory, any app can add its own workflow.
|
35
35
|
|
36
36
|
### Adding a custom workflow
|
@@ -1,20 +1,20 @@
|
|
1
|
-
.budget-vote-button.expanded{
|
1
|
+
.budget-vote-button.expanded {
|
2
2
|
display: flex;
|
3
3
|
text-align: left;
|
4
4
|
justify-content: space-between;
|
5
5
|
align-items: center;
|
6
6
|
|
7
|
-
span{
|
7
|
+
span {
|
8
8
|
font-size: 1rem;
|
9
9
|
}
|
10
10
|
|
11
|
-
&.added{
|
11
|
+
&.added {
|
12
12
|
background-color: tint($success, 80%);
|
13
13
|
color: $body-font-color;
|
14
14
|
}
|
15
15
|
|
16
|
-
&:not(.added){
|
17
|
-
.budget-list__action{
|
16
|
+
&:not(.added) {
|
17
|
+
.budget-list__action {
|
18
18
|
border-color: white;
|
19
19
|
color: white;
|
20
20
|
}
|
@@ -13,7 +13,7 @@ module Decidim
|
|
13
13
|
delegate :settings, to: :current_component
|
14
14
|
|
15
15
|
def budgets_link_list(budgets)
|
16
|
-
budgets.map { |budget| link_to(
|
16
|
+
budgets.map { |budget| link_to(translated_attribute(budget.title), resource_locator(budget).path) }
|
17
17
|
.to_sentence
|
18
18
|
.html_safe
|
19
19
|
end
|
@@ -1,28 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<
|
8
|
-
|
9
|
-
<span aria-hidden="true">×</span>
|
10
|
-
</button>
|
11
|
-
</div>
|
12
|
-
|
13
|
-
<%= content_tag(:p, more_information) if more_information %>
|
14
|
-
|
15
|
-
<% unless current_workflow.single? %>
|
16
|
-
<p>
|
17
|
-
<%= link_to t(:back_to, scope: i18n_scope, component_name: component_name), budgets_path %>
|
1
|
+
<%= decidim_modal id: "budget-modal-info" do %>
|
2
|
+
<div data-dialog-container>
|
3
|
+
<%= icon "information-line" %>
|
4
|
+
<h3 class="h3" id="dialog-title-budget-modal-info" tabindex="-1" data-dialog-title>
|
5
|
+
<%= decidim_sanitize(component_name) %>
|
6
|
+
</h3>
|
7
|
+
<p id="dialog-desc-budget-modal-info">
|
8
|
+
<%= content_tag(:p, more_information) if more_information %>
|
18
9
|
</p>
|
19
|
-
<% end %>
|
20
|
-
|
21
|
-
<div class="row">
|
22
|
-
<div class="columns medium-8 medium-offset-2">
|
23
|
-
<button class="button expanded" data-close>
|
24
|
-
<%= t(:continue, scope: i18n_scope) %>
|
25
|
-
</button>
|
26
|
-
</div>
|
27
10
|
</div>
|
28
|
-
|
11
|
+
<div data-dialog-actions>
|
12
|
+
<button class="button button__sm md:button__lg button__secondary" data-dialog-close="budget-modal-info">
|
13
|
+
<%= t("continue", scope: "decidim.budgets.budget_information_modal") %>
|
14
|
+
</button>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<div class="inline-block pr-4">
|
2
|
+
<%= icon "git-pull-request-line", class: "text-gray fill-current inline-block" , aria_label: t("activerecord.models.decidim/budgets/project", count: 1) %>
|
3
|
+
<span class="text-sm">
|
4
|
+
<%= t(:projects_count, scope: "decidim.budgets.projects.count", count: budget.projects.size) %>
|
5
|
+
</span>
|
6
|
+
</div>
|
@@ -1,38 +1,43 @@
|
|
1
|
-
<div class="<%= card_class %>
|
2
|
-
<div class="
|
3
|
-
<%= link_to
|
4
|
-
<h3 class="
|
5
|
-
<%=
|
1
|
+
<div class="<%= card_class %> card__highlight">
|
2
|
+
<div class="card__highlight-text md:w-[70%] p-0">
|
3
|
+
<%= link_to resource_path, class: "p-4" do %>
|
4
|
+
<h3 class="h3 text-secondary inline-block align-middle">
|
5
|
+
<%= translated_attribute(title) %>
|
6
6
|
</h3>
|
7
|
+
<% if voted? %>
|
8
|
+
<%= icon "check-double-line", class: "inline-block align-middle fill-success ml-2 h-[1.5em] w-[1.5em]" %>
|
9
|
+
<% end %>
|
10
|
+
<div class="my-2">
|
11
|
+
<%= decidim_sanitize html_truncate(translated_attribute(description), length: 70) %>
|
12
|
+
</div>
|
13
|
+
<% unless voted? %>
|
14
|
+
<div class="divide-x-2 divide-gray-3">
|
15
|
+
<%= render :projects_count %>
|
16
|
+
<%= render :vote_action if voting_context? %>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
20
|
+
<% if voted? %>
|
21
|
+
<div class="divide-x-2 divide-gray-3 p-4 pt-0">
|
22
|
+
<%= render :projects_count %>
|
23
|
+
<%= render :vote_action if voting_context? %>
|
24
|
+
</div>
|
7
25
|
<% end %>
|
8
|
-
|
9
|
-
<div class="heading5">
|
10
|
-
<strong>
|
11
|
-
<%= budget_to_currency(total_budget) %>
|
12
|
-
</strong>
|
13
|
-
</div>
|
14
|
-
|
15
|
-
<%= decidim_sanitize html_truncate(translated_attribute(description), length: 140) %>
|
16
26
|
</div>
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
<%= icon "check", class: "icon--small", role: "img", aria_label: t("decidim.budgets.budget_list_item.voting_finished") %>
|
27
|
+
<% if voting_context? %>
|
28
|
+
<%= link_to resource_path, class: "budget__card__highlight-vote" do %>
|
29
|
+
<div class="budget__card__highlight-vote__header">
|
30
|
+
<span class="budget__card__highlight-vote__text">
|
31
|
+
<%= t("name", scope: "decidim.budgets.admin.models.budget") %>
|
23
32
|
</span>
|
24
|
-
|
25
|
-
|
26
|
-
<%= icon "bookmark", class: "icon--small", role: "img", aria_label: t("decidim.budgets.budget_list_item.voting_started") %>
|
33
|
+
<span class="budget__card__highlight-vote__number">
|
34
|
+
<%= budget_to_currency(total_budget) %>
|
27
35
|
</span>
|
36
|
+
</div>
|
37
|
+
<%= button_tag class: "button button__sm #{button_class} #{voted? ? "button__transparent-secondary" : "button__secondary"} budget__card__highlight-vote__button" do %>
|
38
|
+
<span><%= button_text %></span>
|
39
|
+
<%= icon "arrow-right-line" %>
|
28
40
|
<% end %>
|
29
|
-
</div>
|
30
|
-
<% end %>
|
31
|
-
|
32
|
-
<div class="budget-list__data">
|
33
|
-
<%= link_to budget_path(budget), class: "button button--sc expanded #{button_class} mb-none" do %>
|
34
|
-
<span><%= button_text %></span>
|
35
|
-
<%= icon "chevron-right", class: "icon--small", role: "img" %>
|
36
41
|
<% end %>
|
37
|
-
|
42
|
+
<% end %>
|
38
43
|
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% if voted? %>
|
2
|
+
<%= link_to(
|
3
|
+
budget_order_path(budget),
|
4
|
+
method: :delete,
|
5
|
+
class: "pl-4",
|
6
|
+
data: { confirm: t(:are_you_sure, scope: "decidim.budgets.projects.budget_summary") }
|
7
|
+
) do %>
|
8
|
+
<%= icon "delete-bin-line", class: "inline-block align-middle text-gray fill-current" %>
|
9
|
+
<span class="inline-block align-middle underline text-alert">
|
10
|
+
<%= t("cancel_order", scope: "decidim.budgets.projects.budget_summary") %>
|
11
|
+
</span>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
@@ -9,7 +9,6 @@ module Decidim
|
|
9
9
|
include ActiveSupport::NumberHelper
|
10
10
|
include Decidim::Budgets::ProjectsHelper
|
11
11
|
|
12
|
-
delegate :voting_finished?, to: :controller
|
13
12
|
delegate :highlighted, to: :current_workflow
|
14
13
|
|
15
14
|
property :title, :description, :total_budget
|
@@ -64,6 +63,30 @@ module Decidim
|
|
64
63
|
def i18n_scope
|
65
64
|
"decidim.budgets.budgets_list"
|
66
65
|
end
|
66
|
+
|
67
|
+
def resource_path
|
68
|
+
resource_locator(budget).path
|
69
|
+
end
|
70
|
+
|
71
|
+
def current_workflow
|
72
|
+
@current_workflow ||=
|
73
|
+
controller.try(:current_workflow) ||
|
74
|
+
Decidim::Budgets.workflows[component.settings.workflow.to_sym].new(component, current_user)
|
75
|
+
end
|
76
|
+
|
77
|
+
def component
|
78
|
+
@component ||= controller.try(:current_component) || budget.component
|
79
|
+
end
|
80
|
+
|
81
|
+
def voting_context?
|
82
|
+
controller.respond_to?(:voting_finished?)
|
83
|
+
end
|
84
|
+
|
85
|
+
def voting_finished?
|
86
|
+
return unless voting_context?
|
87
|
+
|
88
|
+
controller.voting_finished?
|
89
|
+
end
|
67
90
|
end
|
68
91
|
end
|
69
92
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Budgets
|
5
|
+
# This cell renders metadata for an instance of a budget
|
6
|
+
class BudgetMetadataCell < Decidim::CardMetadataCell
|
7
|
+
alias budget model
|
8
|
+
|
9
|
+
def initialize(*)
|
10
|
+
super
|
11
|
+
|
12
|
+
@items.prepend(*budget_items)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def budget_items
|
18
|
+
[project_count]
|
19
|
+
end
|
20
|
+
|
21
|
+
def project_count
|
22
|
+
{
|
23
|
+
text: t(:projects_count, scope: "decidim.budgets.projects.count", count: budget.projects.size),
|
24
|
+
icon: "git-pull-request-line"
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Budgets
|
5
|
+
# This cell renders the Search (:s) budget card
|
6
|
+
# for a given instance of a Budget
|
7
|
+
class BudgetSCell < Decidim::CardSCell
|
8
|
+
private
|
9
|
+
|
10
|
+
def metadata_cell
|
11
|
+
"decidim/budgets/budget_metadata"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,7 +1,3 @@
|
|
1
|
-
<div class="
|
2
|
-
|
3
|
-
<div class="section">
|
4
|
-
<%= decidim_sanitize_editor_admin(landing_page_content) %>
|
5
|
-
</div>
|
6
|
-
</div>
|
1
|
+
<div class="editor-content">
|
2
|
+
<%= decidim_sanitize_editor_admin(landing_page_content) %>
|
7
3
|
</div>
|
@@ -1,18 +1,13 @@
|
|
1
|
-
<%# show highlighted budgets first %>
|
2
1
|
<% if highlighted.any? %>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
<% end %>
|
7
|
-
</div>
|
2
|
+
<% reordered_highlighted_budgets.each do |budget| %>
|
3
|
+
<%= cell("decidim/budgets/budget_list_item", budget) %>
|
4
|
+
<% end %>
|
8
5
|
<% end %>
|
9
6
|
|
10
|
-
<% non_highlighted = (budgets
|
7
|
+
<% non_highlighted = reorder(budgets).where.not(id: (highlighted + voted).map(&:id)) %>
|
11
8
|
|
12
|
-
<% if non_highlighted.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
<% end %>
|
17
|
-
</div>
|
9
|
+
<% if non_highlighted.exists? %>
|
10
|
+
<% non_highlighted.each do |budget| %>
|
11
|
+
<%= cell("decidim/budgets/budget_list_item", budget) %>
|
12
|
+
<% end %>
|
18
13
|
<% end %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<h2 class="h5 md:h3 decorator"><%= t(:count, scope: i18n_scope, count: budgets.length) %></h2>
|
2
|
+
|
3
|
+
<%= render partial: "decidim/shared/orders", formats: [:html], locals: { orders: AVAILABLE_ORDERS, i18n_scope: "decidim.budgets.projects.orders" } %>
|
4
|
+
|
5
|
+
<%= render :card_list %>
|
@@ -1,19 +1,15 @@
|
|
1
|
-
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
<h2 class="section-heading">
|
6
|
-
<%= t(:my_budgets, scope: i18n_scope) %>
|
7
|
-
</h2>
|
1
|
+
<% if !voting_finished? && voted? %>
|
2
|
+
<h2 class="h5 md:h3 decorator mb-8">
|
3
|
+
<%= t("voted_budgets", scope: "decidim.budgets.budgets_list") %>
|
4
|
+
</h2>
|
8
5
|
|
9
|
-
|
10
|
-
|
11
|
-
<% end %>
|
6
|
+
<%= render :voted %>
|
7
|
+
<% end %>
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
</div>
|
17
|
-
</div>
|
9
|
+
<% if budgets.where.not(id: voted.map(&:id)).exists? %>
|
10
|
+
<div id="budgets" class="card__list-list">
|
11
|
+
<%= main_list %>
|
18
12
|
</div>
|
19
|
-
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<%= decidim_paginate budget_paginate %>
|
@@ -1,49 +1,13 @@
|
|
1
1
|
<% if voted? %>
|
2
|
-
<
|
3
|
-
<p class="lead">
|
4
|
-
<%= t(:voted_on, scope: i18n_scope, links: budgets_link_list(voted)) %>
|
5
|
-
</p>
|
2
|
+
<p><%= t(:voted_on, scope: i18n_scope, links: budgets_link_list(voted)) %></p>
|
6
3
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<% end %>
|
11
|
-
</div>
|
12
|
-
|
13
|
-
<% if finished? %>
|
14
|
-
<p class="lead">
|
15
|
-
<%= t(:finished_message, scope: i18n_scope) %>
|
16
|
-
</p>
|
17
|
-
<% end %>
|
18
|
-
|
19
|
-
<% if voting_open? %>
|
20
|
-
<div>
|
21
|
-
<p>
|
22
|
-
<%= t(:if_change_opinion, scope: i18n_scope) %>
|
23
|
-
<%= link_to(
|
24
|
-
t("cancel_order.only_one", scope: i18n_scope),
|
25
|
-
budget_order_path(voted.first),
|
26
|
-
method: :delete,
|
27
|
-
data: { confirm: t("projects.budget_summary.are_you_sure", scope: "decidim.budgets") }) if voted.one? %>
|
28
|
-
</p>
|
29
|
-
|
30
|
-
<% if !voted.one? && voted.any? %>
|
31
|
-
<ul>
|
32
|
-
<% voted.each do |budget| %>
|
33
|
-
<li>
|
34
|
-
<%= link_to(
|
35
|
-
t("cancel_order.more_than_one", scope: i18n_scope, name: decidim_escape_translated(budget.title)),
|
36
|
-
budget_order_path(budget),
|
37
|
-
method: :delete,
|
38
|
-
class: "cancel-order",
|
39
|
-
data: {
|
40
|
-
confirm: t("projects.budget_summary.are_you_sure", scope: "decidim.budgets")
|
41
|
-
}) %>
|
42
|
-
</li>
|
43
|
-
<% end %>
|
44
|
-
</ul>
|
45
|
-
<% end %>
|
46
|
-
</div>
|
4
|
+
<div id="voted-budgets" class="card__list-list">
|
5
|
+
<% voted.each do |budget| %>
|
6
|
+
<%= cell("decidim/budgets/budget_list_item", budget) %>
|
47
7
|
<% end %>
|
48
8
|
</div>
|
9
|
+
|
10
|
+
<% if finished? %>
|
11
|
+
<p><%= t(:finished_message, scope: i18n_scope) %></p>
|
12
|
+
<% end %>
|
49
13
|
<% end %>
|
@@ -4,6 +4,13 @@ module Decidim
|
|
4
4
|
module Budgets
|
5
5
|
# This cell renders the budgets list of a Budget component
|
6
6
|
class BudgetsListCell < BaseCell
|
7
|
+
AVAILABLE_ORDERS = %w(random highest_cost lowest_cost).freeze
|
8
|
+
|
9
|
+
include Decidim::CellsPaginateHelper
|
10
|
+
include Decidim::OrdersHelper
|
11
|
+
include Decidim::Orderable
|
12
|
+
include Cell::ViewModel::Partial
|
13
|
+
|
7
14
|
alias current_workflow model
|
8
15
|
|
9
16
|
delegate :allowed, :budgets, :highlighted, :voted, to: :current_workflow
|
@@ -15,6 +22,8 @@ module Decidim
|
|
15
22
|
render
|
16
23
|
end
|
17
24
|
|
25
|
+
def main_list = render
|
26
|
+
|
18
27
|
private
|
19
28
|
|
20
29
|
def highlighted?
|
@@ -34,6 +43,31 @@ module Decidim
|
|
34
43
|
def i18n_scope
|
35
44
|
"decidim.budgets.budgets_list"
|
36
45
|
end
|
46
|
+
|
47
|
+
def budget_paginate
|
48
|
+
@budget_paginate ||= Kaminari.paginate_array(budgets).page(params[:page]).per(10)
|
49
|
+
end
|
50
|
+
|
51
|
+
def reordered_highlighted_budgets
|
52
|
+
return highlighted if highlighted.length < 2
|
53
|
+
|
54
|
+
reorder(budgets.where(id: highlighted.map(&:id)))
|
55
|
+
end
|
56
|
+
|
57
|
+
def reorder(budgets)
|
58
|
+
case order
|
59
|
+
when "highest_cost"
|
60
|
+
budgets.order(total_budget: :desc)
|
61
|
+
when "lowest_cost"
|
62
|
+
budgets.order(total_budget: :asc)
|
63
|
+
when "random"
|
64
|
+
budgets.order_randomly(random_seed)
|
65
|
+
else
|
66
|
+
budgets
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def available_orders = AVAILABLE_ORDERS
|
37
71
|
end
|
38
72
|
end
|
39
73
|
end
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module Budgets
|
5
|
-
# This cell renders information when current user
|
5
|
+
# This cell renders information when current user cannot create more budgets orders.
|
6
6
|
class LimitAnnouncementCell < BaseCell
|
7
7
|
alias budget model
|
8
8
|
delegate :voted?, :vote_allowed?, :discardable, :limit_reached?, to: :current_workflow
|
9
9
|
delegate :voting_open?, to: :controller
|
10
10
|
|
11
11
|
def show
|
12
|
-
|
12
|
+
render if announce?
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
@@ -5,10 +5,7 @@ module Decidim
|
|
5
5
|
# A cell to display when actions happen on an order.
|
6
6
|
class OrderActivityCell < ActivityCell
|
7
7
|
def title
|
8
|
-
I18n.t(
|
9
|
-
"decidim.budgets.last_activity.new_vote_at_html",
|
10
|
-
link: participatory_space_link
|
11
|
-
)
|
8
|
+
I18n.t("decidim.budgets.last_activity.new_vote_at")
|
12
9
|
end
|
13
10
|
|
14
11
|
def resource_link_path
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "cell/partial"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Budgets
|
7
|
+
# This cell renders the List (:l) project card
|
8
|
+
# for an instance of a Project
|
9
|
+
class ProjectLCell < Decidim::CardLCell
|
10
|
+
include ActiveSupport::NumberHelper
|
11
|
+
include Decidim::Budgets::ProjectsHelper
|
12
|
+
|
13
|
+
alias project model
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def resource_path
|
18
|
+
resource_locator([project.budget, project]).path(url_extra_params)
|
19
|
+
end
|
20
|
+
|
21
|
+
def resource_added?
|
22
|
+
current_order && current_order.projects.include?(model)
|
23
|
+
end
|
24
|
+
|
25
|
+
def current_order
|
26
|
+
@current_order ||= controller.try(:current_order)
|
27
|
+
end
|
28
|
+
|
29
|
+
def show_only_added
|
30
|
+
options[:show_only_added]
|
31
|
+
end
|
32
|
+
|
33
|
+
def resource_id = "project-#{project.id}-item"
|
34
|
+
|
35
|
+
def metadata_cell = "decidim/budgets/project_metadata"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|