Merge pull request #4552 from consul/table_icons_with_text

Use icons with text in admin table actions
This commit is contained in:
Javi Martín
2021-06-30 16:31:18 +02:00
committed by GitHub
44 changed files with 102 additions and 142 deletions

View File

@@ -74,6 +74,7 @@ $outline-focus: 3px solid #ffbf47 !default;
$input-height: $line-height * 2 !default; $input-height: $line-height * 2 !default;
$font-icon-margin: rem-calc(4) !default;
$icon-width: $line-height * 2 !default; $icon-width: $line-height * 2 !default;
$off-screen-left: -1000rem !default; $off-screen-left: -1000rem !default;

View File

@@ -23,6 +23,10 @@
.preview-link { .preview-link {
@include has-fa-icon(eye, regular); @include has-fa-icon(eye, regular);
@include hollow-button; @include hollow-button;
&::before {
margin-right: $font-icon-margin;
}
} }
.publish-link { .publish-link {

View File

@@ -36,7 +36,6 @@
&::after { &::after {
bottom: $padding / 2; bottom: $padding / 2;
color: $white; color: $white;
margin-right: 0;
position: absolute; position: absolute;
right: calc(#{$padding} + #{$quote-padding}); right: calc(#{$padding} + #{$quote-padding});
} }

View File

@@ -6,33 +6,22 @@
} }
a { a {
align-items: center;
display: flex;
flex-direction: column;
font-size: 0.9em;
line-height: $global-lineheight;
margin-right: 1em;
position: relative; position: relative;
text-align: center;
> :first-child {
@include bottom-tooltip;
left: $off-screen-left;
opacity: 0;
transform: translateX(-50%);
transition: opacity 0.3s, left 0s 0.3s;
}
&:hover, &:hover,
&:focus { &:focus {
color: $link-hover; color: $link-hover;
> :first-child {
left: 50%;
opacity: 1;
transition: opacity 0.4s 0.2s;
}
}
&:not(:focus) > :first-child:hover {
left: $off-screen-left;
} }
&::before { &::before {
font-size: rem-calc(18); font-size: 1.6em;
} }
} }
@@ -42,7 +31,14 @@
.destroy-link { .destroy-link {
@include has-fa-icon(trash-alt, regular); @include has-fa-icon(trash-alt, regular);
color: $alert-color; }
.destroy-link,
.destroy-role-link,
.destroy-officer-link,
.reject-link,
.confirm-hide-link {
color: darken($alert-color, 5%);
} }
.show-link, .show-link,
@@ -66,17 +62,23 @@
.destroy-officer-link, .destroy-officer-link,
.reject-link { .reject-link {
@include has-fa-icon(user-times, solid); @include has-fa-icon(user-times, solid);
color: $alert-color;
} }
.restore-link { .restore-link {
@include has-fa-icon(undo, solid); @include has-fa-icon(undo, solid);
}
.restore-link,
.investments-link {
color: darken($warning-color, 20%);
&::before {
color: $warning-color; color: $warning-color;
} }
}
.confirm-hide-link { .confirm-hide-link {
@include has-fa-icon(flag, regular); @include has-fa-icon(flag, regular);
color: $alert-color;
} }
.verify-link { .verify-link {
@@ -108,7 +110,6 @@
.investments-link { .investments-link {
@include has-fa-icon(coins, solid); @include has-fa-icon(coins, solid);
color: $warning-color;
} }
.groups-link, .groups-link,

View File

@@ -33,10 +33,6 @@
position: absolute; position: absolute;
right: $close-icon-margin; right: $close-icon-margin;
top: $close-icon-margin; top: $close-icon-margin;
&::before {
margin-right: 0;
}
} }
&:hover { &:hover {

View File

@@ -71,7 +71,6 @@
&::after { &::after {
font-size: 2em; font-size: 2em;
margin-left: auto; margin-left: auto;
margin-right: 0;
transform: translateY(-25%); transform: translateY(-25%);
} }
} }

View File

@@ -6,5 +6,9 @@
color: $brand-secondary; color: $brand-secondary;
font-weight: bold; font-weight: bold;
margin-top: $line-height; margin-top: $line-height;
&::before {
margin-right: $font-icon-margin;
}
} }
} }

View File

@@ -204,7 +204,6 @@
&::after { &::after {
font-weight: bold; font-weight: bold;
margin-left: 0.5em; margin-left: 0.5em;
margin-right: 0;
} }
} }
} }

View File

