adds booth backend for index, show, create and edit actions

This commit is contained in:
rgarcia
2016-09-28 11:56:19 +02:00
committed by kikito
parent 6d7d6e67ea
commit 63ccac963a
18 changed files with 287 additions and 80 deletions

View File

@@ -0,0 +1,20 @@
<div class="row">
<div class="small-12 medium-6 column">
<%= f.text_field :name,
placeholder: t('admin.booths.new.name'),
label: t("admin.booths.new.name") %>
</div>
<div class="small-12 column">
<%= f.text_field :location,
placeholder: t("admin.booths.new.location"),
label: t("admin.booths.new.location") %>
</div>
</div>
<div class="row">
<div class="small-12 medium-4 column">
<%= f.submit t("admin.booths.#{admin_submit_action(@booth)}.submit_button"),
class: "button success expanded" %>
</div>
</div>

View File

@@ -1,28 +1,7 @@
<%= render 'shared/back_link' %>
<h2><%= t("admin.booths.edit.title") %>: <%= t("admin.booths.edit.subtitle") %></h2>
<h2><%= t("admin.booths.edit.title", poll: @poll.name) %>: <%= t("admin.booths.edit.subtitle") %></h2>
<form>
<div class="row">
<div class="small-12 medium-6 column">
<label><%= t("admin.booths.edit.name") %></label>
<input type="text" placeholder="<%= t('admin.booths.edit.name') %>">
</div>
<div class="small-12 medium-6 column">
<label><%= t("admin.booths.edit.reference") %></label>
<input type="text" placeholder="<%= t('admin.booths.edit.reference') %>">
</div>
<div class="small-12 column">
<label><%= t("admin.booths.edit.location") %></label>
<input type="text" placeholder="<%= t("admin.booths.edit.location") %>">
</div>
</div>
<div class="row">
<div class="small-12 medium-4 column">
<input type="submit" value="<%= t('admin.booths.edit.submit_button') %>" class="button success expanded">
</div>
</div>
</form>
<%= form_for @booth, url: admin_poll_booth_path(@poll, @booth) do |f| %>
<%= render "form", f: f %>
<% end %>

View File

@@ -1,22 +1,27 @@
<h2><%= t("admin.booths.index.title") %></h2>
<form>
<div class="small-12 medium-6">
<select>
<option><%= t("admin.booths.index.select_poll") %></option>
</select>
</div>
</form>
<h3><%= t("admin.booths.index.title_list") %></h3>
<!-- If booths of this poll == 0 -->
<div class="callout primary">
<%= t("admin.booths.index.no_booths") %>
<div class="small-12 medium-6">
<%= form_tag '', method: :get do %>
<%= select_tag "poll_id",
options_for_select(@polls.collect {|poll|
[poll.name, admin_poll_booths_path(poll)]
}),
prompt: t("admin.booths.index.select_poll"),
class: "js-location-changer" %>
<% end %>
</div>
<!-- end -->
<%= link_to t("admin.booths.index.add_booth"), new_admin_poll_booth_path, class: "button success" %>
<h3><%= t("admin.booths.index.title_list", poll: @poll.name) %></h3>
<% if @booths.empty? %>
<div class="callout primary">
<%= t("admin.booths.index.no_booths") %>
</div>
<% end %>
<%= link_to t("admin.booths.index.add_booth"),
new_admin_poll_booth_path,
class: "button success" %>
<table>
<thead>
@@ -26,23 +31,25 @@
<th>&nbsp;</th>
</thead>
<tbody>
<!-- @polls.each do |poll| -->
<tr>
<% @booths.each do |booth| %>
<tr id="booth_<%= booth.id %>" class="booth">
<td>
<strong>
<%= link_to "Urna Moncloa (REFNUM)", "booths/1" %>
<%= link_to booth.name, admin_poll_booth_path(@poll, booth) %>
</strong>
</td>
<td>
C/ Isaac Peral, 25. 28003, Madrid
<%= booth.location %>
</td>
<td>
N <%= t("admin.booths.index.officers") %>
</td>
<td class="text-right">
<%= link_to t("admin.actions.edit"), "booths/1/edit", class: "button hollow" %>
<%= link_to t("admin.actions.edit"),
edit_admin_poll_booth_path(@poll, booth),
class: "button hollow" %>
</td>
</tr>
<!-- end -->
<% end %>
</tbody>
</table>

View File

@@ -1,28 +1,7 @@
<%= render 'shared/back_link' %>
<h2><%= t("admin.booths.new.title") %>: <%= t("admin.booths.new.subtitle") %></h2>
<h2><%= t("admin.booths.new.title", poll: @poll.name) %>: <%= t("admin.booths.new.subtitle") %></h2>
<form>
<div class="row">
<div class="small-12 medium-6 column">
<label><%= t("admin.booths.new.name") %></label>
<input type="text" placeholder="<%= t('admin.booths.new.name') %>">
</div>
<div class="small-12 medium-6 column">
<label><%= t("admin.booths.new.reference") %></label>
<input type="text" placeholder="<%= t('admin.booths.new.reference') %>">
</div>
<div class="small-12 column">
<label><%= t("admin.booths.new.location") %></label>
<input type="text" placeholder="<%= t("admin.booths.new.location") %>">
</div>
</div>
<div class="row">
<div class="small-12 medium-4 column">
<input type="submit" value="<%= t('admin.booths.new.submit_button') %>" class="button success expanded">
</div>
</div>
</form>
<%= form_for @booth, url: admin_poll_booths_path(@poll) do |f| %>
<%= render "form", f: f %>
<% end %>

View File

@@ -1,10 +1,17 @@
<%= render 'shared/back_link' %>
<div class="clear"></div>
<h2 class="inline-block">Urna Moncloa (REFNUM)</h2>
<%= link_to t("admin.actions.edit"), "1/edit", class: "button hollow float-right" %>
<h2 class="inline-block">
<%= @booth.name %>
</h2>
<%= link_to t("admin.actions.edit"),
edit_admin_poll_booth_path(@poll, @booth),
class: "button hollow float-right" %>
<p><strong><%= t("admin.booths.show.location") %></strong>: C/ Isaac Peral, 25. 28003, Madrid</p>
<p>
<strong><%= t("admin.booths.show.location") %></strong>:
<%= @booth.location %>
</p>
<h3><%= t("admin.booths.show.officers_list") %></h3>