Merge pull request #1294 from consul/polls-views

Polls views
This commit is contained in:
Raimond Garcia
2016-12-14 19:26:55 +01:00
committed by GitHub
18 changed files with 235 additions and 202 deletions

View File

@@ -32,6 +32,13 @@ body.admin {
height: auto;
}
.top-bar-title {
h1 {
margin-bottom: 0;
}
}
form {
.button {
@@ -77,6 +84,11 @@ body.admin {
color: $admin-color;
}
.tabs-panel {
padding-left: 0;
padding-right: 0;
}
#proposals {
width: 100% !important;
}
@@ -148,6 +160,13 @@ body.admin {
}
}
.input-group {
.input-group-button {
padding-bottom: rem-calc(16);
}
}
// 02. Sidebar
// -----------

View File

@@ -1,4 +1,4 @@
<nav class="admin-sidebar" data-equalizer-watch>
<div class="admin-sidebar" data-equalizer-watch>
<ul id="admin_menu" data-accordion-menu>
<li class="section-title">
@@ -119,4 +119,4 @@
</ul>
</li>
</ul>
</nav>
</div>

View File

@@ -1,4 +1,7 @@
<h2><%= t("admin.booths.index.title") %></h2>
<h2 class="inline-block"><%= t("admin.booths.index.title") %></h2>
<%= link_to t("admin.booths.index.add_booth"), new_admin_booth_path,
class: "button success float-right" %>
<% if @booths.empty? %>
<div class="callout primary">
@@ -6,10 +9,6 @@
</div>
<% end %>
<%= link_to t("admin.booths.index.add_booth"),
new_admin_booth_path,
class: "button success" %>
<% if @booths.any? %>
<h3><%= page_entries_info @booths %></h3>
<table>

View File

@@ -1,26 +1,30 @@
<div class="small-12 column">
<table>
<tbody>
<tr>
<td>
<%= officer.name %>
</td>
<td>
<%= officer.email %>
</td>
<td class="text-right">
<% if officer.persisted? %>
<%= link_to t('admin.poll_officers.officer.delete'),
admin_poll_officer_path(officer),
method: :delete,
class: "button hollow alert" %>
<% else %>
<%= link_to t('admin.poll_officers.officer.add'),{ controller: "admin/poll/officers", action: :create, user_id: officer.user_id },
method: :post,
class: "button success" %>
<% end %>
</td>
</tr>
</tbody>
</table>
</div>
<table>
<thead>
<tr>
<th><%= t('admin.poll_officers.officer.name') %></th>
<th colspan="2"><%= t('admin.poll_officers.officer.email') %></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<%= officer.name %>
</td>
<td>
<%= officer.email %>
</td>
<td class="text-right">
<% if officer.persisted? %>
<%= link_to t('admin.poll_officers.officer.delete'),
admin_poll_officer_path(officer),
method: :delete,
class: "button hollow alert" %>
<% else %>
<%= link_to t('admin.poll_officers.officer.add'),{ controller: "admin/poll/officers", action: :create, user_id: officer.user_id },
method: :post,
class: "button success" %>
<% end %>
</td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,9 @@
<%= form_tag search_admin_officers_path, method: :get, remote: true do %>
<div class="input-group">
<%= text_field_tag :email, '',
placeholder: t("admin.poll_officers.search.email_placeholder") %>
<div class="input-group-button">
<%= submit_tag t("admin.poll_officers.search.search"), class: "button" %>
</div>
</div>
<% end %>

View File

@@ -1,21 +1,25 @@
<h2><%= t("admin.poll_officers.index.title") %></h2>
<div class="row">
<%= form_tag search_admin_officers_path, method: :get, remote: true do %>
<div class="small-12 medium-6 column">
<%= text_field_tag :email, '', placeholder: t('admin.poll_officers.search.email_placeholder') %>
</div>
<div class="small-12 medium-6 column">
<%= submit_tag t('admin.poll_officers.search.search'), class: 'button' %>
</div>
<% end %>
<div class="small-12 medium-6 column">
<%= render 'search' %>
</div>
</div>
<div id="search-result" class="row"></div>
<div id="search-result"></div>
<h3><%= page_entries_info @officers %></h3>
<h3>
<%= page_entries_info @officers, entry_name: t('admin.poll_officers.officer.entry_name') %>
</h3>
<table id="officers">
<thead>
<tr>
<th><%= t('admin.poll_officers.officer.name') %></th>
<th colspan="2"><%= t('admin.poll_officers.officer.email') %></th>
</tr>
</thead>
<tbody>
<% @officers.each do |officer| %>
<tr>
<td>
@@ -41,6 +45,7 @@
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @officers %>