@@ -1470,6 +1470,7 @@ table {
&::before { &::before {
font-size: rem-calc(24); font-size: rem-calc(24);
margin-right: $font-icon-margin;
} }
} }
@@ -1863,6 +1864,7 @@ table {
.show-children::before, .show-children::before,
.collapse-children::before { .collapse-children::before {
margin-right: $font-icon-margin;
transform: translateY(-1px); transform: translateY(-1px);
} }
@@ -1891,6 +1893,7 @@ table {
} }
&::before { &::before {
margin-right: $font-icon-margin;
transform: translateY(-1px); transform: translateY(-1px);
} }
} }
@@ -2456,6 +2459,10 @@ table {
@include has-fa-icon(times, solid); @include has-fa-icon(times, solid);
color: $color-alert; color: $color-alert;
} }
&::before {
margin-right: $font-icon-margin;
}
} }
} }

View File

@@ -1,7 +1,6 @@
%font-icon { %font-icon {
@extend %fa-icon; @extend %fa-icon;
font-family: "Font Awesome 5 Free"; font-family: "Font Awesome 5 Free";
margin-right: rem-calc(4);
vertical-align: middle; vertical-align: middle;
} }

View File

@@ -7,8 +7,8 @@
@include has-fa-icon(circle, solid, after); @include has-fa-icon(circle, solid, after);
&::before { &::before {
@include breakpoint(medium) { @include breakpoint(small only) {
margin-right: 0; margin-right: $font-icon-margin;
} }
} }
@@ -18,7 +18,6 @@
color: #ecf00b; color: #ecf00b;
font-size: $circle-icon-size; font-size: $circle-icon-size;
margin-right: 0;
position: absolute; position: absolute;
left: $notification-icon-size - rem-calc(5); left: $notification-icon-size - rem-calc(5);
top: $menu-link-top-padding - $circle-icon-size / 2; top: $menu-link-top-padding - $circle-icon-size / 2;

View File

@@ -1215,7 +1215,6 @@
&::after { &::after {
margin-left: $line-height / 4; margin-left: $line-height / 4;
margin-right: 0;
} }
} }
} }

View File

@@ -31,8 +31,7 @@
<td> <td>
<%= render Admin::TableActionsComponent.new(phase, <%= render Admin::TableActionsComponent.new(phase,
actions: [:edit], actions: [:edit],
edit_path: edit_path(phase), edit_path: edit_path(phase)
edit_text: t("admin.budgets.edit.edit_phase")
) %> ) %>
</td> </td>
</tr> </tr>

View File

@@ -1,5 +1,4 @@
<%= render Admin::TableActionsComponent.new(budget, <%= render Admin::TableActionsComponent.new(budget,
edit_text: t("admin.budgets.index.edit_budget"),
destroy_confirmation: t("admin.actions.confirm_delete", resource_name: t("admin.budgets.shared.resource_name"), destroy_confirmation: t("admin.actions.confirm_delete", resource_name: t("admin.budgets.shared.resource_name"),
name: budget.name) name: budget.name)
) do %> ) do %>

View File

@@ -1,5 +1,4 @@
class Admin::Budgets::TableActionsComponent < ApplicationComponent class Admin::Budgets::TableActionsComponent < ApplicationComponent
include TableActionLink
attr_reader :budget attr_reader :budget
def initialize(budget) def initialize(budget)

View File

@@ -1,5 +1,4 @@
class Admin::HiddenTableActionsComponent < ApplicationComponent class Admin::HiddenTableActionsComponent < ApplicationComponent
include TableActionLink
attr_reader :record attr_reader :record
def initialize(record) def initialize(record)

View File

@@ -1,5 +1,4 @@
class Admin::Organizations::TableActionsComponent < ApplicationComponent class Admin::Organizations::TableActionsComponent < ApplicationComponent
include TableActionLink
delegate :can?, to: :controller delegate :can?, to: :controller
attr_reader :organization attr_reader :organization

View File

@@ -1,5 +1,4 @@
class Admin::Roles::TableActionsComponent < ApplicationComponent class Admin::Roles::TableActionsComponent < ApplicationComponent
include TableActionLink
attr_reader :record, :actions attr_reader :record, :actions
def initialize(record, actions: [:destroy]) def initialize(record, actions: [:destroy])

View File

@@ -1,5 +1,4 @@
class Admin::TableActionsComponent < ApplicationComponent class Admin::TableActionsComponent < ApplicationComponent
include TableActionLink
include Admin::Namespace include Admin::Namespace
attr_reader :record, :options attr_reader :record, :options

View File

@@ -1,7 +0,0 @@
module TableActionLink
extend ActiveSupport::Concern
def link_to(text, url, **options)
super(tag.span(text), url, options)
end
end

View File

