Add draft info on unpublished budgets

Before commit 28caabecd, it was clear which budgets were in draft mode
because their phase was "drafting".

Now the phase isn't "drafting" anymore, so we have to make it clear
somehow that the budget is a draft.

I'm using styles similar to the ones we added in commit 2f636eaf7 for
completed budgets but at the same time making them slightly different so
it's easy to differenciate completed and drafting budgets.
This commit is contained in:
Javi Martín
2021-04-21 14:15:02 +02:00
parent 0eedc7b6ab
commit fc1a0f33e7
5 changed files with 34 additions and 8 deletions

View File

@@ -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: "";

View File

@@ -31,11 +31,17 @@ class Admin::Budgets::IndexComponent < ApplicationComponent
end
def status_html_class(budget)
"budget-completed" if budget.finished?
if budget.drafting?
"budget-draft"
elsif budget.finished?
"budget-completed"
end
end
def status_text(budget)
if budget.finished?
if budget.drafting?
tag.span t("admin.budgets.index.table_draft")
elsif budget.finished?
tag.span t("admin.budgets.index.table_completed")
end
end

View File

@@ -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

View File

@@ -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

View File

@@ -27,7 +27,7 @@ describe "Admin budgets", :admin do
end
scenario "Filters by phase" do
create(:budget, :drafting, name: "Drafting budget")
create(:budget, :drafting, name: "Unpublished budget")
create(:budget, :accepting, name: "Accepting budget")
create(:budget, :selecting, name: "Selecting budget")
create(:budget, :balloting, name: "Balloting budget")
@@ -35,18 +35,21 @@ describe "Admin budgets", :admin do
visit admin_budgets_path
expect(page).to have_content "Drafting budget"
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"
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"
@@ -54,7 +57,7 @@ describe "Admin budgets", :admin do
click_link "Open"
expect(page).to have_content "Drafting budget"
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"