decidim-lausanne-budgets 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +141 -0
  3. data/Rakefile +93 -0
  4. data/app/cells/decidim/lausanne/budgets/base_cell.rb +24 -0
  5. data/app/cells/decidim/lausanne/budgets/budget_cell.rb +23 -0
  6. data/app/cells/decidim/lausanne/budgets/budget_information_modal/show.erb +21 -0
  7. data/app/cells/decidim/lausanne/budgets/budget_information_modal_cell.rb +24 -0
  8. data/app/cells/decidim/lausanne/budgets/budget_list_item/show.erb +21 -0
  9. data/app/cells/decidim/lausanne/budgets/budget_list_item_cell.rb +43 -0
  10. data/app/cells/decidim/lausanne/budgets/budget_m/data.erb +12 -0
  11. data/app/cells/decidim/lausanne/budgets/budget_m/footer.erb +5 -0
  12. data/app/cells/decidim/lausanne/budgets/budget_m_cell.rb +18 -0
  13. data/app/cells/decidim/lausanne/budgets/budgets_header/show.erb +7 -0
  14. data/app/cells/decidim/lausanne/budgets/budgets_header_cell.rb +16 -0
  15. data/app/cells/decidim/lausanne/budgets/budgets_list/card_list.erb +7 -0
  16. data/app/cells/decidim/lausanne/budgets/budgets_list/highlighted.erb +11 -0
  17. data/app/cells/decidim/lausanne/budgets/budgets_list/show.erb +20 -0
  18. data/app/cells/decidim/lausanne/budgets/budgets_list/voted.erb +43 -0
  19. data/app/cells/decidim/lausanne/budgets/budgets_list_cell.rb +40 -0
  20. data/app/cells/decidim/lausanne/budgets/limit_announcement_cell.rb +47 -0
  21. data/app/cells/decidim/lausanne/budgets/project_cell.rb +23 -0
  22. data/app/cells/decidim/lausanne/budgets/project_list_item/project_data.erb +19 -0
  23. data/app/cells/decidim/lausanne/budgets/project_list_item/project_data_vote_button.erb +22 -0
  24. data/app/cells/decidim/lausanne/budgets/project_list_item/project_image.erb +5 -0
  25. data/app/cells/decidim/lausanne/budgets/project_list_item/project_text.erb +23 -0
  26. data/app/cells/decidim/lausanne/budgets/project_list_item/show.erb +5 -0
  27. data/app/cells/decidim/lausanne/budgets/project_list_item_cell.rb +75 -0
  28. data/app/cells/decidim/lausanne/budgets/project_m/data.erb +12 -0
  29. data/app/cells/decidim/lausanne/budgets/project_m/footer.erb +5 -0
  30. data/app/cells/decidim/lausanne/budgets/project_m_cell.rb +24 -0
  31. data/app/cells/decidim/lausanne/budgets/project_selected_status_cell.rb +30 -0
  32. data/app/cells/decidim/lausanne/budgets/project_tags/show.erb +4 -0
  33. data/app/cells/decidim/lausanne/budgets/project_tags_cell.rb +20 -0
  34. data/app/cells/decidim/lausanne/budgets/project_voted_hint_cell.rb +35 -0
  35. data/app/cells/decidim/lausanne/budgets/project_votes_count_cell.rb +46 -0
  36. data/app/commands/decidim/lausanne/budgets/add_line_item.rb +54 -0
  37. data/app/commands/decidim/lausanne/budgets/admin/create_budget.rb +50 -0
  38. data/app/commands/decidim/lausanne/budgets/admin/create_project.rb +71 -0
  39. data/app/commands/decidim/lausanne/budgets/admin/destroy_budget.rb +44 -0
  40. data/app/commands/decidim/lausanne/budgets/admin/destroy_project.rb +44 -0
  41. data/app/commands/decidim/lausanne/budgets/admin/import_proposals_to_budgets.rb +87 -0
  42. data/app/commands/decidim/lausanne/budgets/admin/update_budget.rb +50 -0
  43. data/app/commands/decidim/lausanne/budgets/admin/update_project.rb +79 -0
  44. data/app/commands/decidim/lausanne/budgets/cancel_order.rb +46 -0
  45. data/app/commands/decidim/lausanne/budgets/checkout.rb +43 -0
  46. data/app/commands/decidim/lausanne/budgets/command.rb +16 -0
  47. data/app/commands/decidim/lausanne/budgets/create_user_record.rb +39 -0
  48. data/app/commands/decidim/lausanne/budgets/remove_line_item.rb +40 -0
  49. data/app/commands/decidim/lausanne/budgets/update_user_record.rb +40 -0
  50. data/app/controllers/concerns/decidim/lausanne/budgets/needs_current_order.rb +52 -0
  51. data/app/controllers/concerns/decidim/lausanne/budgets/orderable.rb +54 -0
  52. data/app/controllers/decidim/lausanne/budgets/admin/application_controller.rb +34 -0
  53. data/app/controllers/decidim/lausanne/budgets/admin/attachment_collections_controller.rb +27 -0
  54. data/app/controllers/decidim/lausanne/budgets/admin/attachments_controller.rb +28 -0
  55. data/app/controllers/decidim/lausanne/budgets/admin/lausanne_budgets_controller.rb +105 -0
  56. data/app/controllers/decidim/lausanne/budgets/admin/projects_controller.rb +98 -0
  57. data/app/controllers/decidim/lausanne/budgets/admin/proposals_imports_controller.rb +43 -0
  58. data/app/controllers/decidim/lausanne/budgets/application_controller.rb +77 -0
  59. data/app/controllers/decidim/lausanne/budgets/lausanne_budgets_controller.rb +29 -0
  60. data/app/controllers/decidim/lausanne/budgets/line_items_controller.rb +63 -0
  61. data/app/controllers/decidim/lausanne/budgets/orders_controller.rb +59 -0
  62. data/app/controllers/decidim/lausanne/budgets/projects_controller.rb +103 -0
  63. data/app/controllers/decidim/lausanne/budgets/user_records_controller.rb +121 -0
  64. data/app/forms/decidim/lausanne/budgets/admin/component_form.rb +93 -0
  65. data/app/forms/decidim/lausanne/budgets/admin/lausanne_budget_form.rb +41 -0
  66. data/app/forms/decidim/lausanne/budgets/admin/project_form.rb +96 -0
  67. data/app/forms/decidim/lausanne/budgets/admin/project_import_proposals_form.rb +52 -0
  68. data/app/forms/decidim/lausanne/budgets/user_record_form.rb +61 -0
  69. data/app/helpers/decidim/lausanne/budgets/admin/application_helper.rb +15 -0
  70. data/app/helpers/decidim/lausanne/budgets/application_helper.rb +26 -0
  71. data/app/helpers/decidim/lausanne/budgets/projects_helper.rb +103 -0
  72. data/app/jobs/decidim/lausanne/budgets/send_order_summary_job.rb +17 -0
  73. data/app/mailers/decidim/lausanne/budgets/order_summary_mailer.rb +38 -0
  74. data/app/models/decidim/lausanne/budgets/application_record.rb +12 -0
  75. data/app/models/decidim/lausanne/budgets/lausanne_budget.rb +37 -0
  76. data/app/models/decidim/lausanne/budgets/line_item.rb +23 -0
  77. data/app/models/decidim/lausanne/budgets/order.rb +204 -0
  78. data/app/models/decidim/lausanne/budgets/project.rb +129 -0
  79. data/app/models/decidim/lausanne/budgets/user_record.rb +28 -0
  80. data/app/packs/entrypoints/decidim_lausanne_budgets.js +2 -0
  81. data/app/packs/images/decidim/lausanne/budgets/icon.svg +1 -0
  82. data/app/packs/images/decidim/lausanne/budgets/lausanneparticipe.gif +0 -0
  83. data/app/packs/src/decidim/lausanne/budgets/index.js +1 -0
  84. data/app/packs/src/decidim/lausanne/budgets/progressFixed.js.es6 +23 -0
  85. data/app/packs/src/decidim/lausanne/budgets/projects.js.es6 +66 -0
  86. data/app/packs/stylesheets/decidim/lausanne/budgets/_budgets.scss +13 -0
  87. data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_budget-list.scss +195 -0
  88. data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_budget-meter.scss +85 -0
  89. data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_print.scss +73 -0
  90. data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_progress.scss +25 -0
  91. data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_proposal_link.scss +38 -0
  92. data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_share_buttons.scss +15 -0
  93. data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_user_record_form.scss +8 -0
  94. data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_votation-progress.scss +100 -0
  95. data/app/packs/stylesheets/decidim/lausanne/budgets/budget/_voting-rules.scss +20 -0
  96. data/app/permissions/decidim/lausanne/budgets/admin/permissions.rb +49 -0
  97. data/app/permissions/decidim/lausanne/budgets/permissions.rb +63 -0
  98. data/app/presenters/decidim/lausanne/budgets/admin_log/budget_presenter.rb +44 -0
  99. data/app/presenters/decidim/lausanne/budgets/admin_log/project_presenter.rb +44 -0
  100. data/app/queries/decidim/lausanne/budgets/filtered_projects.rb +47 -0
  101. data/app/queries/decidim/lausanne/budgets/metrics/budget_followers_metric_measure.rb +34 -0
  102. data/app/queries/decidim/lausanne/budgets/metrics/budget_participants_metric_measure.rb +29 -0
  103. data/app/queries/decidim/lausanne/budgets/query.rb +16 -0
  104. data/app/serializers/decidim/lausanne/budgets/data_portability_budgets_order_serializer.rb +46 -0
  105. data/app/services/decidim/lausanne/budgets/project_search.rb +65 -0
  106. data/app/services/decidim/lausanne/budgets/project_search_rs.rb +13 -0
  107. data/app/views/decidim/lausanne/budgets/admin/lausanne_budgets/_form.html.erb +23 -0
  108. data/app/views/decidim/lausanne/budgets/admin/lausanne_budgets/edit.html.erb +7 -0
  109. data/app/views/decidim/lausanne/budgets/admin/lausanne_budgets/index.html.erb +75 -0
  110. data/app/views/decidim/lausanne/budgets/admin/lausanne_budgets/new.html.erb +7 -0
  111. data/app/views/decidim/lausanne/budgets/admin/projects/_form.html.erb +47 -0
  112. data/app/views/decidim/lausanne/budgets/admin/projects/edit.html.erb +7 -0
  113. data/app/views/decidim/lausanne/budgets/admin/projects/index.html.erb +82 -0
  114. data/app/views/decidim/lausanne/budgets/admin/projects/new.html.erb +7 -0
  115. data/app/views/decidim/lausanne/budgets/admin/projects/proposals_picker.html.erb +1 -0
  116. data/app/views/decidim/lausanne/budgets/admin/proposals_imports/new.html.erb +32 -0
  117. data/app/views/decidim/lausanne/budgets/lausanne_budgets/index.html.erb +5 -0
  118. data/app/views/decidim/lausanne/budgets/line_items/update_budget.js.erb +41 -0
  119. data/app/views/decidim/lausanne/budgets/order_summary_mailer/order_summary.html.erb +22 -0
  120. data/app/views/decidim/lausanne/budgets/orders/show.html.erb +71 -0
  121. data/app/views/decidim/lausanne/budgets/projects/_budget_confirm.html.erb +37 -0
  122. data/app/views/decidim/lausanne/budgets/projects/_budget_excess.html.erb +14 -0
  123. data/app/views/decidim/lausanne/budgets/projects/_budget_summary.html.erb +95 -0
  124. data/app/views/decidim/lausanne/budgets/projects/_count.html.erb +1 -0
  125. data/app/views/decidim/lausanne/budgets/projects/_filters.html.erb +34 -0
  126. data/app/views/decidim/lausanne/budgets/projects/_filters_small_view.html.erb +18 -0
  127. data/app/views/decidim/lausanne/budgets/projects/_linked_projects.html.erb +12 -0
  128. data/app/views/decidim/lausanne/budgets/projects/_order_progress.html.erb +32 -0
  129. data/app/views/decidim/lausanne/budgets/projects/_order_selected_projects.html.erb +27 -0
  130. data/app/views/decidim/lausanne/budgets/projects/_order_total_budget.html.erb +7 -0
  131. data/app/views/decidim/lausanne/budgets/projects/_project.html.erb +1 -0
  132. data/app/views/decidim/lausanne/budgets/projects/_project_budget_button.html.erb +46 -0
  133. data/app/views/decidim/lausanne/budgets/projects/_projects.html.erb +13 -0
  134. data/app/views/decidim/lausanne/budgets/projects/_user_record_form.html.erb +40 -0
  135. data/app/views/decidim/lausanne/budgets/projects/_votation_banner.html.erb +71 -0
  136. data/app/views/decidim/lausanne/budgets/projects/index.html.erb +36 -0
  137. data/app/views/decidim/lausanne/budgets/projects/index.js.erb +10 -0
  138. data/app/views/decidim/lausanne/budgets/projects/show.html.erb +81 -0
  139. data/app/views/decidim/lausanne/budgets/user_records/edit.html.erb +6 -0
  140. data/app/views/decidim/proposals/proposals/show.html.erb +172 -0
  141. data/app/views/layouts/lausanne_budgets/print.erb +12 -0
  142. data/config/assets.rb +11 -0
  143. data/config/initializers/social_share.rb +3 -0
  144. data/config/locales/fr.yml +381 -0
  145. data/config/routes.rb +7 -0
  146. data/db/migrate/20170127114122_create_lausanne_projects.rb +15 -0
  147. data/db/migrate/20170127114123_create_lausanne_user_records.rb +14 -0
  148. data/db/migrate/20170130095615_create_lausanne_orders.rb +16 -0
  149. data/db/migrate/20170130101825_create_lausanne_line_items.rb +12 -0
  150. data/db/migrate/20170215132708_add_lausanne_reference_to_projects.rb +13 -0
  151. data/db/migrate/20200617105120_create_decidim_lausanne_budgets.rb +15 -0
  152. data/db/migrate/20200629134013_add_lausanne_budget_reference_to_project.rb +7 -0
  153. data/db/migrate/20200706142609_add_lausanne_budget_reference_to_order.rb +7 -0
  154. data/db/migrate/20200714103519_move_lausanne_budgets_to_own_model.rb +109 -0
  155. data/db/migrate/20200717140012_add_lausanne_scope_to_budgets.rb +7 -0
  156. data/db/migrate/20200728075039_add_lausanne_selected_at_to_project.rb +7 -0
  157. data/db/migrate/20200804175222_lausanne_votes_enabled_to_votes_choices.rb +35 -0
  158. data/db/migrate/20200827154129_add_lausanne_commentable_counter_cache_to_projects.rb +9 -0
  159. data/db/migrate/20210310120613_add_lausanne_followable_counter_cache_to_budgets.rb +16 -0
  160. data/db/migrate/20210508180613_add_checkboxes_to_user_record.rb +9 -0
  161. data/db/migrate/20221001151237_add_excerpt_to_decidim_lausanne_budgets_project.rb +7 -0
  162. data/lib/decidim/lausanne/budgets/admin.rb +12 -0
  163. data/lib/decidim/lausanne/budgets/admin_engine.rb +40 -0
  164. data/lib/decidim/lausanne/budgets/component.rb +107 -0
  165. data/lib/decidim/lausanne/budgets/current_user_record_middleware.rb +17 -0
  166. data/lib/decidim/lausanne/budgets/engine.rb +57 -0
  167. data/lib/decidim/lausanne/budgets/project_serializer.rb +83 -0
  168. data/lib/decidim/lausanne/budgets/seeds/Exampledocument.pdf +0 -0
  169. data/lib/decidim/lausanne/budgets/seeds/city.jpeg +0 -0
  170. data/lib/decidim/lausanne/budgets/test/factories.rb +169 -0
  171. data/lib/decidim/lausanne/budgets/version.rb +15 -0
  172. data/lib/decidim/lausanne/budgets/workflows/all.rb +22 -0
  173. data/lib/decidim/lausanne/budgets/workflows/base.rb +140 -0
  174. data/lib/decidim/lausanne/budgets/workflows/one.rb +35 -0
  175. data/lib/decidim/lausanne/budgets/workflows.rb +19 -0
  176. data/lib/decidim/lausanne/budgets.rb +17 -0
  177. metadata +372 -0
@@ -0,0 +1,95 @@
1
+ <p>
2
+ <%= translated_attribute(current_settings.more_information_modal).presence %>
3
+ </p>
4
+ <% if (hide_user_record && !user_record_submitted?) || (!hide_user_record) %>
5
+ <div class="row column voting-rules">
6
+ <div class="callout <%= current_order_checked_out? ? "success" : "secondary" %>">
7
+ <div class="row">
8
+ <div class="columns medium-8 large-9">
9
+ <% if current_order_checked_out? %>
10
+ <h3 class="heading3">
11
+ <%= t(".checked_out_sucess") %>
12
+ </h3>
13
+ <div style="display: flex; gap: 1rem;align-items: center;">
14
+ <%= button_to(
15
+ t("decidim.lausanne.budgets.projects.banner.cancel_order", count: current_order.total_projects),
16
+ lausanne_budget_order_path(current_user_record.budget),
17
+ method: :delete,
18
+ data: {
19
+ disable: true,
20
+ budget: current_user_record.budget,
21
+ "redirect-url": lausanne_budget_path(current_user_record.budget)
22
+ },
23
+ disabled: current_order.total_projects == 0,
24
+ class: "link secondary small",
25
+ style: "margin-bottom: 0"
26
+ ) %>
27
+ <%= link_to(
28
+ t("decidim.lausanne.budgets.projects.banner.confirmation", count: current_order.total_projects),
29
+ lausanne_budget_order_path(current_user_record.budget),
30
+ target: "_blank",
31
+ style: "margin-bottom: 0",
32
+ class: "primary small"
33
+ ) %>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ <div class="row column voting-rules">
40
+ <div class="callout secondary">
41
+ <div>
42
+ <div>
43
+ <div>
44
+ <% elsif display_rules? %>
45
+ <h3 class="heading3">
46
+ <%= t(".rules.title") %>
47
+ </h3>
48
+ <ul>
49
+ <%= raw current_rule_explanation %>
50
+ <%= raw t(".rules.extra_rule") %>
51
+ </ul>
52
+ <% end %>
53
+ <% if user_record_submitted? && !hide_user_record.present? %>
54
+ <h3 class="heading6">
55
+ <%= t(".user_record") %>
56
+ </h3>
57
+ <dl>
58
+ <dt><%= t("activemodel.attributes.user_record.first_name") %></dt>
59
+ <dd><%= current_user_record.first_name %></dd>
60
+ <dt><%= t("activemodel.attributes.user_record.last_name") %></dt>
61
+ <dd><%= current_user_record.last_name %></dd>
62
+ <dt><%= t("activemodel.attributes.user_record.birthdate") %></dt>
63
+ <dd><%= current_user_record.birthdate %></dd>
64
+ </dl>
65
+ <% if current_user && !voting_finished? %>
66
+ <button class="link secondary small" data-toggle="userRecord">
67
+ <%= t(".update_user_record") %>
68
+ </button>
69
+ <% end %>
70
+ <% if !current_user && current_order_checked_out? %>
71
+ <div style="display: flex; gap: 1rem">
72
+ <%= button_to(
73
+ t("decidim.lausanne.budgets.projects.banner.terminate_session", count: current_order.total_projects),
74
+ lausanne_budget_user_record_path(lausanne_budget_id: current_user_record.budget.id, id: current_user_record.id),
75
+ method: :delete,
76
+ data: {
77
+ disable: true,
78
+ },
79
+ class: "secondary small"
80
+ ) %>
81
+ </div>
82
+ <% end %>
83
+ <% else %>
84
+ <button class="button primary small" data-toggle="userRecord">
85
+ <%= t(".start_voting") %>
86
+ </button>
87
+ <% end %>
88
+ </div>
89
+ </div>
90
+ </div>
91
+ </div>
92
+ <% end %>
93
+
94
+ <%= render partial: "decidim/lausanne/budgets/projects/budget_excess" %>
95
+ <%= render partial: "decidim/lausanne/budgets/projects/budget_confirm" %>
@@ -0,0 +1 @@
1
+ <%= t(".projects_count", count: projects.total_count) %>
@@ -0,0 +1,34 @@
1
+ <%= render partial: "decidim/shared/filter_form_help", locals: { skip_to_id: "projects" } %>
2
+
3
+ <%= filter_form_for filter do |form| %>
4
+ <div class="filters__section">
5
+ <div class="filters__search">
6
+ <div class="input-group">
7
+ <% if Decidim.version.to_f >= 0.27 %>
8
+ <%= form.search_field :title_or_description_cont, label: false, class: "input-group-field", placeholder: t(".search"), title: t(".search"), data: { disable_dynamic_change: true } %>
9
+ <% else %>
10
+ <%= form.search_field :search_text, label: false, class: "input-group-field", placeholder: t(".search"), title: t(".search"), data: { disable_dynamic_change: true } %>
11
+ <% end %>
12
+ <div class="input-group-button">
13
+ <button type="submit" class="button" aria-controls="projects">
14
+ <%= icon "magnifying-glass", aria_label: t(".search"), role: "img", "aria-hidden": true %>
15
+ </button>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ </div>
20
+
21
+ <% if voting_finished? %>
22
+ <%= form.check_boxes_tree :status, filter_status_values, legend_title: t(".status"), "aria-controls": "projects" %>
23
+ <% end %>
24
+
25
+ <% if current_component.has_subscopes? %>
26
+ <%= form.check_boxes_tree :scope_id, resource_filter_scope_values(budget.scope), legend_title: t(".scope"), "aria-controls": "projects" %>
27
+ <% end %>
28
+
29
+ <% if current_participatory_space.categories.any? %>
30
+ <%= form.check_boxes_tree :category_id, filter_categories_values, legend_title: t(".category"), "aria-controls": "projects" %>
31
+ <% end %>
32
+
33
+ <%= hidden_field_tag :order, order, id: nil, class: "order_filter" %>
34
+ <% end %>
@@ -0,0 +1,18 @@
1
+ <div class="filters-controls hide-for-mediumlarge">
2
+ <button data-open="filter-box" class="filters-controls__trigger">
3
+ <%= t ".filter" %>
4
+ <%= icon "caret-bottom", class: "icon--small float-right", aria_label: t(".unfold"), role: "img" %>
5
+ </button>
6
+ </div>
7
+
8
+ <div class="reveal" id="filter-box" data-reveal>
9
+ <div class="reveal__header">
10
+ <h3 class="reveal__title"><%= t ".filter_by" %>:</h3>
11
+ <button class="close-button" data-close aria-label="<%= t(".close_modal") %>" type="button">
12
+ <span aria-hidden="true">&times;</span>
13
+ </button>
14
+ </div>
15
+ <div class="filters">
16
+ <%= render partial: "decidim/lausanne/budgets/projects/filters", locals: { type: :small } %>
17
+ </div>
18
+ </div>
@@ -0,0 +1,12 @@
1
+ <div class="card card--action card--list">
2
+ <% resources.each do |project| %>
3
+ <div class="card--list__item">
4
+ <%= icon "actions", class: "card--list__icon", role: "img", "aria-hidden": true, remove_icon_class: true %>
5
+ <%= link_to resource_locator([project.budget, project]).path, class: "card--list__text card__link card__link--block" do %>
6
+ <h5 class="card--list__heading">
7
+ <%= translated_attribute(project.title) %>
8
+ </h5>
9
+ <% end %>
10
+ </div>
11
+ <% end %>
12
+ </div>
@@ -0,0 +1,32 @@
1
+ <div id="order-progress">
2
+ <div class="budget-summary__progressbox" data-current-allocation="<%= current_order ? current_order.total : 0 %>">
3
+ <div class="progress budget-progress" role="progressbar" aria-valuenow="<%= current_order_budget_percent %>" aria-valuetext="<%= current_order_budget_percent %>%" aria-valuemin="0" aria-valuemax="100">
4
+ <div class="progress-meter progress-meter--minimum" style="width: <%= current_order_budget_percent_minimum %>%"></div>
5
+ <!--Change width and text dynamically.-->
6
+ <div class="progress-meter budget-progress__meter" style="width: <%= current_order_budget_percent %>%">
7
+ <span class="progress-meter-text progress-meter-text--right"><%= current_order_budget_percent %>%</span>
8
+ </div>
9
+ </div>
10
+ <% if !current_order_checked_out? && voting_open? %>
11
+ <button class="button small button--sc" data-toggle="budget-confirm" <%= budget_confirm_disabled_attr %>>
12
+ <%= t(".vote") %>
13
+ </button>
14
+ <% end %>
15
+ </div>
16
+
17
+ <div class="progressbox-fixed-wrapper" data-progressbox-fixed>
18
+ <div class="budget-summary__progressbox budget-summary__progressbox--fixed">
19
+ <div class="progress budget-progress budget-progress--fixed" role="progressbar" aria-valuenow="<%= current_order_budget_percent %>" aria-valuetext="<%= current_order_budget_percent %>%" aria-valuemin="0" aria-valuemax="100">
20
+ <div class="progress-meter progress-meter--minimum" style="width: <%= current_order_budget_percent_minimum %>%"></div>
21
+ <div class="progress-meter budget-progress__meter" style="width: <%= current_order_budget_percent %>%">
22
+ <span class="progress-meter-text progress-meter-text--right"><%= current_order_budget_percent %>%</span>
23
+ </div>
24
+ </div>
25
+ <% if !current_order_checked_out? && voting_open? %>
26
+ <button class="button small button--sc" data-toggle="budget-confirm" <%= budget_confirm_disabled_attr %>>
27
+ <%= t(".vote") %>
28
+ </button>
29
+ <% end %>
30
+ </div>
31
+ </div>
32
+ </div>
@@ -0,0 +1,27 @@
1
+ <div id="order-selected-projects">
2
+ <% if current_order&.projects&.any? %>
3
+ <div class="card__content budget-summary__selected">
4
+ <button data-toggle="reveal-selected">
5
+ <strong><%= current_order.projects.size %> </strong><%= t(".selected_projects", count: current_order.projects.size) %>
6
+ <%= icon("caret-bottom", class:"icon--small", aria_label: t(".view"), role: "img") %>
7
+ </button>
8
+ <div id="reveal-selected" class="hide" data-toggler=".hide">
9
+ <ul class="budget-summary__selected-list">
10
+ <% current_order.projects.each do |project| %>
11
+ <li class="budget-summary__selected-item">
12
+ <%= link_to translated_attribute(project.title), resource_locator([budget, project]).path %>
13
+ <strong class="budget-summary__selected-number">
14
+ <%= budget_to_currency project.budget_amount %>
15
+ </strong>
16
+ <% unless current_order_checked_out? %>
17
+ <%= button_to lausanne_budget_order_line_item_path(project_id: project), method: :delete, remote: true, data: { disable: true }, form: { style: "display: inline" } do %>
18
+ <%= icon("trash", aria_label: t(".remove"), role: "img") %>
19
+ <% end %>
20
+ <% end %>
21
+ </li>
22
+ <% end %>
23
+ </ul>
24
+ </div>
25
+ </div>
26
+ <% end %>
27
+ </div>
@@ -0,0 +1,7 @@
1
+ <strong id="order-total-budget" class="mini-title__strong">
2
+ <% if current_order.projects_rule? %>
3
+ <%= current_order.projects.count %> / <%= current_order.maximum_projects %>
4
+ <% else %>
5
+ <%= budget_to_currency current_order&.total_budget.to_f %>
6
+ <% end %>
7
+ </strong>
@@ -0,0 +1 @@
1
+ <%= cell "decidim/lausanne/budgets/project_list_item", project %>
@@ -0,0 +1,46 @@
1
+ <div id="project-<%= project.id %>-budget-button">
2
+ <% if voted_for?(project) %>
3
+ <%= button_to(
4
+ t(".added"),
5
+ lausanne_budget_order_line_item_path(budget, project_id: project),
6
+ method: :delete,
7
+ remote: true,
8
+ data: {
9
+ disable: true,
10
+ budget: project.budget_amount,
11
+ "redirect-url": lausanne_budget_project_path(budget, project)
12
+ },
13
+ disabled: !can_have_order? || current_order_checked_out?,
14
+ class: "button expanded button--sc success",
15
+ "aria-label": t(".added_descriptive", resource_name: translated_attribute(project.title))
16
+ ) %>
17
+ <% else %>
18
+ <% if user_record_for_budget? %>
19
+ <% if user_record_submitted? %>
20
+ <%= button_to(
21
+ t(".add"),
22
+ lausanne_budget_order_line_item_path(budget, project_id: project),
23
+ remote: true,
24
+ method: :post,
25
+ data: {
26
+ disable: true,
27
+ budget: project.budget_amount,
28
+ add: true,
29
+ "redirect-url": lausanne_budget_project_path(budget, project)
30
+ },
31
+ disabled: !can_have_order? || current_order_checked_out?,
32
+ class: "button expanded button--sc",
33
+ "aria-label": t(".add_descriptive", resource_name: translated_attribute(project.title))
34
+ ) %>
35
+ <% else %>
36
+ <button class="button expanded button--sc disabled" data-toggle="userRecord">
37
+ <%= t(".add") %>
38
+ </button>
39
+ <% end %>
40
+ <% else %>
41
+ <button class="button expanded button--sc disabled" data-toggle="userRecord" >
42
+ <%= t(".add") %>
43
+ </button>
44
+ <% end %>
45
+ <% end %>
46
+ </div>
@@ -0,0 +1,13 @@
1
+ <div class="collection-sort-controls row small-up-1 medium-up-3 card-grid">
2
+ <div class="column">
3
+ <%= order_selector available_orders, i18n_scope: "decidim.lausanne.budgets.projects.orders" %>
4
+ </div>
5
+ </div>
6
+
7
+ <div class="budget-list">
8
+ <% projects.each do |project| %>
9
+ <%= render partial: "decidim/lausanne/budgets/projects/project", locals: { project: project } %>
10
+ <% end %>
11
+ </div>
12
+
13
+ <%= decidim_paginate projects %>
@@ -0,0 +1,40 @@
1
+ <div class="reveal" id="userRecord" data-reveal>
2
+ <div class="reveal__header">
3
+ <h3 class="reveal__title"><%= t(".title") %></h3>
4
+ <h4 class="reveal__subtitle"><%= translated_attribute(budget.title) %></h4>
5
+ <button class="close-button" data-close aria-label="<%= t(".close") %>" type="button">
6
+ <span aria-hidden="true">&times;</span>
7
+ </button>
8
+ </div>
9
+ <div class="user_record_form">
10
+ <%= decidim_form_for([budget, @user_record_form], html: { class: "form edit_budget" }) do |form| %>
11
+ <% unless @user_record_form.errors.empty? %>
12
+ <div class="callout small alert">
13
+ <h5>Impossible d'effectuer l'opération</h5>
14
+ <p>Vous avez déjà soumis votre vote.</p>
15
+ </div>
16
+ <% end %>
17
+ <div class="row column">
18
+ <div class="fields">
19
+ <%= form.text_field :first_name %>
20
+ <%= form.text_field :last_name %>
21
+ <%= form.text_field :birthdate %>
22
+ <blockquote style="background:white;padding:0.2rem">
23
+ <%= raw t(".explanations") %>
24
+ </blockquote>
25
+ <%= form.check_box :allow_process_data, required: true %>
26
+ <%= form.check_box :its_me, required: true %>
27
+ <%= form.check_box :iam_lausanne, required: true %>
28
+ </div>
29
+
30
+ <div class="actions">
31
+ <div class="button--double form-general-submit">
32
+ <%= form.submit "Enregistrer et commencer à voter" %>
33
+ </div>
34
+ </div>
35
+ </div>
36
+
37
+ <% end %>
38
+
39
+ </div>
40
+ </div>
@@ -0,0 +1,71 @@
1
+ <div id="VotationBanner" class="votation_banner <%= "votation_banner--checked_out" if current_order_checked_out? %>">
2
+ <% if current_order_checked_out? %>
3
+ <div class="votation_banner__header">
4
+ <h3 class="votation_banner__title heading6">
5
+ <%= t("decidim.lausanne.budgets.projects.banner.checked_out.title") %>
6
+ </h3>
7
+ </div>
8
+ <div class="votation_banner__actions">
9
+ <%= button_to(
10
+ t("decidim.lausanne.budgets.projects.banner.cancel_order", count: current_order.total_projects),
11
+ lausanne_budget_order_path(current_user_record.budget),
12
+ method: :delete,
13
+ data: {
14
+ disable: true,
15
+ budget: current_user_record.budget,
16
+ "redirect-url": lausanne_budget_path(current_user_record.budget)
17
+ },
18
+ disabled: current_order.total_projects == 0,
19
+ class: "button secondary hollow small"
20
+ ) %>
21
+ <%= link_to(
22
+ t("decidim.lausanne.budgets.projects.banner.confirmation", count: current_order.total_projects),
23
+ lausanne_budget_order_path(current_user_record.budget),
24
+ target: "_blank",
25
+ style: "margin-bottom: 0",
26
+ class: "button small"
27
+ ) %>
28
+ </div>
29
+ <% else %>
30
+ <% if user_record_submitted? %>
31
+ <div class="votation_banner__header">
32
+ <h3 class="votation_banner__title">
33
+ <%= t("decidim.lausanne.budgets.projects.banner.pending_order") %>
34
+ <div class="votation_banner__helptext">
35
+ <%= current_rule_explanation("banner") %>
36
+ </div>
37
+ </h3>
38
+ </div>
39
+ <div class="votation_banner__actions">
40
+ <%= button_to(
41
+ t("decidim.lausanne.budgets.projects.banner.cancel_order", count: current_order.total_projects),
42
+ lausanne_budget_order_path(current_user_record.budget),
43
+ method: :delete,
44
+ data: {
45
+ disable: true,
46
+ budget: current_user_record.budget,
47
+ "redirect-url": lausanne_budget_path(current_user_record.budget)
48
+ },
49
+ disabled: current_order.total_projects == 0,
50
+ class: "button secondary hollow small"
51
+ ) %>
52
+ <button data-toggle="budget-confirm" class="button primary small" <%= budget_confirm_disabled_attr %>>
53
+ <%= t("decidim.lausanne.budgets.projects.banner.finalize") %>
54
+ </button>
55
+ </div>
56
+ <% else %>
57
+ <div class="votation_banner__header">
58
+ <h3 class="votation_banner__title">
59
+ <div class="votation_banner__helptext">
60
+ <%= t("decidim.lausanne.budgets.projects.banner.user_data_help") %>
61
+ </div>
62
+ </h3>
63
+ </div>
64
+ <div class="votation_banner__actions">
65
+ <button class="button primary small" data-toggle="userRecord">
66
+ <%= t("decidim.lausanne.budgets.projects.banner.user_data_action") %>
67
+ </button>
68
+ </div>
69
+ <% end %>
70
+ <% end %>
71
+ </div>
@@ -0,0 +1,36 @@
1
+ <%= render partial: "decidim/shared/component_announcement" %>
2
+ <%= render partial: "decidim/lausanne/budgets/projects/votation_banner" %>
3
+
4
+ <%= cell("decidim/lausanne/budgets/limit_announcement", budget) %>
5
+
6
+ <div class="row columns">
7
+ <% if voting_finished? %>
8
+ <h2 class="heading2">
9
+ <%= t("decidim.lausanne_budgets.projects.projects_for", name: translated_attribute(budget.title)) %>
10
+ </h2>
11
+ <% else %>
12
+ <%= render partial: "decidim/lausanne/budgets/projects/budget_summary", locals: { include_heading: true, hide_user_record: false} %>
13
+ <% end %>
14
+ </div>
15
+
16
+ <div class="row columns">
17
+ <h3 class="section-heading">
18
+ <%= render partial: "decidim/lausanne/budgets/projects/count" %>
19
+ </h3>
20
+ </div>
21
+
22
+ <div class="row">
23
+ <div class="columns mediumlarge-4 large-3">
24
+ <%= render partial: "decidim/lausanne/budgets/projects/filters_small_view" %>
25
+ <div class="card card--secondary show-for-mediumlarge">
26
+ <%= render partial: "decidim/lausanne/budgets/projects/filters" %>
27
+ </div>
28
+ </div>
29
+ <div id="projects" class="columns mediumlarge-8 large-9" aria-live="polite">
30
+ <%= render partial: "decidim/lausanne/budgets/projects/projects" %>
31
+ </div>
32
+ </div>
33
+ <%= render partial: "decidim/lausanne/budgets/projects/user_record_form" %>
34
+
35
+ <%= javascript_include_tag("decidim/filters") %>
36
+ <%= javascript_include_tag("decidim/lausanne/budgets/projects") %>
@@ -0,0 +1,10 @@
1
+ var $projects = $('#projects');
2
+ var $projectsCount = $('#projects-count');
3
+ var $orderFilterInput = $('.order_filter');
4
+
5
+ $projects.html('<%= j(render partial: "projects").strip.html_safe %>');
6
+ $projectsCount.html('<%= j(render partial: "count").strip.html_safe %>');
7
+ $orderFilterInput.val('<%= order %>');
8
+
9
+ var $dropdownMenu = $('.dropdown.menu', $projects);
10
+ $dropdownMenu.foundation();
@@ -0,0 +1,81 @@
1
+ <%= render partial: "decidim/lausanne/budgets/projects/votation_banner" %>
2
+ <% add_decidim_meta_tags(
3
+ title: translated_attribute(project.title),
4
+ description: translated_attribute(project.description)
5
+ ) %>
6
+
7
+ <%
8
+ edit_link(
9
+ resource_locator([project.budget, project]).edit,
10
+ :update,
11
+ :project,
12
+ project: project
13
+ )
14
+ %>
15
+
16
+ <%= render partial: "decidim/budgets/projects/exit_modal", locals: {budget_projects_path: resource_locator([project.budget, project]).index } %>
17
+ <%= cell("decidim/budgets/limit_announcement", budget) %>
18
+
19
+ <div class="row column view-header">
20
+ <% unless voting_finished? %>
21
+ <%= render partial: "decidim/lausanne/budgets/projects/budget_summary", locals: { include_heading: false, hide_user_record: true } %>
22
+ <% end %>
23
+
24
+ <div class="m-bottom">
25
+ <%= link_to resource_locator(budget).index, class: "muted-link js-back-to-list" do %>
26
+ <%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %>
27
+ <%= t(".view_all_projects") %>
28
+ <% end %>
29
+
30
+ </div>
31
+ <h2 class="heading2"><%= translated_attribute project.title %></h2>
32
+ </div>
33
+ <div class="row">
34
+ <div id="project" class="columns section view-side mediumlarge-4 mediumlarge-push-8
35
+ large-3 large-push-9">
36
+ <div class="card extra">
37
+ <div class="card__content">
38
+ <div class="m-bottom">
39
+ <span class="definition-data__title"><%= t(".budget") %></span>
40
+ <span class="definition-data__number"><%= budget_to_currency project.budget_amount %></span>
41
+ </div>
42
+
43
+ <%= cell("decidim/lausanne/budgets/project_votes_count", project, layout: :one_line, class: "display-block") %>
44
+
45
+ <% if voting_finished? %>
46
+ <%= cell("decidim/lausanne/budgets/project_voted_hint", project, class: "display-block") %>
47
+ <% elsif voting_open? %>
48
+ <%= render partial: "decidim/lausanne/budgets/projects/project_budget_button", locals: { project: project } %>
49
+ <% end %>
50
+
51
+ <%= render partial: "decidim/shared/follow_button", locals: { followable: project, large: false } %>
52
+ </div>
53
+ </div>
54
+ <div class="shares">
55
+ <%= social_share_button_tag(
56
+ "#{translated_attribute(project.title)}: les votes sont ouverts!",
57
+ url: lausanne_budget_project_url(project.budget, project),
58
+ desc: escape_once(strip_tags(decidim_sanitize(translated_attribute(project.description)))),
59
+ allow_sites: %w(whatsapp_app facebook twitter email)
60
+ ) %>
61
+ </div>
62
+
63
+ <%= resource_reference(project) %>
64
+ </div>
65
+ <div class="columns mediumlarge-8 mediumlarge-pull-4">
66
+ <div class="section">
67
+ <%= cell("decidim/lausanne/budgets/project_selected_status", project, as_label: true) %>
68
+ <%= decidim_sanitize translated_attribute project.description %>
69
+
70
+ <%= cell "decidim/lausanne/budgets/project_tags", project, context: { extra_classes: ["tags--project"] } %>
71
+ </div>
72
+ <%= linked_resources_for project, :proposals, "included_proposals" %>
73
+ <%= linked_resources_for project, :results, "included_projects" %>
74
+ </div>
75
+ </div>
76
+
77
+ <%= comments_for project %>
78
+ <%= render partial: "decidim/lausanne/budgets/projects/user_record_form" %>
79
+
80
+ <%= attachments_for project %>
81
+ <%= javascript_pack_tag "decidim_lausanne_budgets" %>
@@ -0,0 +1,6 @@
1
+ <%= render template: "decidim/lausanne/budgets/projects/index" %>
2
+ <script type="text/javascript">
3
+ $(function(){
4
+ $('#userRecord').foundation('open');
5
+ });
6
+ </script>