class HomeController < ApplicationController
- layout 'test' if Pettanr::TestLayout
- before_filter :authenticate_user!, :only => [
- :index, :show, :profile, :configure, :create_token, :delete_token, :step2, :save_step2, :step3, :save_step3,
- :comic, :panel, :picture, :panel_picture
+ before_filter :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,
+ :scrolls_count, :scroll_panels_count, :comics_count, :comic_stories_count, :stories_count, :story_sheets_count, :sheets_count, :sheet_panels_count, :panels_count, :resource_pictures_count, :panel_pictures_count, :speech_balloons_count, :balloons_count, :speeches_count, :ground_pictures_count, :ground_colors_count
]
- before_filter :authenticate_artist, :only => [:picture]
+ before_filter :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,
+ :scrolls_count, :scroll_panels_count, :comics_count, :comic_stories_count, :stories_count, :story_sheets_count, :sheets_count, :sheet_panels_count, :panels_count, :resource_pictures_count, :panel_pictures_count, :speech_balloons_count, :balloons_count, :speeches_count, :ground_pictures_count, :ground_colors_count
+ ]
+ before_filter :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, @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, @artist, true, true, @operators
end
def create_token
- respond_to do |format|
- if @user.create_token
- format.html { redirect_to({:action => :configure}, {:notice => 'user 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
- @user.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
+ def scrolls
+ filer_list
end
- def save_step2
- 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
end
- def step3
+ def comics
+ filer_list
end
- def save_step3
- if @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
end
- def comic
- @page = Author.page params[:page]
- @page_size = Author.comic_page_size params[:page_size]
- @comics = Comic.mylist(@author, {}, @page, @page_size)
-
- respond_to do |format|
- format.html # index.html.erb
- format.json { render json: @comics }
- end
+ def stories
+ filer_list
end
- def panel
- @page = Author.page params[:page]
- @page_size = Author.panel_page_size params[:page_size]
- @panels = Panel.mylist(@author, {}, @page, @page_size)
-
- respond_to do |format|
- format.html # index.html.erb
- format.json { render json: @panels }
- end
+ def story_sheets
+ filer_list
end
- def picture
- @page = OriginalPicture.page params[:page]
- @page_size = OriginalPicture.page_size params[:page_size]
- @original_pictures = OriginalPicture.list(@artist.id, {}, @page, @page_size)
-
- respond_to do |format|
- format.html # index.html.erb
- format.json { render json: @original_pictures.to_json(OriginalPicture.list_json_opt) }
- end
+ def sheets
+ filer_list
end
- def panel_picture
- @page = Author.page params[:page]
- @page_size = Author.panel_picture_page_size params[:page_size]
- @panel_pictures = PanelPicture.mylist(@author, {}, @page, @page_size)
-
- respond_to do |format|
- format.html # index.html.erb
- format.json { render json: @panel_pictures }
- end
+ def sheet_panels
+ filer_list
+ end
+
+ def panels
+ filer_list
+ end
+
+ def panel_pictures
+ filer_list
+ end
+
+ def speech_balloons
+ filer_list
+ end
+
+ def balloons
+ filer_list
+ end
+
+ def speeches
+ filer_list
+ end
+
+ def ground_pictures
+ filer_list
+ end
+
+ def ground_colors
+ filer_list
+ end
+
+ def resource_pictures
+ filer_list
+ end
+
+ def scrolls_count
+ list_count
+ end
+
+ def scroll_panels_count
+ list_count
+ end
+
+ def comics_count
+ list_count
+ end
+
+ def comic_stories_count
+ list_count
+ end
+
+ def stories_count
+ list_count
+ end
+
+ def story_sheets_count
+ list_count
+ end
+
+ def sheets_count
+ list_count
+ end
+
+ def sheet_panels_count
+ list_count
+ end
+
+ def panels_count
+ list_count
+ end
+
+ def panel_pictures_count
+ list_count
+ end
+
+ def balloons_count
+ list_count
+ end
+
+ def speeches_count
+ list_count
+ end
+
+ def ground_pictures_count
+ list_count
+ end
+
+ def ground_colors_count
+ list_count
+ end
+
+ def resource_pictures_count
+ list_count
end
end