Merge pull request #625 from AyuntamientoMadrid/management-print-proposals

Management print proposals
This commit is contained in:
Juanjo Bazán
2015-10-20 15:01:08 +02:00
3 changed files with 4 additions and 9 deletions

View File

@@ -14,7 +14,7 @@ class Management::ProposalsController < Management::BaseController
end
def print
@proposals = Proposal.all.page(params[:page]).for_render.send("sort_by_#{@current_order}")
@proposals = Proposal.send("sort_by_#{@current_order}").limit(5)
set_proposal_votes(@proposal)
end

View File

@@ -13,7 +13,6 @@
</div>
<%= render @proposals %>
<%= paginate @proposals %>
</div>
</div>
</section>

View File

@@ -104,16 +104,12 @@ feature 'Proposals' do
context "Printing" do
scenario 'Printing proposals', :js do
5.times { create(:proposal) }
6.times { create(:proposal) }
click_link "Print proposals"
find("#print_link").click
### CHANGE ME
# should probably test something else here
# maybe that we are loading a print.css stylesheet?
###
expect(page).to have_css('.proposal', count: 5)
expect(page).to have_css("a[href='javascript:window.print();']", text: 'Print')
end
scenario "Filtering proposals to be printed", :js do