View File

@@ -1,39 +1,34 @@
<div class="row">
<div class="small-12 column">
<% if @poll.booths.empty? %>
<div class="callout primary text-center">
<%= t("admin.polls.show.no_booths") %>
</div>
<% else %>
<h3><%= t("admin.polls.show.booths_title") %></h3>
<h2><%= t("admin.polls.show.booths_title") %></h2>
<table>
<thead>
<th><%= t("admin.polls.show.name") %></th>
<th><%= t("admin.polls.show.location") %></th>
<th>&nbsp;</th>
</thead>
<tbody>
<% @poll.booths.each do |booth| %>
<tr id="booth_<%= booth.id %>" class="booth">
<td>
<strong>
<%= link_to booth.name, admin_booth_path(booth) %>
</strong>
</td>
<td>
<%= booth.location %>
</td>
<td class="text-right">
<%= link_to t("admin.polls.show.remove_booth"),
"#",
class: "button hollow alert" %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% if @poll.booths.empty? %>
<div class="callout primary margin-top">
<%= t("admin.polls.show.no_booths") %>
</div>
</div>
<% else %>
<table>
<thead>
<th><%= t("admin.polls.show.name") %></th>
<th><%= t("admin.polls.show.location") %></th>
<th>&nbsp;</th>
</thead>
<tbody>
<% @poll.booths.each do |booth| %>
<tr id="booth_<%= booth.id %>" class="booth">
<td>
<strong>
<%= link_to booth.name, admin_booth_path(booth) %>
</strong>
</td>
<td>
<%= booth.location %>
</td>
<td class="text-right">
<%= link_to t("admin.polls.show.remove_booth"),
"#",
class: "button hollow alert" %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>

View File

@@ -1,30 +1,20 @@
<div class="row">
<div class="small-12 column">
<ul class="tabs" data-tabs id="example-tabs">
<li class="tabs-title is-active">
<%= link_to "#tab-questions" do %>
<h2>
<%= t("admin.polls.show.questions_tab") %>
<span class="js-comments-count">(<%= @poll.questions.count %>)</span>
</h2>
<% end %>
</li>
<li class="tabs-title">
<%= link_to "#tab-booths" do %>
<h2>
<%= t("admin.polls.show.booths_tab") %>
(<%= @poll.booths.count %>)
</h2>
<% end %>
</li>
<li class="tabs-title">
<%= link_to "#tab-officers" do %>
<h2>
<%= t("admin.polls.show.officers_tab") %>
(<%= @poll.officers.count %>)
</h2>
<% end %>
</li>
</ul>
</div>
</div>
<ul class="tabs" data-tabs id="example-tabs">
<li class="tabs-title is-active">
<%= link_to "#tab-questions" do %>
<%= t("admin.polls.show.questions_tab") %>
<span class="js-comments-count">(<%= @poll.questions.count %>)</span>
<% end %>
</li>
<li class="tabs-title">
<%= link_to "#tab-booths" do %>
<%= t("admin.polls.show.booths_tab") %>
(<%= @poll.booths.count %>)
<% end %>
</li>
<li class="tabs-title">
<%= link_to "#tab-officers" do %>
<%= t("admin.polls.show.officers_tab") %>
(<%= @poll.officers.count %>)
<% end %>
</li>
</ul>

View File

