Merge pull request #4218 from consul/table_icons

Use icons in admin table actions
This commit is contained in:
Javi Martín
2020-11-04 13:22:25 +01:00
committed by GitHub
48 changed files with 249 additions and 104 deletions

View File

@@ -122,3 +122,4 @@ $pagination-radius: $global-radius;
$show-header-for-stacked: true; $show-header-for-stacked: true;
$tooltip-background-color: $brand;

View File

@@ -1,12 +1,128 @@
.admin .table-actions { .admin .table-actions {
align-items: baseline;
display: flex; display: flex;
> :not(:first-child) { > :not(:first-child) {
margin-left: $line-height / 2; margin-left: rem-calc(10);
} }
> p { a {
align-self: flex-start; position: relative;
> :first-child {
@include bottom-tooltip;
left: -10000px;
opacity: 0;
transform: translateX(-50%);
transition: opacity 0.3s, left 0s 0.3s;
}
&:hover,
&:focus {
color: $link-hover;
> :first-child {
left: 50%;
opacity: 1;
transition: opacity 0.4s 0.2s;
}
}
&:not(:focus) > :first-child:hover {
left: -10000px;
}
&::before {
font-size: rem-calc(18);
}
}
.edit-link {
@include has-fa-icon(edit, regular);
}
.destroy-link {
@include has-fa-icon(trash-alt, regular);
color: $alert-color;
}
.show-link,
.preview-link {
@include has-fa-icon(eye, regular);
}
.new-link,
.assign-booth-link {
@include has-fa-icon(plus-circle, solid);
color: $color-success;
}
.create-role-link,
.create-officer-link {
@include has-fa-icon(user-plus, solid);
color: $color-success;
}
.destroy-role-link,
.destroy-officer-link,
.reject-link {
@include has-fa-icon(user-times, solid);
color: $alert-color;
}
.restore-link {
@include has-fa-icon(undo, solid);
color: $warning-color;
}
.confirm-hide-link {
@include has-fa-icon(flag, regular);
color: $alert-color;
}
.verify-link {
@include has-fa-icon(user-check, solid);
color: $color-success;
}
.preview-pending-link {
@include has-fa-icon(search, solid);
}
.send-pending-link {
@include has-fa-icon(share-square, regular);
color: $color-success;
}
.configure-link,
.answers-link {
@include has-fa-icon(tools, solid);
}
.download-link {
@include has-fa-icon(download, solid);
}
.shifts-link {
@include has-fa-icon(clock, regular);
}
.investments-link {
@include has-fa-icon(coins, solid);
color: $warning-color;
}
.groups-link,
.headings-link {
@include has-fa-icon(chart-pie, solid);
color: $color-success;
}
.manage-link,
.ballots-link {
@include has-fa-icon(archive, solid);
}
.cards-link {
@include has-fa-icon(images, regular);
} }
} }

View File

@@ -176,3 +176,17 @@
} }
} }
} }
@mixin bottom-tooltip {
@include tooltip;
line-height: $global-lineheight;
margin-top: $line-height / 8;
white-space: nowrap;
&::before {
@include css-triangle($tooltip-pip-width, $tooltip-background-color, up);
bottom: 100%;
left: 50%;
transform: translateX(-50%);
}
}

View File

@@ -1,10 +1,14 @@
<%= render Admin::TableActionsComponent.new(budget, actions: [:edit], edit_text: t("admin.budgets.index.edit_budget")) do %> <%= render Admin::TableActionsComponent.new(budget, actions: [:edit], edit_text: t("admin.budgets.index.edit_budget")) do %>
<%= link_to t("admin.budgets.index.budget_investments"), <%= link_to t("admin.budgets.index.budget_investments"),
admin_budget_budget_investments_path(budget_id: budget.id), admin_budget_budget_investments_path(budget_id: budget.id),
class: "button hollow medium" %> class: "investments-link" %>
<%= link_to t("admin.budgets.index.edit_groups"), admin_budget_groups_path(budget) %> <%= link_to t("admin.budgets.index.edit_groups"),
admin_budget_groups_path(budget),
class: "groups-link" %>
<% if budget.poll.present? %> <% if budget.poll.present? %>
<%= link_to t("admin.budgets.index.admin_ballots"), admin_poll_booth_assignments_path(budget.poll) %> <%= link_to t("admin.budgets.index.admin_ballots"),
admin_poll_booth_assignments_path(budget.poll),
class: "ballots-link" %>
<% else %> <% else %>
<%= link_to_create_budget_poll %> <%= link_to_create_budget_poll %>
<% end %> <% end %>

View File

