allow to preselect order view

This commit is contained in:
wvengen 2014-01-17 15:03:46 +01:00
parent 1129cf4094
commit 65041c78c5
3 changed files with 12 additions and 17 deletions

View file

@ -28,16 +28,17 @@ class OrdersController < ApplicationController
# Renders also the pdf
def show
@order= Order.find(params[:id])
@view = (params[:view] or 'default').gsub(/[^-_a-zA-Z0-9]/, '')
respond_to do |format|
@partial = case @view
when 'default' then "articles"
when 'groups'then 'shared/articles_by_groups'
when 'articles'then 'shared/articles_by_articles'
else 'articles'
end
format.html
format.js do
@partial = case params[:view]
when 'default' then "articles"
when 'groups'then 'shared/articles_by_groups'
when 'articles'then 'shared/articles_by_articles'
else 'articles'
end
render :layout => false
end
format.pdf do