File tree 5 files changed +31
-14
lines changed
5 files changed +31
-14
lines changed Original file line number Diff line number Diff line change 1
1
class UsersController < ApplicationController
2
2
def show
3
- @user = User . find_by_username ( params [ :username ] )
3
+ @user = User . find_by_username! ( params [ :username ] )
4
4
@projects = @user . authorized_projects . where ( 'projects.id in (?)' , current_user . authorized_projects . map ( &:id ) )
5
5
@events = @user . recent_events . where ( project_id : @projects . map ( &:id ) ) . limit ( 20 )
6
6
end
Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ def << args
21
21
end
22
22
end
23
23
24
+ def get_tm user_id
25
+ project . users_projects . find_by_user_id ( user_id )
26
+ end
27
+
24
28
def add_user ( user , access )
25
29
add_users_ids ( [ user . id ] , access )
26
30
end
Original file line number Diff line number Diff line change
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
+ – user is a project owner
Original file line number Diff line number Diff line change 3
3
%h3 .page_title
4
4
= image_tag gravatar_icon(@user.email, 90), class: " avatar s90"
5
5
= @user.name
6
- %span .light (@#{@user.username})
6
+ %br
7
+ %small @#{@user.username}
8
+ %br
9
+ %small member since #{@user.created_at.stamp("Nov 12, 2031")}
7
10
.clearfix
8
11
%hr
9
12
%h5 Recent events
31
34
%li
32
35
%strong Bio
33
36
%span .right = @user.bio
34
- .ui-box
35
- %h5 .title Projects
36
- %ul .well-list
37
- - @projects.each do |project|
38
- %li
39
- = link_to project_path(project), class: dom_class(project) do
40
- - if project.namespace
41
- = project.namespace.human_name
42
- \/
43
- %strong .well-title
44
- = truncate(project.name, length: 45)
37
+ = render 'projects'
Original file line number Diff line number Diff line change 97
97
end
98
98
99
99
resources :keys
100
- match "/u/:username" => "users#show" , as : :user
100
+ match "/u/:username" => "users#show" , as : :user , constraints : { username : /.*/ }
101
101
102
102
103
103
You can’t perform that action at this time.
0 commit comments