1 class StandardLicensesController < ApplicationController
2 layout 'test' if Pettanr::TestLayout
3 before_filter :authenticate_user!, :only => [:new, :create]
4 before_filter :authenticate_artist, :only => [:new, :create]
8 def authenticate_artist
12 respond_to do |format|
13 format.html { redirect_to new_artist_path, :status => :found }
14 format.js { render "artists/new" }
16 raise ActiveRecord::Forbidden
25 # GET /standard_licenses/new
26 # GET /standard_licenses/new.js
28 @original_picture = OriginalPicture.show params[:original_picture_id], @artist
29 @original_picture_license_group = OriginalPictureLicenseGroup.new(params[:original_picture_license_group])
30 @license_group = LicenseGroup.show @original_picture_license_group.license_group_id
31 @standard_license = StandardLicense.new
32 @standard_license.supply_default @artist
34 respond_to do |format|
35 format.html # new.html.erb
40 # POST /standard_licenses
41 # POST /standard_licenses.js
43 @original_picture = OriginalPicture.show params[:original_picture_id], @artist
44 @original_picture_license_group = OriginalPictureLicenseGroup.new params[:original_picture_license_group]
45 @license_group = LicenseGroup.show @original_picture_license_group.license_group_id
46 @standard_license = StandardLicense.new params[:standard_license]
47 @license = License.show @standard_license.license_id
48 @resource_picture = ResourcePicture.new :original_picture_id => @original_picture.id,
49 :license_id => @license.id, :artist_name => @standard_license.artist_name,
50 :credit => @standard_license.credit, :settings => @license.settings
52 respond_to do |format|
53 if @standard_license.valid?
54 format.html { render :template => "resource_pictures/new" }
55 format.js { render :template => "resource_pictures/new" }
57 format.html { render action: "new" }
58 format.js { render action: "new" }