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
Tatuya Kamada
gitlab-ce
Commits
607ea7c6
Commit
607ea7c6
authored
Dec 30, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Share the key table between admin and profile resources.
parent
82829ed4
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
47 additions
and
53 deletions
+47
-53
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+1
-1
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+8
-0
app/views/admin/keys/show.html.haml
app/views/admin/keys/show.html.haml
+1
-4
app/views/admin/users/show.html.haml
app/views/admin/users/show.html.haml
+1
-24
app/views/profiles/keys/_key.html.haml
app/views/profiles/keys/_key.html.haml
+12
-9
app/views/profiles/keys/_key_details.html.haml
app/views/profiles/keys/_key_details.html.haml
+3
-0
app/views/profiles/keys/_key_table.html.haml
app/views/profiles/keys/_key_table.html.haml
+19
-0
app/views/profiles/keys/index.html.haml
app/views/profiles/keys/index.html.haml
+2
-12
app/views/profiles/keys/show.html.haml
app/views/profiles/keys/show.html.haml
+0
-3
No files found.
app/controllers/admin/users_controller.rb
View file @
607ea7c6
...
@@ -11,7 +11,7 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -11,7 +11,7 @@ class Admin::UsersController < Admin::ApplicationController
def
show
def
show
@personal_projects
=
user
.
personal_projects
@personal_projects
=
user
.
personal_projects
@joined_projects
=
user
.
projects
.
joined
(
@user
)
@joined_projects
=
user
.
projects
.
joined
(
@user
)
@
ssh_
keys
=
user
.
keys
.
order
(
'id DESC'
)
@keys
=
user
.
keys
.
order
(
'id DESC'
)
end
end
def
new
def
new
...
...
app/helpers/application_helper.rb
View file @
607ea7c6
...
@@ -297,4 +297,12 @@ module ApplicationHelper
...
@@ -297,4 +297,12 @@ module ApplicationHelper
def
outdated_browser?
def
outdated_browser?
browser
.
ie?
&&
browser
.
version
.
to_i
<
10
browser
.
ie?
&&
browser
.
version
.
to_i
<
10
end
end
def
path_to_key
(
key
,
admin
=
false
)
if
admin
admin_user_key_path
(
@user
,
key
)
else
profile_key_path
(
key
)
end
end
end
end
app/views/admin/keys/show.html.haml
View file @
607ea7c6
=
render
"profiles/keys/key_details"
=
render
"profiles/keys/key_details"
,
admin:
true
.pull-right
=
link_to
'Remove'
,
admin_user_key_path
(
@user
,
@key
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-remove delete-key"
app/views/admin/users/show.html.haml
View file @
607ea7c6
...
@@ -220,27 +220,4 @@
...
@@ -220,27 +220,4 @@
=
link_to
project_team_member_path
(
project
,
@user
),
data:
{
confirm:
remove_from_project_team_message
(
project
,
@user
)
},
remote:
true
,
method: :delete
,
class:
"btn-tiny btn btn-remove"
,
title:
'Remove user from project'
do
=
link_to
project_team_member_path
(
project
,
@user
),
data:
{
confirm:
remove_from_project_team_message
(
project
,
@user
)
},
remote:
true
,
method: :delete
,
class:
"btn-tiny btn btn-remove"
,
title:
'Remove user from project'
do
%i
.fa.fa-times
%i
.fa.fa-times
#ssh-keys
.tab-pane
#ssh-keys
.tab-pane
-
if
@ssh_keys
.
any?
=
render
'profiles/keys/key_table'
,
admin:
true
.panel.panel-default
%table
.table
%thead
.panel-heading
%tr
%th
Title
%th
Fingerprint
%th
%tbody
-
@ssh_keys
.
each
do
|
key
|
%tr
%td
=
link_to
admin_user_key_path
(
@user
,
key
)
do
%strong
=
key
.
title
%td
%span
(
#{
key
.
fingerprint
}
)
%span
.cgray
added
#{
time_ago_with_tooltip
(
key
.
created_at
)
}
%td
=
link_to
'Remove'
,
admin_user_key_path
(
@user
,
key
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-small btn-remove delete-key pull-right"
-
else
.nothing-here-block
User has no ssh keys
app/views/profiles/keys/_key.html.haml
View file @
607ea7c6
%li
%tr
=
link_to
profile_key_path
(
key
)
do
%td
=
link_to
path_to_key
(
key
,
is_admin
)
do
%strong
=
key
.
title
%strong
=
key
.
title
%td
%span
%span
(
#{
key
.
fingerprint
}
)
(
#{
key
.
fingerprint
}
)
%td
%span
.cgray
%span
.cgray
added
#{
time_ago_with_tooltip
(
key
.
created_at
)
}
added
#{
time_ago_with_tooltip
(
key
.
created_at
)
}
%td
=
link_to
'Remove'
,
profile_key_path
(
key
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-small btn-remove delete-key pull-right"
=
link_to
'Remove'
,
path_to_key
(
key
,
is_admin
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-small btn-remove delete-key pull-right"
app/views/profiles/keys/_key_details.html.haml
View file @
607ea7c6
-
is_admin
=
defined?
(
admin
)
?
true
:
false
.row
.row
.col-md-4
.col-md-4
.panel.panel-default
.panel.panel-default
...
@@ -17,3 +18,5 @@
...
@@ -17,3 +18,5 @@
%strong
=
@key
.
fingerprint
%strong
=
@key
.
fingerprint
%pre
.well-pre
%pre
.well-pre
=
@key
.
key
=
@key
.
key
.pull-right
=
link_to
'Remove'
,
path_to_key
(
@key
,
is_admin
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-remove delete-key"
app/views/profiles/keys/_key_table.html.haml
0 → 100644
View file @
607ea7c6
-
is_admin
=
defined?
(
admin
)
?
true
:
false
.panel.panel-default
-
if
@keys
.
any?
%table
.table
%thead
.panel-heading
%tr
%th
Title
%th
Fingerprint
%th
Added at
%th
%tbody
-
@keys
.
each
do
|
key
|
=
render
'profiles/keys/key'
,
key:
key
,
is_admin:
is_admin
-
else
.nothing-here-block
-
if
is_admin
User has no ssh keys
-
else
There are no SSH keys with access to your account.
app/views/profiles/keys/index.html.haml
View file @
607ea7c6
%h3
.page-title
%h3
.page-title
My SSH keys
My SSH keys
(
#{
@keys
.
count
}
)
.pull-right
.pull-right
=
link_to
"Add SSH Key"
,
new_profile_key_path
,
class:
"btn btn-new"
=
link_to
"Add SSH Key"
,
new_profile_key_path
,
class:
"btn btn-new"
%p
.light
%p
.light
...
@@ -9,14 +9,4 @@
...
@@ -9,14 +9,4 @@
=
link_to
"generate it"
,
help_page_path
(
"ssh"
,
"ssh"
)
=
link_to
"generate it"
,
help_page_path
(
"ssh"
,
"ssh"
)
%hr
%hr
=
render
'key_table'
.panel.panel-default
.panel-heading
SSH Keys (
#{
@keys
.
count
}
)
%ul
.well-list
#keys-table
=
render
@keys
-
if
@keys
.
blank?
%li
.nothing-here-block
There are no SSH keys with access to your account.
app/views/profiles/keys/show.html.haml
View file @
607ea7c6
=
render
"key_details"
=
render
"key_details"
.pull-right
=
link_to
'Remove'
,
profile_key_path
(
@key
),
data:
{
confirm:
'Are you sure?'
},
method: :delete
,
class:
"btn btn-remove delete-key"
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