class HomeController < ApplicationController
- before_filter :authenticate_author!, :only => [
- :index, :show, :profile, :configure, :create_token, :delete_token, :step2, :save_step2, :step3, :save_step3,
- :comic, :picture
+ before_action :authenticate_user, :only => [
+ :index, :show, :profile, :configure, :create_token, :delete_token,
+ :scrolls, :scroll_panels, :comics, :comic_stories, :stories, :story_sheets,
+ :sheets, :sheet_panels,
+ :panels, :panel_pictures, :speech_balloons, :balloons, :speeches, :ground_pictures, :ground_colors
]
+ before_action :authenticate_author, :only => [
+ :scrolls, :scroll_panels, :comics, :comic_stories, :stories, :story_sheets,
+ :sheets, :sheet_panels,
+ :panels, :panel_pictures, :speech_balloons, :balloons, :speeches, :ground_pictures, :ground_colors
+ ]
+ before_action :authenticate_artist, :only => [:resource_pictures]
def index
end
end
def configure
+ @author = @operators.author
+ unless @author
+ @author = Author.new
+ @author.supply_default
+ end
+ @author.boosts 'post'
+ @author_form = Locmare::Bucket.factory @author.item_name, 'default', @author, true, true, @operators
+ @artist = @operators.artist
+ unless @artist
+ @artist = Artist.new
+ @artist.supply_default
+ end
+ @artist.boosts 'post'
+ @artist_form = Locmare::Bucket.factory @artist.item_name, 'default', @artist, true, true, @operators
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" }
+ if @operators.user.create_token
+ respond_to do |format|
+ flash[:notice] = I18n.t('flash.notice.created', :model => User.human_attribute_name(:authentication_token))
+ format.html { redirect_to({:action => :configure}) }
end
+ else
+ flash[:notice] = I18n.t('flash.notice.not_created', :model => User.human_attribute_name(:authentication_token))
+ format.html { render action: "configure" }
end
end
def delete_token
- current_author.delete_token
- respond_to do |format|
- format.html { redirect_to :action => :configure}
+ if @operators.user.delete_token
+ respond_to do |format|
+ flash[:notice] = I18n.t('flash.notice.destroyed', :model => User.human_attribute_name(:authentication_token))
+ format.html { redirect_to :action => :configure}
+ end
+ else
+ flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => User.human_attribute_name(:authentication_token))
+ format.html { render action: "configure" }
end
end
- def step2
- @author = current_author
+ def scrolls
+ filer_list finder: :find_private, param: @operators
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
+ def scroll_panels
+ filer_list finder: :find_private, param: @operators
end
- def step3
- @artist = Artist.new :author_id => current_author.id, :name => current_author.name, :default_lisence_id => 1
+ def comics
+ filer_list finder: :find_private, param: @operators
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
+ def comic_stories
+ filer_list finder: :find_private, param: @operators
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
+ def stories
+ filer_list finder: :find_private, param: @operators
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
+ def story_sheets
+ filer_list finder: :find_private, param: @operators
+ end
+
+ def sheets
+ filer_list finder: :find_private, param: @operators
+ end
+
+ def sheet_panels
+ filer_list finder: :find_private, param: @operators
+ end
+
+ def panels
+ filer_list finder: :find_private, param: @operators
+ end
+
+ def panel_pictures
+ filer_list finder: :find_private, param: @operators
+ end
+
+ def speech_balloons
+ filer_list finder: :find_private, param: @operators
+ end
+
+ def balloons
+ filer_list finder: :find_private, param: @operators
+ end
+
+ def speeches
+ filer_list finder: :find_private, param: @operators
+ end
+
+ def ground_pictures
+ filer_list finder: :find_private, param: @operators
+ end
+
+ def ground_colors
+ filer_list finder: :find_private, param: @operators
+ end
+
+ def resource_pictures
+ filer_list finder: :find_private, param: @operators
end
end