Fixes #1081, Add more profile info on user Profile
This commit is contained in:
parent
7ea168fef4
commit
18d0f6215b
9 changed files with 133 additions and 25 deletions
18
app/views/users/_personal_info_fields.html.haml
Normal file
18
app/views/users/_personal_info_fields.html.haml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
= semantic_form_for(user, url: user_path(user.id), remote: true) do |f|
|
||||
= f.input :name, as: :string
|
||||
= f.input :nickname, as: :string
|
||||
.control-label
|
||||
= "Avatar"
|
||||
= image_tag(user.gravatar_url(size: '48'), title: "Yo #{user.name}!", :alt => '')
|
||||
= 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.input :biography, input_html: { rows: 5, data: { provide: 'markdown-editable' }, 'onkeyup' => "word_count(this, 'biography-count', 150)" },hint: markdown_hint
|
||||
You have used
|
||||
%span#bio_length
|
||||
= user.biography ? user.biography.split.length : 0
|
||||
words. Biographies are limited to 150 words.
|
||||
%br
|
||||
%br
|
||||
= f.action :submit, as: :button, label: 'Update', button_html: {class: 'btn btn-primary'}
|
||||
6
app/views/users/_social_code_fields.html.haml
Normal file
6
app/views/users/_social_code_fields.html.haml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
= semantic_form_for(user, url: user_path(user.id), remote: true) do |f|
|
||||
= 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.action :submit, as: :button, label: 'Update', button_html: {class: 'btn btn-primary'}
|
||||
7
app/views/users/_social_media_fields.html.haml
Normal file
7
app/views/users/_social_media_fields.html.haml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
= semantic_form_for(user, url: user_path(user.id), remote: true) do |f|
|
||||
= 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/78458952'
|
||||
= 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. https://joindiaspora.com/osem'
|
||||
= f.action :submit, as: :button, label: 'Update', button_html: {class: 'btn btn-primary'}
|
||||
|
|
@ -2,24 +2,18 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.page-header
|
||||
%h1 Edit your profile
|
||||
%h1
|
||||
Edit your profile
|
||||
= link_to 'My Profile', user_path(@user), class: 'btn btn-primary pull-right'
|
||||
.row
|
||||
.col-md-12
|
||||
= semantic_form_for(@user, url: user_path(@user.id)) do |f|
|
||||
= f.input :name, as: :string
|
||||
= f.input :nickname, as: :string
|
||||
.control-label
|
||||
= "Avatar"
|
||||
= image_tag(@user.gravatar_url(size: '48'), title: "Yo #{@user.name}!", :alt => '')
|
||||
= 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 :biography, input_html: { rows: 5, data: { provide: 'markdown-editable' } },
|
||||
hint: markdown_hint
|
||||
You have used
|
||||
%span#bio_length
|
||||
= @user.biography ? @user.biography.split.length : 0
|
||||
words. Biographies are limited to 150 words.
|
||||
%br
|
||||
%br
|
||||
= f.action :submit, as: :button, label: 'Update', button_html: {class: 'btn btn-primary'}
|
||||
%ul.nav.nav-pills
|
||||
%li.active
|
||||
= link_to 'Personal Info', edit_user_path({ tab: 'personal_info' }), remote: true, id: 'personal_info'
|
||||
%li
|
||||
= link_to 'Social Media', edit_user_path({ tab: 'social_media' }), remote: true, id: 'social_media'
|
||||
%li
|
||||
= link_to 'Social Code', edit_user_path({ tab: 'social_code' }), remote: true, id: 'social_code'
|
||||
%br/
|
||||
#form
|
||||
= render partial: 'personal_info_fields', locals: { user: @user }
|
||||
|
|
|
|||
11
app/views/users/field_select.js.erb
Normal file
11
app/views/users/field_select.js.erb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
$('.active').removeClass('active');
|
||||
<% if @tab_select == "personal_info" %>
|
||||
$('#personal_info').closest('li').addClass('active');
|
||||
$('#form').html('<%= j render partial: "personal_info_fields", locals: { user: @user } %>');
|
||||
<% elsif @tab_select == "social_code" %>
|
||||
$('#social_code').closest('li').addClass('active');
|
||||
$('#form').html('<%= j render partial: "social_code_fields", locals: { user: @user } %>');
|
||||
<% else %>
|
||||
$('#social_media').closest('li').addClass('active');
|
||||
$('#form').html('<%= j render partial: "social_media_fields", locals: { user: @user } %>');
|
||||
<% end %>
|
||||
|
|
@ -7,6 +7,64 @@
|
|||
= @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
|
||||
.user_profile-icon
|
||||
%icon.fa.fa-external-link.fa-3x
|
||||
%span.concat-text Blog
|
||||
- if @user.twitter.present?
|
||||
%li
|
||||
= link_to(@user.twitter) do
|
||||
.user_profile-icon
|
||||
%icon.fa.fa-twitter.fa-3x
|
||||
%span.concat-text Twitter
|
||||
- if @user.linkedin.present?
|
||||
%li
|
||||
= link_to(@user.linkedin) do
|
||||
.user_profile-icon
|
||||
%icon.fa.fa-linkedin.fa-3x
|
||||
%span.concat-text Linkedin
|
||||
- if @user.googleplus.present?
|
||||
%li
|
||||
= link_to(@user.googleplus) do
|
||||
.user_profile-icon
|
||||
%icon.fa.fa-googleplus.fa-3x
|
||||
%span.concat-text Google+
|
||||
- if @user.gnu.present?
|
||||
%li
|
||||
= link_to(@user.gnu) do
|
||||
.user_profile-icon
|
||||
%icon.fa.fa-linux.fa-3x
|
||||
%span.concat-text GNU
|
||||
- if @user.diaspora.present?
|
||||
%li
|
||||
= link_to(@user.diaspora) do
|
||||
.user_profile-icon
|
||||
%icon.fa.fa-asterisk.fa-3x
|
||||
%span.concat-text Diaspora
|
||||
- if @user.savannah.present?
|
||||
%li
|
||||
= link_to(@user.savannah) do
|
||||
.user_profile-icon
|
||||
%icon.fa.fa-linux.fa-3x
|
||||
%span.concat-text Savannah
|
||||
- if @user.github.present?
|
||||
%li
|
||||
= link_to(@user.github) do
|
||||
.user_profile-icon
|
||||
%icon.fa.fa-github.fa-3x
|
||||
%span.concat-text Github
|
||||
- if @user.gitlab.present?
|
||||
%li
|
||||
= link_to(@user.gitlab) do
|
||||
.user_profile-icon
|
||||
%icon.fa.fa-gitlab.fa-3x
|
||||
%span.concat-text Gitlab
|
||||
%h3.text-center Bio
|
||||
%p
|
||||
= markdown(@user.biography)
|
||||
.row
|
||||
|
|
|
|||
1
app/views/users/update.js.erb
Normal file
1
app/views/users/update.js.erb
Normal file
|
|
@ -0,0 +1 @@
|
|||
$('#messages').html("<%= j render 'layouts/messages' %>");
|
||||
Loading…
Add table
Add a link
Reference in a new issue