Admin area improved

This commit is contained in:
Dmitriy Zaporozhets 2012-02-11 19:56:18 +02:00
parent a769204ff4
commit cc043f32d8
39 changed files with 434 additions and 334 deletions

View file

@ -18,9 +18,6 @@
.clearfix
= f.label :password_confirmation
.input= f.password_field :password_confirmation
.clearfix
= f.check_box :admin
= f.label :admin
.clearfix
= f.label :projects_limit
@ -35,8 +32,13 @@
.clearfix
= f.label :twitter
.input= f.text_field :twitter
.clear
%br
.clearfix
= f.label :admin do
= f.check_box :admin
%span Administrator
.actions
= f.submit 'Save', :class => "btn primary"
= link_to 'Cancel', admin_users_path, :class => "btn"
- if @admin_user.new_record?
= link_to 'Cancel', admin_users_path, :class => "btn"
- else
= link_to 'Cancel', admin_user_path(@admin_user), :class => "btn"

View file

@ -1,6 +1,3 @@
%h3= @admin_user.name
%hr
= render 'form'
%br
= link_to 'Back', admin_users_path, :class => ""
|
= link_to 'Show', [:admin, @admin_user], :class => ""

View file

@ -1,4 +1,8 @@
%table
%h3
Users
= link_to 'New User', new_admin_user_path, :class => "btn small right"
%hr
%table.zebra-striped
%thead
%th Admin
%th Name
@ -13,9 +17,7 @@
%td= link_to user.name, [:admin, user]
%td= user.email
%td= user.users_projects.count
%td= link_to 'Edit', edit_admin_user_path(user), :id => "edit_#{dom_id(user)}"
%td= link_to 'Destroy', [:admin, user], :confirm => 'Are you sure?', :method => :delete
%td= link_to 'Edit', edit_admin_user_path(user), :id => "edit_#{dom_id(user)}", :class => "btn small"
%td= link_to 'Destroy', [:admin, user], :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger"
= paginate @admin_users
%br
= link_to 'New User', new_admin_user_path, :class => "btn"

View file

@ -1,6 +1,10 @@
%h2= @admin_user.name
%h3
= @admin_user.name
= link_to 'Edit', edit_admin_user_path(@admin_user), :class => "btn small right"
%table.round-borders
%hr
%table.zebra-striped
%tr
%td
%b
@ -39,31 +43,57 @@
Twitter:
%td
= @admin_user.twitter
%h3 Projects
%hr
%table.zebra-striped
%tr
%td{:colspan => 2}
= link_to 'Edit', edit_admin_user_path(@admin_user), :class => "btn"
%thead
%th Name
%th Project Access
%th Repository Access
%th
%th
.span-14
%h2 Projects
%table.round-borders
- @admin_user.users_projects.each do |tm|
- project = tm.project
%tr
%thead
%th Name
%th Added
%th Project Access
%th Repository Access
%th
%th
%td= link_to project.name, admin_project_path(project)
%td= select_tag :tm_project_access, options_for_select(Project.access_options, tm.project_access), :class => "medium project-access-select", :disabled => :disabled
%td= select_tag :tm_repo_access, options_for_select(Repository.access_options, tm.repo_access), :class => "medium repo-access-select", :disabled => :disabled
%td= link_to 'Edit Access', edit_admin_team_member_path(tm), :class => "btn small"
%td= link_to 'Remove from team', admin_team_member_path(tm), :confirm => 'Are you sure?', :method => :delete, :class => "btn small danger"
- @admin_user.users_projects.each do |tm|
- project = tm.project
= form_tag team_update_admin_user_path(@admin_user), :class => "bulk_import", :method => :put do
%table
%thead
%tr
%td= link_to project.name, admin_project_path(project)
%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= link_to 'Edit', edit_admin_team_member_path(tm)
%td= link_to 'Cancel', admin_team_member_path(tm), :confirm => 'Are you sure?', :method => :delete
%th Projects
%th Project Access:
%th Repo Access:
%tr
%td= select_tag :project_ids, options_from_collection_for_select(@projects , :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"
.actions
= submit_tag 'Add', :class => "btn primary"
:css
form select {
width:150px;
}
#project_ids {
width:300px;
}
:javascript
$('select#project_ids').chosen();
$('select#repo_access').chosen();
$('select#project_access').chosen();
= link_to 'Add To Another Project', new_admin_team_member_path(:team_member => {:user_id => @admin_user.id}), :class => "btn"