Skip to content
Snippets Groups Projects
Commit 3e09e6f7 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Move Profile related controllers under Profiles:: module

parent e55e23bb
No related branches found
No related tags found
No related merge requests found
Showing
with 50 additions and 30 deletions
class KeysController < ApplicationController
class Profiles::KeysController < ApplicationController
layout "profile"
respond_to :js, :html
 
def index
@keys = current_user.keys.all
Loading
Loading
@@ -12,15 +11,16 @@ class KeysController < ApplicationController
 
def new
@key = current_user.keys.new
respond_with(@key)
end
 
def create
@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
 
def destroy
Loading
Loading
@@ -28,7 +28,7 @@ class KeysController < ApplicationController
@key.destroy
 
respond_to do |format|
format.html { redirect_to keys_url }
format.html { redirect_to profile_keys_url }
format.js { render nothing: true }
end
end
Loading
Loading
class NotificationsController < ApplicationController
class Profiles::NotificationsController < ApplicationController
layout 'profile'
 
def show
Loading
Loading
class PasswordsController < ApplicationController
class Profiles::PasswordsController < ApplicationController
layout 'navless'
 
skip_before_filter :check_password_expiration
Loading
Loading
Loading
Loading
@@ -95,7 +95,7 @@ module ApplicationHelper
 
default_nav = [
{ 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: "Admin Section", url: admin_root_path },
]
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@
= nav_link(controller: :notifications) do
= link_to "Notifications", profile_notifications_path
= nav_link(controller: :keys) do
= link_to keys_path do
= link_to profile_keys_path do
SSH Keys
%span.count= current_user.keys.count
= nav_link(path: 'profiles#design') do
Loading
Loading
%div
= form_for @key do |f|
-if @key.errors.any?
= form_for [:profile, @key] do |f|
- if @key.errors.any?
.alert.alert-error
%ul
- @key.errors.full_messages.each do |msg|
Loading
Loading
@@ -20,5 +20,5 @@
 
.actions
= 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"
 
%tr
%td
= link_to key_path(key) do
= link_to profile_key_path(key) do
%strong= key.title
%td
%span.cgray
Loading
Loading
@@ -8,5 +8,5 @@
= time_ago_in_words(key.created_at)
ago
%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"
 
Loading
Loading
@@ -2,6 +2,6 @@
 
= render 'form'
 
= link_to 'Show', @key
= link_to 'Show', profile_keys_path(key)
\|
= link_to 'Back', keys_path
= link_to 'Back', profile_keys_path
%h3.page_title
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
%p.slead
Loading
Loading
@@ -13,8 +13,7 @@
%th Name
%th Added
%th
- @keys.each do |key|
= render(partial: 'show', locals: {key: key})
= render @keys
- if @keys.blank?
%tr
%td{colspan: 3}
Loading
Loading
Loading
Loading
@@ -5,10 +5,10 @@
created at
= @key.created_at.stamp("Aug 21, 2011")
.back_link
= link_to keys_path do
= link_to profile_keys_path do
&larr; To keys list
%hr
 
%pre= @key.key
.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"
Loading
Loading
@@ -83,9 +83,9 @@
%legend
SSH public keys:
%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
= 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
= f.submit 'Save', class: "btn btn-save"
Loading
Loading
@@ -113,11 +113,13 @@ Gitlab::Application.routes.draw do
put :update_username
end
 
resource :notifications, only: [:show, :update]
resource :password, only: [:new, :create]
scope module: :profiles do
resource :notifications, only: [:show, :update]
resource :password, only: [:new, :create]
resources :keys
end
end
 
resources :keys
match "/u/:username" => "users#show", as: :user, constraints: { username: /.*/ }
 
 
Loading
Loading
Loading
Loading
@@ -21,7 +21,7 @@ class ProfileSshKeys < Spinach::FeatureSteps
key = Key.find_by_title("Laptop")
page.should have_content(key.title)
page.should have_content(key.key)
current_path.should == key_path(key)
current_path.should == profile_key_path(key)
end
 
Given 'I click link "Work"' do
Loading
Loading
@@ -33,7 +33,7 @@ class ProfileSshKeys < Spinach::FeatureSteps
end
 
Then 'I visit profile keys page' do
visit keys_path
visit profile_keys_path
end
 
And 'I should not see "Work" ssh key' do
Loading
Loading
Loading
Loading
@@ -70,7 +70,7 @@ module SharedPaths
end
 
step 'I visit profile SSH keys page' do
visit keys_path
visit profile_keys_path
end
 
step 'I visit profile design page' do
Loading
Loading
require "spec_helper"
 
describe NotificationsController do
describe Profiles::NotificationsController do
describe "routing" do
it "routes to #show" do
get("/profile/notifications").should route_to("notifications#show")
get("/profile/notifications").should route_to("profiles/notifications#show")
end
 
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment