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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
0bc714c2
Commit
0bc714c2
authored
Jun 22, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove form for adding user to several projects from admin area.
Remove unnecessary projects order on User#show
parent
19d628dd
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
7 additions
and
49 deletions
+7
-49
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+0
-5
app/controllers/users_controller.rb
app/controllers/users_controller.rb
+1
-1
app/views/admin/users/show.html.haml
app/views/admin/users/show.html.haml
+0
-22
app/views/dashboard/projects.html.haml
app/views/dashboard/projects.html.haml
+3
-1
spec/factories.rb
spec/factories.rb
+1
-0
spec/features/admin/admin_users_spec.rb
spec/features/admin/admin_users_spec.rb
+0
-14
spec/models/user_spec.rb
spec/models/user_spec.rb
+2
-6
No files found.
app/controllers/admin/users_controller.rb
View file @
0bc714c2
...
...
@@ -9,11 +9,6 @@ class Admin::UsersController < Admin::ApplicationController
end
def
show
# 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
end
...
...
app/controllers/users_controller.rb
View file @
0bc714c2
...
...
@@ -3,7 +3,7 @@ class UsersController < ApplicationController
def
show
@user
=
User
.
find_by_username!
(
params
[
:username
])
@projects
=
@user
.
authorized_projects
.
where
(
'projects.id in (?)'
,
current_user
.
authorized_projects
.
map
(
&
:id
))
.
order
(
'namespace_id DESC'
)
@projects
=
@user
.
authorized_projects
.
where
(
'projects.id in (?)'
,
current_user
.
authorized_projects
.
map
(
&
:id
))
@events
=
@user
.
recent_events
.
where
(
project_id:
@projects
.
map
(
&
:id
)).
limit
(
20
)
@title
=
@user
.
name
...
...
app/views/admin/users/show.html.haml
View file @
0bc714c2
...
...
@@ -63,28 +63,6 @@
%strong
=
link_to
@admin_user
.
created_by
.
name
,
[
:admin
,
@admin_user
.
created_by
]
%hr
%h5
Add User to Projects
%small
Read more about project permissions
%strong
=
link_to
"here"
,
help_permissions_path
,
class:
"vlink"
%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"
.form-actions
=
submit_tag
'Add'
,
class:
"btn btn-create"
.pull-right
%br
-
if
@admin_user
.
owned_groups
.
present?
.ui-box
%h5
.title
Owned groups:
...
...
app/views/dashboard/projects.html.haml
View file @
0bc714c2
...
...
@@ -24,6 +24,8 @@
.ui-box
%h5
.title
Projects (
#{
@projects
.
total_count
}
)
.pull-right.light
%small
Last activity
%ul
.well-list
-
@projects
.
each
do
|
project
|
%li
...
...
@@ -39,7 +41,7 @@
=
truncate
project
.
description
,
length:
80
.pull-right.light
%small
Last activity
#{
project_last_activity
(
project
)
}
%small
#{
project_last_activity
(
project
)
}
-
if
@projects
.
blank?
%li
...
...
spec/factories.rb
View file @
0bc714c2
...
...
@@ -27,6 +27,7 @@ FactoryGirl.define do
sequence
(
:name
)
{
|
n
|
"project
#{
n
}
"
}
path
{
name
.
downcase
.
gsub
(
/\s/
,
'_'
)
}
creator
namespace
{
creator
.
namespace
}
end
factory
:redmine_project
,
parent: :project
do
...
...
spec/features/admin/admin_users_spec.rb
View file @
0bc714c2
...
...
@@ -109,18 +109,4 @@ describe "Admin::Users" do
end
end
end
describe
"Add new project"
do
before
do
@new_project
=
create
(
:project
)
visit
admin_user_path
(
@user
)
end
it
"should create new user"
do
select
@new_project
.
name
,
from:
"project_ids"
expect
{
click_button
"Add"
}.
to
change
{
UsersProject
.
count
}.
by
(
1
)
page
.
should
have_content
@new_project
.
name
current_path
.
should
==
admin_user_path
(
@user
)
end
end
end
spec/models/user_spec.rb
View file @
0bc714c2
...
...
@@ -111,12 +111,8 @@ describe User do
@project_2
=
create
:project
# Grant MASTER access to the user
@project_3
=
create
:project
# Grant DEVELOPER access to the user
UsersProject
.
add_users_into_projects
(
[
@project_2
.
id
],
[
@user
.
id
],
UsersProject
::
MASTER
)
UsersProject
.
add_users_into_projects
(
[
@project_3
.
id
],
[
@user
.
id
],
UsersProject
::
DEVELOPER
)
@project_2
.
team
<<
[
@user
,
:master
]
@project_3
.
team
<<
[
@user
,
:developer
]
end
it
{
@user
.
authorized_projects
.
should
include
(
@project
)
}
...
...
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