1 class ArtistsController < ApplicationController
2 layout 'test' if MagicNumber['test_layout']
3 if MagicNumber['run_mode'] == 0
4 before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
5 before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
7 before_filter :authenticate_resource_reader, :only => [:index, :show, :resource_pictures]
8 before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
9 before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
25 @item = Artist.show(params[:id], @operators)
27 respond_to do |format|
32 format.json { render :json => @item.to_json(Artist.show_json_opt) }
37 @artist = {:count => Artist.visible_count}
38 respond_to do |format|
39 format.json { render json: @artist.to_json }
45 @artist.supply_default
47 respond_to do |format|
50 format.json { render json: @artist.to_json(Artist.show_json_opt) }
55 @artist = Artist.edit(params[:id], @operators)
56 respond_to do |format|
63 @artist = Artist.new()
64 @artist.supply_default
65 @artist.attributes = params[:artist]
66 @artist.overwrite @operators
67 respond_to do |format|
69 flash[:notice] = I18n.t('flash.notice.created', :model => Artist.model_name.human)
70 format.html { redirect_to root_path }
71 format.json { render json: @artist.to_json(Artist.show_json_opt), status: :created, location: @artist }
73 flash[:notice] = I18n.t('flash.notice.not_created', :model => Artist.model_name.human)
74 format.html { render action: "new" }
75 format.json { render json: @artist.errors, status: :unprocessable_entity }
81 @artist = Artist.edit(params[:id], @operators)
82 @artist.attributes = params[:artist]
83 @artist.overwrite @operators
85 respond_to do |format|
87 flash[:notice] = I18n.t('flash.notice.updated', :model => Artist.model_name.human)
88 format.html { redirect_to '/home/configure' }
89 format.json { head :ok }
91 flash[:notice] = I18n.t('flash.notice.not_updated', :model => Artist.model_name.human)
92 format.html { render action: "edit" }
93 format.json { render json: @artist.errors, status: :unprocessable_entity }
99 @artist = Artist.edit(params[:id], @operators)
102 respond_to do |format|
103 format.html { redirect_to artists_url }
104 format.json { head :ok }