@@ -1,4 +1,5 @@
class Admin::Budgets::TableActionsComponent < ApplicationComponent class Admin::Budgets::TableActionsComponent < ApplicationComponent
include TableActionLink
attr_reader :budget attr_reader :budget
def initialize(budget) def initialize(budget)
@@ -15,7 +16,9 @@ class Admin::Budgets::TableActionsComponent < ApplicationComponent
name: budget.name, name: budget.name,
budget_id: budget.id, budget_id: budget.id,
starts_at: balloting_phase.starts_at, starts_at: balloting_phase.starts_at,
ends_at: balloting_phase.ends_at }), ends_at: balloting_phase.ends_at
}),
class: "ballots-link",
method: :post method: :post
end end
end end

View File

@@ -2,11 +2,11 @@
<%= link_to restore_text, restore_path, <%= link_to restore_text, restore_path,
method: :put, method: :put,
data: { confirm: t("admin.actions.confirm") }, data: { confirm: t("admin.actions.confirm") },
class: "button hollow warning" %> class: "restore-link" %>
<% unless record.confirmed_hide? %> <% unless record.confirmed_hide? %>
<%= link_to confirm_hide_text, confirm_hide_path, <%= link_to confirm_hide_text, confirm_hide_path,
method: :put, method: :put,
class: "button" %> class: "confirm-hide-link" %>
<% end %> <% end %>
<% end %> <% end %>

View File

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

View File

@@ -2,12 +2,12 @@
<% if can_verify? %> <% if can_verify? %>
<%= link_to t("admin.organizations.index.verify"), <%= link_to t("admin.organizations.index.verify"),
verify_admin_organization_path(organization, request.query_parameters), verify_admin_organization_path(organization, request.query_parameters),
method: :put, class: "button success small-5" %> method: :put, class: "verify-link" %>
<% end %> <% end %>
<% if can_reject? %> <% if can_reject? %>
<%= link_to t("admin.organizations.index.reject"), <%= link_to t("admin.organizations.index.reject"),
reject_admin_organization_path(organization, request.query_parameters), reject_admin_organization_path(organization, request.query_parameters),
method: :put, class: "button hollow alert small-5" %> method: :put, class: "reject-link" %>
<% end %> <% end %>
<% end %> <% end %>

View File

@@ -1,4 +1,5 @@
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

@@ -3,7 +3,7 @@
<tr> <tr>
<th><%= t("admin.poll_officers.officer.name") %></th> <th><%= t("admin.poll_officers.officer.name") %></th>
<th><%= t("admin.poll_officers.officer.email") %></th> <th><%= t("admin.poll_officers.officer.email") %></th>
<th class="small-3"><%= t("admin.actions.actions") %></th> <th><%= t("admin.actions.actions") %></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -19,14 +19,15 @@
<% if officer.persisted? %> <% if officer.persisted? %>
<%= render Admin::TableActionsComponent.new(officer, <%= render Admin::TableActionsComponent.new(officer,
actions: [:destroy], actions: [:destroy],
destroy_text: t("admin.poll_officers.officer.delete") destroy_text: t("admin.poll_officers.officer.delete"),
destroy_options: { class: "destroy-officer-link" }
) %> ) %>
<% else %> <% else %>
<%= render Admin::TableActionsComponent.new(actions: []) do |actions| %> <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
<%= actions.link_to t("admin.poll_officers.officer.add"), <%= actions.link_to t("admin.poll_officers.officer.add"),
add_user_path(officer), add_user_path(officer),
method: :post, method: :post,
class: "button success expanded" %> class: "create-officer-link" %>
<% end %> <% end %>
<% end %> <% end %>
</td> </td>

View File

@@ -1,7 +1,10 @@
<% if already_has_role? %> <% if already_has_role? %>
<%= render Admin::TableActionsComponent.new(record, actions: actions) %> <%= render Admin::TableActionsComponent.new(record,
actions: actions,
destroy_options: { class: "destroy-role-link" }
) %>
<% else %> <% else %>
<%= render Admin::TableActionsComponent.new(actions: []) do %> <%= render Admin::TableActionsComponent.new(actions: []) do %>
<%= link_to add_user_text, add_user_path, method: :post, class: "button success expanded" %> <%= link_to add_user_text, add_user_path, method: :post, class: "create-role-link" %>
<% end %> <% end %>
<% end %> <% end %>

View File

