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
iv
gitlab-ce
Commits
c5f56ee8
Commit
c5f56ee8
authored
Jun 10, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restyle admin:group:show. Remove .all calls fro users, projects here
parent
251945e2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
132 deletions
+92
-132
app/assets/javascripts/admin.js.coffee
app/assets/javascripts/admin.js.coffee
+4
-2
app/assets/javascripts/users_select.js.coffee
app/assets/javascripts/users_select.js.coffee
+18
-17
app/controllers/admin/groups_controller.rb
app/controllers/admin/groups_controller.rb
+2
-3
app/controllers/admin/projects_controller.rb
app/controllers/admin/projects_controller.rb
+0
-3
app/views/admin/groups/show.html.haml
app/views/admin/groups/show.html.haml
+68
-107
No files found.
app/assets/javascripts/admin.js.coffee
View file @
c5f56ee8
...
@@ -19,11 +19,13 @@ class Admin
...
@@ -19,11 +19,13 @@ class Admin
modal
=
$
(
'.change-owner-holder'
)
modal
=
$
(
'.change-owner-holder'
)
$
(
'.change-owner-link'
).
bind
"click"
,
->
$
(
'.change-owner-link'
).
bind
"click"
,
(
e
)
->
e
.
preventDefault
()
$
(
this
).
hide
()
$
(
this
).
hide
()
modal
.
show
()
modal
.
show
()
$
(
'.change-owner-cancel-link'
).
bind
"click"
,
->
$
(
'.change-owner-cancel-link'
).
bind
"click"
,
(
e
)
->
e
.
preventDefault
()
modal
.
hide
()
modal
.
hide
()
$
(
'.change-owner-link'
).
show
()
$
(
'.change-owner-link'
).
show
()
...
...
app/assets/javascripts/users_select.js.coffee
View file @
c5f56ee8
...
@@ -14,23 +14,24 @@ $ ->
...
@@ -14,23 +14,24 @@ $ ->
userFormatSelection
=
(
user
)
->
userFormatSelection
=
(
user
)
->
user
.
name
user
.
name
$
(
'.ajax-users-select'
).
select2
$
(
'.ajax-users-select'
).
each
(
i
,
select
)
->
placeholder
:
"Search for a user"
$
(
select
).
select2
multiple
:
$
(
'.ajax-users-select'
).
hasClass
(
'multiselect'
)
placeholder
:
"Search for a user"
minimumInputLength
:
0
multiple
:
$
(
select
).
hasClass
(
'multiselect'
)
query
:
(
query
)
->
minimumInputLength
:
0
Api
.
users
query
.
term
,
(
users
)
->
query
:
(
query
)
->
data
=
{
results
:
users
}
Api
.
users
query
.
term
,
(
users
)
->
query
.
callback
(
data
)
data
=
{
results
:
users
}
query
.
callback
(
data
)
initSelection
:
(
element
,
callback
)
->
initSelection
:
(
element
,
callback
)
->
id
=
$
(
element
).
val
()
id
=
$
(
element
).
val
()
if
id
isnt
""
if
id
isnt
""
Api
.
user
(
id
,
callback
)
Api
.
user
(
id
,
callback
)
formatResult
:
userFormatResult
formatResult
:
userFormatResult
formatSelection
:
userFormatSelection
formatSelection
:
userFormatSelection
dropdownCssClass
:
"ajax-users-dropdown"
dropdownCssClass
:
"ajax-users-dropdown"
escapeMarkup
:
(
m
)
->
# we do not want to escape markup since we are displaying html in results
escapeMarkup
:
(
m
)
->
# we do not want to escape markup since we are displaying html in results
m
m
app/controllers/admin/groups_controller.rb
View file @
c5f56ee8
...
@@ -12,8 +12,6 @@ class Admin::GroupsController < Admin::ApplicationController
...
@@ -12,8 +12,6 @@ class Admin::GroupsController < Admin::ApplicationController
@projects
=
@projects
.
not_in_group
(
@group
)
if
@group
.
projects
.
present?
@projects
=
@projects
.
not_in_group
(
@group
)
if
@group
.
projects
.
present?
@projects
=
@projects
.
all
@projects
=
@projects
.
all
@projects
.
reject!
(
&
:empty_repo?
)
@projects
.
reject!
(
&
:empty_repo?
)
@users
=
User
.
active
end
end
def
new
def
new
...
@@ -68,7 +66,8 @@ class Admin::GroupsController < Admin::ApplicationController
...
@@ -68,7 +66,8 @@ class Admin::GroupsController < Admin::ApplicationController
end
end
def
project_teams_update
def
project_teams_update
@group
.
add_users_to_project_teams
(
params
[
:user_ids
],
params
[
:project_access
])
@group
.
add_users_to_project_teams
(
params
[
:user_ids
].
split
(
','
),
params
[
:project_access
])
redirect_to
[
:admin
,
@group
],
notice:
'Users were successfully added.'
redirect_to
[
:admin
,
@group
],
notice:
'Users were successfully added.'
end
end
...
...
app/controllers/admin/projects_controller.rb
View file @
c5f56ee8
...
@@ -14,9 +14,6 @@ class Admin::ProjectsController < Admin::ApplicationController
...
@@ -14,9 +14,6 @@ class Admin::ProjectsController < Admin::ApplicationController
def
show
def
show
@repository
=
@project
.
repository
@repository
=
@project
.
repository
@users
=
User
.
active
@users
=
@users
.
not_in_project
(
@project
)
if
@project
.
users
.
present?
@users
=
@users
.
all
end
end
protected
protected
...
...
app/views/admin/groups/show.html.haml
View file @
c5f56ee8
%h3
.page_title
%h3
.page_title
Group:
#{
@group
.
name
}
Group:
#{
@group
.
name
}
%br
=
link_to
edit_admin_group_path
(
@group
),
class:
"btn btn-small pull-right"
do
%table
.zebra-striped
%i
.icon-edit
%thead
Edit
%tr
%hr
%th
Group
.row
%th
.span6
%tr
.ui-box
%td
%h5
.title
%b
Group info:
Name:
%ul
.well-list
%td
%li
=
@group
.
name
%span
.light
Name:
%strong
=
@group
.
name
=
link_to
edit_admin_group_path
(
@group
),
class:
"btn btn-small pull-right"
do
%li
%i
.icon-edit
%span
.light
Path:
Edit
%strong
%tr
=
@group
.
path
%td
%b
Description:
%td
=
@group
.
description
%tr
%td
%b
Path:
%td
%span
.monospace
=
File
.
join
(
Gitlab
.
config
.
gitlab_shell
.
repos_path
,
@group
.
path
)
%tr
%td
%b
Owner:
%td
=
@group
.
owner_name
.pull-right
=
link_to
"#"
,
class:
"btn btn-small change-owner-link"
do
%i
.icon-edit
Change owner
%tr
.change-owner-holder.hide
%li
%td
.bgred
%span
.light
Description:
%b
.cred
%strong
New Owner:
=
@group
.
description
%td
.bgred
=
form_for
[
:admin
,
@group
]
do
|
f
|
=
f
.
select
:owner_id
,
User
.
all
.
map
{
|
user
|
[
user
.
name
,
user
.
id
]
},
{},
{
class:
'chosen'
}
%div
=
f
.
submit
'Change Owner'
,
class:
"btn btn-remove"
=
link_to
"Cancel"
,
"#"
,
class:
"btn change-owner-cancel-link"
-
if
@group
.
projects
.
any?
%li
%fieldset
%span
.light
Owned by:
%legend
Projects (
#{
@group
.
projects
.
count
}
)
%strong
%table
-
if
@group
.
owner
%thead
=
link_to
@group
.
owner_name
,
admin_user_path
(
@group
.
owner
)
%tr
-
else
%th
Project name
(deleted)
%th
Path
.pull-right
%th
Users
=
link_to
"#"
,
class:
"btn btn-small change-owner-link"
do
%th
.cred
Danger Zone!
%i
.icon-edit
-
@group
.
projects
.
each
do
|
project
|
Change owner
%
tr
%
li
.change-owner-holder.hide.bgred
%td
.form-holder
=
link_to
project
.
name_with_namespace
,
[
:admin
,
project
]
%strong
.cred
New Owner:
%td
=
form_for
[
:admin
,
@group
]
do
|
f
|
%span
.monospace
=
project
.
path_with_namespace
+
".git"
=
users_select_tag
(
:"group[owner_id]"
)
%td
=
project
.
users
.
count
.prepend-top-10
%td
.bgred
=
f
.
submit
'Change Owner'
,
class:
"btn btn-remove"
=
link_to
'Transfer project to global namespace'
,
remove_project_admin_group_path
(
@group
,
project_id:
project
.
id
),
confirm:
'Remove project from group and move to global namespace. Are you sure?'
,
method: :delete
,
class:
"btn btn-remove small
"
=
link_to
"Cancel"
,
"#"
,
class:
"btn change-owner-cancel-link
"
=
form_tag
project_teams_update_admin_group_path
(
@group
),
id:
"new_team_member"
,
class:
"bulk_import"
,
method: :put
do
%li
%table
.zebra-striped
%span
.light
Created at:
%thead
%strong
%tr
=
@group
.
created_at
.
stamp
(
"March 1, 1999"
)
%th
Users
%th
Project Access:
-
@group
.
users
.
each
do
|
user
|
-
next
unless
user
%tr
{
class:
"user_#{user.id}"
}
%td
.name
=
link_to
user
.
name
,
admin_user_path
(
user
)
%td
.projects_access
-
user
.
authorized_projects
.
in_namespace
(
@group
).
each
do
|
project
|
-
u_p
=
user
.
users_projects
.
in_project
(
project
).
first
-
next
unless
u_p
%span
=
project
.
name_with_namespace
=
link_to
"(
#{
u_p
.
project_access_human
}
)"
,
edit_admin_project_member_path
(
project
,
user
)
%tr
%td
.input
=
select_tag
:user_ids
,
options_from_collection_for_select
(
@users
,
:id
,
:name
),
multiple:
true
,
data:
{
placeholder:
'Select users'
},
class:
'chosen span5'
%td
=
select_tag
:project_access
,
options_for_select
(
Project
.
access_options
),
{
class:
"project-access-select chosen span3"
}
%tr
.ui-box
%td
=
submit_tag
'Add user to projects in group'
,
class:
"btn btn-create"
%h5
.title
%td
Add user to Group projects:
.ui-box-body.form-holder
%p
.light
Read more about project permissions
Read more about project permissions
%strong
=
link_to
"here"
,
help_permissions_path
,
class:
"vlink"
%strong
=
link_to
"here"
,
help_permissions_path
,
class:
"vlink"
-
else
=
form_tag
project_teams_update_admin_group_path
(
@group
),
id:
"new_team_member"
,
class:
"bulk_import"
,
method: :put
do
%fieldset
%div
%legend
Group is empty
=
users_select_tag
(
:user_ids
,
multiple:
true
)
%div
.prepend-top-10
=
select_tag
:project_access
,
options_for_select
(
Project
.
access_options
),
{
class:
"project-access-select chosen span2"
}
%hr
=
submit_tag
'Add user to projects in group'
,
class:
"btn btn-create"
=
form_tag
project_update_admin_group_path
(
@group
),
class:
"bulk_import"
,
method: :put
do
.span6
%fieldset
.ui-box
%legend
Move projects to group
%h5
.title
.alert
You can move only projects with existing repos
%br
Group projects will be moved in group directory and will not be accessible by old path
.clearfix
=
label_tag
:project_ids
do
Projects
Projects
.input
%small
=
select_tag
:project_ids
,
options_from_collection_for_select
(
@projects
,
:id
,
:name_with_namespace
),
multiple:
true
,
data:
{
placeholder:
'Select projects'
},
class:
'chosen span5'
(
#{
@group
.
projects
.
count
}
)
.form-actions
%ul
.well-list
=
submit_tag
'Move projects'
,
class:
"btn btn-create"
-
@group
.
projects
.
each
do
|
project
|
%li
%strong
=
link_to
project
.
name_with_namespace
,
[
:admin
,
project
]
%span
.pull-right.light
%span
.monospace
=
project
.
path_with_namespace
+
".git"
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