Skip to content

Commit

Permalink
Backport 'Change the selected column in budgets' projects' to v0.27 (d…
Browse files Browse the repository at this point in the history
…ecidim#12296)

* Change the selected column in budgets' projects

* Change the selected column in budgets' projects

* Fix specs

* Apply suggestions from code review

Co-authored-by: Andrés Pereira de Lucena <[email protected]>

---------

Co-authored-by: Andrés Pereira de Lucena <[email protected]>
  • Loading branch information
alecslupu and andreslucena authored Jan 19, 2024
1 parent dff6cad commit 4b1453b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
</td>
<td>
<% if project.selected? %>
<%= content_tag :strong, t("projects.index.selected", scope: "decidim.budgets.admin"), class: "text-success" %>
<%= content_tag :strong, t("yes", scope: "decidim.budgets.admin.projects.index.selected_options"), class: "label" %>
<% else %>
<%= content_tag :span, "x", class: "text-muted" %>
<%= content_tag :strong, t("no", scope: "decidim.budgets.admin.projects.index.selected_options"), class: "label secondary" %>
<% end %>
</td>
<td class="table-list__actions">
Expand Down
3 changes: 3 additions & 0 deletions decidim-budgets/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ en:
pending_orders: Pending votes
select_for_implementation: Select for implementation
selected: Selected
selected_options:
'no': 'No'
'yes': 'Yes'
title: Projects
update: Update
update_scope_button: Update scope
Expand Down
15 changes: 11 additions & 4 deletions decidim-budgets/spec/system/admin_manages_projects_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,24 @@
end

it "selects projects to implementation" do
find("#projects_bulk").set(true)
find("#js-bulk-actions-button").click
within "tr[data-id='#{project.id}']" do
expect(page).to have_content("No")
end
within "tr[data-id='#{project2.id}']" do
expect(page).to have_content("No")
end

find_by_id("projects_bulk").set(true)
find_by_id("js-bulk-actions-button").click
click_button "Change selected"
select "Select", from: "selected_value"
click_button "Update"
expect(page).to have_css(".callout.success")
within "tr[data-id='#{project.id}']" do
expect(page).to have_content("Selected")
expect(page).to have_content("Yes")
end
within "tr[data-id='#{project2.id}']" do
expect(page).to have_content("Selected")
expect(page).to have_content("Yes")
end
expect(::Decidim::Budgets::Project.find(project.id).selected_at).to eq(Time.zone.today)
expect(::Decidim::Budgets::Project.find(project2.id).selected_at).to eq(Time.zone.today)
Expand Down

0 comments on commit 4b1453b

Please sign in to comment.