@@ -1,4 +1,5 @@
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,4 +1,5 @@
class Admin::TableActionsComponent < ApplicationComponent class Admin::TableActionsComponent < ApplicationComponent
include TableActionLink
attr_reader :record, :options attr_reader :record, :options
def initialize(record = nil, **options) def initialize(record = nil, **options)
@@ -21,7 +22,7 @@ class Admin::TableActionsComponent < ApplicationComponent
end end
def edit_options def edit_options
{ class: "button hollow" }.merge(options[:edit_options] || {}) { class: "edit-link" }.merge(options[:edit_options] || {})
end end
def destroy_text def destroy_text
@@ -35,7 +36,7 @@ class Admin::TableActionsComponent < ApplicationComponent
def destroy_options def destroy_options
{ {
method: :delete, method: :delete,
class: "button hollow alert", class: "destroy-link",
data: { confirm: destroy_confirmation } data: { confirm: destroy_confirmation }
}.merge(options[:destroy_options] || {}) }.merge(options[:destroy_options] || {})
end end

View File

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

View File

@@ -9,7 +9,7 @@
<th><%= t("admin.admin_notifications.index.title") %></th> <th><%= t("admin.admin_notifications.index.title") %></th>
<th><%= t("admin.admin_notifications.index.segment_recipient") %></th> <th><%= t("admin.admin_notifications.index.segment_recipient") %></th>
<th><%= t("admin.admin_notifications.index.sent") %></th> <th><%= t("admin.admin_notifications.index.sent") %></th>
<th class="small-5"><%= t("admin.admin_notifications.index.actions") %></th> <th><%= t("admin.admin_notifications.index.actions") %></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -33,13 +33,13 @@
<%= render Admin::TableActionsComponent.new(admin_notification) do |actions| %> <%= render Admin::TableActionsComponent.new(admin_notification) do |actions| %>
<%= actions.link_to t("admin.admin_notifications.index.preview"), <%= actions.link_to t("admin.admin_notifications.index.preview"),
admin_admin_notification_path(admin_notification), admin_admin_notification_path(admin_notification),
class: "button" %> class: "preview-link" %>
<% end %> <% end %>
<% else %> <% else %>
<%= render Admin::TableActionsComponent.new(actions: []) do |actions| %> <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
<%= actions.link_to t("admin.admin_notifications.index.view"), <%= actions.link_to t("admin.admin_notifications.index.view"),
admin_admin_notification_path(admin_notification), admin_admin_notification_path(admin_notification),
class: "button" %> class: "show-link" %>
<% end %> <% end %>
<% end %> <% end %>
</td> </td>

View File

@@ -10,7 +10,7 @@
<thead> <thead>
<th scope="col"><%= t("admin.administrators.index.name") %></th> <th scope="col"><%= t("admin.administrators.index.name") %></th>
<th scope="col"><%= t("admin.administrators.index.email") %></th> <th scope="col"><%= t("admin.administrators.index.email") %></th>
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th> <th scope="col"><%= t("admin.shared.actions") %></th>
</thead> </thead>
<tbody> <tbody>
<% @users.each do |user| %> <% @users.each do |user| %>

View File

@@ -37,7 +37,7 @@
<%= render Admin::TableActionsComponent.new(actions: []) do |actions| %> <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
<%= actions.link_to t("shared.show"), <%= actions.link_to t("shared.show"),
admin_polymorphic_path(audit), admin_polymorphic_path(audit),
class: "button hollow primary" %> class: "show-link" %>
<% end %> <% end %>
</td> </td>
</tr> </tr>

View File

@@ -13,7 +13,7 @@
<tr id="<%= dom_id(banner) %>"> <tr id="<%= dom_id(banner) %>">
<th scope="col"><%= Banner.human_attribute_name(:post_started_at) %></th> <th scope="col"><%= Banner.human_attribute_name(:post_started_at) %></th>
<th scope="col"><%= Banner.human_attribute_name(:post_ended_at) %></th> <th scope="col"><%= Banner.human_attribute_name(:post_ended_at) %></th>
<th scope="col" class="small-4"><%= t("admin.actions.actions") %></th> <th scope="col"><%= t("admin.actions.actions") %></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@@ -28,7 +28,8 @@
<td> <td>
<%= render Admin::TableActionsComponent.new(group) do |actions| %> <%= render Admin::TableActionsComponent.new(group) do |actions| %>
<%= actions.link_to t("admin.budget_groups.headings_manage"), <%= actions.link_to t("admin.budget_groups.headings_manage"),
admin_budget_group_headings_path(@budget, group) %> admin_budget_group_headings_path(@budget, group),
class: "headings-link" %>
<% end %> <% end %>
</td> </td>
</tr> </tr>

View File

@@ -76,9 +76,10 @@
<span class="budget-phase-enabled <%= phase.enabled? ? "enabled" : "disabled" %>"></span> <span class="budget-phase-enabled <%= phase.enabled? ? "enabled" : "disabled" %>"></span>
</td> </td>
<td> <td>
<%= link_to t("admin.budgets.edit.edit_phase"), <%= render Admin::TableActionsComponent.new(phase,
edit_admin_budget_budget_phase_path(@budget, phase), actions: [:edit],
class: "button hollow expanded" %> edit_text: t("admin.budgets.edit.edit_phase")
) %>
</td> </td>
</tr> </tr>
<% end %> <% end %>

