This commit is contained in:
Anitha Palanisamy 2017-02-08 18:38:34 +00:00 committed by GitHub
commit 5c198a11aa
11 changed files with 215 additions and 18 deletions

View file

@ -90,3 +90,12 @@ p.comment-body {
.changeset{
display: none;
}
.user-profile-icon{
text-align: center;
display: table;
.concat-text{
display: block;
font-size: 14px;
}
}

View file

@ -24,6 +24,8 @@ class UsersController < ApplicationController
# Only allow a trusted parameter "white list" through.
def user_params
params.require(:user).permit(:name, :biography, :nickname, :affiliation)
params.require(:user).permit(:name, :biography, :nickname, :affiliation,
:website_url, :linkedin, :twitter, :googleplus,
:gnu, :diaspora, :github, :gitlab, :gna, :savannah)
end
end

View file

@ -54,7 +54,6 @@ class User < ActiveRecord::Base
scope :admin, -> { where(is_admin: true) }
validates :email, presence: true
validates :username,
uniqueness: {
case_sensitive: false
@ -62,6 +61,9 @@ class User < ActiveRecord::Base
presence: true
validate :biography_limit
validates :website_url, :linkedin, :googleplus, :gnu, :twitter, :gitlab, :github, :gna, :savannah, :diaspora,
format: { with: URI.regexp(%w(http https)), message: 'This is an invalid URL. It should start with http or https'},
allow_blank: true
##
# Checkes if the user attended the event

View file

@ -14,6 +14,27 @@
= link_to 'Change your avatar here', 'https://gravatar.com'
= f.input :affiliation, as: :string,
hint: 'This could be a company, a user group, or nothing at all.'
= f.input :website_url, type: :url, label: 'Personal Website'
= f.inputs :name => 'Social Media' do
= f.input :linkedin, type: :url, as: :string,
hint: 'e.g. https://linkedin.com/osem'
= f.input :twitter, type: :url, as: :string,
hint: 'e.g. https://twitter.com/osem'
= f.input :googleplus, type: :url, label: 'Google+ Url', as: :string,
hint: 'e.g. https://googleplus.com/798239DR45'
= f.input :gnu, type: :url, label: 'GNU Social', as: :string,
hint: 'e.g. https://gnu.io/osem'
= f.input :diaspora, type: :url, as: :string,
hint: 'e.g http://joindiaspora.com/osem'
= f.inputs :name => 'Social Code' do
= f.input :github, type: :url, as: :string,
hint: 'e.g http://github.com/osem'
= f.input :gitlab, type: :url, as: :string,
hint: 'e.g http://gitlab.com/osem'
= f.input :savannah, type: :url, as: :string,
hint: 'e.g http://savannah.gnu.org/osem'
= f.input :gna, type: :url, label: 'Gna!', as: :string,
hint: 'e.g http://gna.com/osem'
= f.input :biography, input_html: { rows: 5, data: { provide: 'markdown-editable' }, 'onkeyup' => "word_count(this, 'biography-count', 150)" },
hint: markdown_hint
You have used

View file

@ -7,18 +7,82 @@
= @user.name
%small
= @user.nickname
%h3.text-center
Social Media and Social Code
%ul.list-inline.list-unstyled.text-center
- if @user.website_url.present?
%li
= link_to(@user.website_url) do
%div.user-profile-icon
%icon.fa.fa-external-link.fa-3x
%span.concat-text Blog
- if @user.linkedin.present?
%li
= link_to(@user.linkedin) do
%div.user-profile-icon
%icon.fa.fa-linkedin.fa-3x
%span.concat-text Linkedin
- if @user.twitter.present?
%li
= link_to(@user.twitter) do
%div.user-profile-icon
%icon.fa.fa-twitter.fa-3x
%span.concat-text Twitter
- if @user.googleplus.present?
%li
= link_to(@user.googleplus) do
%div.user-profile-icon
%icon.fa.fa-google-plus.fa-3x
%span.concat-text Google+
- if @user.gnu.present?
%li
= link_to(@user.gnu) do
%div.user-profile-icon
%icon.fa.fa-linux.fa-3x
%span.concat-text Gnu
- if @user.diaspora.present?
%li
= link_to(@user.diaspora) do
%div.user-profile-icon
%icon.fa.fa-asterisk.fa-3x
%span.concat-text Diaspora
- if @user.savannah.present?
%li
= link_to(@user.savannah) do
%div.user-profile-icon
%icon.fa.fa-linux.fa-3x
%span.concat-text Savannah
- if @user.gna.present?
%li
= link_to(@user.gna) do
%div.user-profile-icon
%icon.fa.fa-linux.fa-3x
%span.concat-text Gna!
- if @user.github.present?
%li
= link_to(@user.github) do
%div.user-profile-icon
%icon.fa.fa-github.fa-3x
%span.concat-text Github
- if @user.gitlab.present?
%li
= link_to(@user.gitlab) do
%div.user-profile-icon
%icon.fa.fa-gitlab.fa-3x
%span.concat-text Gitlab
%h3.text-center Bio
%p
= markdown(@user.biography)
.row
.col-md-12
- if @user.events.confirmed.any?
%h3
= "#{@user.name} presents #{pluralize(@user.events.confirmed.count, 'Event')}:"
%ul.list-unstyled
- @user.events.confirmed.each do |event|
%li
%h4
= link_to event.title, conference_program_proposal_path(event.program.conference.short_title, event.id)
%strong
at
= event.program.conference.title
- if @user.events.confirmed.any?
%h3
= "#{@user.name} presents #{pluralize(@user.events.confirmed.count, 'Event')}:"
%ul.list-unstyled
- @user.events.confirmed.each do |event|
%li
%h4
= link_to event.title, conference_program_proposal_path(event.program.conference.short_title, event.id)
%strong
at
= event.program.conference.title