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]
11 before_filter :authenticate_admin!, :only => [:list, :browse]
22 @item = Artist.show(params[:id], @operators)
24 respond_to do |format|
29 format.json { render :json => @item.to_json(Artist.show_json_opt) }
34 @artist = Artist.show(params[:id], @operators)
35 @page = Author.page params[:page]
36 @page_size = Author.resource_picture_page_size params[:page_size]
37 @resource_pictures = ResourcePicture.himlist(@artist, @page, @page_size)
38 respond_to do |format|
40 @paginate = ResourcePicture.himlist_paginate(@artist, @page, @page_size)
42 format.json { render json: @resource_pictures.to_json(ResourcePicture.list_json_opt) }
47 @artist = {:count => Artist.visible_count}
48 respond_to do |format|
49 format.json { render json: @artist.to_json }
56 respond_to do |format|
57 format.html { render layout: 'system' }
58 format.json { render json: @artists }
63 @artist = Artist.find(params[:id])
65 respond_to do |format|
66 format.html { render layout: 'system' }
67 format.json { render json: @artist }
73 @artist.supply_default
75 respond_to do |format|
76 format.html # new.html.erb
78 format.json { render json: @artist.to_json(Artist.show_json_opt) }
83 @artist = Artist.edit(params[:id], @operators)
84 respond_to do |format|
91 @artist = Artist.new()
92 @artist.supply_default
93 @artist.attributes = params[:artist]
94 @artist.overwrite @operators
95 respond_to do |format|
97 flash[:notice] = I18n.t('flash.notice.created', :model => Artist.model_name.human)
98 format.html { redirect_to root_path }
99 format.json { render json: @artist.to_json(Artist.show_json_opt), status: :created, location: @artist }
101 flash[:notice] = I18n.t('flash.notice.not_created', :model => Artist.model_name.human)
102 format.html { render action: "new" }
103 format.json { render json: @artist.errors, status: :unprocessable_entity }
109 @artist = Artist.edit(params[:id], @operators)
110 @artist.attributes = params[:artist]
111 @artist.overwrite @operators
113 respond_to do |format|
115 flash[:notice] = I18n.t('flash.notice.updated', :model => Artist.model_name.human)
116 format.html { redirect_to '/home/configure' }
117 format.json { head :ok }
119 flash[:notice] = I18n.t('flash.notice.not_updated', :model => Artist.model_name.human)
120 format.html { render action: "edit" }
121 format.json { render json: @artist.errors, status: :unprocessable_entity }
127 @artist = Artist.edit(params[:id], @operators)
130 respond_to do |format|
131 format.html { redirect_to artists_url }
132 format.json { head :ok }