View File

@@ -17,7 +17,7 @@
<th class="text-center"><%= t("admin.dashboard.actions.index.day_offset") %></th> <th class="text-center"><%= t("admin.dashboard.actions.index.day_offset") %></th>
<th class="text-center"><%= t("admin.dashboard.actions.index.required_supports") %></th> <th class="text-center"><%= t("admin.dashboard.actions.index.required_supports") %></th>
<th class="text-center"><%= t("admin.dashboard.actions.index.order") %></th> <th class="text-center"><%= t("admin.dashboard.actions.index.order") %></th>
<th class="small-3"><%= t("admin.actions.actions") %></th> <th><%= t("admin.actions.actions") %></th>
</tr> </tr>
</thead> </thead>

View File

@@ -10,7 +10,7 @@
<th><%= t("admin.geozones.geozone.external_code") %></th> <th><%= t("admin.geozones.geozone.external_code") %></th>
<th><%= t("admin.geozones.geozone.census_code") %></th> <th><%= t("admin.geozones.geozone.census_code") %></th>
<th><%= t("admin.geozones.geozone.coordinates") %></th> <th><%= t("admin.geozones.geozone.coordinates") %></th>
<th class="small-3"><%= t("admin.actions.actions") %></th> <th><%= t("admin.actions.actions") %></th>
</tr> </tr>
</thead> </thead>

View File

@@ -27,16 +27,12 @@
<tbody> <tbody>
<% @processes.each do |process| %> <% @processes.each do |process| %>
<tr id="<%= dom_id(process) %>"> <tr id="<%= dom_id(process) %>">
<td class="small-12 medium-6 large-4"> <td class="small-12 medium-6 large-4"><%= process.title %></td>
<%= link_to process.title, edit_admin_legislation_process_path(process) %>
</td>
<td><%= t("admin.legislation.processes.process.status_#{process.status}") %></td> <td><%= t("admin.legislation.processes.process.status_#{process.status}") %></td>
<td class="text-center"><%= I18n.l process.start_date %></td> <td class="text-center"><%= I18n.l process.start_date %></td>
<td class="text-center"><%= I18n.l process.end_date %></td> <td class="text-center"><%= I18n.l process.end_date %></td>
<td class="text-center"><%= process.total_comments %></td> <td class="text-center"><%= process.total_comments %></td>
<td> <td><%= render Admin::TableActionsComponent.new(process) %></td>
<%= render Admin::TableActionsComponent.new(process, actions: [:destroy]) %>
</td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@@ -10,7 +10,7 @@
<thead> <thead>
<th scope="col"><%= t("admin.managers.index.name") %></th> <th scope="col"><%= t("admin.managers.index.name") %></th>
<th scope="col"><%= t("admin.managers.index.email") %></th> <th scope="col"><%= t("admin.managers.index.email") %></th>
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th> <th scope="col"><%= t("admin.shared.actions") %></th>
</thead> </thead>
<tbody> <tbody>
<% @users.each do |user| %> <% @users.each do |user| %>

View File

@@ -30,9 +30,7 @@
<% milestoneable.milestones.order_by_publication_date.each do |milestone| %> <% milestoneable.milestones.order_by_publication_date.each do |milestone| %>
<tr id="<%= dom_id(milestone) %>" class="milestone"> <tr id="<%= dom_id(milestone) %>" class="milestone">
<td class="text-center"><%= milestone.id %></td> <td class="text-center"><%= milestone.id %></td>
<td> <td><%= milestone.title %></td>
<%= link_to milestone.title, admin_polymorphic_path(milestone, action: :edit) %>
</td>
<td class="small small-5"><%= milestone.description %></td> <td class="small small-5"><%= milestone.description %></td>
<td class="small"> <td class="small">
<%= l(milestone.publication_date.to_date) if milestone.publication_date.present? %> <%= l(milestone.publication_date.to_date) if milestone.publication_date.present? %>
@@ -55,9 +53,8 @@
<% end %> <% end %>
<% end %> <% end %>
</td> </td>
<td class="small-2"> <td>
<%= render Admin::TableActionsComponent.new(milestone, <%= render Admin::TableActionsComponent.new(milestone,
actions: [:destroy],
destroy_text: t("admin.milestones.index.delete") destroy_text: t("admin.milestones.index.delete")
) %> ) %>
</td> </td>

View File

