Merge pull request #4483 from consul/draft_budgets_text
Add draft info on unpublished budgets
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
.admin .budgets-table {
|
||||
|
||||
.budget-completed {
|
||||
@include has-fa-icon(lock, solid);
|
||||
.budget-completed,
|
||||
.budget-draft {
|
||||
padding-left: calc(1em + #{rem-calc(10)});
|
||||
position: relative;
|
||||
|
||||
@@ -18,10 +18,25 @@
|
||||
font-size: $tiny-font-size;
|
||||
font-weight: bold;
|
||||
line-height: rem-calc(12);
|
||||
}
|
||||
}
|
||||
|
||||
.budget-completed {
|
||||
@include has-fa-icon(lock, solid);
|
||||
|
||||
span {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
|
||||
.budget-draft {
|
||||
@include has-fa-icon(pencil-alt, solid);
|
||||
|
||||
span {
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
|
||||
td time:last-of-type::after,
|
||||
td small::before {
|
||||
content: "";
|
||||
|
||||
@@ -20,12 +20,8 @@
|
||||
<tbody>
|
||||
<% budgets.each do |budget| %>
|
||||
<tr id="<%= dom_id(budget) %>" class="budget">
|
||||
<td class="<%= "budget-completed" if budget.finished? %>">
|
||||
<% if budget.finished? %>
|
||||
<span>
|
||||
<%= t("admin.budgets.index.table_completed") %>
|
||||
</span>
|
||||
<% end %>
|
||||
<td class="<%= status_html_class(budget) %>">
|
||||
<%= status_text(budget) %>
|
||||
<strong><%= budget.name %></strong>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@@ -29,4 +29,20 @@ class Admin::Budgets::IndexComponent < ApplicationComponent
|
||||
def duration(budget)
|
||||
Admin::Budgets::DurationComponent.new(budget).duration
|
||||
end
|
||||
|
||||
def status_html_class(budget)
|
||||
if budget.drafting?
|
||||
"budget-draft"
|
||||
elsif budget.finished?
|
||||
"budget-completed"
|
||||
end
|
||||
end
|
||||
|
||||
def status_text(budget)
|
||||
if budget.drafting?
|
||||
tag.span t("admin.budgets.index.table_draft")
|
||||
elsif budget.finished?
|
||||
tag.span t("admin.budgets.index.table_completed")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -80,6 +80,7 @@ en:
|
||||
help: "Participatory budgets allow citizens to propose and decide directly how to spend part of the budget, with monitoring and rigorous evaluation of proposals by the institution."
|
||||
budget_investments: Manage projects
|
||||
table_completed: Completed
|
||||
table_draft: "Draft"
|
||||
table_duration: "Duration"
|
||||
table_name: Name
|
||||
table_phase: Phase
|
||||
|
||||
@@ -80,6 +80,7 @@ es:
|
||||
help: "Los presupuestos participativos permiten que los ciudadanos propongan y decidan de manera directa cómo gastar parte del presupuesto, con un seguimiento y evaluación riguroso de las propuestas por parte de la institución."
|
||||
budget_investments: Gestionar proyectos de gasto
|
||||
table_completed: Completado
|
||||
table_draft: "Borrador"
|
||||
table_duration: "Duración"
|
||||
table_name: Nombre
|
||||
table_phase: Fase
|
||||
|
||||
@@ -27,36 +27,41 @@ describe "Admin budgets", :admin do
|
||||
end
|
||||
|
||||
scenario "Filters by phase" do
|
||||
drafting_budget = create(:budget, :drafting)
|
||||
accepting_budget = create(:budget, :accepting)
|
||||
selecting_budget = create(:budget, :selecting)
|
||||
balloting_budget = create(:budget, :balloting)
|
||||
finished_budget = create(:budget, :finished)
|
||||
create(:budget, :drafting, name: "Unpublished budget")
|
||||
create(:budget, :accepting, name: "Accepting budget")
|
||||
create(:budget, :selecting, name: "Selecting budget")
|
||||
create(:budget, :balloting, name: "Balloting budget")
|
||||
create(:budget, :finished, name: "Finished budget")
|
||||
|
||||
visit admin_budgets_path
|
||||
expect(page).to have_content(drafting_budget.name)
|
||||
expect(page).to have_content(accepting_budget.name)
|
||||
expect(page).to have_content(selecting_budget.name)
|
||||
expect(page).to have_content(balloting_budget.name)
|
||||
expect(page).to have_content(finished_budget.name)
|
||||
|
||||
within "#budget_#{finished_budget.id}" do
|
||||
expect(page).to have_content("COMPLETED")
|
||||
expect(page).to have_content "Accepting budget"
|
||||
expect(page).to have_content "Selecting budget"
|
||||
expect(page).to have_content "Balloting budget"
|
||||
|
||||
within "tr", text: "Unpublished budget" do
|
||||
expect(page).to have_content "Draft"
|
||||
end
|
||||
|
||||
within "tr", text: "Finished budget" do
|
||||
expect(page).to have_content "COMPLETED"
|
||||
end
|
||||
|
||||
click_link "Finished"
|
||||
expect(page).not_to have_content(drafting_budget.name)
|
||||
expect(page).not_to have_content(accepting_budget.name)
|
||||
expect(page).not_to have_content(selecting_budget.name)
|
||||
expect(page).not_to have_content(balloting_budget.name)
|
||||
expect(page).to have_content(finished_budget.name)
|
||||
|
||||
expect(page).not_to have_content "Unpublished budget"
|
||||
expect(page).not_to have_content "Accepting budget"
|
||||
expect(page).not_to have_content "Selecting budget"
|
||||
expect(page).not_to have_content "Balloting budget"
|
||||
expect(page).to have_content "Finished budget"
|
||||
|
||||
click_link "Open"
|
||||
expect(page).to have_content(drafting_budget.name)
|
||||
expect(page).to have_content(accepting_budget.name)
|
||||
expect(page).to have_content(selecting_budget.name)
|
||||
expect(page).to have_content(balloting_budget.name)
|
||||
expect(page).not_to have_content(finished_budget.name)
|
||||
|
||||
expect(page).to have_content "Unpublished budget"
|
||||
expect(page).to have_content "Accepting budget"
|
||||
expect(page).to have_content "Selecting budget"
|
||||
expect(page).to have_content "Balloting budget"
|
||||
expect(page).not_to have_content "Finished budget"
|
||||
end
|
||||
|
||||
scenario "Filters are properly highlighted" do
|
||||
|
||||
Reference in New Issue
Block a user