@@ -20,12 +20,7 @@
<tr> <tr>
<td><%= banner.post_started_at %></td> <td><%= banner.post_started_at %></td>
<td><%= banner.post_ended_at %></td> <td><%= banner.post_ended_at %></td>
<td> <td><%= render Admin::TableActionsComponent.new(banner) %></td>
<%= render Admin::TableActionsComponent.new(banner,
edit_text: t("admin.banners.index.edit"),
destroy_text: t("admin.banners.index.delete")
) %>
</td>
</tr> </tr>
<tr> <tr>
<td colspan="3"> <td colspan="3">

View File

@@ -53,11 +53,7 @@
<% end %> <% end %>
<% end %> <% end %>
</td> </td>
<td> <td><%= render Admin::TableActionsComponent.new(milestone) %></td>
<%= render Admin::TableActionsComponent.new(milestone,
destroy_text: t("admin.milestones.index.delete")
) %>
</td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@@ -28,8 +28,7 @@
<td> <td>
<%= render Admin::TableActionsComponent.new( <%= render Admin::TableActionsComponent.new(
actions: [:edit], actions: [:edit],
edit_path: edit_admin_official_path(official), edit_path: edit_admin_official_path(official)
edit_text: t("admin.officials.search.edit_official")
) %> ) %>
</td> </td>
</tr> </tr>

View File

@@ -35,7 +35,7 @@
<%= render Admin::TableActionsComponent.new( <%= render Admin::TableActionsComponent.new(
actions: [:edit], actions: [:edit],
edit_path: edit_admin_official_path(user), edit_path: edit_admin_official_path(user),
edit_text: user.official? ? t("admin.officials.search.edit_official") : t("admin.officials.search.make_official") edit_text: (t("admin.officials.search.make_official") unless user.official?)
) %> ) %>
</td> </td>
</tr> </tr>

View File

@@ -13,10 +13,7 @@
class: "shifts-link" %> class: "shifts-link" %>
<% end %> <% end %>
<% else %> <% else %>
<%= render Admin::TableActionsComponent.new(booth, <%= render Admin::TableActionsComponent.new(booth, actions: [:edit]) %>
actions: [:edit],
edit_text: t("admin.booths.booth.edit")
) %>
<% end %> <% end %>
</td> </td>
</tr> </tr>

View File

@@ -34,10 +34,7 @@
<td><%= link_to "#{content_block.name} (#{content_block.locale})", edit_admin_site_customization_content_block_path(content_block) %></td> <td><%= link_to "#{content_block.name} (#{content_block.locale})", edit_admin_site_customization_content_block_path(content_block) %></td>
<td><%= raw content_block.body %></td> <td><%= raw content_block.body %></td>
<td> <td>
<%= render Admin::TableActionsComponent.new(content_block, <%= render Admin::TableActionsComponent.new(content_block, actions: [:destroy]) %>
actions: [:destroy],
destroy_text: t("admin.site_customization.content_blocks.index.delete")
) %>
</td> </td>
</tr> </tr>
<% end %> <% end %>
@@ -48,7 +45,6 @@
<td> <td>
<%= render Admin::TableActionsComponent.new( <%= render Admin::TableActionsComponent.new(
actions: [:destroy], actions: [:destroy],
destroy_text: t("admin.site_customization.content_blocks.index.delete"),
destroy_path: admin_site_customization_delete_heading_content_block_path(content_block) destroy_path: admin_site_customization_delete_heading_content_block_path(content_block)
) %> ) %>
</td> </td>

View File

@@ -30,7 +30,7 @@
<% end %> <% end %>
</td> </td>
<td id="tag_<%= tag.id %>"> <td id="tag_<%= tag.id %>">
<%= render Admin::TableActionsComponent.new(tag, actions: [:destroy], destroy_text: t("admin.tags.destroy")) %> <%= render Admin::TableActionsComponent.new(tag, actions: [:destroy]) %>
</td> </td>
</tr> </tr>
<% end %> <% end %>

View File

