diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-01-21 21:03:47 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-01-21 21:03:47 +0400 |
commit | c5a48a6a9017d8e138564624a15427b8929606f3 (patch) | |
tree | c229807fd647ba5a8bae3f49154dbd1c288dd893 /app | |
parent | fa8c0c78136c1a3bcff2bff042affcfee973c6e1 (diff) |
add users to project from admin area easily
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/projects_controller.rb | 11 | ||||
-rw-r--r-- | app/views/admin/projects/show.html.haml | 38 | ||||
-rw-r--r-- | app/views/admin/projects/team.html.haml | 30 |
3 files changed, 40 insertions, 39 deletions
diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 676a40aefd5..813e135b77f 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -9,6 +9,12 @@ class Admin::ProjectsController < ApplicationController def show @admin_project = Project.find_by_code(params[:id]) + + @users = if @admin_project.users.empty? + User + else + User.not_in_project(@admin_project) + end.all end def new @@ -19,11 +25,6 @@ class Admin::ProjectsController < ApplicationController @admin_project = Project.find_by_code(params[:id]) end - def team - @admin_project = Project.find_by_code(params[:id]) - @users = User.not_in_project(@admin_project).all - end - def team_update @admin_project = Project.find_by_code(params[:id]) diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml index 74cfbb7d5e4..cc83add6db4 100644 --- a/app/views/admin/projects/show.html.haml +++ b/app/views/admin/projects/show.html.haml @@ -38,6 +38,23 @@ %h2 Team + = form_tag team_update_admin_project_path(@admin_project), :class => "bulk_import", :method => :put do + %table + %thead + %tr + %th Users + %th Project Access: + %th Repo Access: + + %tr + %td= select_tag :user_ids, options_from_collection_for_select(@users , :id, :name), :multiple => true + %td= select_tag :project_access, options_for_select(Project.access_options), :class => "project-access-select" + %td= select_tag :repo_access, options_for_select(Repository.access_options), :class => "repo-access-select" + + %tr + %td{ :colspan => 3 } + = submit_tag 'Add', :class => "positive-button" + %table.round-borders %thead %tr @@ -52,9 +69,22 @@ %td = link_to tm.user_name, admin_team_member_path(tm) %td= time_ago_in_words(tm.updated_at) + " ago" - %td= select_tag :project_access, options_for_select(Project.access_options, tm.project_access), :class => "project-access-select", :disabled => :disabled - %td= select_tag :repo_access, options_for_select(Repository.access_options, tm.repo_access), :class => "repo-access-select", :disabled => :disabled + %td= select_tag :tm_project_access, options_for_select(Project.access_options, tm.project_access), :class => "project-access-select", :disabled => :disabled + %td= select_tag :tm_repo_access, options_for_select(Repository.access_options, tm.repo_access), :class => "repo-access-select", :disabled => :disabled %td= link_to 'Destroy', admin_team_member_path(tm), :confirm => 'Are you sure?', :method => :delete - = link_to 'New Team Member', new_admin_team_member_path(:team_member => {:project_id => @admin_project.id}), :class => "grey-button" - .right= link_to 'Bulk Import', team_admin_project_path(@admin_project), :class => "grey-button" +:css + form select { + width:150px; + } + + #user_ids { + width:300px; + } + + +:javascript + $('select#user_ids').chosen(); + $('select#repo_access').chosen(); + $('select#project_access').chosen(); + diff --git a/app/views/admin/projects/team.html.haml b/app/views/admin/projects/team.html.haml index c032d5800be..e69de29bb2d 100644 --- a/app/views/admin/projects/team.html.haml +++ b/app/views/admin/projects/team.html.haml @@ -1,30 +0,0 @@ -= form_tag team_update_admin_project_path(@admin_project), :class => "bulk_import", :method => :put do - .span-6 - %b Project Access: - .span-6 - = select_tag :project_access, options_for_select(Project.access_options), :class => "project-access-select" - - .span-6 - %b Repository Access: - .span-6 - = select_tag :repo_access, options_for_select(Repository.access_options), :class => "repo-access-select" - - %br - = select_tag :user_ids, options_from_collection_for_select(@users , :id, :name), :multiple => true - - %br - .clear - %br - .actions - = submit_tag 'Save', :class => "grey-button" - -:css - form select { - width:300px; - } - - -:javascript - $('select#user_ids').chosen(); - $('select#repo_access').chosen(); - $('select#project_access').chosen(); |