decidim-budgets 0.25.0.rc4 → 0.26.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/decidim/budgets/budget/_budget-vote-button.scss +22 -0
  3. data/app/cells/decidim/budgets/budget_information_modal/show.erb +3 -3
  4. data/app/cells/decidim/budgets/budget_list_item/show.erb +31 -15
  5. data/app/cells/decidim/budgets/budget_list_item_cell.rb +30 -1
  6. data/app/cells/decidim/budgets/budgets_header/show.erb +1 -1
  7. data/app/cells/decidim/budgets/budgets_list/card_list.erb +17 -6
  8. data/app/cells/decidim/budgets/budgets_list/show.erb +2 -3
  9. data/app/cells/decidim/budgets/budgets_list/voted.erb +6 -0
  10. data/app/cells/decidim/budgets/project_list_item/project_data.erb +1 -1
  11. data/app/cells/decidim/budgets/{project_list_item/project_data_vote_button.erb → project_vote_button/show.erb} +1 -0
  12. data/app/cells/decidim/budgets/project_vote_button_cell.rb +10 -0
  13. data/app/commands/decidim/budgets/add_line_item.rb +5 -1
  14. data/app/controllers/concerns/decidim/budgets/admin/filterable.rb +51 -0
  15. data/app/controllers/decidim/budgets/admin/projects_controller.rb +6 -1
  16. data/app/controllers/decidim/budgets/line_items_controller.rb +2 -2
  17. data/app/helpers/decidim/budgets/admin/filterable_helper.rb +10 -0
  18. data/app/models/decidim/budgets/project.rb +28 -1
  19. data/app/packs/entrypoints/decidim_budgets.js +1 -0
  20. data/app/packs/src/decidim/budgets/exit_handler.js +131 -0
  21. data/app/packs/src/decidim/budgets/projects.js +9 -39
  22. data/app/packs/stylesheets/decidim/budgets/budget/_budget-list.scss +35 -1
  23. data/app/views/decidim/budgets/admin/projects/index.html.erb +16 -5
  24. data/app/views/decidim/budgets/projects/_exit_modal.html.erb +22 -0
  25. data/app/views/decidim/budgets/projects/_filters_small_view.html.erb +3 -3
  26. data/app/views/decidim/budgets/projects/_project_budget_button.html.erb +17 -38
  27. data/app/views/decidim/budgets/projects/index.html.erb +25 -22
  28. data/app/views/decidim/budgets/projects/show.html.erb +42 -39
  29. data/config/locales/ca.yml +4 -0
  30. data/config/locales/cs.yml +24 -0
  31. data/config/locales/de.yml +10 -0
  32. data/config/locales/el.yml +141 -1
  33. data/config/locales/en.yml +23 -0
  34. data/config/locales/es-MX.yml +1 -0
  35. data/config/locales/es-PY.yml +1 -0
  36. data/config/locales/es.yml +24 -0
  37. data/config/locales/eu.yml +166 -0
  38. data/config/locales/fi-plain.yml +24 -0
  39. data/config/locales/fi.yml +24 -0
  40. data/config/locales/fr-CA.yml +19 -0
  41. data/config/locales/fr.yml +19 -0
  42. data/config/locales/ga-IE.yml +91 -0
  43. data/config/locales/gl.yml +9 -0
  44. data/config/locales/it.yml +10 -0
  45. data/config/locales/ja.yml +29 -5
  46. data/config/locales/lb-LU.yml +294 -0
  47. data/config/locales/lb.yml +295 -0
  48. data/config/locales/nl.yml +18 -0
  49. data/config/locales/pl.yml +7 -0
  50. data/config/locales/pt-BR.yml +1 -1
  51. data/config/locales/pt.yml +143 -0
  52. data/config/locales/ro-RO.yml +127 -49
  53. data/config/locales/sv.yml +4 -0
  54. data/config/locales/val-ES.yml +1 -0
  55. data/lib/decidim/budgets/engine.rb +4 -0
  56. data/lib/decidim/budgets/version.rb +1 -1
  57. metadata +25 -18
  58. data/app/cells/decidim/budgets/budgets_list/highlighted.erb +0 -11