@@ -21,8 +21,6 @@ en:
index: index:
title: Banners title: Banners
create: Create banner create: Create banner
edit: Edit banner
delete: Delete banner
filters: filters:
all: All all: All
with_active: Active with_active: Active
@@ -69,7 +67,7 @@ en:
no_activity: There are no moderators activity. no_activity: There are no moderators activity.
budgets: budgets:
actions: actions:
preview: "Preview budget" preview: "Preview"
index: index:
title: Participatory budgets title: Participatory budgets
new_link: Create new budget new_link: Create new budget
@@ -78,7 +76,7 @@ en:
all: All all: All
open: Open open: Open
finished: Finished finished: Finished
budget_investments: Manage projects budget_investments: Investment projects
table_budget_type: "Type" table_budget_type: "Type"
table_completed: Completed table_completed: Completed
table_draft: "Draft" table_draft: "Draft"
@@ -89,9 +87,8 @@ en:
type_multiple: "Multiple headings" type_multiple: "Multiple headings"
type_pending: "Pending: No headings yet" type_pending: "Pending: No headings yet"
type_single: "Single heading" type_single: "Single heading"
edit_groups: Edit headings groups edit_groups: Heading groups
edit_budget: Edit budget admin_ballots: Ballots
admin_ballots: Admin ballots
no_budgets: "There are no budgets." no_budgets: "There are no budgets."
create: create:
notice: New participatory budget created successfully! notice: New participatory budget created successfully!
@@ -109,7 +106,6 @@ en:
duration: "Duration" duration: "Duration"
enabled: Enabled enabled: Enabled
actions: Actions actions: Actions
edit_phase: Edit phase
enable_phase: "Enable %{phase} phase" enable_phase: "Enable %{phase} phase"
active: Active active: Active
blank_dates: Dates are blank blank_dates: Dates are blank
@@ -156,7 +152,7 @@ en:
budget_groups: budget_groups:
name: "Name" name: "Name"
headings_name: "Headings" headings_name: "Headings"
headings_manage: "Manage headings" headings_manage: "Headings"
no_groups: "There are no groups." no_groups: "There are no groups."
amount: amount:
one: "There is 1 group" one: "There is 1 group"
@@ -354,7 +350,6 @@ en:
table_publication_date: "Publication date" table_publication_date: "Publication date"
table_status: Status table_status: Status
table_actions: "Actions" table_actions: "Actions"
delete: "Delete milestone"
no_milestones: "Don't have defined milestones" no_milestones: "Don't have defined milestones"
image: "Image" image: "Image"
show_image: "Show image" show_image: "Show image"
@@ -1207,7 +1202,6 @@ en:
location: "Location" location: "Location"
booth: booth:
shifts: "Manage shifts" shifts: "Manage shifts"
edit: "Edit booth"
officials: officials:
edit: edit:
destroy: Remove "Official" status destroy: Remove "Official" status
@@ -1229,7 +1223,6 @@ en:
level_4: Level 4 level_4: Level 4
level_5: Level 5 level_5: Level 5
search: search:
edit_official: Edit official
make_official: Make official make_official: Make official
title: "Official positions: User search" title: "Official positions: User search"
no_results: Official positions not found. no_results: Official positions not found.
@@ -1513,7 +1506,6 @@ en:
title: "Sustainable Development Goals - Stats" title: "Sustainable Development Goals - Stats"
tags: tags:
create: Create topic create: Create topic
destroy: Delete topic
index: index:
add_tag: Add a new proposal topic add_tag: Add a new proposal topic
title: Proposal topics title: Proposal topics
@@ -1601,7 +1593,7 @@ en:
create: Create new page create: Create new page
delete: Delete page delete: Delete page
title: Custom Pages title: Custom Pages
see_page: See page see_page: View
new: new:
title: Create new custom page title: Create new custom page
slug_help: "Text to identify this page on URL, for example <code>https://consulproject.org/page-slug</code>" slug_help: "Text to identify this page on URL, for example <code>https://consulproject.org/page-slug</code>"
@@ -1611,7 +1603,7 @@ en:
updated_at: Updated at updated_at: Updated at
title: Title title: Title
slug: Slug slug: Slug
see_cards: See Cards see_cards: Manage cards
cards: cards:
cards_title: cards cards_title: cards
create_card: Create card create_card: Create card

View File

@@ -21,8 +21,6 @@ es:
index: index:
title: Banners title: Banners
create: Crear un banner create: Crear un banner
edit: Editar banner
delete: Eliminar banner
filters: filters:
all: Todos all: Todos
with_active: Activos with_active: Activos
@@ -69,7 +67,7 @@ es:
no_activity: No hay actividad de moderadores. no_activity: No hay actividad de moderadores.
budgets: budgets:
actions: actions:
preview: "Previsualizar presupuesto" preview: "Previsualizar"
index: index:
title: Presupuestos participativos title: Presupuestos participativos
new_link: Crear nuevo presupuesto new_link: Crear nuevo presupuesto
@@ -78,7 +76,7 @@ es:
all: Todos all: Todos
open: Abiertos open: Abiertos
finished: Terminados finished: Terminados
budget_investments: Gestionar proyectos de gasto budget_investments: Proyectos de gasto
table_budget_type: "Tipo" table_budget_type: "Tipo"
table_completed: Completado table_completed: Completado
table_draft: "Borrador" table_draft: "Borrador"
@@ -89,9 +87,8 @@ es:
type_multiple: "Múltiples partidas" type_multiple: "Múltiples partidas"
type_pending: "Pendiente: Aún no hay partidas" type_pending: "Pendiente: Aún no hay partidas"
type_single: "Partida única" type_single: "Partida única"
edit_groups: Editar grupos de partidas edit_groups: Grupos de partidas
edit_budget: Editar presupuesto admin_ballots: Urnas
admin_ballots: Gestionar urnas
no_budgets: "No hay presupuestos participativos." no_budgets: "No hay presupuestos participativos."
create: create:
notice: '¡Presupuestos participativos creados con éxito!' notice: '¡Presupuestos participativos creados con éxito!'
@@ -109,7 +106,6 @@ es:
duration: "Duración" duration: "Duración"
enabled: Habilitada enabled: Habilitada
actions: Acciones actions: Acciones
edit_phase: Editar fase
enable_phase: "Habilitar fase de %{phase}" enable_phase: "Habilitar fase de %{phase}"
active: Activa active: Activa
blank_dates: Sin fechas blank_dates: Sin fechas
@@ -156,7 +152,7 @@ es:
budget_groups: budget_groups:
name: "Nombre" name: "Nombre"
headings_name: "Partidas" headings_name: "Partidas"
headings_manage: "Gestionar partidas" headings_manage: "Partidas"
no_groups: "No hay grupos." no_groups: "No hay grupos."
amount: amount:
one: "Hay 1 grupo de partidas presupuestarias" one: "Hay 1 grupo de partidas presupuestarias"
@@ -354,7 +350,6 @@ es:
table_publication_date: "Fecha de publicación" table_publication_date: "Fecha de publicación"
table_status: Estado table_status: Estado
table_actions: "Acciones" table_actions: "Acciones"
delete: "Eliminar hito"
no_milestones: "No hay hitos definidos" no_milestones: "No hay hitos definidos"
image: "Imagen" image: "Imagen"
show_image: "Mostrar imagen" show_image: "Mostrar imagen"
@@ -1206,7 +1201,6 @@ es:
location: "Ubicación" location: "Ubicación"
booth: booth:
shifts: "Asignar turnos" shifts: "Asignar turnos"
edit: "Editar urna"
officials: officials:
edit: edit:
destroy: Eliminar condición de 'Cargo Público' destroy: Eliminar condición de 'Cargo Público'
@@ -1228,7 +1222,6 @@ es:
level_4: Nivel 4 level_4: Nivel 4
level_5: Nivel 5 level_5: Nivel 5
search: search:
edit_official: Editar cargo público
make_official: Convertir en cargo público make_official: Convertir en cargo público
title: "Cargos Públicos: Búsqueda de usuarios" title: "Cargos Públicos: Búsqueda de usuarios"
no_results: No se han encontrado cargos públicos. no_results: No se han encontrado cargos públicos.
@@ -1512,7 +1505,6 @@ es:
title: "Objetivos de Desarrollo Sostenible - Estadísticas" title: "Objetivos de Desarrollo Sostenible - Estadísticas"
tags: tags:
create: Crear tema create: Crear tema
destroy: Eliminar tema
index: index:
add_tag: Añade un nuevo tema de propuesta add_tag: Añade un nuevo tema de propuesta
title: Temas de propuesta title: Temas de propuesta
@@ -1600,7 +1592,7 @@ es:
create: Crear nueva página create: Crear nueva página
delete: Borrar página delete: Borrar página
title: Páginas title: Páginas
see_page: Ver página see_page: Ver
new: new:
title: Página nueva title: Página nueva
slug_help: "Texto que identifica esta página en la URL, por ejemplo <code>https://consulproject.org/slug-de-pagina</code>" slug_help: "Texto que identifica esta página en la URL, por ejemplo <code>https://consulproject.org/slug-de-pagina</code>"
@@ -1610,7 +1602,7 @@ es:
updated_at: Última actualización updated_at: Última actualización
title: Título title: Título
slug: Slug slug: Slug
see_cards: Ver tarjetas see_cards: Tarjetas
cards: cards:
cards_title: tarjetas cards_title: tarjetas
create_card: Crear tarjeta create_card: Crear tarjeta

View File

@@ -12,18 +12,18 @@ describe Admin::Budgets::TableActionsComponent, type: :component do
render_inline component render_inline component
expect(page).to have_css "a", count: 6 expect(page).to have_css "a", count: 6
expect(page).to have_link "Manage projects", href: /investments/ expect(page).to have_link "Investment projects", href: /investments/
expect(page).to have_link "Edit headings groups", href: /groups/ expect(page).to have_link "Heading groups", href: /groups/
expect(page).to have_link "Edit budget", href: /edit/ expect(page).to have_link "Edit", href: /edit/
expect(page).to have_link "Admin ballots" expect(page).to have_link "Ballots"
expect(page).to have_link "Preview budget", href: /budgets/ expect(page).to have_link "Preview", href: /budgets/
expect(page).to have_link "Delete", href: /budgets/ expect(page).to have_link "Delete", href: /budgets/
end end
it "renders link to create new poll for budgets without polls" do it "renders link to create new poll for budgets without polls" do
render_inline component render_inline component
expect(page).to have_css "a[href*='polls'][data-method='post']", text: "Admin ballots" expect(page).to have_css "a[href*='polls'][data-method='post']", text: "Ballots"
end end
it "renders link to manage ballots for budgets with polls" do it "renders link to manage ballots for budgets with polls" do
@@ -31,6 +31,6 @@ describe Admin::Budgets::TableActionsComponent, type: :component do
render_inline component render_inline component
expect(page).to have_link "Admin ballots", href: /booth_assignments/ expect(page).to have_link "Ballots", href: /booth_assignments/
end end
end end

View File

@@ -108,12 +108,12 @@ shared_examples "admin_milestoneable" do |factory_name, path_name|
end end
context "Delete" do context "Delete" do
scenario "Remove milestone", :no_js do scenario "Remove milestone" do
create(:milestone, milestoneable: milestoneable, title: "Title will it remove") create(:milestone, milestoneable: milestoneable, title: "Title will it remove")
visit path visit path
click_link "Delete milestone" accept_confirm { click_link "Delete" }
expect(page).not_to have_content "Title will it remove" expect(page).not_to have_content "Title will it remove"
end end

View File

@@ -104,7 +104,7 @@ describe "Admin banners magement", :admin do
fill_in "Post ended at", with: Date.current + 1.week fill_in "Post ended at", with: Date.current + 1.week
click_button "Save changes" click_button "Save changes"
click_link "Edit banner" click_link "Edit"
expect_to_have_language_selected "Français" expect_to_have_language_selected "Français"
expect(page).to have_field "Title", with: "En Français" expect(page).to have_field "Title", with: "En Français"
@@ -137,7 +137,7 @@ describe "Admin banners magement", :admin do
click_link "Manage banners" click_link "Manage banners"
end end
click_link "Edit banner" click_link "Edit"
fill_in "Title", with: "Modified title" fill_in "Title", with: "Modified title"
fill_in "Description", with: "Edited text" fill_in "Description", with: "Edited text"
@@ -173,7 +173,7 @@ describe "Admin banners magement", :admin do
expect(page).to have_content "Ugly banner" expect(page).to have_content "Ugly banner"
accept_confirm { click_link "Delete banner" } accept_confirm { click_link "Delete" }
visit admin_root_path visit admin_root_path
expect(page).not_to have_content "Ugly banner" expect(page).not_to have_content "Ugly banner"

View File

@@ -37,21 +37,21 @@ describe "Admin budget groups", :admin do
expect(page).to have_content(group1.name) expect(page).to have_content(group1.name)
expect(page).to have_content(group1.max_votable_headings) expect(page).to have_content(group1.max_votable_headings)
expect(page).to have_content(group1.headings.count) expect(page).to have_content(group1.headings.count)
expect(page).to have_link "Manage headings" expect(page).to have_link "Headings"
end end
within "#budget_group_#{group2.id}" do within "#budget_group_#{group2.id}" do
expect(page).to have_content(group2.name) expect(page).to have_content(group2.name)
expect(page).to have_content(group2.max_votable_headings) expect(page).to have_content(group2.max_votable_headings)
expect(page).to have_content(group2.headings.count) expect(page).to have_content(group2.headings.count)
expect(page).to have_link "Manage headings" expect(page).to have_link "Headings"
end end
within "#budget_group_#{group3.id}" do within "#budget_group_#{group3.id}" do
expect(page).to have_content(group3.name) expect(page).to have_content(group3.name)
expect(page).to have_content(group3.max_votable_headings) expect(page).to have_content(group3.max_votable_headings)
expect(page).to have_content(group3.headings.count) expect(page).to have_content(group3.headings.count)
expect(page).to have_link "Manage headings" expect(page).to have_link "Headings"
end end
end end

View File