@@ -10,7 +10,7 @@
<thead> <thead>
<th scope="col"><%= t("admin.moderators.index.name") %></th> <th scope="col"><%= t("admin.moderators.index.name") %></th>
<th scope="col" class="small-6"><%= t("admin.moderators.index.email") %></th> <th scope="col" class="small-6"><%= t("admin.moderators.index.email") %></th>
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th> <th scope="col"><%= t("admin.shared.actions") %></th>
</thead> </thead>
<tbody> <tbody>
<% @users.each do |user| %> <% @users.each do |user| %>

View File

@@ -9,7 +9,7 @@
<th class="small-2"><%= t("admin.newsletters.index.subject") %></th> <th class="small-2"><%= t("admin.newsletters.index.subject") %></th>
<th><%= t("admin.newsletters.index.segment_recipient") %></th> <th><%= t("admin.newsletters.index.segment_recipient") %></th>
<th><%= t("admin.newsletters.index.sent") %></th> <th><%= t("admin.newsletters.index.sent") %></th>
<th class="small-5"><%= t("admin.newsletters.index.actions") %></th> <th><%= t("admin.newsletters.index.actions") %></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -32,7 +32,7 @@
<%= render Admin::TableActionsComponent.new(newsletter) do |actions| %> <%= render Admin::TableActionsComponent.new(newsletter) do |actions| %>
<%= actions.link_to t("admin.newsletters.index.preview"), <%= actions.link_to t("admin.newsletters.index.preview"),
admin_newsletter_path(newsletter), admin_newsletter_path(newsletter),
class: "button" %> class: "preview-link" %>
<% end %> <% end %>
</td> </td>
</tr> </tr>

View File

@@ -31,8 +31,7 @@
admin_poll_booth_assignments_path(@poll, booth_id: booth.id), admin_poll_booth_assignments_path(@poll, booth_id: booth.id),
method: :post, method: :post,
remote: true, remote: true,
title: t("admin.booth_assignments.manage.actions.assign"), class: "assign-booth-link" %>
class: "button hollow expanded" %>
<% end %> <% end %>
<% end %> <% end %>
</td> </td>

View File

@@ -10,7 +10,7 @@
<%= render Admin::TableActionsComponent.new(actions: []) do |actions| %> <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
<%= actions.link_to t("admin.booths.booth.shifts"), <%= actions.link_to t("admin.booths.booth.shifts"),
new_admin_booth_shift_path(booth), new_admin_booth_shift_path(booth),
class: "button hollow" %> class: "shifts-link" %>
<% end %> <% end %>
<% else %> <% else %>
<%= render Admin::TableActionsComponent.new(booth, <%= render Admin::TableActionsComponent.new(booth,

View File

@@ -14,7 +14,7 @@
) do |actions| %> ) do |actions| %>
<%= actions.link_to t("admin.actions.configure"), <%= actions.link_to t("admin.actions.configure"),
admin_poll_path(poll), admin_poll_path(poll),
class: "button hollow " %> class: "configure-link" %>
<% end %> <% end %>
</td> </td>
</tr> </tr>

View File

@@ -8,11 +8,11 @@
<%= t("admin.polls.show.no_questions") %> <%= t("admin.polls.show.no_questions") %>
</div> </div>
<% else %> <% else %>
<table class="fixed margin"> <table class="margin">
<thead> <thead>
<tr> <tr>
<th><%= t("admin.polls.show.table_title") %></th> <th><%= t("admin.polls.show.table_title") %></th>
<th class="small-6"><%= t("admin.actions.actions") %></th> <th><%= t("admin.actions.actions") %></th>
</tr> </tr>
</thead> </thead>
<% @poll.questions.each do |question| %> <% @poll.questions.each do |question| %>
@@ -30,7 +30,7 @@
<td> <td>
<%= render Admin::TableActionsComponent.new(question) do |actions| %> <%= render Admin::TableActionsComponent.new(question) do |actions| %>
<%= actions.link_to t("admin.polls.show.edit_answers"), admin_question_path(question), <%= actions.link_to t("admin.polls.show.edit_answers"), admin_question_path(question),
class: "button hollow" %> class: "answers-link" %>
<% end %> <% end %>
</td> </td>
</tr> </tr>

View File

@@ -18,7 +18,7 @@
<%= render Admin::TableActionsComponent.new(actions: []) do |actions| %> <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
<%= actions.link_to t("admin.booth_assignments.manage_assignments"), <%= actions.link_to t("admin.booth_assignments.manage_assignments"),
manage_admin_poll_booth_assignments_path(poll), manage_admin_poll_booth_assignments_path(poll),
class: "button hollow" %> class: "manage-link" %>
<% end %> <% end %>
</td> </td>
</tr> </tr>

View File

