Fixed user collection display, and other admin display issues

This commit is contained in:
Kenneth Jao 2016-10-24 09:54:35 -04:00
parent 3810cf8b2b
commit 725c779620
5 changed files with 46 additions and 9 deletions

View File

@ -320,7 +320,7 @@ a
font-size: 2vh; font-size: 2vh;
} }
.noScroll .fa-plus, .creWork .fa-plus, .fa-minus, .fa-graduation-cap, .fa-exchange { .noScroll .fa-plus, .creWork .fa-plus, .fa-minus, .noScroll .fa-graduation-cap, .fa-exchange {
font-size: 130%; font-size: 130%;
padding: 5%; padding: 5%;
} }

View File

@ -122,9 +122,11 @@ AdminConfig = {
{ label: 'ID', name: '_id' }, { label: 'ID', name: '_id' },
{ label: 'Name', name: 'name' } { label: 'Name', name: 'name' }
], ],
color: 'red' color: 'red',
label: 'Schools'
}, },
classes: { classes: {
icon: 'graduation-cap',
tableColumns: [ tableColumns: [
{ label: 'ID', name: '_id' }, { label: 'ID', name: '_id' },
{ label: 'School', name: 'school' }, { label: 'School', name: 'school' },
@ -140,9 +142,11 @@ AdminConfig = {
{ label: 'Banned', name: 'banned', template: 'adminUserDisplay' }, { label: 'Banned', name: 'banned', template: 'adminUserDisplay' },
{ label: 'Subscribers', name: 'subscribers', template: 'adminUserDisplay'} { label: 'Subscribers', name: 'subscribers', template: 'adminUserDisplay'}
], ],
color: 'purple' color: 'blue',
label: 'Classes'
}, },
work: { work: {
icon: 'pencil',
tableColumns: [ tableColumns: [
{ label: 'ID', name: '_id' }, { label: 'ID', name: '_id' },
{ label: 'Class', name: 'class' }, { label: 'Class', name: 'class' },
@ -156,16 +160,30 @@ AdminConfig = {
{ label: 'Done', name: 'done', template: 'adminUserDisplay' }, { label: 'Done', name: 'done', template: 'adminUserDisplay' },
{ label: 'Type', name: 'type' } { label: 'Type', name: 'type' }
], ],
color: 'yellow' color: 'yellow',
label: 'Work'
}, },
requests: { requests: {
tableColumns: [ icon: 'exclamation-triangle',
tableColumns: [
{ label: 'ID', name: '_id' }, { label: 'ID', name: '_id' },
{ label: 'User', name: 'requestor', template: 'adminUserDisplay' }, { label: 'User', name: 'requestor', template: 'adminUserDisplay' },
{ label: 'Request', name: 'request' }, { label: 'Request', name: 'request' },
{ label: 'Time', name: 'timeRequested' } { label: 'Time', name: 'timeRequested' }
], ],
color: 'green' color: 'green',
label: 'Requests'
},
'Meteor.users': {
icon: 'user',
tableColumns: [
{ label: 'ID', name: '_id' },
{ label: 'Email', name: 'services.google.email' },
{ label: 'Name', name: 'profile.name' },
{ label: 'Icon', name: '_id', template: 'adminUserDisplay' }
],
color: 'purple',
label: 'Users'
} }
} }
}; };

View File

@ -8,7 +8,7 @@
<div class="content-wrapper" style="min-height: {{minHeight}}"> <div class="content-wrapper" style="min-height: {{minHeight}}">
<section class="content-header"> <section class="content-header">
<h1> <h1>
{{$.Session.get 'admin_title'}} {{adminCollectionLabel admin_collection_name}}
<small>{{$.Session.get 'admin_subtitle'}}</small> <small>{{$.Session.get 'admin_subtitle'}}</small>
</h1> </h1>
<ol class="breadcrumb"> <ol class="breadcrumb">

View File

@ -21,6 +21,26 @@ Template.AdminLayout.helpers({
} }
}); });
/* This helper is copied from https://github.com/yogiben/meteor-admin/blob/master/lib/client/js/helpers.coffee.
I used this to remove the (irrelevant) Meteor.users collection from the dashboard and sidebar (the routes still exist).
TODO: Maybe a future version of yogiben:admin could allow this without monkey-patching?
*/
UI.registerHelper("admin_collections", function() {
var collections = {};
if (typeof AdminConfig !== 'undefined' && typeof AdminConfig.collections === 'object')
collections = AdminConfig.collections;
// remove Meteor.users collection (see above)
delete collections.Users;
return _.map(collections, function(obj, key) {
obj = _.extend(obj, { name: key });
obj = _.defaults(obj, { label: key, icon: 'plus', color: 'blue' });
return obj = _.extend(obj, {
viewPath: Router.path("adminDashboard" + key + "View"),
newPath: Router.path("adminDashboard" + key + "New")
});
});
});
dataTableOptions = { dataTableOptions = {
"aaSorting": [], "aaSorting": [],
"bPaginate": true, "bPaginate": true,

View File

@ -24,8 +24,6 @@ UI.registerHelper 'AdminConfig', ->
UI.registerHelper 'admin_skin', -> UI.registerHelper 'admin_skin', ->
AdminConfig?.skin or 'blue' AdminConfig?.skin or 'blue'
UI.registerHelper 'admin_collections', adminCollections
UI.registerHelper 'admin_collection_name', -> UI.registerHelper 'admin_collection_name', ->
Session.get 'admin_collection_name' Session.get 'admin_collection_name'
@ -111,3 +109,4 @@ UI.registerHelper 'adminUserEmail', (user) ->
user.services.facebook.email user.services.facebook.email
else if user && user.services && user.services.google && user.services.google.email else if user && user.services && user.services.google && user.services.google.email
user.services.google.email user.services.google.email