-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds complete Booth management to admin
- Loading branch information
Showing
11 changed files
with
58 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
<tr id="booth_<%= booth.id %>" class="booth"> | ||
<td> | ||
<strong> | ||
<%= link_to booth.name, admin_poll_booth_path(@poll, booth) %> | ||
<%= link_to booth.name, admin_booth_path(booth) %> | ||
</strong> | ||
</td> | ||
<td> | ||
<%= booth.location %> | ||
</td> | ||
<td> | ||
N <%= t("admin.booths.index.officers") %> | ||
</td> | ||
<td class="text-right"> | ||
<%= link_to t("admin.actions.edit"), | ||
edit_admin_poll_booth_path(@poll, booth), | ||
edit_admin_booth_path(booth), | ||
class: "button hollow" %> | ||
</td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<%= render 'shared/back_link' %> | ||
<%= back_link_to admin_booths_path %> | ||
|
||
<h2><%= t("admin.booths.edit.title", poll: @poll.name) %>: <%= t("admin.booths.edit.subtitle") %></h2> | ||
<h2><%= t("admin.booths.edit.title") %></h2> | ||
|
||
<%= form_for @booth, url: admin_poll_booth_path(@poll, @booth) do |f| %> | ||
<%= form_for @booth, url: admin_booth_path(@booth) do |f| %> | ||
<%= render "form", f: f %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,28 @@ | ||
<h2><%= t("admin.booths.index.title") %></h2> | ||
|
||
<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> | ||
|
||
<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(@poll), | ||
new_admin_booth_path, | ||
class: "button success" %> | ||
<table> | ||
<thead> | ||
<th><%= t("admin.booths.index.name") %></th> | ||
<th><%= t("admin.booths.index.location") %></th> | ||
<th><%= t("admin.booths.index.officers") %></th> | ||
<th> </th> | ||
</thead> | ||
<tbody> | ||
<% @booths.each do |booth| %> | ||
<%= render partial: "booth", locals: { booth: booth } %> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
<% if @booths.any? %> | ||
<table> | ||
<thead> | ||
<th><%= t("admin.booths.index.name") %></th> | ||
<th><%= t("admin.booths.index.location") %></th> | ||
<th> </th> | ||
</thead> | ||
<tbody> | ||
<% @booths.each do |booth| %> | ||
<%= render partial: "booth", locals: { booth: booth } %> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
|
||
<%= paginate @booths %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<%= render 'shared/back_link' %> | ||
<%= back_link_to admin_booths_path %> | ||
|
||
<h2><%= t("admin.booths.new.title", poll: @poll.name) %>: <%= t("admin.booths.new.subtitle") %></h2> | ||
<h2><%= t("admin.booths.new.title") %></h2> | ||
|
||
<%= form_for @booth, url: admin_poll_booths_path(@poll) do |f| %> | ||
<%= form_for @booth, url: admin_booths_path(@booth) do |f| %> | ||
<%= render "form", f: f %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,15 @@ | ||
<%= render 'shared/back_link' %> | ||
<%= back_link_to admin_booths_path %> | ||
|
||
<div class="clear"></div> | ||
|
||
<h2 class="inline-block"> | ||
<%= @booth.name %> | ||
</h2> | ||
<%= link_to t("admin.actions.edit"), | ||
edit_admin_poll_booth_path(@poll, @booth), | ||
edit_admin_booth_path(@booth), | ||
class: "button hollow float-right" %> | ||
|
||
<p> | ||
<strong><%= t("admin.booths.show.location") %></strong>: | ||
<%= @booth.location %> | ||
</p> | ||
|
||
<h3><%= t("admin.booths.show.officers_list") %></h3> | ||
|
||
<% if @booth.officers.empty? %> | ||
<div class="callout primary"> | ||
<%= t("admin.booths.show.no_officers") %> | ||
</div> | ||
<% end %> | ||
|
||
<div class="small-12 column"> | ||
<%= form_for @booth, url: admin_poll_booth_path(@poll, @booth) do |f| %> | ||
<%= f.label :officer_ids, t("admin.spending_proposals.edit.assigned_valuators") %> | ||
<%= f.collection_check_boxes :officer_ids, @officers, :id, :email do |b| %> | ||
<% b.label { b.check_box + truncate(officer_label(b.object), length: 60) } %> | ||
<% end %> | ||
<%= f.submit t("admin.booths.show.assign_officer"), class: "button success" %> | ||
<% end %> | ||
</div> | ||
|
||
<table id="assigned_officers"> | ||
<% @booth.officers.each do |officer| %> | ||
<tr id="officer_<%= officer.id %>" class="officer"> | ||
<td> | ||
<%= officer.name %> | ||
</td> | ||
<td> | ||
<%= officer.email %> | ||
</td> | ||
<td class="text-right"> | ||
<%= link_to t('admin.poll_officers.officer.delete'), "#", class: "button hollow alert" %> | ||
<%# link_to t('admin.poll_officers.officer.delete'), | ||
admin_poll_officer_path(Poll.last, officer), | ||
method: :delete, | ||
class: "button hollow alert" | ||
%> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,5 +102,4 @@ | |
# as the one that triggered the failure. | ||
Kernel.srand config.seed | ||
|
||
|
||
end |