summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/user.rb15
-rw-r--r--app/views/admin/users/_form.html.haml3
-rw-r--r--app/views/profiles/show.html.haml3
-rw-r--r--app/views/users/_profile.html.haml4
4 files changed, 23 insertions, 2 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index f2cd554f9c3..3691b1d1eaa 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -41,7 +41,8 @@
# confirmed_at :datetime
# confirmation_sent_at :datetime
# unconfirmed_email :string(255)
-# hide_no_ssh_key :boolean default(FALSE), not null
+# hide_no_ssh_key :boolean default(FALSE)
+# website_url :string(255) default(""), not null
#
require 'carrierwave/orm/activerecord'
@@ -52,7 +53,7 @@ class User < ActiveRecord::Base
:recoverable, :rememberable, :trackable, :validatable, :omniauthable, :confirmable, :registerable
attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username,
- :skype, :linkedin, :twitter, :color_scheme_id, :theme_id, :force_random_password,
+ :skype, :linkedin, :twitter, :website_url, :color_scheme_id, :theme_id, :force_random_password,
:extern_uid, :provider, :password_expires_at, :avatar, :hide_no_ssh_key,
as: [:default, :admin]
@@ -424,4 +425,14 @@ class User < ActiveRecord::Base
order('id DESC').limit(1000).
update_all(updated_at: Time.now)
end
+
+ def full_website_url
+ return "http://#{website_url}" if website_url !~ /^https?:\/\//
+
+ website_url
+ end
+
+ def short_website_url
+ website_url.gsub(/https?:\/\//, '')
+ end
end
diff --git a/app/views/admin/users/_form.html.haml b/app/views/admin/users/_form.html.haml
index 98bf65bc420..ebc68e2ea63 100644
--- a/app/views/admin/users/_form.html.haml
+++ b/app/views/admin/users/_form.html.haml
@@ -80,6 +80,9 @@
.form-group
= f.label :twitter, class: 'control-label'
.col-sm-10= f.text_field :twitter, class: 'form-control'
+ .form-group
+ = f.label :website_url, class: 'control-label'
+ .col-sm-10= f.text_field :website_url, class: 'form-control'
.form-actions
- if @user.new_record?
diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml
index 6ae1032aebf..f1ccc000524 100644
--- a/app/views/profiles/show.html.haml
+++ b/app/views/profiles/show.html.haml
@@ -47,6 +47,9 @@
= f.label :twitter, class: "control-label"
.col-sm-10= f.text_field :twitter, class: "form-control"
.form-group
+ = f.label :website_url, class: "control-label"
+ .col-sm-10= f.text_field :website_url, class: "form-control"
+ .form-group
= f.label :bio, class: "control-label"
.col-sm-10
= f.text_area :bio, rows: 6, class: "form-control", maxlength: 250
diff --git a/app/views/users/_profile.html.haml b/app/views/users/_profile.html.haml
index c7eb6fa182e..30a86ba01f1 100644
--- a/app/views/users/_profile.html.haml
+++ b/app/views/users/_profile.html.haml
@@ -17,6 +17,10 @@
%li
%span.light Twitter:
%strong= link_to user.twitter, "http://www.twitter.com/#{user.twitter}"
+ - unless user.website_url.blank?
+ %li
+ %span.light Website url:
+ %strong= link_to user.short_website_url, user.full_website_url
- unless user.bio.blank?
%li
%span.light Bio: