OSDN Git Service

fix: fetch fail
[pettanr/pettanr.git] / app / controllers / ground_colors_controller.rb
index 32e3d64..c9be0d3 100644 (file)
@@ -1,17 +1,13 @@
 class GroundColorsController < ApplicationController
   if Manifest.manifest.magic_numbers['run_mode'] == 0
-    before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
-    before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
+    before_action :authenticate_user, :only => []
+    before_action :authenticate_author, :only => []
   else
-    before_filter :authenticate_reader, :only => [
-      :index, :show, :by_panel, :by_author, :count, :count_by_panel, :count_by_author
+    before_action :authenticate_reader, :only => [
+      :index, :show, :by_panel, :by_author
     ]
-    before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
-    before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
-  end
-
-  def self.model
-    GroundColor
+    before_action :authenticate_user, :only => []
+    before_action :authenticate_author, :only => []
   end
   
   def index
@@ -19,11 +15,11 @@ class GroundColorsController < ApplicationController
   end
   
   def by_panel
-    filer_list
+    filer_list param: params[:id]
   end
   
   def by_author
-    filer_list
+    filer_list param: params[:id]
   end
   
   def show_html_format format
@@ -41,100 +37,4 @@ class GroundColorsController < ApplicationController
     end
   end
   
-  def count
-    list_count
-  end
-  
-  def count_by_panel
-    list_count
-  end
-  
-  def count_by_author
-    list_count
-  end
-  
-  def new
-    raise Pettanr::NotWork unless @operators.author.working_panel
-    @panel = Panel.edit(@operators.author.working_panel, @operators)
-    @ground_color = GroundColor.new :panel_id => @panel.id, :code => params[:code].to_i
-    @ground_color.supply_default
-
-    respond_to do |format|
-      format.html
-      format.json { render :json => @ground_color.to_json(GroundColor.show_json_opt) }
-    end
-  end
-
-  def edit
-    @ground_color = GroundColor.show(params[:id], @operators)
-    @panel = Panel.edit(@ground_color.panel.id, @operators)
-    
-    respond_to do |format|
-      format.html
-    end
-  end
-
-  def create
-    raise Pettanr::NotWork unless @operators.author.working_panel
-    @panel = Panel.edit(@operators.author.working_panel, @operators)
-    
-    @ground_color = GroundColor.new 
-    @ground_color.attributes = params[:ground_color]
-    @ground_color.overwrite @panel.id
-    
-    respond_to do |format|
-      if @ground_color.valid?
-        if @ground_color.store @operators
-          flash[:notice] = I18n.t('flash.notice.created', :model => Panel.model_name.human)
-          format.html { redirect_to @panel }
-          format.json { render json: @panel.panel_elements_as_json, status: :created, location: @panel }
-        else
-          flash[:notice] = I18n.t('flash.notice.not_created', :model => GroundColor.model_name.human)
-          format.html { render action: "new" }
-          format.json { render json: @ground_color.errors, status: :unprocessable_entity }
-        end
-      else
-        flash[:notice] = I18n.t('flash.notice.not_created', :model => GroundColor.model_name.human)
-        format.html { render action: "new" }
-        format.json { render json: @ground_color.errors, status: :unprocessable_entity }
-      end
-    end
-  end
-
-  def update
-    @ground_color = GroundColor.show(params[:id], @operators)
-    @ground_color.attributes = params[:ground_color]
-    @panel = Panel.edit(@ground_color.panel.id, @operators)
-    @ground_color.overwrite @panel.id
-    
-    respond_to do |format|
-      if @ground_color.store @operators
-        flash[:notice] = I18n.t('flash.notice.updated', :model => GroundColor.model_name.human)
-        format.html { redirect_to @ground_color }
-        format.json { head :ok }
-      else
-        flash[:notice] = I18n.t('flash.notice.not_updated', :model => GroundColor.model_name.human)
-        format.html { render action: "edit" }
-        format.json { render json: @ground_color.errors, status: :unprocessable_entity }
-      end
-    end
-  end
-
-  def destroy
-    @ground_color = GroundColor.show(params[:id], @operators)
-    @panel = Panel.edit(@ground_color.panel.id, @operators)
-    
-    respond_to do |format|
-      if @ground_color.remove @operators
-        flash[:notice] = I18n.t('flash.notice.destroyed', :model => GroundColor.model_name.human)
-        format.html { redirect_to @panel }
-        format.json { head :ok }
-      else
-        flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => GroundColor.model_name.human)
-        format.html { redirect_to @ground_color }
-        format.json { render json: @ground_color.errors, status: :unprocessable_entity }
-      end
-    end
-  end
-  
 end