BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
3e09e6f7
Commit
3e09e6f7
authored
Jun 24, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Profile related controllers under Profiles:: module
parent
e55e23bb
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
41 additions
and
40 deletions
+41
-40
keys_controller.rb
app/controllers/profiles/keys_controller.rb
+7
-7
notifications_controller.rb
app/controllers/profiles/notifications_controller.rb
+1
-1
passwords_controller.rb
app/controllers/profiles/passwords_controller.rb
+1
-1
application_helper.rb
app/helpers/application_helper.rb
+1
-1
_profile.html.haml
app/views/layouts/nav/_profile.html.haml
+1
-1
_form.html.haml
app/views/profiles/keys/_form.html.haml
+3
-3
_key.html.haml
app/views/profiles/keys/_key.html.haml
+2
-2
edit.html.haml
app/views/profiles/keys/edit.html.haml
+2
-2
index.html.haml
app/views/profiles/keys/index.html.haml
+2
-3
new.html.haml
app/views/profiles/keys/new.html.haml
+0
-0
show.html.haml
app/views/profiles/keys/show.html.haml
+2
-2
_settings.html.haml
app/views/profiles/notifications/_settings.html.haml
+0
-0
show.html.haml
app/views/profiles/notifications/show.html.haml
+0
-0
update.js.haml
app/views/profiles/notifications/update.js.haml
+0
-0
new.html.haml
app/views/profiles/passwords/new.html.haml
+0
-0
show.html.haml
app/views/profiles/show.html.haml
+2
-2
routes.rb
config/routes.rb
+3
-1
profile_ssh_keys.rb
features/steps/profile/profile_ssh_keys.rb
+2
-2
paths.rb
features/steps/shared/paths.rb
+1
-1
notifications_routing_spec.rb
spec/routing/notifications_routing_spec.rb
+3
-3
routing_spec.rb
spec/routing/routing_spec.rb
+8
-8
No files found.
app/controllers/keys_controller.rb
→
app/controllers/
profiles/
keys_controller.rb
View file @
3e09e6f7
class
KeysController
<
ApplicationController
class
Profiles
::
KeysController
<
ApplicationController
layout
"profile"
layout
"profile"
respond_to
:js
,
:html
def
index
def
index
@keys
=
current_user
.
keys
.
all
@keys
=
current_user
.
keys
.
all
...
@@ -12,15 +11,16 @@ class KeysController < ApplicationController
...
@@ -12,15 +11,16 @@ class KeysController < ApplicationController
def
new
def
new
@key
=
current_user
.
keys
.
new
@key
=
current_user
.
keys
.
new
respond_with
(
@key
)
end
end
def
create
def
create
@key
=
current_user
.
keys
.
new
(
params
[
:key
])
@key
=
current_user
.
keys
.
new
(
params
[
:key
])
@key
.
save
respond_with
(
@key
)
if
@key
.
save
redirect_to
profile_key_path
(
@key
)
else
render
'new'
end
end
end
def
destroy
def
destroy
...
@@ -28,7 +28,7 @@ class KeysController < ApplicationController
...
@@ -28,7 +28,7 @@ class KeysController < ApplicationController
@key
.
destroy
@key
.
destroy
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_to
keys_url
}
format
.
html
{
redirect_to
profile_
keys_url
}
format
.
js
{
render
nothing:
true
}
format
.
js
{
render
nothing:
true
}
end
end
end
end
...
...
app/controllers/notifications_controller.rb
→
app/controllers/
profiles/
notifications_controller.rb
View file @
3e09e6f7
class
NotificationsController
<
ApplicationController
class
Profiles
::
NotificationsController
<
ApplicationController
layout
'profile'
layout
'profile'
def
show
def
show
...
...
app/controllers/passwords_controller.rb
→
app/controllers/p
rofiles/p
asswords_controller.rb
View file @
3e09e6f7
class
PasswordsController
<
ApplicationController
class
P
rofiles
::
P
asswordsController
<
ApplicationController
layout
'navless'
layout
'navless'
skip_before_filter
:check_password_expiration
skip_before_filter
:check_password_expiration
...
...
app/helpers/application_helper.rb
View file @
3e09e6f7
...
@@ -95,7 +95,7 @@ module ApplicationHelper
...
@@ -95,7 +95,7 @@ module ApplicationHelper
default_nav
=
[
default_nav
=
[
{
label:
"My Profile"
,
url:
profile_path
},
{
label:
"My Profile"
,
url:
profile_path
},
{
label:
"My SSH Keys"
,
url:
keys_path
},
{
label:
"My SSH Keys"
,
url:
profile_
keys_path
},
{
label:
"My Dashboard"
,
url:
root_path
},
{
label:
"My Dashboard"
,
url:
root_path
},
{
label:
"Admin Section"
,
url:
admin_root_path
},
{
label:
"Admin Section"
,
url:
admin_root_path
},
]
]
...
...
app/views/layouts/nav/_profile.html.haml
View file @
3e09e6f7
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
=
nav_link
(
controller: :notifications
)
do
=
nav_link
(
controller: :notifications
)
do
=
link_to
"Notifications"
,
profile_notifications_path
=
link_to
"Notifications"
,
profile_notifications_path
=
nav_link
(
controller: :keys
)
do
=
nav_link
(
controller: :keys
)
do
=
link_to
keys_path
do
=
link_to
profile_
keys_path
do
SSH Keys
SSH Keys
%span
.count
=
current_user
.
keys
.
count
%span
.count
=
current_user
.
keys
.
count
=
nav_link
(
path:
'profiles#design'
)
do
=
nav_link
(
path:
'profiles#design'
)
do
...
...
app/views/keys/_form.html.haml
→
app/views/
profiles/
keys/_form.html.haml
View file @
3e09e6f7
%div
%div
=
form_for
@key
do
|
f
|
=
form_for
[
:profile
,
@key
]
do
|
f
|
-
if
@key
.
errors
.
any?
-
if
@key
.
errors
.
any?
.alert.alert-error
.alert.alert-error
%ul
%ul
-
@key
.
errors
.
full_messages
.
each
do
|
msg
|
-
@key
.
errors
.
full_messages
.
each
do
|
msg
|
...
@@ -20,5 +20,5 @@
...
@@ -20,5 +20,5 @@
.actions
.actions
=
f
.
submit
'Save'
,
class:
"btn btn-save"
=
f
.
submit
'Save'
,
class:
"btn btn-save"
=
link_to
"Cancel"
,
keys_path
,
class:
"btn btn-cancel"
=
link_to
"Cancel"
,
profile_
keys_path
,
class:
"btn btn-cancel"
app/views/
keys/_show
.html.haml
→
app/views/
profiles/keys/_key
.html.haml
View file @
3e09e6f7
%tr
%tr
%td
%td
=
link_to
key_path
(
key
)
do
=
link_to
profile_
key_path
(
key
)
do
%strong
=
key
.
title
%strong
=
key
.
title
%td
%td
%span
.cgray
%span
.cgray
...
@@ -8,5 +8,5 @@
...
@@ -8,5 +8,5 @@
=
time_ago_in_words
(
key
.
created_at
)
=
time_ago_in_words
(
key
.
created_at
)
ago
ago
%td
%td
=
link_to
'Remove'
,
key
,
confirm:
'Are you sure?'
,
method: :delete
,
class:
"btn btn-small btn-remove delete-key pull-right"
=
link_to
'Remove'
,
profile_key_path
(
key
)
,
confirm:
'Are you sure?'
,
method: :delete
,
class:
"btn btn-small btn-remove delete-key pull-right"
app/views/keys/edit.html.haml
→
app/views/
profiles/
keys/edit.html.haml
View file @
3e09e6f7
...
@@ -2,6 +2,6 @@
...
@@ -2,6 +2,6 @@
=
render
'form'
=
render
'form'
=
link_to
'Show'
,
@key
=
link_to
'Show'
,
profile_keys_path
(
key
)
\|
\|
=
link_to
'Back'
,
keys_path
=
link_to
'Back'
,
profile_
keys_path
app/views/keys/index.html.haml
→
app/views/
profiles/
keys/index.html.haml
View file @
3e09e6f7
%h3
.page_title
%h3
.page_title
SSH Keys
SSH Keys
=
link_to
"Add new"
,
new_key_path
,
class:
"btn pull-right"
=
link_to
"Add new"
,
new_
profile_
key_path
,
class:
"btn pull-right"
%hr
%hr
%p
.slead
%p
.slead
...
@@ -13,8 +13,7 @@
...
@@ -13,8 +13,7 @@
%th
Name
%th
Name
%th
Added
%th
Added
%th
%th
-
@keys
.
each
do
|
key
|
=
render
@keys
=
render
(
partial:
'show'
,
locals:
{
key:
key
})
-
if
@keys
.
blank?
-
if
@keys
.
blank?
%tr
%tr
%td
{
colspan:
3
}
%td
{
colspan:
3
}
...
...
app/views/keys/new.html.haml
→
app/views/
profiles/
keys/new.html.haml
View file @
3e09e6f7
File moved
app/views/keys/show.html.haml
→
app/views/
profiles/
keys/show.html.haml
View file @
3e09e6f7
...
@@ -5,10 +5,10 @@
...
@@ -5,10 +5,10 @@
created at
created at
=
@key
.
created_at
.
stamp
(
"Aug 21, 2011"
)
=
@key
.
created_at
.
stamp
(
"Aug 21, 2011"
)
.back_link
.back_link
=
link_to
keys_path
do
=
link_to
profile_
keys_path
do
←
To keys list
←
To keys list
%hr
%hr
%pre
=
@key
.
key
%pre
=
@key
.
key
.pull-right
.pull-right
=
link_to
'Remove'
,
@key
,
confirm:
'Are you sure?'
,
method: :delete
,
class:
"btn btn-remove delete-key"
=
link_to
'Remove'
,
profile_key_path
(
@key
)
,
confirm:
'Are you sure?'
,
method: :delete
,
class:
"btn btn-remove delete-key"
app/views/notifications/_settings.html.haml
→
app/views/
profiles/
notifications/_settings.html.haml
View file @
3e09e6f7
File moved
app/views/notifications/show.html.haml
→
app/views/
profiles/
notifications/show.html.haml
View file @
3e09e6f7
File moved
app/views/notifications/update.js.haml
→
app/views/
profiles/
notifications/update.js.haml
View file @
3e09e6f7
File moved
app/views/passwords/new.html.haml
→
app/views/p
rofiles/p
asswords/new.html.haml
View file @
3e09e6f7
File moved
app/views/profiles/show.html.haml
View file @
3e09e6f7
...
@@ -83,9 +83,9 @@
...
@@ -83,9 +83,9 @@
%legend
%legend
SSH public keys:
SSH public keys:
%span
.pull-right
%span
.pull-right
=
link_to
pluralize
(
current_user
.
keys
.
count
,
'key'
),
keys_path
=
link_to
pluralize
(
current_user
.
keys
.
count
,
'key'
),
profile_
keys_path
.padded
.padded
=
link_to
"Add Public Key"
,
new_key_path
,
class:
"btn btn-small"
=
link_to
"Add Public Key"
,
new_
profile_
key_path
,
class:
"btn btn-small"
.form-actions
.form-actions
=
f
.
submit
'Save'
,
class:
"btn btn-save"
=
f
.
submit
'Save'
,
class:
"btn btn-save"
config/routes.rb
View file @
3e09e6f7
...
@@ -113,11 +113,13 @@ Gitlab::Application.routes.draw do
...
@@ -113,11 +113,13 @@ Gitlab::Application.routes.draw do
put
:update_username
put
:update_username
end
end
scope
module: :profiles
do
resource
:notifications
,
only:
[
:show
,
:update
]
resource
:notifications
,
only:
[
:show
,
:update
]
resource
:password
,
only:
[
:new
,
:create
]
resource
:password
,
only:
[
:new
,
:create
]
resources
:keys
end
end
end
resources
:keys
match
"/u/:username"
=>
"users#show"
,
as: :user
,
constraints:
{
username:
/.*/
}
match
"/u/:username"
=>
"users#show"
,
as: :user
,
constraints:
{
username:
/.*/
}
...
...
features/steps/profile/profile_ssh_keys.rb
View file @
3e09e6f7
...
@@ -21,7 +21,7 @@ class ProfileSshKeys < Spinach::FeatureSteps
...
@@ -21,7 +21,7 @@ class ProfileSshKeys < Spinach::FeatureSteps
key
=
Key
.
find_by_title
(
"Laptop"
)
key
=
Key
.
find_by_title
(
"Laptop"
)
page
.
should
have_content
(
key
.
title
)
page
.
should
have_content
(
key
.
title
)
page
.
should
have_content
(
key
.
key
)
page
.
should
have_content
(
key
.
key
)
current_path
.
should
==
key_path
(
key
)
current_path
.
should
==
profile_
key_path
(
key
)
end
end
Given
'I click link "Work"'
do
Given
'I click link "Work"'
do
...
@@ -33,7 +33,7 @@ class ProfileSshKeys < Spinach::FeatureSteps
...
@@ -33,7 +33,7 @@ class ProfileSshKeys < Spinach::FeatureSteps
end
end
Then
'I visit profile keys page'
do
Then
'I visit profile keys page'
do
visit
keys_path
visit
profile_
keys_path
end
end
And
'I should not see "Work" ssh key'
do
And
'I should not see "Work" ssh key'
do
...
...
features/steps/shared/paths.rb
View file @
3e09e6f7
...
@@ -70,7 +70,7 @@ module SharedPaths
...
@@ -70,7 +70,7 @@ module SharedPaths
end
end
step
'I visit profile SSH keys page'
do
step
'I visit profile SSH keys page'
do
visit
keys_path
visit
profile_
keys_path
end
end
step
'I visit profile design page'
do
step
'I visit profile design page'
do
...
...
spec/routing/notifications_routing_spec.rb
View file @
3e09e6f7
require
"spec_helper"
require
"spec_helper"
describe
NotificationsController
do
describe
Profiles
::
NotificationsController
do
describe
"routing"
do
describe
"routing"
do
it
"routes to #show"
do
it
"routes to #show"
do
get
(
"/profile/notifications"
).
should
route_to
(
"notifications#show"
)
get
(
"/profile/notifications"
).
should
route_to
(
"
profiles/
notifications#show"
)
end
end
it
"routes to #update"
do
it
"routes to #update"
do
put
(
"/profile/notifications"
).
should
route_to
(
"notifications#update"
)
put
(
"/profile/notifications"
).
should
route_to
(
"
profiles/
notifications#update"
)
end
end
end
end
end
end
spec/routing/routing_spec.rb
View file @
3e09e6f7
...
@@ -155,33 +155,33 @@ end
...
@@ -155,33 +155,33 @@ end
# key GET /keys/:id(.:format) keys#show
# key GET /keys/:id(.:format) keys#show
# PUT /keys/:id(.:format) keys#update
# PUT /keys/:id(.:format) keys#update
# DELETE /keys/:id(.:format) keys#destroy
# DELETE /keys/:id(.:format) keys#destroy
describe
KeysController
,
"routing"
do
describe
Profiles
::
KeysController
,
"routing"
do
it
"to #index"
do
it
"to #index"
do
get
(
"/
keys"
).
should
route_to
(
'
keys#index'
)
get
(
"/
profile/keys"
).
should
route_to
(
'profiles/
keys#index'
)
end
end
it
"to #create"
do
it
"to #create"
do
post
(
"/
keys"
).
should
route_to
(
'
keys#create'
)
post
(
"/
profile/keys"
).
should
route_to
(
'profiles/
keys#create'
)
end
end
it
"to #new"
do
it
"to #new"
do
get
(
"/
keys/new"
).
should
route_to
(
'
keys#new'
)
get
(
"/
profile/keys/new"
).
should
route_to
(
'profiles/
keys#new'
)
end
end
it
"to #edit"
do
it
"to #edit"
do
get
(
"/
keys/1/edit"
).
should
route_to
(
'
keys#edit'
,
id:
'1'
)
get
(
"/
profile/keys/1/edit"
).
should
route_to
(
'profiles/
keys#edit'
,
id:
'1'
)
end
end
it
"to #show"
do
it
"to #show"
do
get
(
"/
keys/1"
).
should
route_to
(
'
keys#show'
,
id:
'1'
)
get
(
"/
profile/keys/1"
).
should
route_to
(
'profiles/
keys#show'
,
id:
'1'
)
end
end
it
"to #update"
do
it
"to #update"
do
put
(
"/
keys/1"
).
should
route_to
(
'
keys#update'
,
id:
'1'
)
put
(
"/
profile/keys/1"
).
should
route_to
(
'profiles/
keys#update'
,
id:
'1'
)
end
end
it
"to #destroy"
do
it
"to #destroy"
do
delete
(
"/
keys/1"
).
should
route_to
(
'
keys#destroy'
,
id:
'1'
)
delete
(
"/
profile/keys/1"
).
should
route_to
(
'profiles/
keys#destroy'
,
id:
'1'
)
end
end
end
end
...
...
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