@@ -7,18 +7,18 @@
<%= t("admin.questions.index.no_questions") %> <%= t("admin.questions.index.no_questions") %>
</div> </div>
<% else %> <% else %>
<table class="fixed"> <table>
<thead> <thead>
<tr> <tr>
<th><%= t("admin.questions.index.table_question") %></th> <th><%= t("admin.questions.index.table_question") %></th>
<th><%= t("admin.questions.index.table_poll") %></th> <th><%= t("admin.questions.index.table_poll") %></th>
<th class="small-4"><%= t("admin.actions.actions") %></th> <th><%= t("admin.actions.actions") %></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @questions.each do |question| %> <% @questions.each do |question| %>
<tr id="<%= dom_id(question) %>"> <tr id="<%= dom_id(question) %>">
<td><%= link_to question.title, admin_question_path(question) %></td> <td><%= question.title %></td>
<td> <td>
<% if question.poll.present? %> <% if question.poll.present? %>
<%= question.poll.name %> <%= question.poll.name %>
@@ -27,7 +27,10 @@
<% end %> <% end %>
</td> </td>
<td> <td>
<%= render Admin::TableActionsComponent.new(question) %> <%= render Admin::TableActionsComponent.new(question) do |actions| %>
<%= actions.link_to t("admin.polls.show.edit_answers"), admin_question_path(question),
class: "answers-link" %>
<% end %>
</td> </td>
</tr> </tr>
<% end %> <% end %>

View File

@@ -1,4 +1,4 @@
<table class="fixed"> <table>
<thead> <thead>
<tr> <tr>
<th class="small-9"><%= t("admin.questions.index.table_proposal") %></th> <th class="small-9"><%= t("admin.questions.index.table_proposal") %></th>
@@ -9,16 +9,17 @@
<% @proposals.each do |proposal| %> <% @proposals.each do |proposal| %>
<tr id="<%= dom_id(proposal) %>"> <tr id="<%= dom_id(proposal) %>">
<td> <td>
<%= link_to proposal.title, proposal_path(proposal) %> <%= proposal.title %>
<p> <p>
<%= proposal.summary %><br> <%= proposal.summary %><br>
</p> </p>
</td> </td>
<td> <td>
<%= render Admin::TableActionsComponent.new(actions: []) do |actions| %> <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
<%= actions.link_to t("admin.shared.view"), proposal_path(proposal), class: "show-link" %>
<%= actions.link_to t("admin.questions.index.create_question"), <%= actions.link_to t("admin.questions.index.create_question"),
new_admin_question_path(proposal_id: proposal.id), new_admin_question_path(proposal_id: proposal.id),
class: "button hollow" %> class: "new-link" %>
<% end %> <% end %>
</td> </td>
</tr> </tr>

View File

@@ -44,7 +44,7 @@
document.attachment.url, document.attachment.url,
target: "_blank", target: "_blank",
rel: "nofollow", rel: "nofollow",
class: "button hollow" %> class: "download-link" %>
<% end %> <% end %>
</td> </td>

View File

@@ -1,5 +1,5 @@
<h3><%= t("admin.poll_shifts.new.shifts") %></h3> <h3><%= t("admin.poll_shifts.new.shifts") %></h3>
<table class="fixed"> <table>
<thead> <thead>
<tr> <tr>
<th><%= t("admin.poll_shifts.new.date") %></th> <th><%= t("admin.poll_shifts.new.date") %></th>

View File

