Removed gravatars & refactor

master
E. Almqvist 3 years ago
parent 25bc1e9201
commit 614e2009a0
  1. 1
      src/Gemfile
  2. 14
      src/app.rb
  3. 9
      src/db_models.rb
  4. 2
      src/lib/database.rb
  5. 2
      src/views/stylesheets/style.sass

@ -13,4 +13,3 @@ gem "slim"
gem "sassc"
gem "colorize"
gem "bcrypt"
gem "gravatar"

@ -1,6 +1,6 @@
#!/usr/bin/ruby -w
DEBUG = ARGV[0] == "debug"
DEBUG = ARGV[0] == "debug"
require "sinatra"
require "sinatra/reloader" if DEBUG
@ -9,7 +9,6 @@ require "sqlite3"
require "sassc"
require "colorize"
require "bcrypt"
require "gravatar"
require_relative "config.rb"
require_relative "debug.rb"
@ -19,6 +18,12 @@ require_relative "func.rb"
require_relative "db_init.rb"
require_relative "db_models.rb"
also_reload "lib/*"
also_reload "func.rb"
also_reload "config.rb"
also_reload "db_models.rb"
also_reload "db_init.rb"
enable :sessions
db_init
@ -71,3 +76,8 @@ post "/login" do
end
end
post "/logout" do
session.clear
redirect "/"
end

@ -14,12 +14,7 @@ class User < EntityModel
end
def avatar
gravatar = nil # Gravatar.src @email
if gravatar then
return gravatar
else
return @avatar_url
end
return @avatar_url
end
# Find user by ID, returns a user object
@ -39,7 +34,7 @@ class User < EntityModel
check_all_fields = email != "" && name != "" && password != "" && password_confirm != ""
# Check email
check_email_dupe = self.find_by_email(email)
check_email_dupe = self.find_by_email(email) == nil
check_email_valid = email.match(EMAIL_REGEX) != nil
# Name

@ -3,7 +3,7 @@ def db
dbbuf.results_as_hash = true
dbbuf
end
class EntityModel
attr_reader :id, :data

@ -104,7 +104,7 @@ label.error_msg
font-weight: bold
img.avatar
background: $shadow_clr
background: $bg_clr
width: 2.15rem
height: auto
border-radius: 50%

Loading…
Cancel
Save