User blocking improved. Admin area styled

This commit is contained in:
Dmitriy Zaporozhets 2012-04-16 23:33:03 +03:00
parent c0df0cd70c
commit c9def945d4
13 changed files with 231 additions and 109 deletions

View file

@ -6,41 +6,55 @@
- @admin_user.errors.full_messages.each do |msg|
%li= msg
.clearfix
= f.label :name
.input= f.text_field :name
.clearfix
= f.label :email
.input= f.text_field :email
.clearfix
= f.label :password
.input= f.password_field :password
.clearfix
= f.label :password_confirmation
.input= f.password_field :password_confirmation
.row
.span6
.clearfix
= f.label :name
.input
= f.text_field :name
%span.help-inline * requried
.clearfix
= f.label :email
.input
= f.text_field :email
%span.help-inline * requried
.clearfix
= f.label :password
.input= f.password_field :password
.clearfix
= f.label :password_confirmation
.input= f.password_field :password_confirmation
%hr
.clearfix
= f.label :skype
.input= f.text_field :skype
.clearfix
= f.label :linkedin
.input= f.text_field :linkedin
.clearfix
= f.label :twitter
.input= f.text_field :twitter
.span6
.clearfix
= f.label :projects_limit
.input= f.text_field :projects_limit, :class => "small_input"
.clearfix
= f.label :projects_limit
.input= f.text_field :projects_limit, :class => "small_input"
.clearfix
= f.label :skype
.input= f.text_field :skype
.clearfix
= f.label :linkedin
.input= f.text_field :linkedin
.clearfix
= f.label :twitter
.input= f.text_field :twitter
%hr
.clearfix
= f.label :admin do
= f.check_box :admin
%span Administrator
.clearfix
= f.label :blocked do
= f.check_box :blocked
%span Blocked
.alert
.clearfix
%p Give user ability to manage application.
= f.label :admin, :class => "checkbox" do
= f.check_box :admin
%span Administrator
- unless @admin_user.new_record?
.alert.alert-error
- if @admin_user.blocked
%span
= link_to 'Unblock', unblock_admin_user_path(@admin_user), :method => :put, :class => "btn small"
This user is blocked and is not able to login GitLab
- else
%span
= link_to 'Block', block_admin_user_path(@admin_user), :confirm => 'USER WILL BE BLOCKED! Are you sure?', :method => :put, :class => "btn small danger"
Blocked user will removed from all projects & will not be able to login to GitLab.
.actions
= f.submit 'Save', :class => "btn primary"
- if @admin_user.new_record?

View file

@ -2,15 +2,29 @@
Users
= link_to 'New User', new_admin_user_path, :class => "btn small right"
%br
%table.zebra-striped.table-bordered
%ul.nav.nav-pills
%li{:class => "#{'active' unless params[:filter]}"}
= link_to "Active", admin_users_path
%li{:class => "#{'active' if params[:filter] == "admins"}"}
= link_to admin_users_path(:filter => "admins") do
Admins
%li{:class => "#{'active' if params[:filter] == "blocked"}"}
= link_to admin_users_path(:filter => "blocked") do
Blocked
%li{:class => "#{'active' if params[:filter] == "wop"}"}
= link_to admin_users_path(:filter => "wop") do
Without projects
%table.admin-table
%thead
%th Admin
%th Name
%th Email
%th Projects
%th Edit
%th Blocked
%th
%th
- @admin_users.each do |user|
%tr
@ -18,8 +32,12 @@
%td= link_to user.name, [:admin, user]
%td= user.email
%td= user.users_projects.count
%td= check_box_tag "blocked", 1, user.blocked, :disabled => :disabled
%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"
%td
- if user.blocked
= link_to 'Unblock', unblock_admin_user_path(user), :method => :put, :class => "btn small success"
- else
= link_to 'Block', block_admin_user_path(user), :confirm => 'USER WILL BE BLOCKED! Are you sure?', :method => :put, :class => "btn small danger"
%td= link_to 'Destroy', [:admin, user], :confirm => 'USER WILL BE REMOVED! Are you sure?', :method => :delete, :class => "btn small danger"
= paginate @admin_users, :theme => "admin"

View file

@ -1,10 +1,14 @@
%h3
= @admin_user.name
- if @admin_user.blocked
%small Blocked
- if @admin_user.admin
%small Administrator
= link_to 'Edit', edit_admin_user_path(@admin_user), :class => "btn small right"
%hr
%br
%table.zebra-striped
%table.zebra-striped.table-bordered
%tr
%td
%b
@ -49,41 +53,47 @@
%td
= @admin_user.twitter
%h3 Projects
%hr
%table.zebra-striped
%tr
%thead
%th Name
%th Project Access
%th Repository Access
%th
%th
- @admin_user.users_projects.each do |tm|
- project = tm.project
%tr
%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= 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"
%br
%h3 Add User to Projects
%br
= form_tag team_update_admin_user_path(@admin_user), :class => "bulk_import", :method => :put do
%table
%table.table-bordered
%thead
%tr
%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"
.actions
= submit_tag 'Add', :class => "btn primary"
%tr
%td= submit_tag 'Add', :class => "btn primary"
%td
Read more about project permissions
%strong= link_to "here", help_permissions_path, :class => "vlink"
%br
- if @admin_user.projects.present?
%h3 Projects
%br
%table.zebra-striped.table-bordered
%tr
%thead
%th Name
%th Project Access
%th
%th
- @admin_user.users_projects.each do |tm|
- project = tm.project
%tr
%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= 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"
:css
form select {