@@ -19,6 +19,26 @@
19
19
  border-bottom-right-radius: $card-border-radius;
20
20
  border-bottom: $border;
21
21
  }
22
+
23
+ &-cell{
24
+ display: grid;
25
+ grid-template-columns: 1fr 40px;
26
+
27
+ .budget-list__data{
28
+ grid-column: span 2;
29
+ background: none;
30
+ }
31
+
32
+ @include breakpoint(medium){
33
+ grid-template-columns: 1fr 40px 15em;
34
+ grid-template-rows: 1fr;
35
+
36
+ .budget-list__data{
37
+ background: $card-secondary-bg;
38
+ grid-column: 3;
39
+ }
40
+ }
41
+ }
22
42
  }
23
43
 
24
44
  &__image{
@@ -54,6 +74,11 @@
54
74
  padding: $card-padding;
55
75
  display: flex;
56
76
  align-items: center;
77
+
78
+ &.flex-horizontal{
79
+ flex-direction: column;
80
+ align-items: flex-start;
81
+ }
57
82
  }
58
83
 
59
84
  .card__text--status{
@@ -79,10 +104,19 @@
79
104
  min-width: 7rem;
80
105
  flex-direction: row;
81
106
  justify-content: flex-end;
82
- flex-basis: 12rem;
107
+ flex-basis: 14rem;
83
108
  padding: 1rem $card-padding;
84
109
  }
85
110
 
111
+ .loading-spinner{
112
+ margin: 0 !important;
113
+ position: relative;
114
+
115
+ &::before{
116
+ position: absolute;
117
+ }
118
+ }
119
+
86
120
  &:last-child{
87
121
  margin-bottom: 0;
88
122
  }
@@ -15,24 +15,36 @@
15
15
  </h2>
16
16
  </div>
17
17
 
18
+ <%= admin_filter_selector(:projects) %>
18
19
  <div class="card-section">
19
20
  <div class="table-scroll">
20
21
  <table class="table-list">
21
22
  <thead>
22
23
  <tr>
23
- <th><%= t("models.project.fields.title", scope: "decidim.budgets") %></th>
24
- <th><%= t("index.confirmed_orders_count") %></th>
25
- <th><%= t(".selected") %></th>
26
- <%= th_resource_scope_label %>
24
+ <th><%= sort_link(query, :id, t("models.project.fields.id", scope: "decidim.budgets"), default_order: :desc) %>
25
+ <th><%= sort_link(query, :title, t("models.project.fields.title", scope: "decidim.budgets")) %></th>
26
+ <th><%= sort_link(query, :category_name, t("models.project.fields.category", scope: "decidim.budgets") ) %></th>
27
+ <%= th_scope_sort_link %>
28
+ <th><%= sort_link(query, :confirmed_orders_count, t("index.confirmed_orders_count")) %></th>
29
+ <th><%= sort_link(query, :selected, t(".selected")) %></th>
27
30
  <th class="actions"><%= t("actions.title", scope: "decidim.budgets") %></th>
28
31
  </tr>
29
32
  </thead>
30
33
  <tbody>
31
34
  <% projects.each do |project| %>
32
35
  <tr data-id="<%= project.id %>">
36
+ <td>
37
+ <%= project.id %><br>
38
+ </td>
33
39
  <td>
34
40
  <%= translated_attribute(project.title) %><br>
35
41
  </td>
42
+ <td>
43
+ <% if project.category %>
44
+ <%= translated_attribute project.category.name %>
45
+ <% end %>
46
+ </td>
47
+ <%= td_resource_scope_for(project.scope) %>
36
48
  <td>
37
49
  <%= project.confirmed_orders_count %>
38
50
  </td>
@@ -43,7 +55,6 @@
43
55
  <%= content_tag :span, "×", class: "text-muted" %>
44
56
  <% end %>
45
57
  </td>
46
- <%= td_resource_scope_for(project.scope) %>
47
58
  <td class="table-list__actions">
48
59
  <%= icon_link_to "eye", resource_locator([budget, project]).path, t("actions.preview", scope: "decidim.budgets"), target: :blank, class: "action-icon--preview" %>
