1 class HomeController < ApplicationController
2 layout 'test' if MagicNumber['test_layout']
3 before_filter :authenticate_user, :only => [
4 :index, :show, :profile, :configure, :create_token, :delete_token,
5 :comic, :story, :panel, :resource_picture, :panel_picture, :panel_color, :ground_picture, :ground_color
7 before_filter :authenticate_author, :only => [:comic, :story, :panel, :panel_picture, :panel_color, :ground_picture, :ground_color]
8 before_filter :authenticate_artist, :only => [:resource_picture]
21 respond_to do |format|
22 flash[:notice] = I18n.t('flash.notice.created', :model => User.human_attribute_name(:authentication_token))
23 format.html { redirect_to({:action => :configure}) }
26 flash[:notice] = I18n.t('flash.notice.not_created', :model => User.human_attribute_name(:authentication_token))
27 format.html { render action: "configure" }
33 respond_to do |format|
34 flash[:notice] = I18n.t('flash.notice.destroyed', :model => User.human_attribute_name(:authentication_token))
35 format.html { redirect_to :action => :configure}
38 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => User.human_attribute_name(:authentication_token))
39 format.html { render action: "configure" }
44 @page = Author.page params[:page]
45 @page_size = Author.comic_page_size params[:page_size]
46 @comics = Comic.mylist(@author, @page, @page_size)
48 respond_to do |format|
49 format.html # index.html.erb
50 format.json { render json: @comics.to_json(Comic.list_json_opt) }
55 @page = Author.page params[:page]
56 @page_size = Author.story_page_size params[:page_size]
57 @stories = Story.mylist(@author, @page, @page_size)
59 respond_to do |format|
60 format.html # index.html.erb
61 format.json { render text: Story.list_as_json_text(@stories) }
66 @page = Author.page params[:page]
67 @page_size = Author.panel_page_size params[:page_size]
68 @panels = Panel.mylist(@author, @page, @page_size)
70 respond_to do |format|
71 format.html # index.html.erb
72 format.json { render text: Panel.list_as_json_text(@panels) }
77 @page = Author.page params[:page]
78 @page_size = Author.panel_picture_page_size params[:page_size]
79 @panel_pictures = PanelPicture.mylist(@author, @page, @page_size)
81 respond_to do |format|
82 format.html # index.html.erb
83 format.json { render json: @panel_pictures.to_json(PanelPicture.list_json_opt) }
88 @page = Author.page params[:page]
89 @page_size = Author.panel_color_page_size params[:page_size]
90 @panel_colors = PanelColor.mylist(@author, @page, @page_size)
92 respond_to do |format|
93 format.html # index.html.erb
94 format.json { render json: @panel_colors.to_json(PanelColor.list_json_opt) }
99 @page = Author.page params[:page]
100 @page_size = Author.ground_picture_page_size params[:page_size]
101 @ground_pictures = GroundPicture.mylist(@author, @page, @page_size)
103 respond_to do |format|
104 format.html # index.html.erb
105 format.json { render json: @ground_pictures.to_json(GroundPicture.list_json_opt) }
110 @page = Author.page params[:page]
111 @page_size = Author.ground_color_page_size params[:page_size]
112 @ground_colors = GroundColor.mylist(@author, @page, @page_size)
114 respond_to do |format|
115 format.html # index.html.erb
116 format.json { render json: @ground_colors.to_json(GroundColor.list_json_opt) }
121 @page = Author.page params[:page]
122 @page_size = Author.resource_picture_page_size params[:page_size]
123 @resource_pictures = ResourcePicture.mylist(@artist, @page, @page_size)
125 respond_to do |format|
126 format.html # index.html.erb
127 format.json { render json: @resource_pictures.to_json(ResourcePicture.list_json_opt) }