@prm = params[:panel] || jsn
@panel = Panel.new(@prm)
treat_param @panel
- @comic = Comic.find @panel.comic_id
+# @comic = Comic.find @panel.comic_id
respond_to do |format|
- Panel.transaction do
- 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 }
- 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 }
end
end
end
def update
@panel = Panel.find(params[:id])
if @panel.own? @author
+ if params[:json]
+ jsn = JSON.parse(params[:json])
+ end
+ @prm = params[:panel] || jsn
respond_to do |format|
Panel.transaction do
if params[:panel][:t] and params[:panel][:t].to_i != @panel.t
@panel.move_to params[:panel][:t].to_i
end
- if @panel.update_attributes(params[:panel])
+ @panel.attributes = @prm
+ if @panel.store
format.html { redirect_to @panel, notice: 'Panel was successfully updated.' }
format.json { head :ok }
else