1 class HomeController < ApplicationController
2 layout 'test' if Pettanr::TestLayout
3 before_filter :authenticate_user!, :only => [
4 :index, :show, :profile, :configure, :create_token, :delete_token, :step2, :save_step2, :step3, :save_step3,
18 respond_to do |format|
20 format.html { redirect_to({:action => :configure}, {:notice => 'user token was successfully created.'}) }
22 format.html { render action: "auth_token" }
29 respond_to do |format|
30 format.html { redirect_to :action => :configure}
38 respond_to do |format|
39 if @author.step2(params[:author][:name])
40 a = if params[:step3].to_i == 1
45 format.html { redirect_to({:action => a}, {:notice => 'your name was successfully updated.'}) }
47 format.html { render action: "step2" }
57 redirect_to :action => :index
59 @artist = Artist.new params[:artist]
60 respond_to do |format|
62 format.html { redirect_to({:action => :index}, {:notice => 'artist was successfully registered.'}) }
64 format.html { render action: "step3" }
71 @comics = Comic.find(:all,
72 :include => :author, :conditions => ['author_id = ?', @author.id],
73 :order => 'updated_at desc', :limit => 20
76 respond_to do |format|
77 format.html # index.html.erb
78 format.json { render json: @comics }
84 @original_pictures = OriginalPicture.find(:all,
85 :include => [:artist, :license, :resource_picture], :conditions => ['artist_id = ?', @author.artist.id],
86 :order => 'updated_at', :limit => 20
89 respond_to do |format|
90 format.html # index.html.erb
91 format.json { render :json => @original_pictures.to_json(
92 :include => [:resource_picture, :artist, :license]