respond_to do |format|
format.html {
- @sheet = StorySheet.play_sheet(@story, @author)
if @author
@new_sheets = Sheet.mylist(@author, 1, 5)
end
}
- format.json { render json: @story.story_as_json(@author) }
+ format.json { render json: @story.to_json(Story.show_json_opt) }
end
end
@new_sheets = Sheet.mylist(@author, 1, 5)
end
}
- format.json {render text: StorySheet.list_as_json_text(@story_sheets, @author)}
+ format.json {
+ if @sheet
+ @story_sheets = SheetPanel.play_list @sheet, @author
+ render text: SheetPanel.list_as_json_text(@story_sheets, @author)
+ else
+ render text: ''
+ end
+ }
format.jsonp {
render :json => "callback(" + @story_sheets.to_json_list + ");"
}
respond_to do |format|
format.html # new.html.erb
format.js
- format.json { render json: @story.story_as_json(@author) }
+ format.json { render json: @story.to_json(Story.show_json_opt) }
end
end
@story = Story.new
@story.supply_default
@story.attributes = params[:story]
- @story.overwrite @author
+ @story.overwrite
@comic = Comic.edit(@story.comic_id, @author) if @story.comic_id
respond_to do |format|
- if @story.store
+ if @story.store @author
flash[:notice] = I18n.t('flash.notice.created', :model => Story.model_name.human)
- format.html { redirect_to story_path(@story) }
- format.json { render json: @story.story_as_json(@author) }
+ format.html { redirect_to play_story_path(@story, :page => @story.t.to_i + 1) }
+ format.json { render json: @story.to_json(Story.show_json_opt) }
else
flash[:notice] = I18n.t('flash.notice.not_created', :model => Story.model_name.human)
format.html { render action: "new" }
@story = Story.edit(params[:id], @author)
ot = @story.t
@story.attributes = params[:story]
- @story.overwrite @author
+ @story.overwrite
respond_to do |format|
- if @story.store ot
+ if @story.store @author, ot
flash[:notice] = I18n.t('flash.notice.updated', :model => Story.model_name.human)
- format.html { redirect_to story_path(@story) }
+ format.html { redirect_to play_story_path(@story, :page => @story.t.to_i + 1) }
format.json { head :ok }
else
flash[:notice] = I18n.t('flash.notice.not_updated', :model => Story.model_name.human)