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 => [
8 :index, :show, :profile, :configure, :create_token, :delete_token,
9 :comic, :story, :panel, :resource_picture, :panel_picture, :panel_color, :ground_picture, :ground_color
11 before_filter :authenticate_artist, :only => [:resource_picture]
24 respond_to do |format|
25 flash[:notice] = I18n.t('flash.notice.created', :model => User.human_attribute_name(:authentication_token))
26 format.html { redirect_to({:action => :configure}) }
29 flash[:notice] = I18n.t('flash.notice.not_created', :model => User.human_attribute_name(:authentication_token))
30 format.html { render action: "configure" }
36 respond_to do |format|
37 flash[:notice] = I18n.t('flash.notice.destroyed', :model => User.human_attribute_name(:authentication_token))
38 format.html { redirect_to :action => :configure}
41 flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => User.human_attribute_name(:authentication_token))
42 format.html { render action: "configure" }
47 @page = Author.page params[:page]
48 @page_size = Author.comic_page_size params[:page_size]
49 @comics = Comic.mylist(@author, @page, @page_size)
51 respond_to do |format|
52 format.html # index.html.erb
53 format.json { render json: @comics.to_json(Comic.list_json_opt) }
58 @page = Author.page params[:page]
59 @page_size = Author.story_page_size params[:page_size]
60 @stories = Story.mylist(@author, @page, @page_size)
62 respond_to do |format|
63 format.html # index.html.erb
64 format.json { render text: Story.list_as_json_text(@stories) }
69 @page = Author.page params[:page]
70 @page_size = Author.panel_page_size params[:page_size]
71 @panels = Panel.mylist(@author, @page, @page_size)
73 respond_to do |format|
74 format.html # index.html.erb
75 format.json { render text: Panel.list_as_json_text(@panels) }
80 @page = Author.page params[:page]
81 @page_size = Author.panel_picture_page_size params[:page_size]
82 @panel_pictures = PanelPicture.mylist(@author, @page, @page_size)
84 respond_to do |format|
85 format.html # index.html.erb
86 format.json { render json: @panel_pictures.to_json(PanelPicture.list_json_opt) }
91 @page = Author.page params[:page]
92 @page_size = Author.panel_page_size params[:page_size]
93 @panel_colors = PanelColor.mylist(@author, @page, @page_size)
95 respond_to do |format|
96 format.html # index.html.erb
97 format.json { render json: @panel_colors.to_json(PanelColor.list_json_opt) }
102 @page = Author.page params[:page]
103 @page_size = Author.panel_page_size params[:page_size]
104 @ground_pictures = GroundPicture.mylist(@author, @page, @page_size)
106 respond_to do |format|
107 format.html # index.html.erb
108 format.json { render json: @ground_pictures.to_json(GroundPicture.list_json_opt) }
113 @page = Author.page params[:page]
114 @page_size = Author.panel_page_size params[:page_size]
115 @ground_colors = GroundColor.mylist(@author, @page, @page_size)
117 respond_to do |format|
118 format.html # index.html.erb
119 format.json { render json: @ground_colors.to_json(GroundColor.list_json_opt) }
124 @page = Author.page params[:page]
125 @page_size = Author.panel_page_size params[:page_size]
126 @resource_pictures = ResourcePicture.mylist(@author, @page, @page_size)
128 respond_to do |format|
129 format.html # index.html.erb
130 format.json { render json: @resource_pictures.to_json(ResourcePicture.list_json_opt) }