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, :step2, :save_step2, :step3, :save_step3,
5 :comic, :panel, :picture, :panel_picture, :panel_color, :ground_picture, :ground_color
7 before_filter :authenticate_author, :only => [
8 :index, :show, :profile, :configure, :create_token, :delete_token, :step2, :save_step2, :step3, :save_step3,
9 :comic, :panel, :picture, :panel_picture, :panel_color, :ground_picture, :ground_color
11 before_filter :authenticate_artist, :only => [:picture]
23 respond_to do |format|
25 format.html { redirect_to({:action => :configure}, {:notice => 'user token was successfully created.'}) }
27 format.html { render action: "auth_token" }
34 respond_to do |format|
35 format.html { redirect_to :action => :configure}
43 respond_to do |format|
44 if @author.step2(params[:author][:name])
45 a = if params[:step3].to_i == 1
50 format.html { redirect_to({:action => a}, {:notice => 'your name was successfully updated.'}) }
52 format.html { render action: "step2" }
62 redirect_to :action => :index
64 @artist = Artist.new params[:artist]
65 respond_to do |format|
67 format.html { redirect_to({:action => :index}, {:notice => 'artist was successfully registered.'}) }
69 format.html { render action: "step3" }
76 @page = Author.page params[:page]
77 @page_size = Author.comic_page_size params[:page_size]
78 @comics = Comic.mylist(@author, @page, @page_size)
80 respond_to do |format|
81 format.html # index.html.erb
82 format.json { render json: @comics.to_json(Comic.list_json_opt) }
87 @page = Author.page params[:page]
88 @page_size = Author.panel_page_size params[:page_size]
89 @panels = Panel.mylist(@author, @page, @page_size)
91 respond_to do |format|
92 format.html # index.html.erb
93 format.json { render text: Panel.list_as_json_text(@panels) }
98 @page = Author.page params[:page]
99 @page_size = Author.panel_picture_page_size params[:page_size]
100 @panel_pictures = PanelPicture.mylist(@author, @page, @page_size)
102 respond_to do |format|
103 format.html # index.html.erb
104 format.json { render json: @panel_pictures.to_json(PanelPicture.list_json_opt) }
109 @page = Author.page params[:page]
110 @page_size = Author.panel_page_size params[:page_size]
111 @panel_colors = PanelColor.mylist(@author, @page, @page_size)
113 respond_to do |format|
114 format.html # index.html.erb
115 format.json { render json: @panel_colors.to_json(PanelColor.list_json_opt) }
120 @page = Author.page params[:page]
121 @page_size = Author.panel_page_size params[:page_size]
122 @ground_pictures = GroundPicture.mylist(@author, @page, @page_size)
124 respond_to do |format|
125 format.html # index.html.erb
126 format.json { render json: @ground_pictures.to_json(GroundPicture.list_json_opt) }
131 @page = Author.page params[:page]
132 @page_size = Author.panel_page_size params[:page_size]
133 @ground_colors = GroundColor.mylist(@author, @page, @page_size)
135 respond_to do |format|
136 format.html # index.html.erb
137 format.json { render json: @ground_colors.to_json(GroundColor.list_json_opt) }