Styling & stuff

master
E. Almqvist 3 years ago
parent ccd1082326
commit b47af09cf8
  1. 3
      src/config.rb
  2. 15
      src/db_models.rb
  3. 3
      src/views/layout.slim
  4. 3
      src/views/stylesheets/style.sass

@ -1,5 +1,8 @@
require_relative "const"
COINS_PREFIX = ""
COINS_SUFFIX = ""
AUTH_ERRORS = {
needed: "Authentication is needed to perform that task! Please login!"
}

@ -52,19 +52,6 @@ class User < EntityModel
self.update({reputation: val}, "id = ?", @id)
end
def update_creds(data)
# Validate input
return false, SETTINGS_ERRORS[:name_len] unless data[:name].length.between?(MIN_NAME_LEN, MAX_NAME_LEN)
return false, SETTINGS_ERRORS[:bio_len] unless data[:bio_text].length.between?(MIN_BIO_LEN, MAX_BIO_LEN)
# Filter unchanged data
data.keys.each do |k|
data.delete(k) if @data[k.to_s] == data[k]
end
User.update(data, "id = ?", @id) unless data.length < 1
return true, nil
end
# Find user by ID, returns a user object
def self.find_by_id(id)
data = self.get("*", "id = ?", id).first
@ -86,7 +73,7 @@ class User < EntityModel
check_email_valid = email.match(EMAIL_REGEX) != nil
# Name
check_name_len = name.length.between?(MIN_NAME_LEN, MAX_NAME_LEN)
check_name_len = name.length >= MIN_NAME_LEN
# Password
check_pass_equals = password == password_confirm

@ -20,11 +20,12 @@ html lang="en"
a.button#register href="/register" target="_self"
| SIGN UP
- else
li.coins = "#{COINS_PREFIX}#{session_user.coins}#{COINS_SUFFIX}"
li
a.inlbutton href="/settings" target="_self"
img.icon src="/icons/settings.svg" alt="Settings"
li
a href="/profile" target="_self"
a.inlbutton href="/profile" target="_self"
img.avatar src="#{session_user.avatar}" alt="Profile"
.content-container

@ -102,6 +102,9 @@ header
justify-content: center
margin: 0 8px
li.coins
color: $green_clr
article.index
width: 70rem
h1

Loading…
Cancel
Save