49
60
 
@@ -0,0 +1,22 @@
1
+ <% if current_user && current_component.current_settings.votes == "enabled" && !current_workflow.voted?(budget) %>
2
+ <div class="reveal" data-reveal id="exit-notification" role="dialog" aria-modal="true" aria-labelledby="exit-notification-label" aria-live="polite">
3
+ <div class="reveal__header">
4
+ <h3 id="exit-notification-label" class="reveal__title"><%= t(".title") %></h3>
5
+ <button class="close-button" data-close aria-label="<%= t(".close_modal") %>" type="button">
6
+ <span aria-hidden="true">&times;</span>
7
+ </button>
8
+ </div>
9
+ <div class="static__content text-center">
10
+ <p><%= t(".message") %></p>
11
+ </div>
12
+
13
+ <div class="row">
14
+ <div class="columns medium-8 medium-offset-2">
15
+ <button class="button primary expanded" data-close type="button">
16
+ <%= t(".cancel") %>
17
+ </button>
18
+ <%= link_to t(".exit"), budget_projects_path, id: "exit-notification-link", class: "button primary hollow expanded" %>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ <% end %>
@@ -1,13 +1,13 @@
1
1
  <div class="filters-controls hide-for-mediumlarge">
2
- <button data-open="filter-box" class="filters-controls__trigger">
2
+ <button data-open="filter-box" class="filters-controls__trigger" aria-controls="filter-box" aria-haspopup="dialog">
3
3
  <%= t ".filter" %>
4
4
  <%= icon "caret-bottom", class: "icon--small float-right", aria_label: t(".unfold"), role: "img" %>
5
5
  </button>
6
6
  </div>
7
7
 
8
- <div class="reveal" id="filter-box" data-reveal>
8
+ <div class="reveal" id="filter-box" data-reveal role="dialog" aria-modal="true" aria-labelledby="filter-box-label">
9
9
  <div class="reveal__header">
10
- <h3 class="reveal__title"><%= t ".filter_by" %>:</h3>
10
+ <h3 id="filter-box-label" class="reveal__title"><%= t ".filter_by" %>:</h3>
11
11
  <button class="close-button" data-close aria-label="<%= t(".close_modal") %>" type="button">
12
12
  <span aria-hidden="true">&times;</span>
13
13
  </button>
