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; height: auto;
} }
.top-bar-title {
h1 {
margin-bottom: 0;
}
}
form { form {
.button { .button {
@@ -77,6 +84,11 @@ body.admin {
color: $admin-color; color: $admin-color;
} }
.tabs-panel {
padding-left: 0;
padding-right: 0;
}
#proposals { #proposals {
width: 100% !important; width: 100% !important;
} }
@@ -148,6 +160,13 @@ body.admin {
} }
} }
.input-group {
.input-group-button {
padding-bottom: rem-calc(16);
}
}
// 02. Sidebar // 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> <ul id="admin_menu" data-accordion-menu>
<li class="section-title"> <li class="section-title">
@@ -119,4 +119,4 @@
</ul> </ul>
</li> </li>
</ul> </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? %> <% if @booths.empty? %>
<div class="callout primary"> <div class="callout primary">
@@ -6,10 +9,6 @@
</div> </div>
<% end %> <% end %>
<%= link_to t("admin.booths.index.add_booth"),
new_admin_booth_path,
class: "button success" %>
<% if @booths.any? %> <% if @booths.any? %>
<h3><%= page_entries_info @booths %></h3> <h3><%= page_entries_info @booths %></h3>
<table> <table>

View File

@@ -1,26 +1,30 @@
<div class="small-12 column"> <table>
<table> <thead>
<tbody> <tr>
<tr> <th><%= t('admin.poll_officers.officer.name') %></th>
<td> <th colspan="2"><%= t('admin.poll_officers.officer.email') %></th>
<%= officer.name %> </tr>
</td> </thead>
<td> <tbody>
<%= officer.email %> <tr>
</td> <td>
<td class="text-right"> <%= officer.name %>
<% if officer.persisted? %> </td>
<%= link_to t('admin.poll_officers.officer.delete'), <td>
admin_poll_officer_path(officer), <%= officer.email %>
method: :delete, </td>
class: "button hollow alert" %> <td class="text-right">
<% else %> <% if officer.persisted? %>
<%= link_to t('admin.poll_officers.officer.add'),{ controller: "admin/poll/officers", action: :create, user_id: officer.user_id }, <%= link_to t('admin.poll_officers.officer.delete'),
method: :post, admin_poll_officer_path(officer),
class: "button success" %> method: :delete,
<% end %> class: "button hollow alert" %>
</td> <% else %>
</tr> <%= link_to t('admin.poll_officers.officer.add'),{ controller: "admin/poll/officers", action: :create, user_id: officer.user_id },
</tbody> method: :post,
</table> class: "button success" %>
</div> <% 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> <h2><%= t("admin.poll_officers.index.title") %></h2>
<div class="row"> <div class="row">
<%= form_tag search_admin_officers_path, method: :get, remote: true do %> <div class="small-12 medium-6 column">
<div class="small-12 medium-6 column"> <%= render 'search' %>
<%= text_field_tag :email, '', placeholder: t('admin.poll_officers.search.email_placeholder') %> </div>
</div>
<div class="small-12 medium-6 column">
<%= submit_tag t('admin.poll_officers.search.search'), class: 'button' %>
</div>
<% end %>
</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"> <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| %> <% @officers.each do |officer| %>
<tr> <tr>
<td> <td>
@@ -41,6 +45,7 @@
</td> </td>
</tr> </tr>
<% end %> <% end %>
</tbody>
</table> </table>
<%= paginate @officers %> <%= paginate @officers %>

View File

@@ -1,39 +1,34 @@
<div class="row"> <h3><%= t("admin.polls.show.booths_title") %></h3>
<div class="small-12 column">
<% if @poll.booths.empty? %>
<div class="callout primary text-center">
<%= t("admin.polls.show.no_booths") %>
</div>
<% else %>
<h2><%= t("admin.polls.show.booths_title") %></h2> <% if @poll.booths.empty? %>
<div class="callout primary margin-top">
<table> <%= t("admin.polls.show.no_booths") %>
<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 %>
</div> </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"> <ul class="tabs" data-tabs id="example-tabs">
<div class="small-12 column"> <li class="tabs-title is-active">
<ul class="tabs" data-tabs id="example-tabs"> <%= link_to "#tab-questions" do %>
<li class="tabs-title is-active"> <%= t("admin.polls.show.questions_tab") %>
<%= link_to "#tab-questions" do %> <span class="js-comments-count">(<%= @poll.questions.count %>)</span>
<h2> <% end %>
<%= t("admin.polls.show.questions_tab") %> </li>
<span class="js-comments-count">(<%= @poll.questions.count %>)</span> <li class="tabs-title">
</h2> <%= link_to "#tab-booths" do %>
<% end %> <%= t("admin.polls.show.booths_tab") %>
</li> (<%= @poll.booths.count %>)
<li class="tabs-title"> <% end %>
<%= link_to "#tab-booths" do %> </li>
<h2> <li class="tabs-title">
<%= t("admin.polls.show.booths_tab") %> <%= link_to "#tab-officers" do %>
(<%= @poll.booths.count %>) <%= t("admin.polls.show.officers_tab") %>
</h2> (<%= @poll.officers.count %>)
<% end %> <% end %>
</li> </li>
<li class="tabs-title"> </ul>
<%= link_to "#tab-officers" do %>
<h2>
<%= t("admin.polls.show.officers_tab") %>
(<%= @poll.officers.count %>)
</h2>
<% end %>
</li>
</ul>
</div>
</div>

View File

@@ -1,33 +1,28 @@
<div class="row"> <h3><%= t("admin.polls.show.officers_title") %></h3>
<div class="small-12 column">
<% if @poll.officers.empty? %>
<div class="callout primary text-center">
<%= t("admin.polls.show.no_officers") %>
</div>
<% else %>
<h2><%= t("admin.polls.show.officers_title") %></h2> <% if @poll.officers.empty? %>
<div class="callout primary margin-top">
<table> <%= t("admin.polls.show.no_officers") %>
<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 %>
</div> </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"> <h3><%= t("admin.polls.show.questions_title") %></h3>
<div class="small-12 column">
<% if @poll.questions.empty? %>
<div class="callout primary text-center">
<%= t('admin.polls.show.no_questions') %>
</div>
<% else %>
<h2><%= t("admin.polls.show.questions_title") %></h2> <% if @poll.questions.empty? %>
<div class="callout primary margin-top">
<table> <%= t('admin.polls.show.no_questions') %>
<% @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 %>
</div> </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 %>
<%= form_tag '', method: :get do %> <%= label_tag :poll_id, t("admin.questions.index.filter_poll") %>
<%= select_tag "poll_id", <%= select_tag "poll_id",
poll_select_options(true), poll_select_options(true),
prompt: t("admin.questions.index.select_poll"), prompt: t("admin.questions.index.select_poll"),
class: "js-location-changer" %> class: "js-location-changer" %>
<% end %> <% end %>
</div>

View File

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

View File

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

View File

@@ -3,11 +3,18 @@
<%= link_to t('admin.questions.index.create'), new_admin_question_path, <%= link_to t('admin.questions.index.create'), new_admin_question_path,
class: "button success float-right" %> class: "button success float-right" %>
<%= render 'filter' %> <div class="row">
<%= render 'search' %> <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 %> <% if @questions.count == 0 %>
<div class="callout primary"> <div class="callout primary margin-top">
<%= t('admin.questions.index.no_questions') %> <%= t('admin.questions.index.no_questions') %>
</div> </div>
<% else %> <% else %>

View File

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

View File

@@ -30,7 +30,7 @@
<div class="off-canvas-content" data-off-canvas-content> <div class="off-canvas-content" data-off-canvas-content>
<%= render 'layouts/admin_header' %> <%= 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="small-12 medium-3 column">
<div class="show-for-small-only"> <div class="show-for-small-only">
@@ -46,7 +46,7 @@
<%= render 'layouts/flash' %> <%= render 'layouts/flash' %>
<%= yield %> <%= yield %>
</div> </div>
</main> </div>
</div> </div>
</div> </div>
</div> </div>

View File

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

View File

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