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]
21 @item = Artist.show(params[:id], @operators)
23 respond_to do |format|
28 format.json { render :json => @item.to_json(Artist.show_json_opt) }
33 @artist = Artist.show(params[:id], @operators)
34 @page = Author.page params[:page]
35 @page_size = Author.resource_picture_page_size params[:page_size]
36 @resource_pictures = ResourcePicture.himlist(@artist, @page, @page_size)
37 respond_to do |format|
39 @paginate = ResourcePicture.himlist_paginate(@artist, @page, @page_size)
41 format.json { render json: @resource_pictures.to_json(ResourcePicture.list_json_opt) }
46 @artist = {:count => Artist.visible_count}
47 respond_to do |format|
48 format.json { render json: @artist.to_json }
54 @artist.supply_default
56 respond_to do |format|
59 format.json { render json: @artist.to_json(Artist.show_json_opt) }
64 @artist = Artist.edit(params[:id], @operators)
65 respond_to do |format|
72 @artist = Artist.new()
73 @artist.supply_default
74 @artist.attributes = params[:artist]
75 @artist.overwrite @operators
76 respond_to do |format|
78 flash[:notice] = I18n.t('flash.notice.created', :model => Artist.model_name.human)
79 format.html { redirect_to root_path }
80 format.json { render json: @artist.to_json(Artist.show_json_opt), status: :created, location: @artist }
82 flash[:notice] = I18n.t('flash.notice.not_created', :model => Artist.model_name.human)
83 format.html { render action: "new" }
84 format.json { render json: @artist.errors, status: :unprocessable_entity }
90 @artist = Artist.edit(params[:id], @operators)
91 @artist.attributes = params[:artist]
92 @artist.overwrite @operators
94 respond_to do |format|
96 flash[:notice] = I18n.t('flash.notice.updated', :model => Artist.model_name.human)
97 format.html { redirect_to '/home/configure' }
98 format.json { head :ok }
100 flash[:notice] = I18n.t('flash.notice.not_updated', :model => Artist.model_name.human)
101 format.html { render action: "edit" }
102 format.json { render json: @artist.errors, status: :unprocessable_entity }
108 @artist = Artist.edit(params[:id], @operators)
111 respond_to do |format|
112 format.html { redirect_to artists_url }
113 format.json { head :ok }