OSDN Git Service

t#30328:create op import ...and pull
[pettanr/pettanr.git] / app / controllers / artists_controller.rb
index acd5fa2..850f045 100644 (file)
@@ -1,7 +1,12 @@
 class ArtistsController < ApplicationController
   layout 'test' if MagicNumber['test_layout']
-  before_filter :authenticate_user!, :only => [:index, :show, :new, :create, :edit, :update, :destroy]
-  before_filter :authenticate_author, :only => [:index, :show, :new, :create, :edit, :update, :destroy]
+  if MagicNumber['run_mode'] == 0
+    before_filter :authenticate_user!, :only => [:new, :create, :edit, :update, :destroy]
+    before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
+  else
+    before_filter :authenticate_user!, :only => [:index, :show, :new, :create, :edit, :update, :destroy]
+    before_filter :authenticate_author, :only => [:index, :show, :new, :create, :edit, :update, :destroy]
+  end
   before_filter :authenticate_admin!, :only => [:list, :browse]
 
   # GET /artists
@@ -84,7 +89,8 @@ class ArtistsController < ApplicationController
     @ar.overwrite @author
     respond_to do |format|
       if @ar.save
-        format.html { redirect_to root_path, notice: 'Artist was successfully created.' }
+        flash[:notice] = I18n.t('flash.notice.created', :model => Artist.model_name.human)
+        format.html { redirect_to root_path }
         format.json { render json: @ar.to_json(Artist.show_json_opt), status: :created, location: @artist }
       else
         format.html { render action: "new" }
@@ -102,7 +108,8 @@ class ArtistsController < ApplicationController
 
     respond_to do |format|
       if @ar.save
-        format.html { redirect_to '/home/configure', notice: 'Artist was successfully updated.' }
+        flash[:notice] = I18n.t('flash.notice.updated', :model => Artist.model_name.human)
+        format.html { redirect_to '/home/configure' }
         format.json { head :ok }
       else
         format.html { render action: "edit" }