Commit c5f56ee8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Restyle admin:group:show. Remove .all calls fro users, projects here

parent 251945e2
...@@ -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()
......
...@@ -14,9 +14,10 @@ $ -> ...@@ -14,9 +14,10 @@ $ ->
userFormatSelection = (user) -> userFormatSelection = (user) ->
user.name user.name
$('.ajax-users-select').select2 $('.ajax-users-select').each (i, select) ->
$(select).select2
placeholder: "Search for a user" placeholder: "Search for a user"
multiple: $('.ajax-users-select').hasClass('multiselect') multiple: $(select).hasClass('multiselect')
minimumInputLength: 0 minimumInputLength: 0
query: (query) -> query: (query) ->
Api.users query.term, (users) -> Api.users query.term, (users) ->
......
...@@ -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
......
...@@ -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
......
%h3.page_title %h3.page_title
Group: #{@group.name} Group: #{@group.name}
%br
%table.zebra-striped
%thead
%tr
%th Group
%th
%tr
%td
%b
Name:
%td
= @group.name
&nbsp;
= link_to edit_admin_group_path(@group), class: "btn btn-small pull-right" do = link_to edit_admin_group_path(@group), class: "btn btn-small pull-right" do
%i.icon-edit %i.icon-edit
Edit Edit
%tr %hr
%td .row
%b .span6
Description: .ui-box
%td %h5.title
Group info:
%ul.well-list
%li
%span.light Name:
%strong= @group.name
%li
%span.light Path:
%strong
= @group.path
%li
%span.light Description:
%strong
= @group.description = @group.description
%tr
%td %li
%b %span.light Owned by:
Path: %strong
%td - if @group.owner
%span.monospace= File.join(Gitlab.config.gitlab_shell.repos_path, @group.path) = link_to @group.owner_name, admin_user_path(@group.owner)
%tr - else
%td (deleted)
%b
Owner:
%td
= @group.owner_name
.pull-right .pull-right
= link_to "#", class: "btn btn-small change-owner-link" do = link_to "#", class: "btn btn-small change-owner-link" do
%i.icon-edit %i.icon-edit
Change owner Change owner
%li.change-owner-holder.hide.bgred
%tr.change-owner-holder.hide .form-holder
%td.bgred %strong.cred New Owner:
%b.cred
New Owner:
%td.bgred
= form_for [:admin, @group] do |f| = form_for [:admin, @group] do |f|
= f.select :owner_id, User.all.map { |user| [user.name, user.id] }, {}, {class: 'chosen'} = users_select_tag(:"group[owner_id]")
%div .prepend-top-10
= f.submit 'Change Owner', class: "btn btn-remove" = f.submit 'Change Owner', class: "btn btn-remove"
= link_to "Cancel", "#", class: "btn change-owner-cancel-link" = link_to "Cancel", "#", class: "btn change-owner-cancel-link"
- if @group.projects.any? %li
%fieldset %span.light Created at:
%legend Projects (#{@group.projects.count}) %strong
%table = @group.created_at.stamp("March 1, 1999")
%thead
%tr
%th Project name
%th Path
%th Users
%th.cred Danger Zone!
- @group.projects.each do |project|
%tr
%td
= link_to project.name_with_namespace, [:admin, project]
%td
%span.monospace= project.path_with_namespace + ".git"
%td= project.users.count
%td.bgred
= 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"
= form_tag project_teams_update_admin_group_path(@group), id: "new_team_member", class: "bulk_import", method: :put do
%table.zebra-striped
%thead
%tr
%th Users
%th Project Access:
- @group.users.each do |user| .ui-box
- next unless user %h5.title
%tr{class: "user_#{user.id}"} Add user to Group projects:
%td.name= link_to user.name, admin_user_path(user) .ui-box-body.form-holder
%td.projects_access %p.light
- 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
%td= submit_tag 'Add user to projects in group', class: "btn btn-create"
%td
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"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment