Skip to content
Permalink
Browse files

hold prerendered / in int

  • Loading branch information...
sorah committed Oct 6, 2014
1 parent 08639bc commit 515a06f4b99e85e753918e13d5dd4297f9f0c109
Showing with 15 additions and 14 deletions.
  1. +15 −14 ruby/app.rb
@@ -42,19 +42,19 @@ def self.layout_(name)
view(name).result(binding)
end

INDEX_NORMAL = ?0
INDEX_LOCKED = ?1
INDEX_BANNED = ?2
INDEX_WRONG = ?3
INDEX_MUST_LOGGED_IN = ?4
INDEX_VIEWS = {
INDEX_NORMAL => [nil],
INDEX_LOCKED => ["This account is locked."],
INDEX_BANNED => ["You're banned."],
INDEX_WRONG => ["Wrong username or password"],
INDEX_MUST_LOGGED_IN => ["You must be logged in"],
}.tap do |views|
views.each_value do |body|
INDEX_NORMAL = 0
INDEX_LOCKED = 1
INDEX_BANNED = 2
INDEX_WRONG = 3
INDEX_MUST_LOGGED_IN = 4
INDEX_VIEWS = [
[nil],
["This account is locked."],
["You're banned."],
["Wrong username or password"],
["You must be logged in"],
].tap do |views|
views.each do |body|
body[0] = [layout(:base)[0], self.view(:index).evaluate(notice: body[0]), layout(:base)[1]].join
end
end
@@ -274,7 +274,8 @@ module Actions
def action_index
content_type 'text/html'
cookie_rem :notice
@body = INDEX_VIEWS[cookies['notice'] || INDEX_NORMAL]
n = cookies['notice']
@body = INDEX_VIEWS[n ? n.to_i : 0]
end

def action_login

0 comments on commit 515a06f

Please sign in to comment.
You can’t perform that action at this time.