class HomeController < ApplicationController
- before_filter :authenticate_author!, :only => [
+ before_filter :authenticate_user!, :only => [
:index, :show, :profile, :configure, :create_token, :delete_token, :step2, :save_step2, :step3, :save_step3,
:comic, :picture
]
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.'}) }
+ if @user.create_token
+ format.html { redirect_to({:action => :configure}, {:notice => 'user token was successfully created.'}) }
else
format.html { render action: "auth_token" }
end
end
def delete_token
- current_author.delete_token
+ @user.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
end
def step3
- @artist = Artist.new :author_id => current_author.id, :name => current_author.name, :default_license_id => 1
end
def save_step3
- if current_author.artist?
+ if @author.artist?
redirect_to :action => :index
else
@artist = Artist.new params[:artist]
def comic
@comics = Comic.find(:all,
- :include => :author, :conditions => ['author_id = ?', current_author.id],
+ :include => :author, :conditions => ['author_id = ?', @author.id],
:order => 'updated_at desc', :limit => 20
)
end
def picture
- if current_author.artist?
+ if @author.artist?
@original_pictures = OriginalPicture.find(:all,
- :include => [:artist, :license, :resource_picture], :conditions => ['artist_id = ?', current_author.artist.id],
+ :include => [:artist, :license, :resource_picture], :conditions => ['artist_id = ?', @author.artist.id],
:order => 'updated_at', :limit => 20
)