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
- Admin:
- Create a conference, halls, tracks
- # Create a conference, halls, tracks
- Starting a CFP
- conferences#show -> admin dashboard
- # conferences#show -> admin dashboard
- proposals#index -> grouped by user
- volunteers#index -> approved volunteers
- events#index -> approved events
- sponsorships#index -> generate token, links to send around
- 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 {
vertical-align: middle !important;
&.boolean-col {
.fa-check-square-o { color: $color-success; }
.fa-minus-square-o { color: $color-failure; }
}
}

View File

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

View File

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

View File

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