Commit 1c6df8e075abf87c6911be7ca9a691d48b7d4009
1 parent
fea64946
Exists in
master
and in
4 other branches
Improved profile & team member show
Showing
9 changed files
with
139 additions
and
81 deletions
Show diff stats
app/assets/stylesheets/common.scss
| ... | ... | @@ -358,12 +358,15 @@ img.lil_av { |
| 358 | 358 | top: 3px; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | -.media-grid { | |
| 362 | - h3, h2 , h4 { | |
| 363 | - &.media_h { | |
| 364 | - padding-left:10px; | |
| 365 | - float:left; | |
| 366 | - } | |
| 361 | +.profile_avatar_holder { | |
| 362 | + float:left; | |
| 363 | + width:90px; | |
| 364 | + height:90px; | |
| 365 | + margin-right:20px; | |
| 366 | + img { | |
| 367 | + width:90px; | |
| 368 | + height:90px; | |
| 369 | + background:#eee; | |
| 367 | 370 | } |
| 368 | 371 | } |
| 369 | 372 | ... | ... |
app/models/user.rb
| ... | ... | @@ -5,13 +5,19 @@ class User < ActiveRecord::Base |
| 5 | 5 | :recoverable, :rememberable, :trackable, :validatable, :omniauthable |
| 6 | 6 | |
| 7 | 7 | # Setup accessible (or protected) attributes for your model |
| 8 | - attr_accessible :email, :password, :password_confirmation, :remember_me, | |
| 8 | + attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, | |
| 9 | 9 | :name, :projects_limit, :skype, :linkedin, :twitter, :dark_scheme, :theme_id |
| 10 | 10 | |
| 11 | 11 | has_many :users_projects, :dependent => :destroy |
| 12 | 12 | has_many :projects, :through => :users_projects |
| 13 | 13 | has_many :my_own_projects, :class_name => "Project", :foreign_key => :owner_id |
| 14 | 14 | has_many :keys, :dependent => :destroy |
| 15 | + | |
| 16 | + has_many :recent_events, | |
| 17 | + :class_name => "Event", | |
| 18 | + :foreign_key => :author_id, | |
| 19 | + :order => "id DESC" | |
| 20 | + | |
| 15 | 21 | has_many :issues, |
| 16 | 22 | :foreign_key => :author_id, |
| 17 | 23 | :dependent => :destroy |
| ... | ... | @@ -38,6 +44,7 @@ class User < ActiveRecord::Base |
| 38 | 44 | :presence => true, |
| 39 | 45 | :numericality => {:greater_than_or_equal_to => 0} |
| 40 | 46 | |
| 47 | + validates :bio, :length => { :within => 0..255 } | |
| 41 | 48 | |
| 42 | 49 | before_create :ensure_authentication_token |
| 43 | 50 | alias_attribute :private_token, :authentication_token | ... | ... |
app/views/dashboard/index.html.haml
| ... | ... | @@ -34,6 +34,15 @@ |
| 34 | 34 | %br |
| 35 | 35 | = link_to new_project_path, :class => "btn" do |
| 36 | 36 | New Project » |
| 37 | + - else | |
| 38 | + %hr | |
| 39 | + %div | |
| 40 | + You've reached project limit for your account. | |
| 41 | + You cannot create new projects. | |
| 42 | + .link_holder | |
| 43 | + %br | |
| 44 | + = link_to profile_path, :class => "btn" do | |
| 45 | + Your Profile » | |
| 37 | 46 | .span10.left= render "dashboard/projects_feed", :projects => @active_projects |
| 38 | 47 | - if @last_push |
| 39 | 48 | .padded.prepend-top-20 | ... | ... |
app/views/devise/sessions/new.html.erb
| ... | ... | @@ -9,6 +9,13 @@ |
| 9 | 9 | <br/> |
| 10 | 10 | <%= f.submit "Sign in", :class => "primary btn" %> |
| 11 | 11 | <div class="right"> <%= render :partial => "devise/shared/links" %></div> |
| 12 | + | |
| 13 | + <%- if devise_mapping.omniauthable? %> | |
| 14 | + <%- resource_class.omniauth_providers.each do |provider| %> | |
| 15 | + <hr/> | |
| 16 | + <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn primary" %><br /> | |
| 17 | + <% end -%> | |
| 18 | + <% end -%> | |
| 12 | 19 | <% if ldap_enable? -%> |
| 13 | 20 | <p><%= link_to "via LDAP", user_omniauth_authorize_path(:ldap)%></p> |
| 14 | 21 | <% end -%> | ... | ... |
app/views/devise/shared/_links.erb
| ... | ... | @@ -17,9 +17,3 @@ |
| 17 | 17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> |
| 18 | 18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br /> |
| 19 | 19 | <% end -%> |
| 20 | - | |
| 21 | -<%- if devise_mapping.omniauthable? %> | |
| 22 | - <%- resource_class.omniauth_providers.each do |provider| %> | |
| 23 | - <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br /> | |
| 24 | - <% end -%> | |
| 25 | -<% end -%> | ... | ... |
app/views/profile/show.html.haml
| 1 | -.media-grid | |
| 2 | - = link_to "#" do | |
| 3 | - = image_tag gravatar_icon(@user.email, 90), :class => "thumbnail" | |
| 4 | - %h3.media_h | |
| 5 | - = @user.name | |
| 6 | - %br | |
| 7 | - %small | |
| 8 | - = @user.email | |
| 9 | - | |
| 10 | - .right | |
| 11 | - %p.alert-message.block-message You can change your avatar at gravatar.com | |
| 12 | - | |
| 1 | +.row | |
| 2 | + .span10 | |
| 3 | + .profile_avatar_holder | |
| 4 | + = image_tag gravatar_icon(@user.email, 90), :class => "styled_image" | |
| 5 | + %h3 | |
| 6 | + = @user.name | |
| 7 | + %br | |
| 8 | + %small | |
| 9 | + = @user.email | |
| 10 | + | |
| 11 | + .span6.right | |
| 12 | + %div | |
| 13 | + %div | |
| 14 | + %h5.cgray | |
| 15 | + Personal projects: | |
| 16 | + %span.right | |
| 17 | + %span= current_user.my_own_projects.count | |
| 18 | + of | |
| 19 | + %span= current_user.projects_limit | |
| 20 | + %h5.cgray | |
| 21 | + SSH public keys: | |
| 22 | + %span.right | |
| 23 | + %span= current_user.keys.count | |
| 13 | 24 | %hr |
| 14 | 25 | |
| 15 | 26 | = form_for @user, :url => profile_update_path, :method => :put do |f| |
| ... | ... | @@ -18,23 +29,39 @@ |
| 18 | 29 | %ul |
| 19 | 30 | - @user.errors.full_messages.each do |msg| |
| 20 | 31 | %li= msg |
| 21 | - | |
| 22 | - .clearfix | |
| 23 | - = f.label :name | |
| 24 | - .input= f.text_field :name | |
| 25 | - .clearfix | |
| 26 | - = f.label :email | |
| 27 | - .input= f.text_field :email | |
| 28 | - .clearfix | |
| 29 | - = f.label :skype | |
| 30 | - .input= f.text_field :skype | |
| 31 | - .clearfix | |
| 32 | - = f.label :linkedin | |
| 33 | - .input= f.text_field :linkedin | |
| 34 | - .clearfix | |
| 35 | - = f.label :twitter | |
| 36 | - .input= f.text_field :twitter | |
| 32 | + .row | |
| 33 | + .span9 | |
| 34 | + .clearfix | |
| 35 | + = f.label :name | |
| 36 | + .input | |
| 37 | + = f.text_field :name, :class => "xlarge" | |
| 38 | + %span.help-block Enter youre name, so people you know can recognize you. | |
| 39 | + .clearfix | |
| 40 | + = f.label :email | |
| 41 | + .input | |
| 42 | + = f.text_field :email, :class => "xlarge" | |
| 43 | + %span.help-block We also use email for avatar detection | |
| 44 | + .clearfix | |
| 45 | + = f.label :skype | |
| 46 | + .input= f.text_field :skype, :class => "xlarge" | |
| 47 | + .clearfix | |
| 48 | + = f.label :linkedin | |
| 49 | + .input= f.text_field :linkedin, :class => "xlarge" | |
| 50 | + .clearfix | |
| 51 | + = f.label :twitter | |
| 52 | + .input= f.text_field :twitter, :class => "xlarge" | |
| 53 | + .clearfix | |
| 54 | + = f.label :bio | |
| 55 | + .input | |
| 56 | + = f.text_area :bio, :rows => 6, :class => "xlarge", :maxlength => 250 | |
| 57 | + %span.help-block About yourself in fewer than 250 characters. | |
| 58 | + .span7.right | |
| 59 | + %p.alert-message.block-message | |
| 60 | + %strong Tip: | |
| 61 | + You can change your avatar at gravatar.com | |
| 37 | 62 | |
| 38 | 63 | .actions |
| 39 | 64 | = f.submit 'Save', :class => "primary btn" |
| 40 | 65 | |
| 66 | +-#= link_to "New project", new_project_path, :class => "btn small padded" | |
| 67 | +-#= link_to "New public key", new_key_path, :class => "btn small" | ... | ... |
app/views/team_members/show.html.haml
| 1 | 1 | - allow_admin = can? current_user, :admin_project, @project |
| 2 | 2 | - user = @team_member.user |
| 3 | -.media-grid | |
| 4 | - = link_to "#" do | |
| 5 | - = image_tag gravatar_icon(user.email, 60), :class => "thumbnail", :width => 60 | |
| 6 | - %h3.media_h | |
| 7 | - = user.name | |
| 8 | - %br | |
| 9 | - %small= user.email | |
| 10 | - | |
| 11 | -.back_link | |
| 12 | - = link_to team_project_path(@project), :class => "" do | |
| 13 | - ← To team list | |
| 14 | 3 | |
| 15 | -%br | |
| 16 | -%table.zebra-striped.borders | |
| 17 | - %tr | |
| 18 | - %td Name | |
| 19 | - %td= user.name | |
| 4 | +.row | |
| 5 | + .span8 | |
| 6 | + .profile_avatar_holder | |
| 7 | + = image_tag gravatar_icon(user.email, 90), :class => "styled_image" | |
| 8 | + %h3 | |
| 9 | + = user.name | |
| 10 | + %br | |
| 11 | + %small | |
| 12 | + = user.email | |
| 13 | + %br | |
| 14 | + .back_link | |
| 15 | + %br | |
| 16 | + = link_to team_project_path(@project), :class => "" do | |
| 17 | + ← To team list | |
| 20 | 18 | |
| 21 | - %tr | |
| 22 | - %td Email | |
| 23 | - %td= user.email | |
| 19 | + .span8.right | |
| 20 | + %div | |
| 21 | + %div | |
| 22 | + %h5.cgray | |
| 23 | + Member since: | |
| 24 | + %span.right | |
| 25 | + = @team_member.created_at.stamp("Aug 21, 2011") | |
| 26 | + %h5.cgray | |
| 27 | + Project Access: | |
| 28 | + %small (#{link_to "read more", help_permissions_path, :class => "vlink"}) | |
| 29 | + %span.right | |
| 30 | + = form_for(@team_member, :as => :team_member, :url => project_team_member_path(@project, @team_member)) do |f| | |
| 31 | + = f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, :class => "project-access-select", :disabled => !allow_admin | |
| 24 | 32 | |
| 25 | - %tr | |
| 26 | - %td Member since | |
| 27 | - %td= @team_member.created_at.stamp("Aug 21, 2011") | |
| 28 | 33 | |
| 29 | - %tr | |
| 30 | - %td | |
| 31 | - Project Access | |
| 32 | - (#{link_to "read more", help_permissions_path, :class => "vlink"}) | |
| 33 | - | |
| 34 | - %td | |
| 35 | - = form_for(@team_member, :as => :team_member, :url => project_team_member_path(@project, @team_member)) do |f| | |
| 36 | - = f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, :class => "project-access-select", :disabled => !allow_admin | |
| 37 | 34 | |
| 35 | +%div.prepend-top-20 | |
| 38 | 36 | - unless user.skype.empty? |
| 39 | - %tr | |
| 40 | - %td Skype: | |
| 41 | - %td= user.skype | |
| 37 | + %p | |
| 38 | + %b Skype: | |
| 39 | + = user.skype | |
| 42 | 40 | |
| 43 | 41 | - unless user.linkedin.empty? |
| 44 | - %tr | |
| 45 | - %td LinkedIn: | |
| 46 | - %td= user.linkedin | |
| 42 | + %p | |
| 43 | + %b LinkedIn: | |
| 44 | + = user.linkedin | |
| 47 | 45 | |
| 48 | 46 | - unless user.twitter.empty? |
| 49 | - %tr | |
| 50 | - %td Twitter: | |
| 51 | - %td= user.twitter | |
| 47 | + %p | |
| 48 | + %b Twitter: | |
| 49 | + = user.twitter | |
| 50 | + - unless user.bio.empty? | |
| 51 | + %p | |
| 52 | + %b Bio: | |
| 53 | + = user.bio | |
| 54 | + | |
| 55 | += render user.recent_events.limit(3) | |
| 56 | + | |
| 52 | 57 | |
| 53 | 58 | - if can? current_user, :admin_project, @project |
| 54 | 59 | .actions | ... | ... |
db/schema.rb
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | # |
| 12 | 12 | # It's strongly recommended to check this file into your version control system. |
| 13 | 13 | |
| 14 | -ActiveRecord::Schema.define(:version => 20120315132931) do | |
| 14 | +ActiveRecord::Schema.define(:version => 20120323221339) do | |
| 15 | 15 | |
| 16 | 16 | create_table "events", :force => true do |t| |
| 17 | 17 | t.string "target_type" |
| ... | ... | @@ -155,6 +155,7 @@ ActiveRecord::Schema.define(:version => 20120315132931) do |
| 155 | 155 | t.string "authentication_token" |
| 156 | 156 | t.boolean "dark_scheme", :default => false, :null => false |
| 157 | 157 | t.integer "theme_id", :default => 1, :null => false |
| 158 | + t.string "bio" | |
| 158 | 159 | end |
| 159 | 160 | |
| 160 | 161 | add_index "users", ["email"], :name => "index_users_on_email", :unique => true | ... | ... |