added user edit, show view info and spec for user profile update
This commit is contained in:
parent
c48c8afa51
commit
a2dd90d355
8 changed files with 155 additions and 14 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -14,6 +14,18 @@
|
|||
= 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
|
||||
= f.input :twitter, type: :url
|
||||
= f.input :googleplus, type: :url, label: 'Google+ Url'
|
||||
= f.input :gnu, type: :url, label: 'GNU Social'
|
||||
= f.input :diaspora, type: :url
|
||||
= f.inputs :name => 'Social Code' do
|
||||
= f.input :github, type: :url
|
||||
= f.input :gitlab, type: :url
|
||||
= f.input :savannah, type: :url
|
||||
= f.input :gna, type: :url, label: 'Gna!'
|
||||
= f.input :biography, input_html: { rows: 5, data: { provide: 'markdown-editable' }, 'onkeyup' => "word_count(this, 'biography-count', 150)" },
|
||||
hint: markdown_hint
|
||||
You have used
|
||||
|
|
|
|||
|
|
@ -11,14 +11,69 @@
|
|||
= 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
|
||||
%h3 Social Media and Social Code
|
||||
%table.table
|
||||
%tr
|
||||
%td
|
||||
%b Website
|
||||
%td
|
||||
= @user.website_url.present? ? @user.website_url : '-'
|
||||
%tr
|
||||
%td
|
||||
%b Linkedin
|
||||
%td
|
||||
= @user.linkedin.present? ? @user.linkedin : '-'
|
||||
%tr
|
||||
%td
|
||||
%b Twitter
|
||||
%td
|
||||
= @user.twitter.present? ? @user.twitter : '-'
|
||||
%tr
|
||||
%td
|
||||
%b GooglePlus
|
||||
%td
|
||||
= @user.googleplus.present? ? @user.googleplus : '-'
|
||||
%tr
|
||||
%td
|
||||
%b GNU Social
|
||||
%td
|
||||
= @user.gnu.present? ? @user.gnu : '-'
|
||||
%tr
|
||||
%td
|
||||
%b Diaspora
|
||||
%td
|
||||
= @user.diaspora.present? ? @user.diaspora : '-'
|
||||
%tr
|
||||
%td
|
||||
%b Savannah
|
||||
%td
|
||||
= @user.savannah.present? ? @user.savannah : '-'
|
||||
%tr
|
||||
%td
|
||||
%b Github
|
||||
%td
|
||||
= @user.github.present? ? @user.github : '-'
|
||||
%tr
|
||||
%td
|
||||
%b Gitlab
|
||||
%td
|
||||
= @user.gitlab.present? ? @user.gitlab : '-'
|
||||
%tr
|
||||
%td
|
||||
%b Gna!
|
||||
%td
|
||||
= @user.gna.present? ? @user.gna : '-'
|
||||
|
||||
.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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue