decidim-lausanne-budgets 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +141 -0
- data/Rakefile +93 -0
- data/app/cells/decidim/lausanne/budgets/base_cell.rb +24 -0
- data/app/cells/decidim/lausanne/budgets/budget_cell.rb +23 -0
- data/app/cells/decidim/lausanne/budgets/budget_information_modal/show.erb +21 -0
- data/app/cells/decidim/lausanne/budgets/budget_information_modal_cell.rb +24 -0
- data/app/cells/decidim/lausanne/budgets/budget_list_item/show.erb +21 -0
- data/app/cells/decidim/lausanne/budgets/budget_list_item_cell.rb +43 -0
- data/app/cells/decidim/lausanne/budgets/budget_m/data.erb +12 -0
- data/app/cells/decidim/lausanne/budgets/budget_m/footer.erb +5 -0
- data/app/cells/decidim/lausanne/budgets/budget_m_cell.rb +18 -0
- data/app/cells/decidim/lausanne/budgets/budgets_header/show.erb +7 -0
- data/app/cells/decidim/lausanne/budgets/budgets_header_cell.rb +16 -0
- data/app/cells/decidim/lausanne/budgets/budgets_list/card_list.erb +7 -0
- data/app/cells/decidim/lausanne/budgets/budgets_list/highlighted.erb +11 -0
- data/app/cells/decidim/lausanne/budgets/budgets_list/show.erb +20 -0
- data/app/cells/decidim/lausanne/budgets/budgets_list/voted.erb +43 -0
- data/app/cells/decidim/lausanne/budgets/budgets_list_cell.rb +40 -0
- data/app/cells/decidim/lausanne/budgets/limit_announcement_cell.rb +47 -0
- data/app/cells/decidim/lausanne/budgets/project_cell.rb +23 -0
- data/app/cells/decidim/lausanne/budgets/project_list_item/project_data.erb +19 -0
- data/app/cells/decidim/lausanne/budgets/project_list_item/project_data_vote_button.erb +22 -0
- data/app/cells/decidim/lausanne/budgets/project_list_item/project_image.erb +5 -0
- data/app/cells/decidim/lausanne/budgets/project_list_item/project_text.erb +23 -0
- data/app/cells/decidim/lausanne/budgets/project_list_item/show.erb +5 -0
- data/app/cells/decidim/lausanne/budgets/project_list_item_cell.rb +75 -0
- data/app/cells/decidim/lausanne/budgets/project_m/data.erb +12 -0
- data/app/cells/decidim/lausanne/budgets/project_m/footer.erb +5 -0
- data/app/cells/decidim/lausanne/budgets/project_m_cell.rb +24 -0
- data/app/cells/decidim/lausanne/budgets/project_selected_status_cell.rb +30 -0
- data/app/cells/decidim/lausanne/budgets/project_tags/show.erb +4 -0
- data/app/cells/decidim/lausanne/budgets/project_tags_cell.rb +20 -0
- data/app/cells/decidim/lausanne/budgets/project_voted_hint_cell.rb +35 -0
- data/app/cells/decidim/lausanne/budgets/project_votes_count_cell.rb +46 -0
- data/app/commands/decidim/lausanne/budgets/add_line_item.rb +54 -0
- data/app/commands/decidim/lausanne/budgets/admin/create_budget.rb +50 -0
- data/app/commands/decidim/lausanne/budgets/admin/create_project.rb +71 -0
- data/app/commands/decidim/lausanne/budgets/admin/destroy_budget.rb +44 -0
- data/app/commands/decidim/lausanne/budgets/admin/destroy_project.rb +44 -0
- data/app/commands/decidim/lausanne/budgets/admin/import_proposals_to_budgets.rb +87 -0
- data/app/commands/decidim/lausanne/budgets/admin/update_budget.rb +50 -0
- data/app/commands/decidim/lausanne/budgets/admin/update_project.rb +79 -0
- data/app/commands/decidim/lausanne/budgets/cancel_order.rb +46 -0
- data/app/commands/decidim/lausanne/budgets/checkout.rb +43 -0
- data/app/commands/decidim/lausanne/budgets/command.rb +16 -0
- data/app/commands/decidim/lausanne/budgets/create_user_record.rb +39 -0
- data/app/commands/decidim/lausanne/budgets/remove_line_item.rb +40 -0
- data/app/commands/decidim/lausanne/budgets/update_user_record.rb +40 -0
- data/app/controllers/concerns/decidim/lausanne/budgets/needs_current_order.rb +52 -0
- data/app/controllers/concerns/decidim/lausanne/budgets/orderable.rb +54 -0
- data/app/controllers/decidim/lausanne/budgets/admin/application_controller.rb +34 -0
- data/app/controllers/decidim/lausanne/budgets/admin/attachment_collections_controller.rb +27 -0
- data/app/controllers/decidim/lausanne/budgets/admin/attachments_controller.rb +28 -0
- data/app/controllers/decidim/lausanne/budgets/admin/lausanne_budgets_controller.rb +105 -0
- data/app/controllers/decidim/lausanne/budgets/admin/projects_controller.rb +98 -0
- data/app/controllers/decidim/lausanne/budgets/admin/proposals_imports_controller.rb +43 -0
- data/app/controllers/decidim/lausanne/budgets/application_controller.rb +77 -0
- data/app/controllers/decidim/lausanne/budgets/lausanne_budgets_controller.rb +29 -0
- data/app/controllers/decidim/lausanne/budgets/line_items_controller.rb +63 -0
- data/app/controllers/decidim/lausanne/budgets/orders_controller.rb +59 -0
- data/app/controllers/decidim/lausanne/budgets/projects_controller.rb +103 -0
- data/app/controllers/decidim/lausanne/budgets/user_records_controller.rb +121 -0
- data/app/forms/decidim/lausanne/budgets/admin/component_form.rb +93 -0
- data/app/forms/decidim/lausanne/budgets/admin/lausanne_budget_form.rb +41 -0
- data/app/forms/decidim/lausanne/budgets/admin/project_form.rb +96 -0
- data/app/forms/decidim/lausanne/budgets/admin/project_import_proposals_form.rb +52 -0
- data/app/forms/decidim/lausanne/budgets/user_record_form.rb +61 -0
- data/app/helpers/decidim/lausanne/budgets/admin/application_helper.rb +15 -0
- data/app/helpers/decidim/lausanne/budgets/application_helper.rb +26 -0
- data/app/helpers/decidim/lausanne/budgets/projects_helper.rb +103 -0
- data/app/jobs/decidim/lausanne/budgets/send_order_summary_job.rb +17 -0
- data/app/mailers/decidim/lausanne/budgets/order_summary_mailer.rb +38 -0
- data/app/models/decidim/lausanne/budgets/application_record.rb +12 -0
- data/app/models/decidim/lausanne/budgets/lausanne_budget.rb +37 -0
- data/app/models/decidim/lausanne/budgets/line_item.rb +23 -0
- data/app/models/decidim/lausanne/budgets/order.rb +204 -0
- data/app/models/decidim/lausanne/budgets/project.rb +129 -0
- data/app/models/decidim/lausanne/budgets/user_record.rb +28 -0
- data/app/packs/entrypoints/decidim_lausanne_budgets.js +2 -0
- data/app/packs/images/decidim/lausanne/budgets/icon.svg +1 -0
- data/app/packs/images/decidim/lausanne/budgets/lausanneparticipe.gif +0 -0
- data/app/packs/src/decidim/lausanne/budgets/index.js +1 -0
- data/app/packs/src/decidim/lausanne/budgets/progressFixed.js.es6 +23 -0
- data/app/packs/src/decidim/lausanne/budgets/projects.js.es6 +66 -0
- data/app/packs/stylesheets/decidim/lausanne/budgets/_budgets.scss +13 -0
- data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_budget-list.scss +195 -0
- data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_budget-meter.scss +85 -0
- data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_print.scss +73 -0
- data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_progress.scss +25 -0
- data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_proposal_link.scss +38 -0
- data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_share_buttons.scss +15 -0
- data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_user_record_form.scss +8 -0
- data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_votation-progress.scss +100 -0
- data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_voting-rules.scss +20 -0
- data/app/permissions/decidim/lausanne/budgets/admin/permissions.rb +49 -0
- data/app/permissions/decidim/lausanne/budgets/permissions.rb +63 -0
- data/app/presenters/decidim/lausanne/budgets/admin_log/budget_presenter.rb +44 -0
- data/app/presenters/decidim/lausanne/budgets/admin_log/project_presenter.rb +44 -0
- data/app/queries/decidim/lausanne/budgets/filtered_projects.rb +47 -0
- data/app/queries/decidim/lausanne/budgets/metrics/budget_followers_metric_measure.rb +34 -0
- data/app/queries/decidim/lausanne/budgets/metrics/budget_participants_metric_measure.rb +29 -0
- data/app/queries/decidim/lausanne/budgets/query.rb +16 -0
- data/app/serializers/decidim/lausanne/budgets/data_portability_budgets_order_serializer.rb +46 -0
- data/app/services/decidim/lausanne/budgets/project_search.rb +65 -0
- data/app/services/decidim/lausanne/budgets/project_search_rs.rb +13 -0
- data/app/views/decidim/lausanne/budgets/admin/lausanne_budgets/_form.html.erb +23 -0
- data/app/views/decidim/lausanne/budgets/admin/lausanne_budgets/edit.html.erb +7 -0
- data/app/views/decidim/lausanne/budgets/admin/lausanne_budgets/index.html.erb +75 -0
- data/app/views/decidim/lausanne/budgets/admin/lausanne_budgets/new.html.erb +7 -0
- data/app/views/decidim/lausanne/budgets/admin/projects/_form.html.erb +47 -0
- data/app/views/decidim/lausanne/budgets/admin/projects/edit.html.erb +7 -0
- data/app/views/decidim/lausanne/budgets/admin/projects/index.html.erb +82 -0
- data/app/views/decidim/lausanne/budgets/admin/projects/new.html.erb +7 -0
- data/app/views/decidim/lausanne/budgets/admin/projects/proposals_picker.html.erb +1 -0
- data/app/views/decidim/lausanne/budgets/admin/proposals_imports/new.html.erb +32 -0
- data/app/views/decidim/lausanne/budgets/lausanne_budgets/index.html.erb +5 -0
- data/app/views/decidim/lausanne/budgets/line_items/update_budget.js.erb +41 -0
- data/app/views/decidim/lausanne/budgets/order_summary_mailer/order_summary.html.erb +22 -0
- data/app/views/decidim/lausanne/budgets/orders/show.html.erb +71 -0
- data/app/views/decidim/lausanne/budgets/projects/_budget_confirm.html.erb +37 -0
- data/app/views/decidim/lausanne/budgets/projects/_budget_excess.html.erb +14 -0
- data/app/views/decidim/lausanne/budgets/projects/_budget_summary.html.erb +95 -0
- data/app/views/decidim/lausanne/budgets/projects/_count.html.erb +1 -0
- data/app/views/decidim/lausanne/budgets/projects/_filters.html.erb +34 -0
- data/app/views/decidim/lausanne/budgets/projects/_filters_small_view.html.erb +18 -0
- data/app/views/decidim/lausanne/budgets/projects/_linked_projects.html.erb +12 -0
- data/app/views/decidim/lausanne/budgets/projects/_order_progress.html.erb +32 -0
- data/app/views/decidim/lausanne/budgets/projects/_order_selected_projects.html.erb +27 -0
- data/app/views/decidim/lausanne/budgets/projects/_order_total_budget.html.erb +7 -0
- data/app/views/decidim/lausanne/budgets/projects/_project.html.erb +1 -0
- data/app/views/decidim/lausanne/budgets/projects/_project_budget_button.html.erb +46 -0
- data/app/views/decidim/lausanne/budgets/projects/_projects.html.erb +13 -0
- data/app/views/decidim/lausanne/budgets/projects/_user_record_form.html.erb +40 -0
- data/app/views/decidim/lausanne/budgets/projects/_votation_banner.html.erb +71 -0
- data/app/views/decidim/lausanne/budgets/projects/index.html.erb +36 -0
- data/app/views/decidim/lausanne/budgets/projects/index.js.erb +10 -0
- data/app/views/decidim/lausanne/budgets/projects/show.html.erb +81 -0
- data/app/views/decidim/lausanne/budgets/user_records/edit.html.erb +6 -0
- data/app/views/decidim/proposals/proposals/show.html.erb +172 -0
- data/app/views/layouts/lausanne_budgets/print.erb +12 -0
- data/config/assets.rb +11 -0
- data/config/initializers/social_share.rb +3 -0
- data/config/locales/fr.yml +381 -0
- data/config/routes.rb +7 -0
- data/db/migrate/20170127114122_create_lausanne_projects.rb +15 -0
- data/db/migrate/20170127114123_create_lausanne_user_records.rb +14 -0
- data/db/migrate/20170130095615_create_lausanne_orders.rb +16 -0
- data/db/migrate/20170130101825_create_lausanne_line_items.rb +12 -0
- data/db/migrate/20170215132708_add_lausanne_reference_to_projects.rb +13 -0
- data/db/migrate/20200617105120_create_decidim_lausanne_budgets.rb +15 -0
- data/db/migrate/20200629134013_add_lausanne_budget_reference_to_project.rb +7 -0
- data/db/migrate/20200706142609_add_lausanne_budget_reference_to_order.rb +7 -0
- data/db/migrate/20200714103519_move_lausanne_budgets_to_own_model.rb +109 -0
- data/db/migrate/20200717140012_add_lausanne_scope_to_budgets.rb +7 -0
- data/db/migrate/20200728075039_add_lausanne_selected_at_to_project.rb +7 -0
- data/db/migrate/20200804175222_lausanne_votes_enabled_to_votes_choices.rb +35 -0
- data/db/migrate/20200827154129_add_lausanne_commentable_counter_cache_to_projects.rb +9 -0
- data/db/migrate/20210310120613_add_lausanne_followable_counter_cache_to_budgets.rb +16 -0
- data/db/migrate/20210508180613_add_checkboxes_to_user_record.rb +9 -0
- data/db/migrate/20221001151237_add_excerpt_to_decidim_lausanne_budgets_project.rb +7 -0
- data/lib/decidim/lausanne/budgets/admin.rb +12 -0
- data/lib/decidim/lausanne/budgets/admin_engine.rb +40 -0
- data/lib/decidim/lausanne/budgets/component.rb +107 -0
- data/lib/decidim/lausanne/budgets/current_user_record_middleware.rb +17 -0
- data/lib/decidim/lausanne/budgets/engine.rb +57 -0
- data/lib/decidim/lausanne/budgets/project_serializer.rb +83 -0
- data/lib/decidim/lausanne/budgets/seeds/Exampledocument.pdf +0 -0
- data/lib/decidim/lausanne/budgets/seeds/city.jpeg +0 -0
- data/lib/decidim/lausanne/budgets/test/factories.rb +169 -0
- data/lib/decidim/lausanne/budgets/version.rb +15 -0
- data/lib/decidim/lausanne/budgets/workflows/all.rb +22 -0
- data/lib/decidim/lausanne/budgets/workflows/base.rb +140 -0
- data/lib/decidim/lausanne/budgets/workflows/one.rb +35 -0
- data/lib/decidim/lausanne/budgets/workflows.rb +19 -0
- data/lib/decidim/lausanne/budgets.rb +17 -0
- metadata +372 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Lausanne
|
5
|
+
module Budgets
|
6
|
+
class DataPortabilityBudgetsOrderSerializer < Decidim::Exporters::Serializer
|
7
|
+
# Public: Initializes the serializer with a conversation.
|
8
|
+
def initialize(order)
|
9
|
+
@order = order
|
10
|
+
end
|
11
|
+
|
12
|
+
# Serializes a Debate for data portability
|
13
|
+
def serialize
|
14
|
+
{
|
15
|
+
id: order.id,
|
16
|
+
budget: order.budget.title,
|
17
|
+
component: order.budget.component.name,
|
18
|
+
checked_out_at: order.checked_out_at,
|
19
|
+
projects: all_projects,
|
20
|
+
created_at: order.created_at,
|
21
|
+
updated_at: order.updated_at
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
attr_reader :order
|
28
|
+
|
29
|
+
def all_projects
|
30
|
+
order.projects.map do |project|
|
31
|
+
{
|
32
|
+
id: project.id,
|
33
|
+
title: project.title,
|
34
|
+
description: project.description,
|
35
|
+
budget_amount: project.budget_amount,
|
36
|
+
scope: project.try(:scope).try(:name),
|
37
|
+
reference: project.reference,
|
38
|
+
created_at: project.created_at,
|
39
|
+
updated_at: project.updated_at
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Lausanne
|
4
|
+
module Budgets
|
5
|
+
# This class handles search and filtering of projects. Needs a
|
6
|
+
# `current_component` param with a `Decidim::Component` in order to
|
7
|
+
# find the projects.
|
8
|
+
class ProjectSearch < ResourceSearch
|
9
|
+
text_search_fields :title, :description, :excerpt
|
10
|
+
|
11
|
+
# Public: Initializes the service.
|
12
|
+
# component - A Decidim::Component to get the projects from.
|
13
|
+
def initialize(options = {})
|
14
|
+
super(Project.all, options)
|
15
|
+
end
|
16
|
+
def search_search_text
|
17
|
+
return query unless self.class.text_search_fields.any?
|
18
|
+
fields = self.class.text_search_fields.dup
|
19
|
+
text_query = query.where(localized_search_text_in("#{query.table_name}.#{fields.shift}"), text: "%#{search_text}%")
|
20
|
+
fields.each do |field|
|
21
|
+
text_query = text_query.or(query.where(localized_search_text_in("#{query.table_name}.#{field}"), text: "%#{search_text}%"))
|
22
|
+
end
|
23
|
+
text_query
|
24
|
+
end
|
25
|
+
# Creates the SearchLight base query.
|
26
|
+
def base_query
|
27
|
+
raise "Missing budget" unless budget
|
28
|
+
raise "Missing component" unless component
|
29
|
+
@scope.where(budget: budget)
|
30
|
+
end
|
31
|
+
# A search method.
|
32
|
+
def search_title
|
33
|
+
# If `"title"` was the first key in the options_hash,
|
34
|
+
# `query` here will be the base query, namely, `Person.all`.
|
35
|
+
query.where(title: options[:title])
|
36
|
+
end
|
37
|
+
|
38
|
+
# Another search method.
|
39
|
+
def search_description
|
40
|
+
# If `"description"` was the second key in the options_hash,
|
41
|
+
# `query` here will be whatever `search_first_name` returned.
|
42
|
+
query.where(description: description)
|
43
|
+
end
|
44
|
+
# Returns the random projects for the current page.
|
45
|
+
def result
|
46
|
+
Project.where(id: results.pluck(:id)).includes([:scope, :component, :attachments, :category])
|
47
|
+
end
|
48
|
+
|
49
|
+
def search_status
|
50
|
+
return query if status.member?("all")
|
51
|
+
|
52
|
+
apply_scopes(%w(selected not_selected), status)
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
# Private: Since budget is not used by a search method we need
|
58
|
+
# to define the method manually.
|
59
|
+
def budget
|
60
|
+
options[:budget]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Lausanne
|
4
|
+
module Budgets
|
5
|
+
# This class handles search and filtering of projects. Needs a
|
6
|
+
# `current_component` param with a `Decidim::Component` in order to
|
7
|
+
# find the projects.
|
8
|
+
class ProjectSearchRs < ResourceSearch
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
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,75 @@
|
|
1
|
+
<div class="card with-overflow">
|
2
|
+
<div class="card-divider">
|
3
|
+
<h2 class="card-title flex--sbc">
|
4
|
+
<div>
|
5
|
+
<%= t(".title") %>
|
6
|
+
</div>
|
7
|
+
<div class="flex--cc flex-gap--1">
|
8
|
+
<% if allowed_to? :export, :budget %>
|
9
|
+
<%= export_dropdown %>
|
10
|
+
<% end %>
|
11
|
+
<div id="js-other-actions-wrapper">
|
12
|
+
<%= link_to t("actions.new", scope: "decidim.lausanne_budgets", name: t("models.budget.name", scope: "decidim.lausanne_budgets.admin")), new_lausanne_budget_path, class: "button tiny button--title" if allowed_to? :create, :budget %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</h2>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="card-section">
|
19
|
+
<div class="table-scroll">
|
20
|
+
<table class="table-list">
|
21
|
+
<thead>
|
22
|
+
<tr>
|
23
|
+
<th><%= t("models.budget.fields.name", scope: "decidim.lausanne_budgets") %></th>
|
24
|
+
<th><%= t("models.budget.fields.total_budget", scope: "decidim.lausanne_budgets") %></th>
|
25
|
+
<th><%= t("models.budget.fields.projects_count", scope: "decidim.lausanne_budgets") %></th>
|
26
|
+
<%= th_resource_scope_label %>
|
27
|
+
<th class="actions"><%= t("actions.title", scope: "decidim.lausanne_budgets") %></th>
|
28
|
+
</tr>
|
29
|
+
</thead>
|
30
|
+
<tbody>
|
31
|
+
<% budgets.each do |budget| %>
|
32
|
+
<tr data-id="<%= budget.id %>">
|
33
|
+
<td>
|
34
|
+
<%= link_to translated_attribute(budget.title), resource_locator(budget).path %>
|
35
|
+
</td>
|
36
|
+
<td>
|
37
|
+
<%= number_to_currency budget.total_budget, unit: Decidim.currency_unit, precision: 0 %>
|
38
|
+
</td>
|
39
|
+
<td>
|
40
|
+
<%= link_to budget.projects.count, lausanne_budget_projects_path(budget) %>
|
41
|
+
</td>
|
42
|
+
<%= td_resource_scope_for(budget.scope) %>
|
43
|
+
<td class="table-list__actions">
|
44
|
+
<%= icon_link_to "eye", resource_locator(budget).path, t("actions.preview", scope: "decidim.lausanne_budgets"), class: "action-icon--preview", target: :blank %>
|
45
|
+
|
46
|
+
<%= icon_link_to "list", lausanne_budget_projects_path(budget), t("actions.edit_projects", scope: "decidim.lausanne_budgets"), class: "action-icon--edit-projects" %>
|
47
|
+
|
48
|
+
<% if allowed_to? :update, :budget, budget: budget %>
|
49
|
+
<%= icon_link_to "pencil", edit_lausanne_budget_path(budget), t("actions.edit", scope: "decidim.lausanne_budgets"), class: "action-icon--edit" %>
|
50
|
+
<% else %>
|
51
|
+
<%= icon "pencil", class: "action-icon action-icon--disabled", role: "img" %>
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
<% if allowed_to? :delete, :budget, budget: budget %>
|
55
|
+
<%= icon_link_to "circle-x", lausanne_budget_path(budget), t("actions.destroy", scope: "decidim.lausanne_budgets"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.lausanne_budgets") } %>
|
56
|
+
<% else %>
|
57
|
+
<%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %>
|
58
|
+
<% end %>
|
59
|
+
</td>
|
60
|
+
</tr>
|
61
|
+
<% end %>
|
62
|
+
</tbody>
|
63
|
+
</table>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
<div class="card-divider">
|
67
|
+
<strong><%= t ".finished_orders" %>: </strong><span><%= finished_orders.count %></span>
|
68
|
+
<span> | </span>
|
69
|
+
<strong><%= t ".pending_orders" %>: </strong><span><%= pending_orders.count %></span>
|
70
|
+
<span> | </span>
|
71
|
+
<strong><%= t ".users_with_finished_orders" %>: </strong><span><%= users_with_finished_orders.count %></span>
|
72
|
+
<span> | </span>
|
73
|
+
<strong><%= t ".users_with_pending_orders" %>: </strong><span><%= users_with_pending_orders.count %></span>
|
74
|
+
</div>
|
75
|
+
</div>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<div class="card">
|
2
|
+
<div class="card-divider">
|
3
|
+
<h2 class="card-title">
|
4
|
+
<%= title.html_safe %>
|
5
|
+
</h2>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="card-section">
|
9
|
+
<div class="row column">
|
10
|
+
<%= form.translated :text_field, :title, autofocus: true %>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="row column">
|
14
|
+
<%= form.translated :editor, :description %>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div class="row column">
|
18
|
+
<%= form.translated :editor, :excerpt %>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div class="row column">
|
22
|
+
<%= form.number_field :budget_amount %>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<% if current_component.has_subscopes? %>
|
26
|
+
<div class="row column">
|
27
|
+
<%= scopes_picker_field form, :decidim_scope_id, root: budget.scope %>
|
28
|
+
</div>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<div class="row column">
|
32
|
+
<%= form.categories_select :decidim_category_id, current_participatory_space.categories, include_blank: true, disable_parents: false %>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div class="row column">
|
36
|
+
<%= proposals_picker(form, :proposals, proposals_picker_projects_path) %>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<%= render partial: "decidim/admin/shared/gallery", locals: { form: form } %>
|
40
|
+
|
41
|
+
<% if form.object.persisted? %>
|
42
|
+
<div class="row column">
|
43
|
+
<%= form.check_box :selected %>
|
44
|
+
</div>
|
45
|
+
<% end %>
|
46
|
+
</div>
|
47
|
+
</div>
|
@@ -0,0 +1,7 @@
|
|
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
|
+
|
4
|
+
<div class="button--double form-general-submit">
|
5
|
+
<%= f.submit t(".update") %>
|
6
|
+
</div>
|
7
|
+
<% end %>
|
@@ -0,0 +1,82 @@
|
|
1
|
+
<div class="card with-overflow">
|
2
|
+
<div class="card-divider">
|
3
|
+
<h2 class="card-title flex--sbc">
|
4
|
+
<div>
|
5
|
+
<%= link_to translated_attribute(budget.title), lausanne_budgets_path %> >
|
6
|
+
<%= t(".title") %>
|
7
|
+
</div>
|
8
|
+
<div class="flex--cc flex-gap--1">
|
9
|
+
<%= link_to t("actions.import", scope: "decidim.lausanne_budgets", name: t("models.project.name", scope: "decidim.lausanne_budgets.admin")), new_lausanne_budget_proposals_import_path(lausanne_budget: budget), class: "button tiny button--title" if allowed_to? :import_proposals, :project %>
|
10
|
+
<% if allowed_to? :export, :budget %>
|
11
|
+
<%= export_dropdown(current_component, budget.id) %>
|
12
|
+
<% end %>
|
13
|
+
<%= link_to t("actions.new", scope: "decidim.lausanne_budgets", name: t("models.project.name", scope: "decidim.lausanne_budgets.admin")), new_lausanne_budget_project_path, class: "button tiny button--title new" if allowed_to? :create, :project %>
|
14
|
+
</div>
|
15
|
+
</h2>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="card-section">
|
19
|
+
<div class="table-scroll">
|
20
|
+
<table class="table-list">
|
21
|
+
<thead>
|
22
|
+
<tr>
|
23
|
+
<th><%= t("models.project.fields.title", scope: "decidim.lausanne_budgets") %></th>
|
24
|
+
<th><%= t("index.confirmed_orders_count") %></th>
|
25
|
+
<th><%= t(".selected") %></th>
|
26
|
+
<%= th_resource_scope_label %>
|
27
|
+
<th class="actions"><%= t("actions.title", scope: "decidim.lausanne_budgets") %></th>
|
28
|
+
</tr>
|
29
|
+
</thead>
|
30
|
+
<tbody>
|
31
|
+
<% projects.each do |project| %>
|
32
|
+
<tr data-id="<%= project.id %>">
|
33
|
+
<td>
|
34
|
+
<%= translated_attribute(project.title) %><br>
|
35
|
+
</td>
|
36
|
+
<td>
|
37
|
+
<%= project.confirmed_orders_count %>
|
38
|
+
</td>
|
39
|
+
<td>
|
40
|
+
<% if project.selected? %>
|
41
|
+
<%= content_tag :strong, t(".selected"), class: "text-success" %>
|
42
|
+
<% else %>
|
43
|
+
<%= content_tag :span, "×", class: "text-muted" %>
|
44
|
+
<% end %>
|
45
|
+
</td>
|
46
|
+
<%= td_resource_scope_for(project.scope) %>
|
47
|
+
<td class="table-list__actions">
|
48
|
+
<%= icon_link_to "eye", resource_locator([budget, project]).path, t("actions.preview", scope: "decidim.lausanne_budgets"), target: :blank, class: "action-icon--preview" %>
|
49
|
+
|
50
|
+
<% if allowed_to? :update, :project, project: project %>
|
51
|
+
<%= icon_link_to "pencil", resource_locator([budget, project]).edit, t("actions.edit", scope: "decidim.lausanne_budgets"), class: "action-icon--edit" %>
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
<% if allowed_to? :update, :project, project: project %>
|
55
|
+
<%= icon_link_to "folder", project_attachment_collections_path(project), t("actions.attachment_collections", scope: "decidim.lausanne_budgets"), class: "action-icon--attachment_collections" %>
|
56
|
+
<% end %>
|
57
|
+
|
58
|
+
<% if allowed_to? :update, :project, project: project %>
|
59
|
+
<%= icon_link_to "paperclip", project_attachments_path(project), t("actions.attachments", scope: "decidim.lausanne_budgets"), class: "action-icon--attachments" %>
|
60
|
+
<% end %>
|
61
|
+
|
62
|
+
<%= resource_permissions_link(project) %>
|
63
|
+
|
64
|
+
<% if allowed_to? :destroy, :project, project: project %>
|
65
|
+
<%= icon_link_to "circle-x", resource_locator([budget, project]).show, t("actions.destroy", scope: "decidim.lausanne_budgets"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.lausanne_budgets") } %>
|
66
|
+
<% else %>
|
67
|
+
<%= icon "circle-x", class: "action-icon action-icon--disabled", role: "img" %>
|
68
|
+
<% end %>
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
<% end %>
|
72
|
+
</tbody>
|
73
|
+
</table>
|
74
|
+
<%= paginate projects, theme: "decidim" %>
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
<div class="card-divider">
|
78
|
+
<strong><%= t ".finished_orders" %>: </strong><span><%= finished_orders.count %></span>
|
79
|
+
<span> | </span>
|
80
|
+
<strong><%= t ".pending_orders" %>: </strong><span><%= pending_orders.count %></span>
|
81
|
+
</div>
|
82
|
+
</div>
|
@@ -0,0 +1,7 @@
|
|
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
|
+
|
4
|
+
<div class="button--double form-general-submit">
|
5
|
+
<%= f.submit t(".create") %>
|
6
|
+
</div>
|
7
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= cell "decidim/proposals/proposals_picker", current_component %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<%= decidim_form_for(@form, url: lausanne_budget_proposals_import_path(lausanne_budget: budget), html: { class: "form import_proposals" }) do |f| %>
|
2
|
+
<% if @form.origin_components.any? %>
|
3
|
+
<div class="card">
|
4
|
+
<div class="card-divider">
|
5
|
+
<h2 class="card-title"><%= t(".title") %></h2>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="card-section">
|
9
|
+
<div class="row column">
|
10
|
+
<%= f.select :origin_component_id, @form.origin_components_collection, prompt: t(".select_component") %>
|
11
|
+
</div>
|
12
|
+
<% if current_component.scopes_enabled? %>
|
13
|
+
<div class="row column">
|
14
|
+
<%= scopes_picker_field f, :scope_id, root: budget.scope %>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
17
|
+
<div class="row column">
|
18
|
+
<%= f.number_field :default_budget %>
|
19
|
+
</div>
|
20
|
+
<div class="row column">
|
21
|
+
<%= f.check_box :import_all_accepted_proposals %>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div class="button--double form-general-submit">
|
27
|
+
<%= f.submit t(".create") %>
|
28
|
+
</div>
|
29
|
+
<% else %>
|
30
|
+
<p><%= t(".no_components") %></p>
|
31
|
+
<% end %>
|
32
|
+
<% end %>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
function updateBudgetInfos() {
|
2
|
+
var $orderTotalBudget = $('#order-total-budget');
|
3
|
+
var $orderSelectedProjects = $('#order-selected-projects');
|
4
|
+
var $orderProgress = $('#order-progress');
|
5
|
+
var $votationBanner = $('#VotationBanner');
|
6
|
+
var $projectItem = $('#project-<%= project.id %>-item');
|
7
|
+
var $projectBudgetButton = $('#project-<%= project.id %>-budget-button');
|
8
|
+
var $budgetConfirm = $('#budget-confirm');
|
9
|
+
console.log("orderTotalBudget");
|
10
|
+
if ($orderTotalBudget.length > 0)
|
11
|
+
morphdom($orderTotalBudget[0], '<%= j(render partial: "decidim/lausanne/budgets/projects/order_total_budget").strip.html_safe %>');
|
12
|
+
console.log("votationBanner");
|
13
|
+
if ($votationBanner.length > 0)
|
14
|
+
morphdom($votationBanner[0], '<%= j(render partial: "decidim/lausanne/budgets/projects/votation_banner").strip.html_safe %>');
|
15
|
+
console.log("orderSelectedProjects");
|
16
|
+
if ($orderSelectedProjects.length > 0)
|
17
|
+
morphdom($orderSelectedProjects[0], '<%= j(render partial: "decidim/lausanne/budgets/projects/order_selected_projects").strip.html_safe %>');
|
18
|
+
console.log("orderProgress");
|
19
|
+
if ($orderProgress.length > 0)
|
20
|
+
morphdom($orderProgress[0], '<%= j(render partial: "decidim/lausanne/budgets/projects/order_progress").strip.html_safe %>');
|
21
|
+
console.log("budgetConfirm");
|
22
|
+
if ($budgetConfirm.length > 0)
|
23
|
+
morphdom($budgetConfirm[0], '<%= j(render partial: "decidim/lausanne/budgets/projects/budget_confirm").strip.html_safe %>')
|
24
|
+
|
25
|
+
$("#order-progress").foundation();
|
26
|
+
$(".budget-summary__selected").foundation();
|
27
|
+
if ($projectItem.length > 0) {
|
28
|
+
morphdom($projectItem[0], '<%= j(render partial: "decidim/lausanne/budgets/projects/project", locals: { project: project }).strip.html_safe %>');
|
29
|
+
}
|
30
|
+
console.log("projectBudgetButton");
|
31
|
+
if ($projectBudgetButton.length > 0) {
|
32
|
+
morphdom($projectBudgetButton[0], '<%= j(render partial: "decidim/lausanne/budgets/projects/project_budget_button", locals: { project: project }).strip.html_safe %>');
|
33
|
+
}
|
34
|
+
}
|
35
|
+
updateBudgetInfos();
|
36
|
+
$(window).on("popstate", function(e){
|
37
|
+
if(e.originalEvent.state !== null) {
|
38
|
+
console.log("history.back triggered")
|
39
|
+
updateBudgetInfos();
|
40
|
+
}
|
41
|
+
})
|
@@ -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>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<% user_record = current_order.user_record %>
|
2
|
+
|
3
|
+
<table class="personal-data">
|
4
|
+
<tbody>
|
5
|
+
<tr>
|
6
|
+
<td class="first-col">
|
7
|
+
<%= t("activemodel.attributes.user_record.first_name") %>
|
8
|
+
</td>
|
9
|
+
<td>
|
10
|
+
<%= user_record.first_name %>
|
11
|
+
</td>
|
12
|
+
</tr>
|
13
|
+
<tr>
|
14
|
+
<td class="first-col">
|
15
|
+
<%= t("activemodel.attributes.user_record.last_name") %>
|
16
|
+
</td>
|
17
|
+
<td>
|
18
|
+
<%= user_record.last_name %>
|
19
|
+
</td>
|
20
|
+
</tr>
|
21
|
+
<tr>
|
22
|
+
<td class="first-col">
|
23
|
+
<%= t("activemodel.attributes.user_record.birthdate") %>
|
24
|
+
</td>
|
25
|
+
<td>
|
26
|
+
<%= user_record.birthdate %>
|
27
|
+
</td>
|
28
|
+
</tr>
|
29
|
+
<tr>
|
30
|
+
<td class="first-col">
|
31
|
+
Vote finalisé le
|
32
|
+
</td>
|
33
|
+
<td>
|
34
|
+
<%= current_order.checked_out_at.strftime("%d/%m/%y @ %H:%M") %>
|
35
|
+
</td>
|
36
|
+
</tr>
|
37
|
+
</tbody>
|
38
|
+
</table>
|
39
|
+
|
40
|
+
<h1><%= link_to lausanne_budget_path(current_order.budget) do %>
|
41
|
+
<%= translated_attribute(current_order.component.participatory_space.title) -%><% end %> // Mon vote</h1>
|
42
|
+
|
43
|
+
<table class="vote">
|
44
|
+
<% current_order.projects.each do |project| %>
|
45
|
+
<tr class="budget-summary__selected-item">
|
46
|
+
<td>
|
47
|
+
<strong><%= translated_attribute(project.title) %></strong><br />
|
48
|
+
<%= raw translated_attribute(project.excerpt) %>
|
49
|
+
</td>
|
50
|
+
<td>
|
51
|
+
<strong class="budget-summary__selected-number">
|
52
|
+
<%= budget_to_currency project.budget_amount %>
|
53
|
+
</strong>
|
54
|
+
</td>
|
55
|
+
</tr>
|
56
|
+
<% end %>
|
57
|
+
</table>
|
58
|
+
|
59
|
+
<div class="actions">
|
60
|
+
<%= link_to lausanne_budget_path(current_order.budget) do %>Retour<% end %>
|
61
|
+
<a onclick="window.print();return false;">Imprimer</a>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<div class="shares">
|
65
|
+
<%= social_share_button_tag(
|
66
|
+
"J’ai voté pour les projets du #{translated_attribute(current_order.component.participatory_space.title).strip}",
|
67
|
+
:url => lausanne_budget_url(current_order.budget),
|
68
|
+
desc: "J’ai voté pour les projets du #{translated_attribute(current_order.component.participatory_space.title).strip}",
|
69
|
+
allow_sites: %w(whatsapp_app facebook twitter email)
|
70
|
+
) %>
|
71
|
+
</div>
|
@@ -0,0 +1,37 @@
|
|
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">×</span>
|
7
|
+
</button>
|
8
|
+
</div>
|
9
|
+
<p><%= t(".description") %></p>
|
10
|
+
<div class="card card--secondary">
|
11
|
+
<table class="card__content unstriped">
|
12
|
+
<% current_order.projects.each do |project| %>
|
13
|
+
<tr class="budget-summary__selected-item">
|
14
|
+
<td>
|
15
|
+
<%= link_to translated_attribute(project.title), resource_locator([budget, project]).path %>
|
16
|
+
<span class="budget-summary__excerpt"><%= raw translated_attribute(project.excerpt) %></span>
|
17
|
+
</td>
|
18
|
+
<td>
|
19
|
+
<strong class="budget-summary__selected-number">
|
20
|
+
<%= budget_to_currency project.budget_amount %>
|
21
|
+
</strong>
|
22
|
+
</td>
|
23
|
+
</tr>
|
24
|
+
<% end %>
|
25
|
+
</table>
|
26
|
+
</div>
|
27
|
+
<p class="text-center"><%= t(".are_you_sure") %></p>
|
28
|
+
<div class="row">
|
29
|
+
<div class="columns medium-8 medium-offset-2">
|
30
|
+
<%= button_to t(".confirm"), checkout_lausanne_budget_order_path(budget), class: "button expanded", data: { disable: true } %>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
<div class="text-center">
|
34
|
+
<button class="link" data-close><%= t(".cancel") %></button>
|
35
|
+
</div>
|
36
|
+
<% end %>
|
37
|
+
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="reveal" data-reveal id="budget-excess">
|
2
|
+
<div class="reveal__header">
|
3
|
+
<h3 class="reveal__title"><%= current_order.projects_rule? ? t(".projects_excess.title") : t(".budget_excess.title") %></h3>
|
4
|
+
<button class="close-button" data-close aria-label="<%= t(".close") %>" type="button">
|
5
|
+
<span aria-hidden="true">×</span>
|
6
|
+
</button>
|
7
|
+
</div>
|
8
|
+
<p><%= current_order.projects_rule? ? t(".projects_excess.description") : t(".budget_excess.description") %></p>
|
9
|
+
<div class="row">
|
10
|
+
<div class="columns medium-8 medium-offset-2">
|
11
|
+
<button data-close class="button expanded"><%= t(".ok") %></button>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
</div>
|