# Web GUI用コントローラ
# @author OHASHI, Norikazu
+require 'rack/cache'
require 'sinatra/base'
require 'sinatra'
require 'haml'
end
end
+ set :root, File.join(File.dirname(__FILE__), '..')
+ set :views, Proc.new {File.join(root, "views")}
+ set :public_dir, Proc.new {File.join(root, "../public")}
+ set :haml, :format => :html5
+ set :environment, :production
+
+ use Rack::Session::Cookie,
+ :expire_after => 1200,
+ :secret => 'change'
+
helpers do
# ページIDを保存して、viewに渡す
# @params [Symble] pageId 表示するページID
end
end
- set :root, File.join(File.dirname(__FILE__), '..')
- set :views, Proc.new {File.join(root, "views")}
- set :public_dir, Proc.new {File.join(root, "../public")}
- set :haml, :format => :html5
- set :environment, :production
-
- use Rack::Session::Cookie,
- :expire_after => 1200,
- :secret => 'change'
-
# スタイルシート
get '/css/style.css' do
+ cache_control :public, :must_revalidate, :max_age => 120
scss :'scss/style'
end
# javaScript
get '/scripts/check_form.js' do
+ cache_control :public, :must_revalidate, :max_age => 120
coffee :'coffee/check_form'
end
# ユーザ用ホームページ
# @raise [WebError] セッションの期限切れ
get '/user_home' do
+ cache_control :public, :must_revalidate, :max_age => 30
id = session[:userId]
if (id == nil)
raise WebError.new(status: 408, message: "セッション期限切れです。再ログインをしてください。")
# 蔵書の登録
get '/book_regist' do
+ cache_control :public, :must_revalidate, :max_age => 30
id = session[:userId]
book_update_f = false
session[:book_update_f] = book_update_f
# 蔵書の編集
get '/book_edit/:isbn' do
+ cache_control :public, :must_revalidate, :max_age => 30
id = session[:userId]
book_update_f = true
session[:book_update_f] = book_update_f
# 書影の表示
get '/book_image/:hash' do
+ cache_control :public, :must_revalidate, :max_age => 30
image_hash = params[:hash]
book_cover = BookManager.getBookCover(image_hash)
# 蔵書情報の取得
get '/book_info/:isbn' do
+ cache_control :public, :must_revalidate, :max_age => 30
id = session[:userId]
isbn = params[:isbn]
if (id == nil)
if (id == nil)
raise WebError.new(status: 408, message: "セッション期限切れです。再ログインをしてください。")
end
- session[:list_status] = {position: {start:0, step: 10},
+ session[:list_status] = {position: {start: 0, step: 10},
find_status: nil}
redirect "/book_list/main"
end
raise WebError.new(status: 408, message: "セッション期限切れです。再ログインをしてください。")
end
step = params[:step].to_i
- session[:list_status][:position][:step] = step
+ session[:list_status][:position] = {start: 0, step: step}
redirect "/book_list/main"
end
# 蔵書の削除
get '/book_delete/:isbn' do
+ cache_control :public, :must_revalidate, :max_age => 30
id = session[:userId]
isbn = params[:isbn]
if (id == nil)
# 蔵書の削除
get '/book_delete/result/:isbn' do
+ cache_control :public, :must_revalidate, :max_age => 30
id = session[:userId]
isbn = params[:isbn]
begin
# ログアウトページ
get '/logout' do
+ cache_control :public, :must_revalidate, :max_age => 30
# 最終ログイン情報登録
goPage :logout
end