tmp commit poll index, show and new
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class Admin::Poll::PollsController < Admin::BaseController
|
||||
skip_authorization_check
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
@@ -40,6 +40,8 @@ module Abilities
|
||||
can [:search, :create, :index, :destroy], ::Manager
|
||||
can [:search, :create, :index, :destroy], ::Poll::Officer
|
||||
|
||||
can [:manage], Poll
|
||||
|
||||
can :manage, Annotation
|
||||
|
||||
can [:read, :update, :destroy, :summary], SpendingProposal
|
||||
|
||||
16
app/views/admin/poll/polls/_poll.html.erb
Normal file
16
app/views/admin/poll/polls/_poll.html.erb
Normal file
@@ -0,0 +1,16 @@
|
||||
<tr id="<%= dom_id(poll) %>" class="poll">
|
||||
<td>
|
||||
<strong>
|
||||
<%= link_to poll.name, admin_poll_path(poll) %>
|
||||
</strong>ß
|
||||
</td>
|
||||
<td>
|
||||
Próximamente <!-- Estado: Activa, Próximamente o Archivada -->
|
||||
<br>(<small>15/12/2016 - 15/02/2017</small>)
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<%= link_to t("admin.actions.edit"),
|
||||
edit_admin_poll_path(poll),
|
||||
class: "button hollow" %>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -16,21 +16,6 @@
|
||||
<th> </th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- @polls.each do |poll| -->
|
||||
<tr>
|
||||
<td>
|
||||
<strong>
|
||||
<%= link_to "Votación de propuestas 2016 (REFNUM)", "polls/3" %>
|
||||
</strong>
|
||||
</td>
|
||||
<td>
|
||||
Próximamente <!-- Estado: Activa, Próximamente o Archivada -->
|
||||
<br>(<small>15/12/2016 - 15/02/2017</small>)
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<%= link_to t("admin.actions.edit"), "polls/3/edit", class: "button hollow" %>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- end -->
|
||||
<%= render @polls %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
<%= render "shared/back_link" %>
|
||||
<div class="clear"></div>
|
||||
|
||||
<h2 class="inline-block">Votación de propuestas 2016</h2>
|
||||
<h2 class="inline-block">
|
||||
<%= @poll.name %>
|
||||
</h2>
|
||||
|
||||
<%= link_to t("admin.actions.edit"), "#", class: "button hollow float-right" %>
|
||||
|
||||
<p>(REFNUM)</p>
|
||||
<p>Próximamente <small>(15/12/2016 - 15/02/2017)</small></p>
|
||||
<%= link_to t("admin.polls.show.add_booth"), "#", class: "button success" %>
|
||||
|
||||
40
spec/features/admin/poll/polls_spec.rb
Normal file
40
spec/features/admin/poll/polls_spec.rb
Normal file
@@ -0,0 +1,40 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Admin polls' do
|
||||
|
||||
background do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
end
|
||||
|
||||
scenario 'Index' do
|
||||
3.times { create(:poll) }
|
||||
|
||||
visit admin_root_path
|
||||
|
||||
within('#side_menu') do
|
||||
click_link "Polls"
|
||||
end
|
||||
|
||||
expect(page).to have_css ".poll", count: 3
|
||||
|
||||
Poll.all.each do |poll|
|
||||
within("#poll_#{poll.id}") do
|
||||
expect(page).to have_content poll.name
|
||||
#expect(page).to have_content "Status/Dates" - Hardcoded
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Show', :focus do
|
||||
poll = create(:poll)
|
||||
|
||||
visit admin_polls_path
|
||||
click_link poll.name
|
||||
|
||||
expect(page).to have_content poll.name
|
||||
#expect(page).to have_content "Status/Dates" - Hardcoded
|
||||
#expect(page).to have_content "REFNUM" - Hardcoded
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user