OSDN Git Service

fix: op upload and destroy
[pettanr/pettanr.git] / app / controllers / story_sheets_controller.rb
index 748f195..887f4e8 100644 (file)
@@ -51,7 +51,7 @@ class StorySheetsController < ApplicationController
     @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
     @panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
     
-    leaf_render_create play_scroll_path(@binder)
+    leaf_render_create play_story_path(@binder)
   end
   
   def update
@@ -65,22 +65,14 @@ class StorySheetsController < ApplicationController
     # swapable hidden panel
     #@panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
     
-    leaf_render_update ot, play_scroll_path(@binder)
+    leaf_render_update ot, play_story_path(@binder)
   end
   
   def destroy
-    @story_sheet = StorySheet.edit(params[:id], @operators)
-    @story = Story.edit(@story_sheet.story_id, @operators) if @story_sheet.story_id
-    respond_to do |format|
-      if @story_sheet.destroy_and_shorten
-        flash[:notice] = I18n.t('flash.notice.destroyed', :model => StorySheet.model_name.human)
-        format.html { redirect_to play_story_path(@story) }
-        format.json { head :ok }
-      else
-        flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => StorySheet.model_name.human)
-        format.html { redirect_to story_sheet_path(@story_sheet) }
-        format.json { render json: @story_sheet.errors, status: :unprocessable_entity }
-      end
-    end
+    set_model
+    @item = @my_model_class.edit(params[:id], @operators)
+    @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
+    render_destroy '/home/' + play_story_path(@item)
   end
+  
 end