@@ -1,40 +1,19 @@
1
- <div id="project-<%= project.id %>-budget-button">
2
- <% if voted_for?(project) %>
3
- <%= action_authorized_button_to(
4
- "vote",
5
- t(".added"),
6
- budget_order_line_item_path(budget, project_id: project),
7
- method: :delete,
8
- remote: true,
9
- data: {
10
- disable: true,
11
- budget: project.budget_amount,
12
- "redirect-url": budget_project_path(budget, project)
13
- },
14
- disabled: !can_have_order? || current_order_checked_out?,
15
- class: "button expanded button--sc success",
16
- "aria-label": t(".added_descriptive", resource_name: translated_attribute(project.title))
17
- ) %>
18
- <% elsif current_user.present? %>
19
- <%= action_authorized_button_to(
20
- "vote",
21
- t(".add"),
22
- budget_order_line_item_path(budget, project_id: project),
23
- method: :post,
24
- remote: true,
25
- data: {
26
- disable: true,
27
- budget: project.budget_amount,
28
- add: true,
29
- "redirect-url": 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" data-toggle="loginModal">
1
+ <% if current_user.blank? %>
2
+ <div id="project-<%= project.id %>-budget-button">
3
+ <button class="button expanded primary button--sc"
4
+ data-toggle="loginModal"
5
+ aria-label="<%= t(".added_descriptive", resource_name: translated_attribute(project.title)) %>">
37
6
  <%= t(".add") %>
38
7
  </button>
39
- <% end %>
40
- </div>
8
+ </div>
9
+ <% else %>
10
+ <div id="project-<%= project.id %>-budget-button"
11
+ class="<%= "added" if voted_for?(project) %> button expanded primary button--sc budget-vote-button budget-list__data"
12
+ aria-label="<%= t(".#{voted_for?(project) ? ".added" : ".add"}_descriptive", resource_name: translated_attribute(project.title)) %>">
13
+ <span>
14
+ <%= t(voted_for?(project) ? ".added" : ".add") %>
15
+ </span>
16
+
17
+ <%= cell("decidim/budgets/project_vote_button", project) %>
18
+ </div>
19
+ <% end %>
@@ -1,32 +1,35 @@
1
1
  <%= render partial: "decidim/shared/component_announcement" %>
2
+ <%= render partial: "exit_modal" %>
2
3
 
3
4
  <%= cell("decidim/budgets/limit_announcement", budget) %>
4
5
 
5
- <div class="row columns">
6
- <% if voting_finished? %>
7
- <h2 class="heading2">
8
- <%= t("decidim.budgets.projects.projects_for", name: translated_attribute(budget.title)) %>
9
- </h2>
10
- <% else %>
11
- <%= render partial: "budget_summary", locals: { include_heading: true } %>
12
- <% end %>
13
- </div>
6
+ <div class="voting-wrapper">
7
+ <div class="row columns">
8
+ <% if voting_finished? %>
9
+ <h2 class="heading2">
10
+ <%= t("decidim.budgets.projects.projects_for", name: translated_attribute(budget.title)) %>
11
+ </h2>
12
+ <% else %>
13
+ <%= render partial: "budget_summary", locals: { include_heading: true } %>
14
+ <% end %>
15
+ </div>
14
16
 
15
- <div class="row columns">
16
- <h3 class="section-heading">
17
- <%= render partial: "count" %>
18
- </h3>
19
- </div>
17
+ <div class="row columns">
18
+ <h3 class="section-heading">
19
+ <%= render partial: "count" %>
20
+ </h3>
21
+ </div>
20
22
 
21
- <div class="row">
22
- <div class="columns mediumlarge-4 large-3">
23
- <%= render partial: "filters_small_view" %>
24
- <div class="card card--secondary show-for-mediumlarge">
25
- <%= render partial: "filters" %>
23
+ <div class="row">
24
+ <div class="columns mediumlarge-4 large-3">
25
+ <%= render partial: "filters_small_view" %>
26
+ <div class="card card--secondary show-for-mediumlarge">
27
+ <%= render partial: "filters" %>
28
+ </div>
29
+ </div>
30
+ <div id="projects" class="columns mediumlarge-8 large-9" aria-live="polite">
31
+ <%= render partial: "projects" %>
26
32
  </div>
27
- </div>
28
- <div id="projects" class="columns mediumlarge-8 large-9" aria-live="polite">
29
- <%= render partial: "projects" %>
30
33
  </div>
31
34
  </div>
32
35
 
@@ -12,57 +12,60 @@ edit_link(
12
12
  )
13
13
  %>
14
14
 
15
+ <%= render partial: "exit_modal" %>
15
16
  <%= cell("decidim/budgets/limit_announcement", budget) %>
16
17
 
17
- <div class="row column view-header">
18
- <% unless voting_finished? %>
19
- <%= render partial: "budget_summary", locals: { include_heading: false } %>
20
- <% end %>
21
-
22
- <div class="m-bottom">
23
- <%= link_to resource_locator(budget).path(filter_link_params), class: "muted-link" do %>
24
- <%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %>
25
- <%= t(".view_all_projects") %>
18
+ <div class="voting-wrapper">
19
+ <div class="row column view-header">
20
+ <% unless voting_finished? %>
21
+ <%= render partial: "budget_summary", locals: { include_heading: false } %>
26
22
  <% end %>
23
+
24
+ <div class="m-bottom">
25
+ <%= link_to resource_locator(budget).path(filter_link_params), class: "muted-link" do %>
26
+ <%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %>
27
+ <%= t(".view_all_projects") %>
28
+ <% end %>
29
+ </div>
30
+ <h2 class="heading2"><%= translated_attribute project.title %></h2>
27
31
  </div>
28
- <h2 class="heading2"><%= translated_attribute project.title %></h2>
29
- </div>
30
- <div class="row">
31
- <div id="project" class="columns section view-side mediumlarge-4 mediumlarge-push-8
32
- large-3 large-push-9">
33
- <div class="card extra">
34
- <div class="card__content">
35
- <div class="m-bottom">
36
- <span class="definition-data__title"><%= t(".budget") %></span>
37
- <span class="definition-data__number"><%= budget_to_currency project.budget_amount %></span>
38
- </div>
32
+ <div class="row">
33
+ <div id="project" class="columns section view-side mediumlarge-4 mediumlarge-push-8
34
+ large-3 large-push-9">
35
+ <div class="card extra">
36
+ <div class="card__content">
37
+ <div class="m-bottom">
38
+ <span class="definition-data__title"><%= t(".budget") %></span>
39
+ <span class="definition-data__number"><%= budget_to_currency project.budget_amount %></span>
40
+ </div>
39
41
 
40
- <%= cell("decidim/budgets/project_votes_count", project, layout: :one_line, class: "display-block") %>
42
+ <%= cell("decidim/budgets/project_votes_count", project, layout: :one_line, class: "display-block") %>
41
43
 
42
- <% if voting_finished? %>
43
- <%= cell("decidim/budgets/project_voted_hint", project, class: "display-block") %>
44
- <% elsif voting_open? %>
45
- <%= render partial: "project_budget_button", locals: { project: project } %>
46
- <% end %>
44
+ <% if voting_finished? %>
45
+ <%= cell("decidim/budgets/project_voted_hint", project, class: "display-block") %>
46
+ <% elsif voting_open? %>
47
+ <%= render partial: "project_budget_button", locals: { project: project } %>
48
+ <% end %>
47
49
 
48
- <%= render partial: "decidim/shared/follow_button", locals: { followable: project, large: false } %>
50
+ <%= render partial: "decidim/shared/follow_button", locals: { followable: project, large: false } %>
51
+ </div>
49
52
  </div>
53
+ <%= resource_reference(project) %>
54
+ <%= render partial: "decidim/shared/share_modal" %>
50
55
  </div>
51
- <%= resource_reference(project) %>
52
- <%= render partial: "decidim/shared/share_modal" %>
53
- </div>
54
- <div class="columns mediumlarge-8 mediumlarge-pull-4">
55
- <div class="section">
56
- <%= cell("decidim/budgets/project_selected_status", project, as_label: true) %>
57
- <%= decidim_sanitize translated_attribute project.description %>
58
- <%= cell "decidim/budgets/project_tags", project, context: { extra_classes: ["tags--project"] } %>
56
+ <div class="columns mediumlarge-8 mediumlarge-pull-4">
57
+ <div class="section">
58
+ <%= cell("decidim/budgets/project_selected_status", project, as_label: true) %>
59
+ <%= decidim_sanitize_editor translated_attribute project.description %>
60
+ <%= cell "decidim/budgets/project_tags", project, context: { extra_classes: ["tags--project"] } %>
61
+ </div>
62
+ <%= attachments_for project %>
63
+ <%= linked_resources_for project, :proposals, "included_proposals" %>
64
+ <%= linked_resources_for project, :results, "included_projects" %>
59
65
  </div>
60
- <%= attachments_for project %>
61
- <%= linked_resources_for project, :proposals, "included_proposals" %>
62
- <%= linked_resources_for project, :results, "included_projects" %>
63
66
  </div>
64
67
  </div>
65
68
 
66
- <%= comments_for project %>
69
+ <%= comments_for project, polymorphic: [project.budget] %>
67
70
 
68
71
  <%= javascript_pack_tag("decidim_budgets") %>
@@ -119,6 +119,9 @@ ca:
119
119
  highlighted_cta: Votar a %{name}
120
120
  if_change_opinion: Si has canviat d'opinió, pots
121
121
  my_budgets: Els meus pressupostos
122
+ progress: Acaba la votació
123
+ show: Mostra els projectes
124
+ vote: Vota
122
125
  voted_on: Has votat a %{links}
123
126
  limit_announcement:
124
127
  cant_vote: No pots votar a aquests pressupostos. <a href="%{landing_path}"> Prova amb un altre pressupost </a>.
@@ -233,6 +236,7 @@ ca:
233
236
  components:
234
237
  budgets:
235
238
  actions:
239
+ comment: Comentar
236
240
  vote: Vota
237
241
  name: Pressupostos
238
242
  settings:
@@ -23,6 +23,18 @@ cs:
23
23
  many: Projekty
24
24
  other: Projekty
25
25
  decidim:
26
+ admin:
27
+ filters:
28
+ projects:
29
+ category_id_eq:
30
+ label: Kategorie
31
+ scope_id_eq:
32
+ label: Oblast působnosti
33
+ selected_at_null:
34
+ label: Vybráno
35
+ values:
36
+ 'false': Vybráno pro implementaci
37
+ 'true': Nevybráno pro implementaci
26
38
  budgets:
27
39
  actions:
28
40
  attachment_collections: Složky
@@ -121,6 +133,9 @@ cs:
121
133
  highlighted_cta: Hlasovat na %{name}
122
134
  if_change_opinion: Pokud jste změnili názor, můžete
123
135
  my_budgets: Mé rozpočty
136
+ progress: Dokončit hlasování
137
+ show: Zobrazit projekty
138
+ vote: Hlasovat
124
139
  voted_on: Hlasovali jste pro %{links}
125
140
  limit_announcement:
126
141
  cant_vote: O tomto rozpočtu nelze hlasovat. <a href="%{landing_path}">Zkuste jiný rozpočet</a>.
@@ -133,6 +148,8 @@ cs:
133
148
  total_budget: Celkový rozpočet
134
149
  project:
135
150
  fields:
151
+ category: Kategorie
152
+ id: ID
136
153
  title: Titul
137
154
  order_summary_mailer:
138
155
  order_summary:
@@ -187,6 +204,12 @@ cs:
187
204
  few: "%{count} projektů"
188
205
  many: "%{count} projektů"
189
206
  other: "%{count} projektů"
207
+ exit_modal:
208
+ cancel: Návrat k hlasování
209
+ close_modal: Zavřít modal
210
+ exit: Ukončit hlasování
211
+ message: Váš hlas nebyl zaregistrován, protože jste ještě nedokončili proces hlasování. Opravdu chcete ukončit hlasování?
212
+ title: Zatím jste nehlasovali
190
213
  filters:
191
214
  category: Kategorie
192
215
  scope: Oblast působnosti
@@ -241,6 +264,7 @@ cs:
241
264
  components:
242
265
  budgets:
243
266
  actions:
267
+ comment: Komentář
244
268
  vote: Hlasovat
245
269
  name: Rozpočty
246
270
  settings:
@@ -119,6 +119,9 @@ de:
119
119
  highlighted_cta: Über %{name} abstimmen
120
120
  if_change_opinion: Wenn sie ihr Meinung geändert haben, können sie
121
121
  my_budgets: Meine Budgets
122
+ progress: Abstimmung beenden
123
+ show: Projekte ansehen
124
+ vote: Abstimmen
122
125
  voted_on: Sie haben über %{links} abgestimmt
123
126
  limit_announcement:
124
127
  cant_vote: Sie können nicht über dieses Budget abstimmen. <a href="%{landing_path}">Versuchen Sie es mit einem anderen Budget</a>.
@@ -183,6 +186,12 @@ de:
183
186
  projects_count:
184
187
  one: 1 Projekt
185
188
  other: "%{count} Projekte"
189
+ exit_modal:
190
+ cancel: Zurück zur Abstimmung
191
+ close_modal: Dialog schließen
192
+ exit: Abstimmung verlassen
193
+ message: Ihre Stimme wurde nicht registriert, weil Sie den Abstimmungsprozess noch nicht abgeschlossen haben. Sind Sie sicher, dass Sie die Abstimmung beenden möchten?
194
+ title: Sie haben noch nicht abgestimmt
186
195
  filters:
187
196
  category: Kategorie
188
197
  scope: Umfang
@@ -233,6 +242,7 @@ de:
233
242
  components:
234
243
  budgets:
235
244
  actions:
245
+ comment: Kommentieren
236
246
  vote: Abstimmen
237
247
  name: Budgets
238
248
  settings: