OSDN Git Service

t#:
[pettanr/pettanr.git] / app / controllers / stories_controller.rb
index 85c47d6..378a275 100644 (file)
@@ -8,7 +8,6 @@ class StoriesController < ApplicationController
     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
@@ -58,36 +57,18 @@ class StoriesController < ApplicationController
     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
@@ -99,10 +80,10 @@ class StoriesController < ApplicationController
     @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) }
@@ -115,12 +96,12 @@ class StoriesController < ApplicationController
   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 }
@@ -133,7 +114,7 @@ class StoriesController < ApplicationController
   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)