Skip to content

Commit efe2f5f

Browse files
committed
Merge branch 'features/profile_page'
2 parents e0fb070 + 0ed7f32 commit efe2f5f

File tree

9 files changed

+80
-5
lines changed

9 files changed

+80
-5
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
v 4.2.0
2+
- User show page. Via /u/username
3+
- Show help contents on pages for better navigation
4+
15
v 4.1.0
26
- Optional Sign-Up
37
- Discussions

app/assets/stylesheets/gitlab_bootstrap/common.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ img.avatar { float: left; margin-right: 12px; width: 40px; border: 1px solid #dd
9595
img.avatar.s16 { width: 16px; height: 16px; margin-right: 6px; }
9696
img.avatar.s24 { width: 24px; height: 24px; margin-right: 8px; }
9797
img.avatar.s32 { width: 32px; height: 32px; margin-right: 10px; }
98+
img.avatar.s90 { width: 90px; height: 90px; margin-right: 15px; }
9899
img.lil_av { padding-left: 4px; padding-right: 3px; }
99100
img.small { width: 80px; }
100101

app/assets/stylesheets/sections/header.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ header {
1313
color: $style_color;
1414
text-shadow: 0 1px 0 #fff;
1515
font-size: 18px;
16-
padding: 11px;
16+
padding: 12px;
1717
}
1818

1919
/** NAV block with links and profile **/

app/controllers/users_controller.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class UsersController < ApplicationController
2+
def show
3+
@user = User.find_by_username!(params[:username])
4+
@projects = @user.authorized_projects.where('projects.id in (?)', current_user.authorized_projects.map(&:id))
5+
@events = @user.recent_events.where(project_id: @projects.map(&:id)).limit(20)
6+
end
7+
end

app/helpers/events_helper.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
module EventsHelper
22
def link_to_author(event)
3-
project = event.project
4-
tm = project.team_member_by_id(event.author_id) if project
3+
author = event.author
54

6-
if tm
7-
link_to event.author_name, project_team_member_path(project, tm)
5+
if author
6+
link_to author.name, user_path(author.username)
87
else
98
event.author_name
109
end

app/models/team.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ def << args
2121
end
2222
end
2323

24+
def get_tm user_id
25+
project.users_projects.find_by_user_id(user_id)
26+
end
27+
2428
def add_user(user, access)
2529
add_users_ids([user.id], access)
2630
end

app/views/users/_projects.html.haml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.ui-box
2+
%h5.title Projects
3+
%ul.well-list
4+
- @projects.each do |project|
5+
%li
6+
= link_to project_path(project), class: dom_class(project) do
7+
- if project.namespace
8+
= project.namespace.human_name
9+
\/
10+
%strong.well-title
11+
= truncate(project.name, length: 45)
12+
%span.right.light
13+
- if project.owner == @user
14+
%i.icon-wrench
15+
- tm = project.team.get_tm(@user.id)
16+
- if tm
17+
= tm.project_access_human
18+
%p.light
19+
%i.icon-wrench
20+
&ndash; user is a project owner

app/views/users/show.html.haml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.row
2+
.span8
3+
%h3.page_title
4+
= image_tag gravatar_icon(@user.email, 90), class: "avatar s90"
5+
= @user.name
6+
%br
7+
%small @#{@user.username}
8+
%br
9+
%small member since #{@user.created_at.stamp("Nov 12, 2031")}
10+
.clearfix
11+
%hr
12+
%h5 Recent events
13+
= render @events
14+
.span4
15+
.ui-box
16+
%h5.title Profile
17+
%ul.well-list
18+
%li
19+
%strong Email
20+
%span.right= mail_to @user.email
21+
- unless @user.skype.blank?
22+
%li
23+
%strong Skype
24+
%span.right= @user.skype
25+
- unless @user.linkedin.blank?
26+
%li
27+
%strong LinkedIn
28+
%span.right= @user.linkedin
29+
- unless @user.twitter.blank?
30+
%li
31+
%strong Twitter
32+
%span.right= @user.twitter
33+
- unless @user.bio.blank?
34+
%li
35+
%strong Bio
36+
%span.right= @user.bio
37+
= render 'projects'

config/routes.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@
9797
end
9898

9999
resources :keys
100+
match "/u/:username" => "users#show", as: :user, constraints: { username: /.*/ }
101+
102+
100103

101104
#
102105
# Dashboard Area

0 commit comments

Comments
 (0)