@@ -29,7 +29,7 @@ describe "Admin budget phases" do
expect(page).to have_content "Accepting projects" expect(page).to have_content "Accepting projects"
expect(page).not_to have_content "My phase custom name" expect(page).not_to have_content "My phase custom name"
within("tr", text: "Accepting projects") { click_link "Edit phase" } within("tr", text: "Accepting projects") { click_link "Edit" }
end end
expect(page).to have_css "h2", exact_text: "Edit phase - Accepting projects" expect(page).to have_css "h2", exact_text: "Edit phase - Accepting projects"

View File

@@ -116,7 +116,7 @@ describe "Admin budgets", :admin do
scenario "Can preview budget before it is published" do scenario "Can preview budget before it is published" do
visit edit_admin_budget_path(budget) visit edit_admin_budget_path(budget)
within_window(window_opened_by { click_link "Preview budget" }) do within_window(window_opened_by { click_link "Preview" }) do
expect(page).to have_current_path budget_path(budget) expect(page).to have_current_path budget_path(budget)
end end
end end
@@ -130,7 +130,7 @@ describe "Admin budgets", :admin do
expect(page).not_to have_content "This participatory budget is in draft mode" expect(page).not_to have_content "This participatory budget is in draft mode"
expect(page).not_to have_link "Publish budget" expect(page).not_to have_link "Publish budget"
within_window(window_opened_by { click_link "Preview budget" }) do within_window(window_opened_by { click_link "Preview" }) do
expect(page).to have_current_path budget_path(budget) expect(page).to have_current_path budget_path(budget)
end end
end end
@@ -227,7 +227,7 @@ describe "Admin budgets", :admin do
within_table "Phases" do within_table "Phases" do
within "tr", text: "Information" do within "tr", text: "Information" do
expect(page).to have_link "Edit phase" expect(page).to have_link "Edit"
end end
end end
end end

View File

@@ -88,10 +88,10 @@ describe "Budgets wizard, first step", :admin do
expect(page).to have_content "New participatory budget created successfully!" expect(page).to have_content "New participatory budget created successfully!"
within("#side_menu") { click_link "Participatory budgets" } within("#side_menu") { click_link "Participatory budgets" }
within("tr", text: "M30 - Summer campaign") { click_link "Edit budget" } within("tr", text: "M30 - Summer campaign") { click_link "Edit" }
expect(page).to have_content "This participatory budget is in draft mode" expect(page).to have_content "This participatory budget is in draft mode"
expect(page).to have_link "Preview budget" expect(page).to have_link "Preview"
expect(page).to have_link "Publish budget" expect(page).to have_link "Publish budget"
end end
end end

View File

@@ -56,7 +56,7 @@ describe "Budgets wizard, phases step", :admin do
expect(page).to have_css ".creation-timeline" expect(page).to have_css ".creation-timeline"
within("tr", text: "Selecting projects") { click_link "Edit phase" } within("tr", text: "Selecting projects") { click_link "Edit" }
fill_in "Name", with: "Choosing projects" fill_in "Name", with: "Choosing projects"
click_button "Save changes" click_button "Save changes"
@@ -86,7 +86,7 @@ describe "Budgets wizard, phases step", :admin do
scenario "update phase in single heading budget" do scenario "update phase in single heading budget" do
visit admin_budgets_wizard_budget_budget_phases_path(budget, mode: "single") visit admin_budgets_wizard_budget_budget_phases_path(budget, mode: "single")
within("tr", text: "Selecting projects") { click_link "Edit phase" } within("tr", text: "Selecting projects") { click_link "Edit" }
fill_in "Name", with: "Choosing projects" fill_in "Name", with: "Choosing projects"
click_button "Save changes" click_button "Save changes"

View File

@@ -27,13 +27,13 @@ describe "Budgets creation wizard", :admin do
expect(page).to have_content "Phases configured successfully" expect(page).to have_content "Phases configured successfully"
within "tr", text: "Single heading budget" do within "tr", text: "Single heading budget" do
click_link "Edit headings groups" click_link "Heading groups"
end end
expect(page).to have_content "There is 1 group" expect(page).to have_content "There is 1 group"
within "tr", text: "Single heading budget" do within "tr", text: "Single heading budget" do
click_link "Manage headings" click_link "Headings"
end end
expect(page).to have_content "There is 1 heading" expect(page).to have_content "There is 1 heading"
@@ -107,7 +107,7 @@ describe "Budgets creation wizard", :admin do
expect(page).to have_css ".budget-phases-table" expect(page).to have_css ".budget-phases-table"
within("tr", text: "Voting projects") { click_link "Edit phase" } within("tr", text: "Voting projects") { click_link "Edit" }
fill_in "Name", with: "Custom phase name" fill_in "Name", with: "Custom phase name"
uncheck "Phase enabled" uncheck "Phase enabled"
click_button "Save changes" click_button "Save changes"
@@ -124,7 +124,7 @@ describe "Budgets creation wizard", :admin do
expect(page).to have_content "Phases configured successfully" expect(page).to have_content "Phases configured successfully"
within "tr", text: "Multiple headings budget" do within "tr", text: "Multiple headings budget" do
click_link "Edit headings groups" click_link "Heading groups"
end end
expect(page).to have_content "There are 2 groups" expect(page).to have_content "There are 2 groups"
@@ -135,7 +135,7 @@ describe "Budgets creation wizard", :admin do
end end
within "tr", text: "Districts" do within "tr", text: "Districts" do
click_link "Manage headings" click_link "Headings"
end end
expect(page).to have_content "There are 2 headings" expect(page).to have_content "There are 2 headings"

