+ def configure
+ end
+
+ def create_token
+ @author = current_author
+ respond_to do |format|
+ if @author.create_token
+ format.html { redirect_to({:action => :configure}, {:notice => 'author token was successfully created.'}) }
+ else
+ format.html { render action: "auth_token" }
+ end
+ end
+ end
+
+ def delete_token
+ current_author.delete_token
+ respond_to do |format|
+ format.html { redirect_to :action => :configure}
+ end
+ end
+
+ def step2
+ @author = current_author
+ end
+
+ def save_step2
+ @author = current_author
+ respond_to do |format|
+ if @author.step2(params[:author][:name])
+ a = if params[:step3].to_i == 1
+ :step3
+ else
+ :index
+ end
+ format.html { redirect_to({:action => a}, {:notice => 'your name was successfully updated.'}) }
+ else
+ format.html { render action: "step2" }
+ end
+ end
+ end
+
+ def step3
+ @artist = Artist.new :author_id => current_author.id, :name => current_author.name, :default_lisence_id => 1
+ end
+
+ def save_step3
+ if current_author.artist?
+ redirect_to :action => :index
+ else
+ @artist = Artist.new params[:artist]
+ respond_to do |format|
+ if @artist.save
+ format.html { redirect_to({:action => :index}, {:notice => 'artist was successfully registered.'}) }
+ else
+ format.html { render action: "step3" }
+ end
+ end
+ end
+ end
+
+ def comic
+ @comics = Comic.find(:all,
+ :include => :author, :conditions => ['author_id = ?', current_author.id],
+ :order => 'updated_at desc', :limit => 20
+ )
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @comics }
+ end
+ end
+
+ def picture
+ if current_author.artist?
+ @original_pictures = OriginalPicture.find(:all,
+ :include => [:artist, :lisence, :resource_picture], :conditions => ['artist_id = ?', current_author.artist.id],
+ :order => 'updated_at', :limit => 20
+ )
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render :json => @original_pictures.to_json(
+ :include => [:resource_picture, :artist, :lisence]
+ ) }
+ end
+ else
+ end
+ end
+