@@ -1,33 +1,28 @@
<div class="row">
<div class="small-12 column">
<% if @poll.officers.empty? %>
<div class="callout primary text-center">
<%= t("admin.polls.show.no_officers") %>
</div>
<% else %>
<h3><%= t("admin.polls.show.officers_title") %></h3>
<h2><%= t("admin.polls.show.officers_title") %></h2>
<table>
<thead>
<th><%= t("admin.polls.show.name") %></th>
<th><%= t("admin.polls.show.email") %></th>
</thead>
<tbody>
<% @poll.officers.each do |officer| %>
<tr id="officer_<%= officer.id %>" class="officer">
<td>
<strong>
<%= officer.name %>
</strong>
</td>
<td>
<%= officer.email %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% if @poll.officers.empty? %>
<div class="callout primary margin-top">
<%= t("admin.polls.show.no_officers") %>
</div>
</div>
<% else %>
<table>
<thead>
<th><%= t("admin.polls.show.name") %></th>
<th><%= t("admin.polls.show.email") %></th>
</thead>
<tbody>
<% @poll.officers.each do |officer| %>
<tr id="officer_<%= officer.id %>" class="officer">
<td>
<strong>
<%= officer.name %>
</strong>
</td>
<td>
<%= officer.email %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>

View File

@@ -1,29 +1,24 @@
<div class="row">
<div class="small-12 column">
<% if @poll.questions.empty? %>
<div class="callout primary text-center">
<%= t('admin.polls.show.no_questions') %>
</div>
<% else %>
<h3><%= t("admin.polls.show.questions_title") %></h3>
<h2><%= t("admin.polls.show.questions_title") %></h2>
<table>
<% @poll.questions.each do |question| %>
<tr id="<%= dom_id(question) %>">
<td><%= link_to question.title, admin_question_path(question) %></td>
<td class="text-right">
<%= link_to t('shared.edit'),
edit_admin_question_path(question),
class: "button hollow" %>
<%= link_to t('shared.delete'),
admin_question_path(question),
class: "button hollow alert",
method: :delete %>
</td>
</tr>
<% end %>
</table>
<% end %>
<% if @poll.questions.empty? %>
<div class="callout primary margin-top">
<%= t('admin.polls.show.no_questions') %>
</div>
</div>
<% else %>
<table class="margin-top">
<% @poll.questions.each do |question| %>
<tr id="<%= dom_id(question) %>">
<td><%= link_to question.title, admin_question_path(question) %></td>
<td class="text-right">
<%= link_to t('shared.edit'),
edit_admin_question_path(question),
class: "button hollow" %>
<%= link_to t('shared.delete'),
admin_question_path(question),
class: "button hollow alert",
method: :delete %>
</td>
</tr>
<% end %>
</table>
<% end %>

View File

@@ -1,8 +1,7 @@
<div class="small-12 medium-6">
<%= form_tag '', method: :get do %>
<%= select_tag "poll_id",
poll_select_options(true),
prompt: t("admin.questions.index.select_poll"),
class: "js-location-changer" %>
<% end %>
</div>
<%= form_tag '', method: :get do %>
<%= label_tag :poll_id, t("admin.questions.index.filter_poll") %>
<%= select_tag "poll_id",
poll_select_options(true),
prompt: t("admin.questions.index.select_poll"),
class: "js-location-changer" %>
<% end %>

View File

@@ -7,15 +7,19 @@
<div class="row">
<div class="small-12 column">
<div class="small-12 medium-6">
<%= f.select :poll_id,
options_for_select(Poll.pluck(:name, :id)),
prompt: t("admin.questions.index.select_poll") %>
<div class="small-12 medium-6 large-4">
<%= f.select :poll_id,
options_for_select(Poll.pluck(:name, :id)),
prompt: t("admin.questions.index.select_poll"),
label: t("admin.questions.new.poll_label") %>
</div>
<%= f.text_field :title, maxlength: Poll::Question.title_max_length %>
<%= f.text_field :valid_answers %>
<%= f.label :valid_answers %>
<p class="note"><%= t("admin.questions.new.valid_answers_note") %></p>
<%= f.text_field :valid_answers, label: false %>
<%= f.text_area :summary, rows: 4, maxlength: 200 %>

View File

@@ -1,11 +1,9 @@
<%= form_tag(admin_questions_path, method: :get) do |f| %>
<div class="row">
<div class="small-12 medium-6 column">
<%= text_field_tag :search,
@search,
placeholder: t("admin.shared.spending_proposal_search.placeholder") %>
</div>
<div class="form-inline small-12 medium-3 column end">
<div class="input-group">
<%= text_field_tag :search,
@search,
placeholder: t("admin.shared.spending_proposal_search.placeholder") %>
<div class="input-group-button">
<%= submit_tag t("admin.shared.spending_proposal_search.button"), class: "button" %>
</div>
</div>

View File

@@ -3,11 +3,18 @@
<%= link_to t('admin.questions.index.create'), new_admin_question_path,
class: "button success float-right" %>
<%= render 'filter' %>
<%= render 'search' %>
<div class="row">
<div class="small-12 medium-6 column">
<%= render 'search' %>
</div>
</div>
<div class="small-12 medium-4 large-3">
<%= render 'filter' %>
</div>
<% if @questions.count == 0 %>
<div class="callout primary">
<div class="callout primary margin-top">
<%= t('admin.questions.index.no_questions') %>
</div>
<% else %>

View File

@@ -1,11 +1,11 @@
<header>
<section class="top-links">
<div class="top-links">
<div class="expanded row">
<%= render 'shared/locale_switcher' %>
<%= link_to t("admin.dashboard.index.back") + " " + setting['org_name'],
root_path, class: "float-right back-web" %>
</div>
</section>
</div>
<div class="expanded row">
<div class="top-bar">
@@ -19,11 +19,13 @@
<div id="responsive-menu">
<div class="top-bar-title">
<%= link_to admin_root_path, class: "hide-for-small-only" do %>
<%= image_tag('logo_header.png', class: 'hide-for-small-only float-left', size: '80x80', alt: t("layouts.header.logo")) %>
<%= setting['org_name'] %>
&nbsp;|&nbsp;<%= t("admin.dashboard.index.title") %>
<% end %>
<h1>
<%= link_to admin_root_path, class: "hide-for-small-only" do %>
<%= image_tag('logo_header.png', class: 'hide-for-small-only float-left', size: '80x80', alt: t("layouts.header.logo")) %>
<%= setting['org_name'] %>
&nbsp;|&nbsp;<%= t("admin.dashboard.index.title") %>
<% end %>
</h1>
</div>
<div class="top-bar-right">

View File

@@ -30,7 +30,7 @@
<div class="off-canvas-content" data-off-canvas-content>
<%= render 'layouts/admin_header' %>
<main class="no-margin-top row no-max-width collapse" data-equalizer>
<div class="no-margin-top row no-max-width collapse" data-equalizer>
<div class="small-12 medium-3 column">
<div class="show-for-small-only">
@@ -46,7 +46,7 @@
<%= render 'layouts/flash' %>
<%= yield %>
</div>
</main>
</div>
</div>
</div>
</div>

View File

@@ -154,6 +154,9 @@ en:
officer:
add: Add
delete: Delete
name: Name
email: Email
entry_name: officer
search:
email_placeholder: Search user by email
search: Search
@@ -194,11 +197,14 @@ en:
title: "Questions"
create: "Create question"
no_questions: "There are no questions."
filter_poll: Filter by Poll
select_poll: Select Poll
edit:
title: "Edit Question"
new:
title: "Create Question"
poll_label: "Poll"
valid_answers_note: "Enter the answers separated by commas (,)"
show:
proposal: Original proposal
author: Author

View File

@@ -154,6 +154,9 @@ es:
officer:
add: Añadir como Presidente de mesa
delete: Borrar
name: Nombre
email: Email
entry_name: presidente de mesa
search:
email_placeholder: Buscar usuario por email
search: Buscar
@@ -194,11 +197,14 @@ es:
title: "Preguntas ciudadanas"
create: "Crear pregunta ciudadana"
no_questions: "No hay ninguna pregunta ciudadana."
select_poll: Seleccionar votación
filter_poll: "Filtrar por votación"
select_poll: "Seleccionar votación"
edit:
title: "Editar pregunta ciudadana"
new:
title: "Crear pregunta ciudadana"
poll_label: "Votación"
valid_answers_note: "Escribe las respuestas separadas por comas (,)"
show:
proposal: Propuesta ciudadana original
author: Autor