View File

@@ -15,7 +15,7 @@ describe "Admin officials", :admin do
scenario "Edit an official" do scenario "Edit an official" do
visit admin_officials_path visit admin_officials_path
click_link "Edit official" click_link "Edit"
expect(page).to have_current_path(edit_admin_official_path(official)) expect(page).to have_current_path(edit_admin_official_path(official))

View File

@@ -47,7 +47,7 @@ describe "Admin booths", :admin do
expect(page).to have_content booth_for_current_poll.name expect(page).to have_content booth_for_current_poll.name
expect(page).not_to have_content booth_for_expired_poll.name expect(page).not_to have_content booth_for_expired_poll.name
expect(page).not_to have_link "Edit booth" expect(page).not_to have_link "Edit"
end end
scenario "Show" do scenario "Show" do
@@ -82,7 +82,7 @@ describe "Admin booths", :admin do
within("#booth_#{booth.id}") do within("#booth_#{booth.id}") do
expect(page).not_to have_link "Manage shifts" expect(page).not_to have_link "Manage shifts"
click_link "Edit booth" click_link "Edit"
end end
fill_in "poll_booth_name", with: "Next booth" fill_in "poll_booth_name", with: "Next booth"

View File

@@ -91,7 +91,7 @@ describe "Admin custom content blocks", :admin do
expect(page).to have_content("#{block.name} (#{block.locale})") expect(page).to have_content("#{block.name} (#{block.locale})")
expect(page).to have_content(block.body) expect(page).to have_content(block.body)
accept_confirm { click_link "Delete block" } accept_confirm { click_link "Delete" }
expect(page).not_to have_content("#{block.name} (#{block.locale})") expect(page).not_to have_content("#{block.name} (#{block.locale})")
expect(page).not_to have_content(block.body) expect(page).not_to have_content(block.body)

View File

@@ -39,7 +39,7 @@ describe "Admin tags", :admin do
expect(page).to have_content "bad tag" expect(page).to have_content "bad tag"
within("#tag_#{tag2.id}") do within("#tag_#{tag2.id}") do
accept_confirm { click_link "Delete topic" } accept_confirm { click_link "Delete" }
end end
expect(page).not_to have_content "bad tag" expect(page).not_to have_content "bad tag"
@@ -57,7 +57,7 @@ describe "Admin tags", :admin do
expect(page).to have_content "bad tag" expect(page).to have_content "bad tag"
within("#tag_#{tag2.id}") do within("#tag_#{tag2.id}") do
accept_confirm { click_link "Delete topic" } accept_confirm { click_link "Delete" }
end end
expect(page).not_to have_content "bad tag" expect(page).not_to have_content "bad tag"

View File

@@ -163,7 +163,7 @@ describe "Cards", :admin do
visit admin_site_customization_pages_path visit admin_site_customization_pages_path
within "#site_customization_page_#{custom_page.id}" do within "#site_customization_page_#{custom_page.id}" do
click_link "See Cards" click_link "Manage cards"
end end
click_link "Create card" click_link "Create card"

View File

@@ -8,7 +8,7 @@ describe "Admin Budgets", :admin do
visit admin_budgets_path visit admin_budgets_path
click_link "Admin ballots" click_link "Ballots"
expect(page).to have_current_path(/admin\/polls\/\d+/) expect(page).to have_current_path(/admin\/polls\/\d+/)
expect(page).to have_content(budget.name) expect(page).to have_content(budget.name)
@@ -37,7 +37,7 @@ describe "Admin Budgets", :admin do
visit admin_budgets_path visit admin_budgets_path
within "#budget_#{budget.id}" do within "#budget_#{budget.id}" do
expect(page).to have_link "Admin ballots", href: admin_poll_booth_assignments_path(poll) expect(page).to have_link "Ballots", href: admin_poll_booth_assignments_path(poll)
end end
end end
end end