- before_filter :authenticate_user!, :only => [:index, :show, :create, :update, :destroy]
+ layout 'test' if Pettanr::TestLayout
+ before_filter :authenticate_user!, :only => [:index, :show, :new, :edit, :create, :update, :destroy]
- @panels = Panel.find(:all, :include => [:comic, :author], :order => 'updated_at', :limit => 20)
+ @page = Panel.page params[:page]
+ @page_size = Panel.page_size params[:page_size]
+ @panels = Panel.list({}, @page, @page_size)
- @panel = Panel.find(params[:id], include: [:comic, :panel_pictures => :resource_picture, :balloons => :speaches])# only: [:width, :height])
+ @panel = Panel.show(params[:id], @author)
- format.json {
- render :json => @panel.to_json(include: {
- :comic => {}, :panel_pictures => {:include => :image}, :fukidashis => {:include => :serifus}
- })
- }
+ format.json { render json: @panel.to_json(Panel.show_json_include_opt) }
- render :json => "callback(" + @panel.to_json(include: {
- :comic => {}, :panel_pictures => {:include => :image}, :fukidashis => {:include => :serifus}
- }) + ");"
+ render :json => "callback(" + @panel.to_json(Panel.show_json_include_opt) + ");"
-# format.json { render :json => @frame.to_json(include: {
-# :comic => {:only => :title}, :panel_pictures => {:include => {:image => {:only => [:width]}},:only => [:width, :height, :z, :image_id]}
-# }, only: [:border]) }
+ def new
+ @panel = Panel.new
+ @panel.supply_default @author
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.js
+ format.json { render json: @panel }
+ end
+ end
+
+ def edit
+ @panel = Panel.show(params[:id], @author)
+ respond_to do |format|
+ format.html
+ format.js
+ end
+ end
+
- Panel.transaction do
- if @panel.vdt_save
- format.html { redirect_to @panel, notice: 'Panel was successfully created.' }
- format.json { render json: @panel, status: :created, location: @panel }
- else
- format.html { render action: "new" }
- format.json { render json: @panel.errors, status: :unprocessable_entity }
- end
+ if @panel.store
+ format.html { redirect_to @panel, notice: 'Panel was successfully created.' }
+ format.json { render json: @panel, status: :created, location: @panel }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @panel.errors, status: :unprocessable_entity }