@@ -13,37 +13,31 @@
<tr> <tr>
<th><%= t("admin.site_customization.pages.page.title") %></th> <th><%= t("admin.site_customization.pages.page.title") %></th>
<th><%= t("admin.site_customization.pages.page.slug") %></th> <th><%= t("admin.site_customization.pages.page.slug") %></th>
<th><%= t("admin.site_customization.pages.page.cards_title") %></th>
<th><%= t("admin.site_customization.pages.page.created_at") %></th> <th><%= t("admin.site_customization.pages.page.created_at") %></th>
<th><%= t("admin.site_customization.pages.page.updated_at") %></th> <th><%= t("admin.site_customization.pages.page.updated_at") %></th>
<th><%= t("admin.site_customization.pages.page.status") %></th> <th><%= t("admin.site_customization.pages.page.status") %></th>
<th class="small-4"><%= t("admin.actions.actions") %></th> <th><%= t("admin.actions.actions") %></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @pages.each do |page| %> <% @pages.each do |page| %>
<tr id="<%= dom_id(page) %>"> <tr id="<%= dom_id(page) %>">
<td> <td><%= page.title %></td>
<%= link_to page.title, edit_admin_site_customization_page_path(page) %>
</td>
<td><%= page.slug %></td> <td><%= page.slug %></td>
<td>
<%= link_to t("admin.site_customization.pages.page.see_cards"), admin_site_customization_page_cards_path(page),
class: "button hollow expanded" %>
</td>
<td><%= I18n.l page.created_at, format: :short %></td> <td><%= I18n.l page.created_at, format: :short %></td>
<td><%= I18n.l page.created_at, format: :short %></td> <td><%= I18n.l page.created_at, format: :short %></td>
<td><%= t("admin.site_customization.pages.page.status_#{page.status}") %></td> <td><%= t("admin.site_customization.pages.page.status_#{page.status}") %></td>
<td> <td>
<%= render Admin::TableActionsComponent.new(page, <%= render Admin::TableActionsComponent.new(page) do |actions| %>
actions: [:destroy], <%= actions.link_to t("admin.site_customization.pages.page.see_cards"),
destroy_text: t("admin.site_customization.pages.index.delete") admin_site_customization_page_cards_path(page),
) do |actions| %> class: "cards-link" %>
<% if page.status == "published" %> <% if page.status == "published" %>
<%= actions.link_to t("admin.site_customization.pages.index.see_page"), <%= actions.link_to t("admin.site_customization.pages.index.see_page"),
page.url, page.url,
target: "_blank", target: "_blank",
class: "button hollow" %> class: "show-link" %>
<% end %> <% end %>
<% end %> <% end %>
</td> </td>

View File

@@ -22,16 +22,16 @@
<% if system_email_actions.include?("view") %> <% if system_email_actions.include?("view") %>
<%= actions.link_to t("admin.shared.view"), <%= actions.link_to t("admin.shared.view"),
admin_system_email_view_path(system_email_title), admin_system_email_view_path(system_email_title),
class: "button hollow" %> class: "show-link" %>
<% end %> <% end %>
<% if system_email_actions.include?("preview_pending") %> <% if system_email_actions.include?("preview_pending") %>
<%= actions.link_to t("admin.system_emails.preview_pending.action"), <%= actions.link_to t("admin.system_emails.preview_pending.action"),
admin_system_email_preview_pending_path(system_email_title), admin_system_email_preview_pending_path(system_email_title),
class: "button" %> class: "preview-pending-link" %>
<%= actions.link_to t("admin.system_emails.preview_pending.send_pending"), <%= actions.link_to t("admin.system_emails.preview_pending.send_pending"),
admin_system_email_send_pending_path(system_email_title), admin_system_email_send_pending_path(system_email_title),
class: "button success", class: "send-pending-link",
method: :put %> method: :put %>
<% end %> <% end %>

View File

@@ -1,5 +1,5 @@
<tr> <tr>
<td><%= link_to valuator.name, admin_valuator_path(valuator) %></td> <td><%= valuator.name %></td>
<td><%= valuator.email %></td> <td><%= valuator.email %></td>
<td> <td>
<% if valuator.description.present? %> <% if valuator.description.present? %>
@@ -19,6 +19,10 @@
<%= valuator_abilities(valuator) %> <%= valuator_abilities(valuator) %>
</td> </td>
<td> <td>
<%= render Admin::TableActionsComponent.new(valuator) %> <%= render Admin::TableActionsComponent.new(valuator) do |actions| %>
<%= actions.link_to t("admin.shared.view"),
admin_valuator_path(valuator),
class: "show-link" %>
<% end %>
</td> </td>
</tr> </tr>

View File

@@ -5,7 +5,7 @@
<th scope="col"><%= t("admin.valuators.index.description") %></th> <th scope="col"><%= t("admin.valuators.index.description") %></th>
<th scope="col"><%= t("admin.valuators.index.group") %></th> <th scope="col"><%= t("admin.valuators.index.group") %></th>
<th scope="col"><%= t("admin.valuators.index.abilities") %></th> <th scope="col"><%= t("admin.valuators.index.abilities") %></th>
<th scope="col" class="small-3"><%= t("admin.actions.actions") %></th> <th scope="col"><%= t("admin.actions.actions") %></th>
</thead> </thead>
<tbody> <tbody>
<% valuators.each do |valuator| %> <% valuators.each do |valuator| %>

View File

@@ -1512,7 +1512,6 @@ en:
updated_at: Updated at updated_at: Updated at
title: Title title: Title
slug: Slug slug: Slug
cards_title: Cards
see_cards: See Cards see_cards: See Cards
cards: cards:
cards_title: cards cards_title: cards

View File

@@ -1511,7 +1511,6 @@ es:
updated_at: Última actualización updated_at: Última actualización
title: Título title: Título
slug: Slug slug: Slug
cards_title: Tarjetas
see_cards: Ver tarjetas see_cards: Ver tarjetas
cards: cards:
cards_title: tarjetas cards_title: tarjetas

