before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
- before_filter :authenticate_admin!, :only => [:list, :browse]
def self.model
Story
end
end
- def list
- @stories = Story.all
-
- respond_to do |format|
- format.html { render layout: 'system' }# index.html.erb
- format.json { render json: @stories }
- end
- end
-
- def browse
- @story = Story.find(params[:id])
-
- respond_to do |format|
- format.html { render layout: 'system' } # show.html.erb
- format.json { render json: @story }
- end
- end
-
def new
@story = Story.new
@story.supply_default
respond_to do |format|
- format.html # new.html.erb
+ format.html
format.js
format.json { render json: @story.to_json(Story.show_json_opt) }
end
end
def edit
- @story = Story.edit(params[:id], @author)
+ @story = Story.edit(params[:id], @operators)
respond_to do |format|
format.html
format.js
@story.supply_default
@story.attributes = params[:story]
@story.overwrite
- @comic = Comic.edit(@story.comic_id, @author) if @story.comic_id
+ @comic = Comic.edit(@story.comic_id, @operators) if @story.comic_id
respond_to do |format|
- if @story.store @author
+ if @story.store @operators
flash[:notice] = I18n.t('flash.notice.created', :model => Story.model_name.human)
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) }
end
def update
- @story = Story.edit(params[:id], @author)
+ @story = Story.edit(params[:id], @operators)
ot = @story.t
@story.attributes = params[:story]
@story.overwrite
respond_to do |format|
- if @story.store @author, ot
+ if @story.store @operators, ot
flash[:notice] = I18n.t('flash.notice.updated', :model => Story.model_name.human)
format.html { redirect_to play_story_path(@story, :page => @story.t.to_i + 1) }
format.json { head :ok }
end
def destroy
- @story = Story.edit(params[:id], @author)
+ @story = Story.edit(params[:id], @operators)
respond_to do |format|
if @story.destroy_and_shorten
flash[:notice] = I18n.t('flash.notice.destroyed', :model => Story.model_name.human)