Layout refactor

master
E. Almqvist 3 years ago
parent 2b30fe0978
commit 94bed11465
  1. 4
      src/app.rb
  2. 4
      src/func.rb
  3. 9
      src/views/empty.slim
  4. 2
      src/views/user/login.slim
  5. 4
      src/views/user/register.slim

@ -46,11 +46,11 @@ get "/404" do
end
get "/login" do
serve :"user/login"
serve :"user/login", layout: :empty
end
get "/register" do
serve :"user/register"
serve :"user/register", layout: :empty
end
get "/profile/:id" do

@ -12,7 +12,7 @@ def get_current_user
end
# Serve templates
def serve(template, locals={})
def serve(template, locals={}, layout: :layout)
# Insert the error locals (if it exists)
locals[:error_msg] = session[:error_msg] or ""
session[:error_msg] = nil
@ -20,5 +20,5 @@ def serve(template, locals={})
locals[:session_user] = get_current_user unless !is_logged_in
# Serve the slim template
slim(template, locals: locals)
slim(template, locals: locals, :layout => layout)
end

@ -0,0 +1,9 @@
html lang="en"
head
meta charset="UTF-8"
meta name="viewport" content="width=device-width, initial-scale=1.0"
link rel="stylesheet" href="/style.css"
title The Auction House
body
.content-container
==yield

@ -8,3 +8,5 @@
a.button href="/register" target="_self"
| Don't have an account? Create one!
a.button href="/" target="_self"
| Return home

@ -10,7 +10,7 @@
a.button href="/login" target="_self"
| Log in instead
a.button href="https://en.wikipedia.org/wiki/Bcrypt" target="_blank"
| How we store passwords
a.button href="/" target="_self"
| Return home

Loading…
Cancel
Save