decidim-budgets 0.21.0 → 0.23.2
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 +24 -19
- 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 +10 -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 +47 -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 +12 -24
- data/app/types/decidim/budgets/budget_type.rb +24 -0
- data/app/types/decidim/budgets/budgets_type.rb +6 -6
- data/app/types/decidim/budgets/project_type.rb +2 -1
- 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 +22 -13
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +2 -16
- data/config/locales/bg-BG.yml +7 -0
- data/config/locales/bg.yml +6 -0
- data/config/locales/ca.yml +125 -11
- data/config/locales/cs.yml +148 -34
- data/config/locales/da-DK.yml +1 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +143 -29
- data/config/locales/el.yml +168 -0
- data/config/locales/en.yml +125 -11
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +125 -11
- data/config/locales/es-PY.yml +125 -11
- data/config/locales/es.yml +125 -11
- data/config/locales/et-EE.yml +1 -0
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +5 -13
- data/config/locales/fi-plain.yml +126 -12
- data/config/locales/fi.yml +136 -22
- data/config/locales/fr-CA.yml +267 -0
- data/config/locales/fr.yml +125 -11
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +70 -15
- data/config/locales/hr-HR.yml +1 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +18 -12
- data/config/locales/id-ID.yml +2 -11
- data/config/locales/is-IS.yml +0 -11
- data/config/locales/is.yml +114 -0
- data/config/locales/it.yml +96 -12
- 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 +112 -12
- data/config/locales/no.yml +42 -13
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +175 -61
- data/config/locales/pt-BR.yml +3 -13
- data/config/locales/pt.yml +62 -46
- data/config/locales/ro-RO.yml +172 -0
- data/config/locales/ru.yml +2 -14
- data/config/locales/si-LK.yml +1 -0
- 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 +125 -11
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +152 -38
- data/config/locales/uk.yml +2 -14
- 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 +87 -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 +123 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8cb468c9b9e59d8b00895a484740f47cb220831d7268208c147dc30a15d170a
|
4
|
+
data.tar.gz: 3652b57728d6034a8eb92fc5312a8607d265ac260fe99aa038d5d31f68d7e715
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1dfffc18c65cde2c6e2a0f71fd5021b5922822eb4f5ee791978c7506902f55adb8f3eb6c3ca146d1b89c087a6f42b740fcddfae3c9b31d160ce387de9c56be0
|
7
|
+
data.tar.gz: 2f550b3044daac8fa9f1aa886694c6a9a0497e74d9f8950e17d90396cd40f7a397b6367d90f1db134a33139550d8dbacaf9f49ab63f4c364d83b9ccfc248bb15
|
data/README.md
CHANGED
@@ -1,17 +1,25 @@
|
|
1
1
|
# Decidim::Budgets
|
2
2
|
|
3
|
-
The Budgets module adds projects to any participatory process. It adds a CRUD engine to the admin and public views scoped inside the participatory
|
3
|
+
The Budgets module adds budgets with projects related to them to any participatory process. It adds a CRUD engine to the admin and public views scoped inside the participatory space. Projects will link to related proposals and have a budget. The users should be able to distribute a budget between these projects.
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
7
|
-
Budgets will be available as a Component for a Participatory
|
7
|
+
Budgets will be available as a Component for a Participatory Space.
|
8
|
+
|
9
|
+
This plugin provides:
|
10
|
+
|
11
|
+
* A CRUD engine to manage budgets.
|
12
|
+
* A CRUD engine to manage projects related to a budget.
|
13
|
+
* Participant orders with the voted projects
|
14
|
+
* Budgets workflow to add different rules for budget voting.
|
15
|
+
* Public views for budgets and projects.
|
8
16
|
|
9
17
|
## Installation
|
10
18
|
|
11
19
|
Add this line to your application's Gemfile:
|
12
20
|
|
13
21
|
```ruby
|
14
|
-
gem
|
22
|
+
gem "decidim-budgets"
|
15
23
|
```
|
16
24
|
|
17
25
|
And then execute:
|
@@ -20,6 +28,33 @@ And then execute:
|
|
20
28
|
bundle
|
21
29
|
```
|
22
30
|
|
31
|
+
## Budget Workflows
|
32
|
+
|
33
|
+
A budget workflow, let's an admin pick, at the component level, how a user can participate in it.
|
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
|
+
|
36
|
+
### Adding a custom workflow
|
37
|
+
|
38
|
+
To add a custom workflow, create a workflow that inherits from the `base`, such as:
|
39
|
+
|
40
|
+
```rb
|
41
|
+
# lib/budgets_workflow_random.rb
|
42
|
+
class BudgetsWorkflowRandom < Decidim::Budgets::Workflows::Base
|
43
|
+
# your code here ...
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
And then add it to the decidim initializer (`config/initializers/decidim_budgets.rb`):
|
48
|
+
|
49
|
+
```rb
|
50
|
+
require "budgets_workflow_random"
|
51
|
+
Decidim::Budgets.workflows[:random] = BudgetsWorkflowRandom
|
52
|
+
```
|
53
|
+
|
54
|
+
Also remember to add the translated name for the `:random` workflow.
|
55
|
+
|
56
|
+
As an example, the `BudgetsWorkflowRandom` (`decidim-generators/lib/decidim/generators/app_templates/budgets_workflow_random.rb`) workflow is added by the generator in the `development_app` and `test_app`.
|
57
|
+
|
23
58
|
## Contributing
|
24
59
|
|
25
60
|
See [Decidim](https://github.com/decidim/decidim).
|
@@ -1,11 +1 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" x="
|
2
|
-
<g>
|
3
|
-
<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 S26.8,2,18,2z"/>
|
4
|
-
</g>
|
5
|
-
<g>
|
6
|
-
<g>
|
7
|
-
<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 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"/>
|
8
|
-
</g>
|
9
|
-
<path d="M30,16H20V6h0.6c4.5,0,9.4,4.4,9.4,8.9V16z M22,14h5.5C27,11,24,8.6,22,8V14z"/>
|
10
|
-
</g>
|
11
|
-
</svg>
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" x="0" y="0" enable-background="new 0 0 36 36" viewBox="0 0 36 36" xml:space="preserve"><g><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 S26.8,2,18,2z"/></g><g><g><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 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"/></g><path d="M30,16H20V6h0.6c4.5,0,9.4,4.4,9.4,8.9V16z M22,14h5.5C27,11,24,8.6,22,8V14z"/></g></svg>
|
@@ -5,7 +5,7 @@ $(() => {
|
|
5
5
|
const $projects = $("#projects, #project");
|
6
6
|
const $budgetSummaryTotal = $(".budget-summary__total");
|
7
7
|
const $budgetExceedModal = $("#budget-excess");
|
8
|
-
|
8
|
+
const $budgetSummary = $(".budget-summary__progressbox");
|
9
9
|
const totalBudget = parseInt($budgetSummaryTotal.attr("data-total-budget"), 10);
|
10
10
|
|
11
11
|
const cancelEvent = (event) => {
|
@@ -13,17 +13,39 @@ $(() => {
|
|
13
13
|
event.preventDefault();
|
14
14
|
};
|
15
15
|
|
16
|
-
$projects.on("click", ".budget
|
17
|
-
const currentBudget = parseInt($
|
16
|
+
$projects.on("click", ".budget-list__action", (event) => {
|
17
|
+
const currentBudget = parseInt($budgetSummary.attr("data-current-budget"), 10);
|
18
18
|
const $currentTarget = $(event.currentTarget);
|
19
19
|
const projectBudget = parseInt($currentTarget.attr("data-budget"), 10);
|
20
20
|
|
21
21
|
if ($currentTarget.attr("disabled")) {
|
22
22
|
cancelEvent(event);
|
23
23
|
|
24
|
-
} else if ($currentTarget.attr("data-add") && ((currentBudget + projectBudget) > totalBudget)) {
|
24
|
+
} else if (($currentTarget.attr("data-add") === "true") && ((currentBudget + projectBudget) > totalBudget)) {
|
25
25
|
$budgetExceedModal.foundation("toggle");
|
26
26
|
cancelEvent(event);
|
27
27
|
}
|
28
28
|
});
|
29
|
+
|
30
|
+
if ($("#order-progress [data-toggle=budget-confirm]").length > 0) {
|
31
|
+
const safeUrl = $(".budget-summary").attr("data-safe-url").split("?")[0];
|
32
|
+
$(document).on("click", "a", (event) => {
|
33
|
+
window.exitUrl = event.currentTarget.href;
|
34
|
+
});
|
35
|
+
$(document).on("submit", "form", (event) => {
|
36
|
+
window.exitUrl = event.currentTarget.action;
|
37
|
+
});
|
38
|
+
|
39
|
+
window.onbeforeunload = () => {
|
40
|
+
const currentBudget = parseInt($budgetSummary.attr("data-current-budget"), 10);
|
41
|
+
const exitUrl = window.exitUrl;
|
42
|
+
window.exitUrl = null;
|
43
|
+
|
44
|
+
if (currentBudget === 0 || (exitUrl && exitUrl.startsWith(safeUrl))) {
|
45
|
+
return null;
|
46
|
+
}
|
47
|
+
|
48
|
+
return "";
|
49
|
+
}
|
50
|
+
}
|
29
51
|
});
|
@@ -1,36 +1,164 @@
|
|
1
|
-
.budget-
|
2
|
-
|
3
|
-
font-size: $global-font-size;
|
4
|
-
}
|
5
|
-
}
|
1
|
+
.budget-list{
|
2
|
+
margin-bottom: 2rem;
|
6
3
|
|
7
|
-
|
8
|
-
|
4
|
+
&__item{
|
5
|
+
padding: 0;
|
6
|
+
background: $card-bg;
|
7
|
+
border: $border;
|
8
|
+
border-bottom: 0;
|
9
|
+
overflow: hidden;
|
10
|
+
display: flex;
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
12
|
+
&:first-child{
|
13
|
+
border-top-left-radius: $card-border-radius;
|
14
|
+
border-top-right-radius: $card-border-radius;
|
15
|
+
}
|
16
|
+
|
17
|
+
&:last-child{
|
18
|
+
border-bottom-left-radius: $card-border-radius;
|
19
|
+
border-bottom-right-radius: $card-border-radius;
|
20
|
+
border-bottom: $border;
|
21
|
+
}
|
13
22
|
}
|
14
|
-
}
|
15
23
|
|
16
|
-
|
17
|
-
|
18
|
-
|
24
|
+
&__image{
|
25
|
+
overflow: hidden;
|
26
|
+
width: 3.5em;
|
27
|
+
height: 3.5rem;
|
28
|
+
flex-shrink: 0;
|
29
|
+
margin-top: $card-padding-small * .7;
|
30
|
+
margin-bottom: $card-padding-small * .7;
|
31
|
+
margin-left: $card-padding-small / 2;
|
32
|
+
|
33
|
+
@include breakpoint(medium){
|
34
|
+
width: 6rem;
|
35
|
+
height: 4rem;
|
36
|
+
flex-shrink: 0;
|
37
|
+
margin: $card-padding;
|
38
|
+
margin-right: 0;
|
39
|
+
}
|
19
40
|
|
20
|
-
|
21
|
-
|
22
|
-
|
41
|
+
img{
|
42
|
+
width: 100%;
|
43
|
+
height: 100%;
|
44
|
+
object-fit: cover;
|
45
|
+
object-position: center;
|
46
|
+
}
|
23
47
|
}
|
24
48
|
|
25
|
-
|
49
|
+
&__text{
|
50
|
+
padding: $card-padding-small / 2;
|
26
51
|
flex-grow: 1;
|
52
|
+
|
53
|
+
@include breakpoint(medium){
|
54
|
+
padding: $card-padding;
|
55
|
+
display: flex;
|
56
|
+
align-items: center;
|
57
|
+
}
|
58
|
+
|
59
|
+
.card__text--status{
|
60
|
+
display: block;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
&__data{
|
65
|
+
flex-shrink: 0;
|
66
|
+
align-self: stretch;
|
67
|
+
display: flex;
|
68
|
+
flex-direction: column;
|
69
|
+
align-items: center;
|
70
|
+
justify-content: center;
|
71
|
+
text-align: center;
|
72
|
+
font-size: 85%;
|
73
|
+
line-height: 1;
|
74
|
+
color: $muted;
|
75
|
+
padding: $card-padding-small / 2;
|
76
|
+
background: $card-secondary-bg;
|
77
|
+
|
78
|
+
@include breakpoint(medium){
|
79
|
+
min-width: 7rem;
|
80
|
+
flex-direction: row;
|
81
|
+
justify-content: flex-end;
|
82
|
+
flex-basis: 12rem;
|
83
|
+
padding: 1rem $card-padding;
|
84
|
+
}
|
85
|
+
|
86
|
+
&:last-child{
|
87
|
+
margin-bottom: 0;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
&__data__icon{
|
92
|
+
.icon{
|
93
|
+
width: 20px;
|
94
|
+
height: 20px;
|
95
|
+
fill: $muted;
|
96
|
+
}
|
97
|
+
|
98
|
+
&:hover{
|
99
|
+
.icon{
|
100
|
+
fill: $anchor-color;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
&__data__number{
|
106
|
+
@extend .card-data__item__number;
|
107
|
+
|
27
108
|
font-size: 1.5rem;
|
28
|
-
|
29
|
-
margin-bottom: 0;
|
30
|
-
text-align: right;
|
109
|
+
line-height: 1.2;
|
31
110
|
}
|
32
|
-
}
|
33
111
|
|
34
|
-
|
35
|
-
|
112
|
+
&__data__votes{
|
113
|
+
@extend .card-data__item__number;
|
114
|
+
|
115
|
+
@include breakpoint(medium){
|
116
|
+
flex-grow: 1;
|
117
|
+
font-size: 1.2rem;
|
118
|
+
margin-left: 1rem;
|
119
|
+
margin-right: 1rem;
|
120
|
+
margin-bottom: 0;
|
121
|
+
text-align: cemter;
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
&__data--added{
|
126
|
+
background-color: tint($success, 80%);
|
127
|
+
}
|
128
|
+
|
129
|
+
&__title{
|
130
|
+
font-size: $global-font-size;
|
131
|
+
}
|
132
|
+
|
133
|
+
&__number{
|
134
|
+
@include breakpoint(medium down){
|
135
|
+
font-size: 1rem;
|
136
|
+
}
|
137
|
+
|
138
|
+
@include breakpoint(medium){
|
139
|
+
flex-grow: 1;
|
140
|
+
font-size: 1.2rem;
|
141
|
+
margin-left: 1rem;
|
142
|
+
margin-right: 1rem;
|
143
|
+
margin-bottom: 0;
|
144
|
+
text-align: right;
|
145
|
+
}
|
146
|
+
}
|
147
|
+
|
148
|
+
&__action{
|
149
|
+
margin-bottom: 0;
|
150
|
+
border-radius: 50%;
|
151
|
+
align-self: center;
|
152
|
+
flex-shrink: 0;
|
153
|
+
width: 2em;
|
154
|
+
height: 2em;
|
155
|
+
padding: 0;
|
156
|
+
display: flex;
|
157
|
+
justify-content: center;
|
158
|
+
align-items: center;
|
159
|
+
|
160
|
+
&--disabled{
|
161
|
+
pointer-events: none;
|
162
|
+
}
|
163
|
+
}
|
36
164
|
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Budgets
|
5
|
+
# This cell has the commons for the budgets cells
|
6
|
+
class BaseCell < Decidim::ViewModel
|
7
|
+
include Decidim::LayoutHelper
|
8
|
+
include Decidim::SanitizeHelper
|
9
|
+
include Decidim::ComponentPathHelper
|
10
|
+
include Decidim::Budgets::Engine.routes.url_helpers
|
11
|
+
|
12
|
+
delegate :current_user, :current_settings, :current_component, :current_workflow, to: :controller
|
13
|
+
delegate :settings, to: :current_component
|
14
|
+
|
15
|
+
def budgets_link_list(budgets)
|
16
|
+
budgets.map { |budget| link_to(translated_attribute(budget.title), resource_locator(budget).path) }
|
17
|
+
.to_sentence
|
18
|
+
.html_safe
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Budgets
|
5
|
+
# This cell renders the budget card for an instance of a budget
|
6
|
+
# the default size is the Medium Card (:m)
|
7
|
+
class BudgetCell < Decidim::ViewModel
|
8
|
+
include Cell::ViewModel::Partial
|
9
|
+
|
10
|
+
def show
|
11
|
+
cell card_size, model, options
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def card_size
|
17
|
+
"decidim/budgets/budget_m"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<button class="link" data-open="budget-modal-info" aria-controls="budget-modal-info" aria-haspopup="true" tabindex="0">
|
2
|
+
<%= t(:more_information, scope: i18n_scope) %>
|
3
|
+
</button>
|
4
|
+
|
5
|
+
<div class="reveal" data-reveal id="budget-modal-info">
|
6
|
+
<div class="reveal__header">
|
7
|
+
<h3 class="reveal__title"><%= decidim_sanitize(component_name) %></h3>
|
8
|
+
<button class="close-button" data-close aria-label="<%= t(:close_modal, scope: i18n_scope) %>" type="button">
|
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 %>
|
18
|
+
</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
|
+
</div>
|
28
|
+
</div>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Budgets
|
5
|
+
# This cell renders the Budgets component "More information" modal dialog
|
6
|
+
class BudgetInformationModalCell < BaseCell
|
7
|
+
alias budget model
|
8
|
+
|
9
|
+
def more_information
|
10
|
+
translated_attribute(current_settings.more_information_modal).presence || translated_attribute(settings.more_information_modal)
|
11
|
+
end
|
12
|
+
|
13
|
+
def component_name
|
14
|
+
translated_attribute(current_component.name)
|
15
|
+
end
|
16
|
+
|
17
|
+
def i18n_scope
|
18
|
+
"decidim.budgets.budget_information_modal"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<div class="<%= card_class %>">
|
2
|
+
<div class="card--list__text">
|
3
|
+
<%= link_to budget_path(budget), class: link_class do %>
|
4
|
+
<% if voted? && !voting_finished? %>
|
5
|
+
<strong>
|
6
|
+
<%= translated_attribute(title) %>
|
7
|
+
</strong>
|
8
|
+
<span class="button tiny success card--list__check card--list__check--disabled">
|
9
|
+
<%= icon "check", class: "icon--small", role: "img" %>
|
10
|
+
</span>
|
11
|
+
<% else %>
|
12
|
+
<%= translated_attribute(title) %>
|
13
|
+
|
14
|
+
<% if progress? && !voting_finished? %>
|
15
|
+
<span class="button tiny hollow secondary card--list__check card--list__check--disabled">
|
16
|
+
<%= icon "bookmark", class: "icon--small", role: "img" %>
|
17
|
+
</span>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
</div>
|