View File

@@ -274,6 +274,10 @@ resolve "Budget::Heading" do |heading, options|
[heading.budget, :group, :heading, options.merge(group_id: heading.group, id: heading)] [heading.budget, :group, :heading, options.merge(group_id: heading.group, id: heading)]
end end
resolve "Budget::Phase" do |phase, options|
[phase.budget, :phase, options.merge(id: phase)]
end
resolve "Poll::Booth" do |booth, options| resolve "Poll::Booth" do |booth, options|
[:booth, options.merge(id: booth)] [:booth, options.merge(id: booth)]
end end

View File

@@ -90,7 +90,7 @@ shared_examples "admin_milestoneable" do |factory_name, path_name|
visit path visit path
expect(page).to have_link document.title expect(page).to have_link document.title
click_link milestone.title within("tr", text: milestone.title) { click_link "Edit" }
expect(page).to have_css("img[alt='#{milestone.image.title}']") expect(page).to have_css("img[alt='#{milestone.image.title}']")

View File

@@ -21,7 +21,7 @@ describe "Admin legislation draft versions" do
visit admin_legislation_processes_path(filter: "all") visit admin_legislation_processes_path(filter: "all")
click_link "An example legislation process" within("tr", text: "An example legislation process") { click_link "Edit" }
click_link "Drafting" click_link "Drafting"
click_link "Version 1" click_link "Version 1"
@@ -41,10 +41,7 @@ describe "Admin legislation draft versions" do
end end
click_link "All" click_link "All"
within("tr", text: "An example legislation process") { click_link "Edit" }
expect(page).to have_content "An example legislation process"
click_link "An example legislation process"
click_link "Drafting" click_link "Drafting"
click_link "Create version" click_link "Create version"
@@ -77,7 +74,7 @@ describe "Admin legislation draft versions" do
expect(page).not_to have_link "All" expect(page).not_to have_link "All"
click_link "An example legislation process" within("tr", text: "An example legislation process") { click_link "Edit" }
click_link "Drafting" click_link "Drafting"
click_link "Version 1" click_link "Version 1"

View File

@@ -201,7 +201,7 @@ describe "Admin collaborative legislation" do
click_link "Collaborative Legislation" click_link "Collaborative Legislation"
end end
click_link "An example legislation process" within("tr", text: "An example legislation process") { click_link "Edit" }
expect(page).to have_selector("h2", text: "An example legislation process") expect(page).to have_selector("h2", text: "An example legislation process")
expect(find("#legislation_process_debate_phase_enabled")).to be_checked expect(find("#legislation_process_debate_phase_enabled")).to be_checked
@@ -224,7 +224,7 @@ describe "Admin collaborative legislation" do
click_link "Collaborative Legislation" click_link "Collaborative Legislation"
end end
click_link "An example legislation process" within("tr", text: "An example legislation process") { click_link "Edit" }
expect(find("#legislation_process_draft_publication_enabled")).to be_checked expect(find("#legislation_process_draft_publication_enabled")).to be_checked

View File

@@ -25,7 +25,7 @@ describe "Admin legislation questions" do
visit admin_legislation_processes_path(filter: "all") visit admin_legislation_processes_path(filter: "all")
click_link "An example legislation process" within("tr", text: "An example legislation process") { click_link "Edit" }
click_link "Debate" click_link "Debate"
expect(page).to have_content("Question 1") expect(page).to have_content("Question 1")
@@ -43,9 +43,7 @@ describe "Admin legislation questions" do
click_link "All" click_link "All"
expect(page).to have_content "An example legislation process" within("tr", text: "An example legislation process") { click_link "Edit" }
click_link "An example legislation process"
click_link "Debate" click_link "Debate"
click_link "Create question" click_link "Create question"
@@ -71,9 +69,8 @@ describe "Admin legislation questions" do
expect(page).not_to have_link "All" expect(page).not_to have_link "All"
click_link "An example legislation process" within("tr", text: "An example legislation process") { click_link "Edit" }
click_link "Debate" click_link "Debate"
click_link "Question 2" click_link "Question 2"
fill_in "Question", with: "Question 2b" fill_in "Question", with: "Question 2b"

View File

@@ -70,7 +70,7 @@ describe "Admin custom pages" do
click_link "Custom pages" click_link "Custom pages"
end end
click_link "An example custom page" within("tr", text: "An example custom page") { click_link "Edit" }
expect(page).to have_selector("h2", text: "An example custom page") expect(page).to have_selector("h2", text: "An example custom page")
expect(page).to have_selector("input[value='custom-example-page']") expect(page).to have_selector("input[value='custom-example-page']")