summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-19 12:04:34 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-19 15:29:53 +0200
commitd059c69db76a5a55841bb8b0914211ae0a4bfd4f (patch)
tree0257a77f6955ae0e6f4c7887a4e9b3a62b57cd0a
parent270b7ce810775d69887e76162a00e8dc97e5d959 (diff)
downloadgitlab-ce-d059c69db76a5a55841bb8b0914211ae0a4bfd4f.tar.gz
Move identities list to own controller action
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--app/controllers/admin/identities_controller.rb12
-rw-r--r--app/views/admin/identities/index.html.haml15
-rw-r--r--app/views/admin/users/show.html.haml14
-rw-r--r--config/routes.rb2
4 files changed, 25 insertions, 18 deletions
diff --git a/app/controllers/admin/identities_controller.rb b/app/controllers/admin/identities_controller.rb
index 795fecd78d6..17ace5a258b 100644
--- a/app/controllers/admin/identities_controller.rb
+++ b/app/controllers/admin/identities_controller.rb
@@ -1,13 +1,17 @@
class Admin::IdentitiesController < Admin::ApplicationController
before_action :user
- before_action :identity
+ before_action :identity, except: :index
+
+ def index
+ @identities = @user.identities
+ end
def edit
end
def update
if @identity.update_attributes(identity_params)
- redirect_to admin_user_path(@user), notice: 'User identity was successfully updated.'
+ redirect_to admin_user_identities_path(@user), notice: 'User identity was successfully updated.'
else
render :edit
end
@@ -16,9 +20,9 @@ class Admin::IdentitiesController < Admin::ApplicationController
def destroy
respond_to do |format|
if @identity.destroy
- format.html { redirect_to [:admin, user], notice: 'User identity was successfully removed.' }
+ format.html { redirect_to admin_user_identities_path(@user), notice: 'User identity was successfully removed.' }
else
- format.html { redirect_to [:admin, user], alert: 'Failed to remove user identity.' }
+ format.html { redirect_to admin_user_identities_path(@user), alert: 'Failed to remove user identity.' }
end
end
end
diff --git a/app/views/admin/identities/index.html.haml b/app/views/admin/identities/index.html.haml
new file mode 100644
index 00000000000..bc8f1b9f0b2
--- /dev/null
+++ b/app/views/admin/identities/index.html.haml
@@ -0,0 +1,15 @@
+%h3.page-title
+ Identities for
+ = link_to @user.name, [:admin, @user]
+
+%hr
+- if @identities.present?
+ %table.table
+ %thead
+ %tr
+ %th Provider
+ %th Id
+ %th
+ = render @identities
+- else
+ %h4 This user has no identities
diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml
index 1546e069863..278102d5d4d 100644
--- a/app/views/admin/users/show.html.haml
+++ b/app/views/admin/users/show.html.haml
@@ -24,7 +24,7 @@
%li
%a{"data-toggle" => "tab", href: "#ssh-keys"} SSH keys
%li
- %a{"data-toggle" => "tab", href: "#identities"} Identities
+ = link_to "Identities", admin_user_identities_path(@user)
.tab-content
#account.tab-pane.active
@@ -232,15 +232,3 @@
%i.fa.fa-times
#ssh-keys.tab-pane
= render 'profiles/keys/key_table', admin: true
-
- #identities.tab-pane
- - if @user.identities.present?
- %table.table
- %thead
- %tr
- %th Provider
- %th Id
- %th
- = render @user.identities
- - else
- %h4 This user has no identities
diff --git a/config/routes.rb b/config/routes.rb
index 8428eff1ef5..00a95a23edc 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -149,7 +149,7 @@ Gitlab::Application.routes.draw do
namespace :admin do
resources :users, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
resources :keys, only: [:show, :destroy]
- resources :identities, only: [:edit, :update, :destroy]
+ resources :identities, only: [:index, :edit, :update, :destroy]
member do
put :team_update