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,5 +1,10 @@
<div class="small-12 column"> <table>
<table> <thead>
<tr>
<th><%= t('admin.poll_officers.officer.name') %></th>
<th colspan="2"><%= t('admin.poll_officers.officer.email') %></th>
</tr>
</thead>
<tbody> <tbody>
<tr> <tr>
<td> <td>
@@ -22,5 +27,4 @@
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>

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">
<%= text_field_tag :email, '', placeholder: t('admin.poll_officers.search.email_placeholder') %> <%= render 'search' %>
</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,13 +1,10 @@
<div class="row"> <h3><%= t("admin.polls.show.booths_title") %></h3>
<div class="small-12 column">
<% if @poll.booths.empty? %> <% if @poll.booths.empty? %>
<div class="callout primary text-center"> <div class="callout primary margin-top">
<%= t("admin.polls.show.no_booths") %> <%= t("admin.polls.show.no_booths") %>
</div> </div>
<% else %> <% else %>
<h2><%= t("admin.polls.show.booths_title") %></h2>
<table> <table>
<thead> <thead>
<th><%= t("admin.polls.show.name") %></th> <th><%= t("admin.polls.show.name") %></th>
@@ -34,6 +31,4 @@
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<% end %> <% end %>
</div>
</div>

View File

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

View File

@@ -1,13 +1,10 @@
<div class="row"> <h3><%= t("admin.polls.show.officers_title") %></h3>
<div class="small-12 column">
<% if @poll.officers.empty? %> <% if @poll.officers.empty? %>
<div class="callout primary text-center"> <div class="callout primary margin-top">
<%= t("admin.polls.show.no_officers") %> <%= t("admin.polls.show.no_officers") %>
</div> </div>
<% else %> <% else %>
<h2><%= t("admin.polls.show.officers_title") %></h2>
<table> <table>
<thead> <thead>
<th><%= t("admin.polls.show.name") %></th> <th><%= t("admin.polls.show.name") %></th>
@@ -28,6 +25,4 @@
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<% end %> <% end %>
</div>
</div>

View File

@@ -1,14 +1,11 @@
<div class="row"> <h3><%= t("admin.polls.show.questions_title") %></h3>
<div class="small-12 column">
<% if @poll.questions.empty? %> <% if @poll.questions.empty? %>
<div class="callout primary text-center"> <div class="callout primary margin-top">
<%= t('admin.polls.show.no_questions') %> <%= t('admin.polls.show.no_questions') %>
</div> </div>
<% else %> <% else %>
<table class="margin-top">
<h2><%= t("admin.polls.show.questions_title") %></h2>
<table>
<% @poll.questions.each do |question| %> <% @poll.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><%= link_to question.title, admin_question_path(question) %></td>
@@ -24,6 +21,4 @@
</tr> </tr>
<% end %> <% end %>
</table> </table>
<% end %> <% end %>
</div>
</div>

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,11 +1,9 @@
<%= 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> <div class="input-group-button">
<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>

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">
<h1>
<%= link_to admin_root_path, class: "hide-for-small-only" do %> <%= 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")) %> <%= image_tag('logo_header.png', class: 'hide-for-small-only float-left', size: '80x80', alt: t("layouts.header.logo")) %>
<%= setting['org_name'] %> <%= setting['org_name'] %>
&nbsp;|&nbsp;<%= t("admin.dashboard.index.title") %> &nbsp;|&nbsp;<%= t("admin.dashboard.index.title") %>
<% end %> <% 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