Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-03-24 03:01:36 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2012-03-24 03:01:36 +0400
commit1c6df8e075abf87c6911be7ca9a691d48b7d4009 (patch)
tree76f715dabcb25e601f686b93af7dea81fec6dc8b
parentfea64946662a6043ec96c53bf2982d4f51ca4879 (diff)
Improved profile & team member show
-rw-r--r--app/assets/stylesheets/common.scss15
-rw-r--r--app/models/user.rb9
-rw-r--r--app/views/dashboard/index.html.haml9
-rw-r--r--app/views/devise/sessions/new.html.erb7
-rw-r--r--app/views/devise/shared/_links.erb6
-rw-r--r--app/views/profile/show.html.haml83
-rw-r--r--app/views/team_members/show.html.haml83
-rw-r--r--db/migrate/20120323221339_add_bio_field_to_user.rb5
-rw-r--r--db/schema.rb3
9 files changed, 139 insertions, 81 deletions
diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss
index 33a1f3427ee..581ad507557 100644
--- a/app/assets/stylesheets/common.scss
+++ b/app/assets/stylesheets/common.scss
@@ -358,12 +358,15 @@ img.lil_av {
top: 3px;
}
-.media-grid {
- h3, h2 , h4 {
- &.media_h {
- padding-left:10px;
- float:left;
- }
+.profile_avatar_holder {
+ float:left;
+ width:90px;
+ height:90px;
+ margin-right:20px;
+ img {
+ width:90px;
+ height:90px;
+ background:#eee;
}
}
diff --git a/app/models/user.rb b/app/models/user.rb
index 5caa7451bef..62c84a1e6fa 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -5,13 +5,19 @@ class User < ActiveRecord::Base
:recoverable, :rememberable, :trackable, :validatable, :omniauthable
# Setup accessible (or protected) attributes for your model
- attr_accessible :email, :password, :password_confirmation, :remember_me,
+ attr_accessible :email, :password, :password_confirmation, :remember_me, :bio,
:name, :projects_limit, :skype, :linkedin, :twitter, :dark_scheme, :theme_id
has_many :users_projects, :dependent => :destroy
has_many :projects, :through => :users_projects
has_many :my_own_projects, :class_name => "Project", :foreign_key => :owner_id
has_many :keys, :dependent => :destroy
+
+ has_many :recent_events,
+ :class_name => "Event",
+ :foreign_key => :author_id,
+ :order => "id DESC"
+
has_many :issues,
:foreign_key => :author_id,
:dependent => :destroy
@@ -38,6 +44,7 @@ class User < ActiveRecord::Base
:presence => true,
:numericality => {:greater_than_or_equal_to => 0}
+ validates :bio, :length => { :within => 0..255 }
before_create :ensure_authentication_token
alias_attribute :private_token, :authentication_token
diff --git a/app/views/dashboard/index.html.haml b/app/views/dashboard/index.html.haml
index 289e8d0a989..0199cb9d308 100644
--- a/app/views/dashboard/index.html.haml
+++ b/app/views/dashboard/index.html.haml
@@ -34,6 +34,15 @@
%br
= link_to new_project_path, :class => "btn" do
New Project »
+ - else
+ %hr
+ %div
+ You've reached project limit for your account.
+ You cannot create new projects.
+ .link_holder
+ %br
+ = link_to profile_path, :class => "btn" do
+ Your Profile »
.span10.left= render "dashboard/projects_feed", :projects => @active_projects
- if @last_push
.padded.prepend-top-20
diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb
index f40a8794e92..da8f911753b 100644
--- a/app/views/devise/sessions/new.html.erb
+++ b/app/views/devise/sessions/new.html.erb
@@ -9,6 +9,13 @@
<br/>
<%= f.submit "Sign in", :class => "primary btn" %>
<div class="right"> <%= render :partial => "devise/shared/links" %></div>
+
+ <%- if devise_mapping.omniauthable? %>
+ <%- resource_class.omniauth_providers.each do |provider| %>
+ <hr/>
+ <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider), :class => "btn primary" %><br />
+ <% end -%>
+ <% end -%>
<% if ldap_enable? -%>
<p><%= link_to "via LDAP", user_omniauth_authorize_path(:ldap)%></p>
<% end -%>
diff --git a/app/views/devise/shared/_links.erb b/app/views/devise/shared/_links.erb
index c624c2d54bf..d7499d14ec5 100644
--- a/app/views/devise/shared/_links.erb
+++ b/app/views/devise/shared/_links.erb
@@ -17,9 +17,3 @@
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
<% end -%>
-
-<%- if devise_mapping.omniauthable? %>
- <%- resource_class.omniauth_providers.each do |provider| %>
- <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
- <% end -%>
-<% end -%>
diff --git a/app/views/profile/show.html.haml b/app/views/profile/show.html.haml
index ab491657511..293ccd91bb0 100644
--- a/app/views/profile/show.html.haml
+++ b/app/views/profile/show.html.haml
@@ -1,15 +1,26 @@
-.media-grid
- = link_to "#" do
- = image_tag gravatar_icon(@user.email, 90), :class => "thumbnail"
- %h3.media_h
- = @user.name
- %br
- %small
- = @user.email
-
- .right
- %p.alert-message.block-message You can change your avatar at gravatar.com
-
+.row
+ .span10
+ .profile_avatar_holder
+ = image_tag gravatar_icon(@user.email, 90), :class => "styled_image"
+ %h3
+ = @user.name
+ %br
+ %small
+ = @user.email
+
+ .span6.right
+ %div
+ %div
+ %h5.cgray
+ Personal projects:
+ %span.right
+ %span= current_user.my_own_projects.count
+ of
+ %span= current_user.projects_limit
+ %h5.cgray
+ SSH public keys:
+ %span.right
+ %span= current_user.keys.count
%hr
= form_for @user, :url => profile_update_path, :method => :put do |f|
@@ -18,23 +29,39 @@
%ul
- @user.errors.full_messages.each do |msg|
%li= msg
-
- .clearfix
- = f.label :name
- .input= f.text_field :name
- .clearfix
- = f.label :email
- .input= f.text_field :email
- .clearfix
- = f.label :skype
- .input= f.text_field :skype
- .clearfix
- = f.label :linkedin
- .input= f.text_field :linkedin
- .clearfix
- = f.label :twitter
- .input= f.text_field :twitter
+ .row
+ .span9
+ .clearfix
+ = f.label :name
+ .input
+ = f.text_field :name, :class => "xlarge"
+ %span.help-block Enter youre name, so people you know can recognize you.
+ .clearfix
+ = f.label :email
+ .input
+ = f.text_field :email, :class => "xlarge"
+ %span.help-block We also use email for avatar detection
+ .clearfix
+ = f.label :skype
+ .input= f.text_field :skype, :class => "xlarge"
+ .clearfix
+ = f.label :linkedin
+ .input= f.text_field :linkedin, :class => "xlarge"
+ .clearfix
+ = f.label :twitter
+ .input= f.text_field :twitter, :class => "xlarge"
+ .clearfix
+ = f.label :bio
+ .input
+ = f.text_area :bio, :rows => 6, :class => "xlarge", :maxlength => 250
+ %span.help-block About yourself in fewer than 250 characters.
+ .span7.right
+ %p.alert-message.block-message
+ %strong Tip:
+ You can change your avatar at gravatar.com
.actions
= f.submit 'Save', :class => "primary btn"
+-#= link_to "New project", new_project_path, :class => "btn small padded"
+-#= link_to "New public key", new_key_path, :class => "btn small"
diff --git a/app/views/team_members/show.html.haml b/app/views/team_members/show.html.haml
index d05ef740fb9..0ed755a10d1 100644
--- a/app/views/team_members/show.html.haml
+++ b/app/views/team_members/show.html.haml
@@ -1,54 +1,59 @@
- allow_admin = can? current_user, :admin_project, @project
- user = @team_member.user
-.media-grid
- = link_to "#" do
- = image_tag gravatar_icon(user.email, 60), :class => "thumbnail", :width => 60
- %h3.media_h
- = user.name
- %br
- %small= user.email
-
-.back_link
- = link_to team_project_path(@project), :class => "" do
- &larr; To team list
-%br
-%table.zebra-striped.borders
- %tr
- %td Name
- %td= user.name
+.row
+ .span8
+ .profile_avatar_holder
+ = image_tag gravatar_icon(user.email, 90), :class => "styled_image"
+ %h3
+ = user.name
+ %br
+ %small
+ = user.email
+ %br
+ .back_link
+ %br
+ = link_to team_project_path(@project), :class => "" do
+ &larr; To team list
- %tr
- %td Email
- %td= user.email
+ .span8.right
+ %div
+ %div
+ %h5.cgray
+ Member since:
+ %span.right
+ = @team_member.created_at.stamp("Aug 21, 2011")
+ %h5.cgray
+ Project Access:
+ %small (#{link_to "read more", help_permissions_path, :class => "vlink"})
+ %span.right
+ = form_for(@team_member, :as => :team_member, :url => project_team_member_path(@project, @team_member)) do |f|
+ = f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, :class => "project-access-select", :disabled => !allow_admin
- %tr
- %td Member since
- %td= @team_member.created_at.stamp("Aug 21, 2011")
- %tr
- %td
- Project Access
- (#{link_to "read more", help_permissions_path, :class => "vlink"})
-
- %td
- = form_for(@team_member, :as => :team_member, :url => project_team_member_path(@project, @team_member)) do |f|
- = f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, :class => "project-access-select", :disabled => !allow_admin
+%div.prepend-top-20
- unless user.skype.empty?
- %tr
- %td Skype:
- %td= user.skype
+ %p
+ %b Skype:
+ = user.skype
- unless user.linkedin.empty?
- %tr
- %td LinkedIn:
- %td= user.linkedin
+ %p
+ %b LinkedIn:
+ = user.linkedin
- unless user.twitter.empty?
- %tr
- %td Twitter:
- %td= user.twitter
+ %p
+ %b Twitter:
+ = user.twitter
+ - unless user.bio.empty?
+ %p
+ %b Bio:
+ = user.bio
+
+= render user.recent_events.limit(3)
+
- if can? current_user, :admin_project, @project
.actions
diff --git a/db/migrate/20120323221339_add_bio_field_to_user.rb b/db/migrate/20120323221339_add_bio_field_to_user.rb
new file mode 100644
index 00000000000..80a4dec5971
--- /dev/null
+++ b/db/migrate/20120323221339_add_bio_field_to_user.rb
@@ -0,0 +1,5 @@
+class AddBioFieldToUser < ActiveRecord::Migration
+ def change
+ add_column :users, :bio, :string, :null => true
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e224aa2c100..c76fd9b5d98 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120315132931) do
+ActiveRecord::Schema.define(:version => 20120323221339) do
create_table "events", :force => true do |t|
t.string "target_type"
@@ -155,6 +155,7 @@ ActiveRecord::Schema.define(:version => 20120315132931) do
t.string "authentication_token"
t.boolean "dark_scheme", :default => false, :null => false
t.integer "theme_id", :default => 1, :null => false
+ t.string "bio"
end
add_index "users", ["email"], :name => "index_users_on_email", :unique => true