master
E. Almqvist 3 years ago
parent ea88425e39
commit 9d05f99a8b
  1. 25
      src/app.rb
  2. 4
      src/func.rb
  3. 1
      src/views/stylesheets/style.sass

@ -13,27 +13,26 @@ require "bcrypt" # password digest
require "redcarpet" # markdown renderer require "redcarpet" # markdown renderer
require "mini_magick" # image manipulation require "mini_magick" # image manipulation
require_relative "config.rb" # config stuff require_relative "config" # config stuff
require_relative "debug.rb" # debug methods require_relative "debug" # debug methods
require_relative "lib/database.rb" # database library require_relative "lib/database" # database library
require_relative "func.rb" # usefull methods require_relative "func" # usefull methods
require_relative "const.rb" # constants require_relative "const" # constants
require_relative "db_init.rb" # db init (pre server init require_relative "db_init" # db init (pre server init
require_relative "db_models.rb" # db models (i.e. User, Roles etc) require_relative "db_models" # db models (i.e. User, Roles etc)
if DEBUG then if DEBUG then
also_reload "lib/*" also_reload "lib/*", "func.rb", "const.rb", "config.rb", "db_models.rb", "db_init.rb"
also_reload "func.rb"
also_reload "const.rb"
also_reload "config.rb"
also_reload "db_models.rb"
also_reload "db_init.rb"
end end
enable :sessions enable :sessions
db_init db_init
not_found do
serve :"404"
end
# Routes # Routes
get "/style.css" do get "/style.css" do
sass :"stylesheets/style", style: :compressed sass :"stylesheets/style", style: :compressed

@ -7,7 +7,7 @@ def is_logged_in
session[:userid] != nil session[:userid] != nil
end end
def get_current_user def sesson_user
session[:userid] && User.find_by_id(session[:userid]) session[:userid] && User.find_by_id(session[:userid])
end end
@ -17,7 +17,7 @@ def serve(template, locals={}, layout: :layout)
locals[:error_msg] = session[:error_msg] or "" locals[:error_msg] = session[:error_msg] or ""
session[:error_msg] = nil session[:error_msg] = nil
locals[:session_user] = get_current_user unless !is_logged_in #locals[:session_user] = get_current_user unless !is_logged_in
# Serve the slim template # Serve the slim template
slim(template, locals: locals, :layout => layout) slim(template, locals: locals, :layout => layout)

@ -267,6 +267,7 @@ ul.button-container
h4 h4
font-weight: normal font-weight: normal
font-size: .8rem font-size: .8rem
max-width: 250px
ul ul
margin: 1rem 0 margin: 1rem 0

Loading…
Cancel
Save