Work on user management

This commit is contained in:
Andrew Radev 2015-05-10 12:36:29 +02:00
parent c304e558ac
commit 749f8ec30d
8 changed files with 69 additions and 8 deletions

13
TODO
View File

@ -4,11 +4,20 @@
- Sponsorship - Sponsorship
- Admin: - Admin:
- Create a conference, halls, tracks - # Create a conference, halls, tracks
- Starting a CFP - Starting a CFP
- conferences#show -> admin dashboard - # conferences#show -> admin dashboard
- proposals#index -> grouped by user - proposals#index -> grouped by user
- volunteers#index -> approved volunteers - volunteers#index -> approved volunteers
- events#index -> approved events - events#index -> approved events
- sponsorships#index -> generate token, links to send around - sponsorships#index -> generate token, links to send around
- scheduling -> calendar with events - scheduling -> calendar with events
- users:
- edit profile: image upload and stuff
- show profile
Notes:
- .row > .col-lg-12 -> put that outside of the "yield"?
- mb_chars?
- human_attribute_name -> create a short alias?

View File

@ -0,0 +1,2 @@
$color-success: #468847; // green
$color-failure: #d9230f; // red

View File

@ -15,4 +15,9 @@ th.action, td.action {
.record-table td { .record-table td {
vertical-align: middle !important; vertical-align: middle !important;
}
&.boolean-col {
.fa-check-square-o { color: $color-success; }
.fa-minus-square-o { color: $color-failure; }
}
}

View File

@ -8,7 +8,8 @@
@import "morris"; @import "morris";
@import "colors";
@import "layout"; @import "layout";
@import "forms"; @import "forms";
@import "record_tables"; @import "record_tables";
@import "dashboard"; @import "dashboard";

View File

@ -1,22 +1,23 @@
module Management module Management
class UsersController < ManagementController class UsersController < ManagementController
before_action :assign_user, only: [:show, :toggle_admin]
def index def index
@users = User.all @users = User.all
end end
def toggle_admin def toggle_admin
@user = find_user
@user.toggle_admin! @user.toggle_admin!
end end
def show def show
@user = find_user
@profile = @user.speaker_profile
end end
private private
def assign_user def find_user
@user = User.find params[:id] User.find(params[:id])
end end
end end
end end

View File

@ -7,6 +7,7 @@ nav.navbar.navbar-static-top.navbar-inverse role="navigation"
span.icon-bar span.icon-bar
= link_to management_path, class: 'navbar-brand' = link_to management_path, class: 'navbar-brand'
| Clarion | Clarion
.navbar-collapse.collapse.navbar-inverse-collapse .navbar-collapse.collapse.navbar-inverse-collapse
- if user_signed_in? - if user_signed_in?
ul.nav.navbar-nav ul.nav.navbar-nav

View File

@ -0,0 +1,30 @@
.row
.col-lg-12
.panel.panel-default
.panel-heading
h2.panel-title= User.model_name.human(count: 2).mb_chars.capitalize
.panel-body
table.table.table-striped.table-hover.record-table#conferences
thead
tr
th = User.human_attribute_name :title
th = User.human_attribute_name :admin
th.actions
tbody
- @users.each do |user|
tr
td= user.name
td.boolean-col
- if user.admin?
= icon 'check-square-o'
- else
= icon 'minus-square-o'
td.actions
div.btn-group.btn-group-sm
= link_to management_user_path(user), title: t('actions.view.button', model: User.model_name.human), class: 'btn btn-info'
= icon :eye
= link_to edit_management_user_path(user), title: t('actions.edit.button', model: User.model_name.human), class: 'btn btn-primary'
= icon :edit
= link_to management_user_path(user), title: t('actions.destroy.button', model: User.model_name.human), class: ['btn', 'btn-danger'], remote: true, method: :delete, data: {confirm: t('actions.are_you_sure')}
= icon :trash

View File

@ -0,0 +1,12 @@
- content_for :title
= @user.name
.row
.col-lg-12
h1.page-header
// - if @profile.present?
// = image_tag(@profile.picture.medium.url)
= @user.name
- if @profile.present?
p.biography= simple_format @profile.biography