Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
ed3f4408
Commit
ed3f4408
authored
Feb 13, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redesign Admin -> user -> show page
parent
6b24c375
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
135 deletions
+99
-135
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+6
-2
app/models/user.rb
app/models/user.rb
+4
-0
app/views/admin/users/show.html.haml
app/views/admin/users/show.html.haml
+76
-120
app/views/users/_profile.html.haml
app/views/users/_profile.html.haml
+9
-9
app/views/users/_projects.html.haml
app/views/users/_projects.html.haml
+2
-2
app/views/users/show.html.haml
app/views/users/show.html.haml
+2
-2
No files found.
app/controllers/admin/users_controller.rb
View file @
ed3f4408
...
...
@@ -9,8 +9,12 @@ class Admin::UsersController < Admin::ApplicationController
end
def
show
@projects
=
Project
.
scoped
@projects
=
@projects
.
without_user
(
admin_user
)
if
admin_user
.
authorized_projects
.
present?
# Projects user can be added to
@not_in_projects
=
Project
.
scoped
@not_in_projects
=
@not_in_projects
.
without_user
(
admin_user
)
if
admin_user
.
authorized_projects
.
present?
# Projects he already own or joined
@projects
=
admin_user
.
authorized_projects
.
where
(
'projects.id in (?)'
,
admin_user
.
authorized_projects
.
map
(
&
:id
))
end
def
team_update
...
...
app/models/user.rb
View file @
ed3f4408
...
...
@@ -313,4 +313,8 @@ class User < ActiveRecord::Base
UserTeam
.
where
(
id:
ids
)
end
end
def
owned_teams
UserTeam
.
where
(
owner_id:
self
.
id
)
end
end
app/views/admin/users/show.html.haml
View file @
ed3f4408
%h3
.page_title
User:
#{
@admin_user
.
name
}
.row
.span6
%h3
.page_title
=
image_tag
gravatar_icon
(
@admin_user
.
email
,
90
),
class:
"avatar s90"
=
@admin_user
.
name
-
if
@admin_user
.
blocked
%small
Blocked
%span
.cred
(Blocked)
-
if
@admin_user
.
admin
%small
Administrator
%span
.cred
(Admin)
.pull-right
=
link_to
edit_admin_user_path
(
@admin_user
),
class:
"btn pull-right"
do
%i
.icon-edit
Edit
%br
%table
.zebra-striped
%thead
%tr
%th
Profile
%th
%tr
%td
%b
Email:
%td
=
@admin_user
.
email
%tr
%td
%b
Username:
%td
=
@admin_user
.
username
%tr
%td
%b
Admin:
%td
=
check_box_tag
"admin"
,
1
,
@admin_user
.
admin
,
disabled: :disabled
%tr
%td
%b
Blocked:
%td
=
check_box_tag
"blocked"
,
1
,
@admin_user
.
blocked
,
disabled: :disabled
%tr
%td
%b
Created at:
%td
=
@admin_user
.
created_at
.
stamp
(
"March 1, 1999"
)
%tr
%td
%b
Projects limit:
%td
=
@admin_user
.
projects_limit
-
unless
@admin_user
.
skype
.
empty?
%tr
%td
%b
Skype:
%td
=
@admin_user
.
skype
-
unless
@admin_user
.
linkedin
.
empty?
%tr
%td
%b
Linkedin:
%td
=
@admin_user
.
linkedin
-
unless
@admin_user
.
twitter
.
empty?
%tr
%td
%b
Twitter:
%td
=
@admin_user
.
twitter
%br
%h5
Add User to Projects
%br
=
form_tag
team_update_admin_user_path
(
@admin_user
),
class:
"bulk_import"
,
method: :put
do
%table
%thead
%tr
%th
Projects
%th
Project Access:
%tr
%td
=
select_tag
:project_ids
,
options_from_collection_for_select
(
@projects
,
:id
,
:name_with_namespace
),
multiple:
true
,
data:
{
placeholder:
'Select projects'
},
class:
'chosen span5'
%td
=
select_tag
:project_access
,
options_for_select
(
Project
.
access_options
),
class:
"project-access-select chosen span3"
%tr
%td
=
submit_tag
'Add'
,
class:
"btn btn-primary"
%td
%br
%small
@
#{
@admin_user
.
username
}
%br
%small
member since
#{
@admin_user
.
created_at
.
stamp
(
"Nov 12, 2031"
)
}
.clearfix
%hr
%h5
Add User to Projects
%small
Read more about project permissions
%strong
=
link_to
"here"
,
help_permissions_path
,
class:
"vlink"
%br
-
if
@admin_user
.
groups
.
present?
%h5
Owner of groups:
%br
=
form_tag
team_update_admin_user_path
(
@admin_user
),
class:
"bulk_import"
,
method: :put
do
.control-group
=
label_tag
:project_ids
,
"Projects"
,
class:
'control-label'
.controls
=
select_tag
:project_ids
,
options_from_collection_for_select
(
@not_in_projects
,
:id
,
:name_with_namespace
),
multiple:
true
,
data:
{
placeholder:
'Select projects'
},
class:
'chosen span3'
.control-group
=
label_tag
:project_access
,
"Project Access"
,
class:
'control-label'
.controls
=
select_tag
:project_access
,
options_for_select
(
Project
.
access_options
),
class:
"project-access-select chosen span3"
%table
.zebra-striped
%thead
%tr
%th
Name
.form-actions
=
submit_tag
'Add'
,
class:
"btn btn-create"
.pull-right
%br
-
if
@admin_user
.
owned_groups
.
present?
.ui-box
%h5
.title
Owned groups:
%ul
.well-list
-
@admin_user
.
groups
.
each
do
|
group
|
%tr
%td
=
link_to
group
.
name
,
admin_group_path
(
group
)
%li
%strong
=
link_to
group
.
name
,
admin_group_path
(
group
)
-
if
@admin_user
.
owned_teams
.
present?
.ui-box
%h5
.title
Owned teams:
%ul
.well-list
-
@admin_user
.
owned_teams
.
each
do
|
team
|
%li
%strong
=
link_to
team
.
name
,
admin_team_path
(
team
)
-
if
@admin_user
.
authorized_projects
.
present?
%h5
Authorized Projects:
%br
%table
.zebra-striped
%thead
%tr
%th
Name
%th
Project Access
%th
%th
-
@admin_user
.
tm_in_authorized_projects
.
each
do
|
tm
|
-
project
=
tm
.
project
%tr
%td
=
link_to
project
.
name_with_namespace
,
admin_project_path
(
project
)
%td
=
tm
.
project_access_human
%td
=
link_to
'Edit Access'
,
edit_admin_project_member_path
(
project
,
tm
.
user
),
class:
"btn btn-small"
%td
=
link_to
'Remove from team'
,
admin_project_member_path
(
project
,
tm
.
user
),
confirm:
'Are you sure?'
,
method: :delete
,
class:
"btn btn-small btn-remove"
.span6
=
render
'users/profile'
,
user:
@admin_user
.ui-box
%h5
.title
Projects (
#{
@projects
.
count
}
)
%ul
.well-list
-
@projects
.
each
do
|
project
|
%li
=
link_to
admin_project_path
(
project
),
class:
dom_class
(
project
)
do
-
if
project
.
namespace
=
project
.
namespace
.
human_name
\/
%strong
.well-title
=
truncate
(
project
.
name
,
length:
45
)
%span
.pull-right.light
-
if
project
.
owner
==
@admin_user
%i
.icon-wrench
-
tm
=
project
.
team
.
get_tm
(
@admin_user
.
id
)
-
if
tm
=
tm
.
project_access_human
=
link_to
edit_admin_project_member_path
(
project
,
tm
.
user
),
class:
"btn btn-small"
do
%i
.icon-edit
=
link_to
admin_project_member_path
(
project
,
tm
.
user
),
confirm:
'Are you sure?'
,
method: :delete
,
class:
"btn btn-small btn-remove"
do
%i
.icon-remove
%p
.light
%i
.icon-wrench
–
user is a project owner
app/views/users/_profile.html.haml
View file @
ed3f4408
...
...
@@ -4,20 +4,20 @@
%ul
.well-list
%li
%strong
Email
%span
.pull-right
=
mail_to
@
user
.
email
-
unless
@
user
.
skype
.
blank?
%span
.pull-right
=
mail_to
user
.
email
-
unless
user
.
skype
.
blank?
%li
%strong
Skype
%span
.pull-right
=
@
user
.
skype
-
unless
@
user
.
linkedin
.
blank?
%span
.pull-right
=
user
.
skype
-
unless
user
.
linkedin
.
blank?
%li
%strong
LinkedIn
%span
.pull-right
=
@
user
.
linkedin
-
unless
@
user
.
twitter
.
blank?
%span
.pull-right
=
user
.
linkedin
-
unless
user
.
twitter
.
blank?
%li
%strong
Twitter
%span
.pull-right
=
@
user
.
twitter
-
unless
@
user
.
bio
.
blank?
%span
.pull-right
=
user
.
twitter
-
unless
user
.
bio
.
blank?
%li
%strong
Bio
%span
.pull-right
=
@
user
.
bio
%span
.pull-right
=
user
.
bio
app/views/users/_projects.html.haml
View file @
ed3f4408
...
...
@@ -10,9 +10,9 @@
%strong
.well-title
=
truncate
(
project
.
name
,
length:
45
)
%span
.pull-right.light
-
if
project
.
owner
==
@
user
-
if
project
.
owner
==
user
%i
.icon-wrench
-
tm
=
project
.
team
.
get_tm
(
@
user
.
id
)
-
tm
=
project
.
team
.
get_tm
(
user
.
id
)
-
if
tm
=
tm
.
project_access_human
%p
.light
...
...
app/views/users/show.html.haml
View file @
ed3f4408
...
...
@@ -17,5 +17,5 @@
%h5
Recent events
=
render
@events
.span4
=
render
'profile'
=
render
'projects'
=
render
'profile'
,
user:
@user
=
render
'projects'
,
user:
@user
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment