Giter VIP home page Giter VIP logo

meteor-admin's Introduction

Meteor Admin

$ meteor add yogiben:admin

To get a working example, clone and run my Meteor starter repo and then go to /admin.

A complete admin dashboard solution for meteor built off the iron-router, roles and autoform packages and frontend from the open source admin dashboard template, Admin LTE.

Feedback Welcome. Please create an issue.

alt tag

alt tag

Maintained by Meteor Factory. Professional Meteor development.

Meteor admin

Getting started

0. Prerequisites####

This package is designed to work with certain types of projects. Your project should be using and have configured

  • Iron Router - meteor add iron:router
  • Collection Helpers - meteor add dburles:collection-helpers
  • Collection2 - meteor add aldeed:collection2
  • An accounts system - e.g. meteor add accounts-base accounts-password
  • Roles - meteor add alanning:roles
  • Bootstrap 3 - e.g. meteor add twbs:bootstrap
  • Fontawesome - e.g. meteor add fortawesome:fontawesome

1. Install

Download to your packages directory and run meteor add yogiben:admin then go to /admin for the setup wizzard.

2. Config

The simplest possible config with one, 'Posts', collection.

#####Server and Client#####

AdminConfig = {
  collections: {
    Posts: {}
  }
};

This config will make the first user admin.

You can also set the adminEmails property which will will override this.

AdminConfig = {
  name: 'My App',
  adminEmails: ['[email protected]'],
  collections: {
    Posts: {}
  },
};

3. Define your data models

If you are unfamiliar with autoform or collection2 or collection-helpers you should check them out now.

You need to define and attach a schema to the collections that you want to edit via the admin dashboard. Check out the documentation.

@Schemas = {}

@Posts = new Meteor.Collection('posts');

Schemas.Posts = new SimpleSchema
	title:
		type: String
		max: 60
	content:
		type: String
		autoform:
			rows: 5
	createdAt:
		type: Date
		label: 'Date'
		autoValue: ->
			if this.isInsert
				return new Date()
	owner:
		type: String
		regEx: SimpleSchema.RegEx.Id
		autoValue: ->
			if this.isInsert
				return Meteor.userId()
		autoform:
			options: ->
				_.map Meteor.users.find().fetch(), (user)->
					label: user.emails[0].address
					value: user._id

Posts.attachSchema(Schemas.Posts)

4. Enjoy

Go to /admin. If you are not made an admin, re-read step 2.

Customization

The admin dashboard is heavily customisable. Most of the possibilities are represented in the config option below.

@AdminConfig =
    nonAdminRedirectRoute: 'entrySignIn',
    collections:
        Posts: {
            icon: 'pencil'
            tableColumns: [
              {label: 'Title', name: 'title'}
	            {label: 'Published', name: 'published'}
	            {label: 'User', name: 'owner', template: 'userEmail'}
            ]
            templates:
              new:
                name: 'postWYSIGEditor'
                data:
                  post: Session.get 'admin_doc' if Meteor.isClient
              edit:
                name: 'postWYSIGEditor'
                data:
                  post: ()-> Session.get 'admin_doc' if Meteor.isClient
            selector: (userId)->
              return {ownerId: userId}
        },
        Comments: {
            icon: 'comment'
            omitFields: ['owner']
            tableColumns: [
              {label: 'Content', name: 'content'}
              {label: 'Post', name: 'postTitle()'}
              {label: 'User', name: 'owner', template: 'userEmail'}
            ]
            showWidget: false
        }
    autoForm:
        omitFields: ['createdAt', 'updatedAt']
    dashboard:
        homeUrl: '/dashboard'
        widgets: [
          {
            template: 'adminCollectionWidget'
            data:
              collection: 'Posts'
              class: 'col-lg-3 col-xs-6'
          }
          {
            template: 'adminUserWidget'
            data:
              class: 'col-lg-3 col-xs-6'
          }
        ]

Comments.helpers({
  postTitle: function () {
    if (this.post) {
      return Posts.findOne(this.post).title;
    }
  }
});

Posts.attachSchema(Schemas.Posts)

Collections

AdminConfig.collections tells the dashboard which collections to manage based on the global variable name.

AdminConfig = {
  collections: {
    Posts: {
      // collection options
    },
    Comments: {
      // collection options
    }
  }
};

It is possible to configure the way the collection is managed.

Comments: {
  icon: 'comment'
  omitFields: ['updatedAt']
  tableColumns: [
   { label: 'Content', name: 'content' },
   { label: 'Post', name: 'postTitle()' },
   { label: 'User', name: 'owner', template: 'userEmail' }
  ]
  showEditColumn: true // Set to false to hide the edit button. True by default.
  showDelColumn: true // Set to false to hide the edit button. True by default.
  showWidget: false
  color: 'red'
}
Collection options

icon is the icon code from Font Awesome.

tableColumns an array of objects that describe the columns that will appear in the admin dashboard.

  • {label: 'Content', name:'content'} will display the content property of the mongo doc.
  • {label: 'Post', name: 'postTitle()'} will use postTitle collection helper (see dburles:collection-helpers package).
  • {label: 'Joined', name: 'createdAt', template: 'prettyDate'} will display createdAt field using prettyDate template. Following object will be set as the context:
{
  value: // current cell value
  doc:   // current document
}

fields is an array of field names - set when the form should only show these fields. From AutoForm.

extraFields fields to be subscribed but not displayed in the table. Can be used if collection helper depends on the field which is not in the table.

omitFields hides fields that we don't want appearing in the add / edit screens like 'updatedAt' for example. From AutoForm.

showWidget when set to false hides the corresponding widget from the dashboard.

color styles the widget. See the LTE Admin documentation.

Users

The Meteor.users collection is automatically added to the admin panel. You can create, view and delete users.

If you have attached a schema to the user, it will automatically be used for the edit form. You can disable this functionality, or customize the schema that is used.

AdminConfig = {
  //...

  // Disable editing of user fields:
  userSchema: null,

  // Use a custom SimpleSchema:
  userSchema: new SimpleSchema({
    'profile.gender': {
       type: String,
       allowedValues: ['male', 'female']
     }
  })
}

Custom Templates

The default admin templates are autoForm instances based on the schemas assigned to the collections. If they don't do the job, you specify a custom template to use for each of the new,edit and view screens for each collection.

AdminConfig = {
  // ...
  collections: {
    Posts: {
      templates: {
        new: {
          name: 'postWYSIGEditor'
        },
        edit: {
          name: 'postWYSIGEditor',
          data: {
             post: Meteor.isClient && Session.get('admin_doc')
          }
        }
      }
    }
  }
};

The /admin/Posts/new and /admin/Posts/edit will now use the postWYSIGEditor template that you've defined somewhere in your code. The edit view will be rendered with a data context (here the document being edited).

Custom templates are most used when you need to use an {{#autoForm}} instead of the default {{> quickForm}}.

Custom route options

It is possible to setup some custom options that will be used during the generation of the routes for your collections. If no options are given, default ones will be used.

This could be useful in order to set up waitOn or onAfterAction hooks:

AdminConfig = {
  // ...
  collections: {
    Posts: {
      routes: {
        new: {
          waitOn: function () { return Meteor.subscribe('images'); }
        },
        view: {
          waitOn: function () { return Meteor.subscribe('images'); }
        },
        edit: {
          waitOn: function () { return Meteor.subscribe('images'); }
        }
      }
    }
  }
  // ...
}

All the options that Iron Router accept are also accepted here, except: path, template, controller, action and data.

However, data context could be set up using the collectionObject key:

AdminConfig = {
  // ...
  collections: {
    Posts: {
      collectionObject: {
        key: 'value'
      }
    }
  }
  // ...
}

Autoform

AdminConfig = {
  // ...
  autoForm:
    omitFields: ['createdAt', 'updatedAt']
};

Here you can specify globally the fields that should never appear in your new and update views. This is typically meta information likes dates.

Important don't omit fields unless the schema specifies either an autoValue or optional is set to true. See autoForm.

AdminLTE Skin

In order to customise the skin, add the key skin with one of the allowed values. skin defaults to "blue".

Available skins: black black-light blue blue-light green green-light purple purple-light red red-light yellow yellow-light

AdminConfig = {
  // ...
  skin: 'black-light',
  // ...
}

Dashboard

Here you can customise the look and feel of the dashboard.

AdminConfig = {
  // ...
  dashboard: {
    homeUrl: '/dashboard',
    widgets: [
      {
        template: 'adminCollectionWidget',
        data: {
          collection: 'Posts',
          class: 'col-lg-3 col-xs-6'
        }
      },
      {
        template: 'adminUserWidget',
        data: {
          class: 'col-lg-3 col-xs-6'
        }
      }
    ]
  }
};

homeUrl is the href property of the 'Home' button. Defaults to /.

widgets is an array of objects specifying template names and data contexts. Make sure to specify the class in the data context. If set, the widgets property will override the collection widgets which appear by default.

Extending Dashboard

There are few things you can do to integrate your package with meteor-admin. Remember to wrap it in Meteor.startup on client.

#####Create custom path to admin dashboard#####

AdminDashboard.path('/:collection/delete')

Note: you can omit the leading slash (it will be inserted automatically).

#####Add sidebar item with single link#####

AdminDashboard.addSidebarItem('New User', AdminDashboard.path('/Users/new'), { icon: 'plus' })

#####Add sidebar item with multiple links#####

AdminDashboard.addSidebarItem('Analytics', {
  icon: 'line-chart',
  urls: [
    { title: 'Statistics', url: AdminDashboard.path('/analytics/statistics') },
    { title: 'Settings', url: AdminDashboard.path('/analytics/settings') }
  ]
});

#####Add link to collection item#####

This will iterate through all collection items in sidebar and call your function. If you return an object with the title and url properties the link will be added. Otherwise it will be ignored.

AdminDashboard.addCollectionItem(function (collection, path) {
  if (collection === 'Users') {
    return {
      title: 'Delete',
      url: path + '/delete'
    };
  }
});

#####Add custom route#####

If you want to add your own sub route of admin dashboard (using iron:router package) there are three key things to follow

  1. Use AdminDashboard.path to get the path

  2. Use AdminController

  3. Set admin_title (and optionally admin_subtitle) session variable

e.g.

Router.route('analytics', {
  path: AdminDashboard.path('analytics'),
  controller: 'AdminController',
  onAfterAction: function () {
    Session.set('admin_title', 'Analytics');
  }
});

Logout Redirects

If you want to redirect to a custom route after the user is loggged out, you can use the logoutRedirect setting.

AdminConfig = {
  logoutRedirect: 'login' // Redirect to the route named 'login' after logging out.
}

Premium Support

Have an urgent issue or want help with implementation? Start a conversation with Meteor Factory.

meteor-admin's People

Contributors

adamwong246 avatar aldeed avatar blainehansen avatar captainn avatar carlosbaraza avatar dermellor avatar freiit avatar jeremyiglehart avatar jocoder avatar logvik avatar maxtor3569 avatar mishashapo avatar mpowaga avatar murilopolese avatar nate-strauser avatar neobii avatar pajooh avatar philip-nunoo avatar readmecritic avatar remcoder avatar renancouto avatar rikonor avatar robertlowe avatar sean-stanley avatar snamoah avatar theduke avatar thosmos avatar xumx avatar yogiben avatar yyl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meteor-admin's Issues

prepopulate the "new" form

I'd like to be able to prefill fields in the "new" form by passing in params, eg

http://localhost:3000/admin/Players/new?name=tester

for my use case I have a slightly wiki-like app where I want to be able to click on non-existing entries and auto-create the entry with the title filled in.

if you could suggest where to start on this maybe I could take a crack / PR.

No compatible build found for yogiben:[email protected]

I've been playing around with your package, probably while you were updating the release un the meteor package server.
while testing many things, I've removed the package and then readded it several times.
Now I can't add it any more. I get this warning

No compatible build found for yogiben:[email protected]
Package yogiben:admin has no compatible build for version 1.0.2

Do you have any ideas why this happens?

cannot pass autoform options from the schema

I thought this was an autoform issue but @aldeed is pointing me back to the integration with meteor-admin

Meteor-Community-Packages/meteor-autoform#411 (comment)

eg on your own examples page here you have

    content:
        type: String
        autoform:
            rows: 5

but that is throwing the error below for me. I'll check how it works in your demo app and see, maybe its todo with package inclusion order as he says. I did upgrade to the latest autoform.

 Error: Invalid definition for metatext field.
     at packages/aldeed:simple-schema/simple-schema.js:62
     at Function._.each._.forEach (packages/underscore/underscore.js:113)
     at SimpleSchema (packages/aldeed:simple-schema/simple-schema.js:59)
     at Package (packages/dcsan:lessons/lib/collections/Lessons.coffee:10:19)
     at /Users/dc/dev/shumi/redes/app/.meteor/local/build/programs/server/packages/dcsan_lessons.js:280:4
     at /Users/dc/dev/shumi/redes/app/.meteor/local/build/programs/server/packages/dcsan_lessons.js:291:3
     at /Users/dc/dev/shumi/redes/app/.meteor/local/build/programs/server/boot.js:168:10
     at Array.forEach (native)
     at Function._.each._.forEach (/Users/dc/.meteor/packages/meteor-tool/.1.0.35-rc.4.1rk418r++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
     at /Users/dc/dev/shumi/redes/app/.meteor/local/build/programs/server/boot.js:82:5

admin stuck on "Loading..."

Hello, Thanks for providing this.
I can't seem to make it work: the admin page, after validating that I'm an admin, is stuck in "Loading"

  • I correctly see the list of Collections on the sidebar, but if I click "view all" I still get the "loading"

I've followed the steps described in your instructions:

  • I have added autoform, roles, simpleschema packages directly to my app, (because for some reason your package dependencies are not installed on my app)
  • I have created SipleSchemas for the 2 collections
  • I have created the user an assigned the role ['admin']
  • I have created a basic AdminConfig like the one described as soon as you connect to the /admin page for the first time
  • the only warning I get in the console is:
    Route dispatch never rendered. Did you forget to call this.next() in an onBeforeAction?
    which suggests that there is something missing in your routes files

I've even tryied without passing any Collections and let the /admin manage only the Users to see if there was a problem with my validation, but the problem persists.

how do I edit the routes inside your packages
what else should I do? any ideas?

Does not create / update :(

Hey @yogiben :)

This project is awesome ๐Ÿ‘ , discovering it made me create a small project that I have called Pillars that uses your project as an admin tool to bootstrap my meteor projects.

Yet, it does not work as intended for now, and I do not understand why : creating a Notification or a Story in Pillars from admin just does not work (with no error) and updating one does not work either.

Any idea ?

Collections in grouper object

I usually group my collections in an object:

Collections = {
  Posts: new Mongo.Collection("posts")
};

This doesn't seem to be supported since you use the property name as the collection. Maybe just allow an override:

collections: {
  Posts: {
    collectionObject: Collections.Posts
  }
}

(Trying out the package on a new project. Will probably submit lots of issues, but I can try to help with PRs when I have time. Seems really good so far.)

can't login?

I added the below to a file as both/app.js

AdminConfig = { 
  collections: { 
    Players: {}, 
    Users: {} 
  } 
}

and did a meteor reset
I am logged in
checked there is a single user created in mongo
u = Meteor.user().profile
Object {name: "Dc Collier"}

but i still get "you need to be an admin to view this page" error message.

iron router to AdminConfig

currently, i'm using the iron-router for routing. my new post route is like this:

    this.route('post_edit', {
      template: 'post_edit',
      path: '/posts/:_id/edit',
      waitOn: function () {
        return [
          coreSubscriptions.subscribe('singlePost', this.params._id),
          coreSubscriptions.subscribe('allUsersAdmin')
        ];
      },
      data: function() {
        return {
          postId: this.params._id,
          post: Posts.findOne(this.params._id)
        };
      },
      fastRender: true
    });

could you please show haw can this be converted to post edit template in AdminConfig?
i mean, how the waitOn and other iron-router api calls can be defined in the new context?

customizing form layout?

the admin tool allows you to customize the table view, but how about the entry/edit form itself?

eg in autoform there are quickfield properties like 'rows' to have a multirow input:

      {{> afQuickField name='summary' rows=6}}

User schema attach

hi, when I have this code that is one example of https://github.com/aldeed/meteor-collection2, fails create user admin and generates this following error, thanks.

Exception while invoking method 'adminCheckAdmin' Error: 0 must be an object
I20141017-12:58:05.411(-3)? at getErrorObject (packages/aldeed:collection2/collection2.js:351)
I20141017-12:58:05.411(-3)? at doValidate (packages/aldeed:collection2/collection2.js:334)
I20141017-12:58:05.411(-3)? at Mongo.Collection.(anonymous function) as update
I20141017-12:58:05.412(-3)? at Object._.extend.updateUserRoles (packages/alanning:roles/roles_common.js:680)
I20141017-12:58:05.412(-3)? at Object.
.extend.addUsersToRoles (packages/alanning:roles/roles_common.js:145)
I20141017-12:58:05.412(-3)? at Meteor.methods.adminCheckAdmin (packages/yogiben:admin/lib/server/methods.coffee:72:11)
I20141017-12:58:05.412(-3)? at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1594)
I20141017-12:58:05.413(-3)? at packages/ddp/livedata_server.js:648
I20141017-12:58:05.413(-3)? at _.extend.withValue (packages/meteor/dynamics_nodejs.js:56)
I20141017-12:58:05.413(-3)? at packages/ddp/livedata_server.js:647
I20141017-12:58:05.414(-3)? Sanitized and reported to the client as: 0 must be an object [400]

Schema = {};

Schema.UserCountry = new SimpleSchema({
name: {
type: String
},
code: {
type: String,
regEx: /^[A-Z]{2}$/
}
});

Schema.UserProfile = new SimpleSchema({
firstName: {
type: String,
regEx: /^[a-zA-Z-]{2,25}$/,
optional: true
},
lastName: {
type: String,
regEx: /^[a-zA-Z]{2,25}$/,
optional: true
},
birthday: {
type: Date,
optional: true
},
gender: {
type: String,
allowedValues: ['Male', 'Female'],
optional: true
},
organization : {
type: String,
regEx: /^[a-z0-9A-z .]{3,30}$/,
optional: true
},
website: {
type: String,
regEx: SimpleSchema.RegEx.Url,
optional: true
},
bio: {
type: String,
optional: true
},
country: {
type: Schema.UserCountry,
optional: true
}
});

Schema.User = new SimpleSchema({
id: {
type: String,
regEx: SimpleSchema.RegEx.Id
},
username: {
type: String,
regEx: /^[a-z0-9A-Z
]{3,15}$/,
optional:true
},
emails: {
type: [Object],
// this must be optional if you also use other login services like facebook,
// but if you use only accounts-password, then it can be required
optional: true
},
"emails.$.address": {
type: String,
regEx: SimpleSchema.RegEx.Email
},
"emails.$.verified": {
type: Boolean
},
createdAt: {
type: Date
},
profile: {
type: Schema.UserProfile,
optional: true
},
services: {
type: Object,
optional: true,
blackbox: true
},
// Add roles to your schema if you use the meteor-roles package.
// Note that when using this package, you must also specify the
// Roles.GLOBAL_GROUP group whenever you add a user to a role.
// Roles.addUsersToRoles(userId, ["admin"], Roles.GLOBAL_GROUP);
// You can't mix and match adding with and without a group since
// you will fail validation in some cases.
roles: {
type: Object,
optional: true,
blackbox: true
}
});

Meteor.users.attachSchema(Schema.User);

new starter: Telescope

i think integrating this package with Telescope whould be a better starter package than the provided one, as many meteor community is familiar with that.
also, maybe @SachaG will be convinced to embrace this package :)

1.0.2 cannot display content

I just pulled the latest 1.0.2 down and now cannot "view all" on any collection, getting the error below.

Exception in defer callback: TypeError: undefined is not a function
    at AdminDashboard.checkAdmin (http://localhost:3000/packages/yogiben_admin.js?d10ebec547c01fdfe8e35979a69aef2356004853:77:17)
    at RouteController.runHooks (http://localhost:3000/packages/iron_router.js?da7f2ac81c3fd9daebf49ce9a6980a54caa1dc17:843:16)
    at http://localhost:3000/packages/iron_router.js?da7f2ac81c3fd9daebf49ce9a6980a54caa1dc17:2302:14
    at Tracker.Computation._compute (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:288:36)
    at new Tracker.Computation (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:206:10)
    at Object.Tracker.autorun (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:476:11)
    at http://localhost:3000/packages/iron_router.js?da7f2ac81c3fd9daebf49ce9a6980a54caa1dc17:2279:12
    at http://localhost:3000/packages/iron_router.js?da7f2ac81c3fd9daebf49ce9a6980a54caa1dc17:2248:21
    at Tracker.Computation._compute (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:288:36)
    at new Tracker.Computation (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:206:10) debug.js:41
2Uncaught TypeError: undefined is not a function AdminDashboard.coffee:17

I rolled back to this commit and things work fine there.

Boolean shows label but no checkbox

Everything is just working out of the box, so I don't think I am doing anything wrong. My boolean type does not show up.

My schema entry for it looks like this

approved: {
    type: Boolean,
    optional: false,
    label: 'Approved and Published'
}

The UI that is rendered shows the checkboxes label string, which is weirdly clickable and it works, but the checkbox itself is hidden. When I inspect the element and move it out of the enclosing div, it appears.

Having written this it might be an issue with autoForm?

When I click in left corner app name, after I have opened a collection to edit data

Exception in template helper: TypeError: Cannot read property 'templates' of undefined
at Object. (http://localhost:8080/packages/yogiben:admin.js?d00160e4f18b9859e40facb612b743ae314e4133:1367:89)
at http://localhost:8080/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:2610:16
at http://localhost:8080/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:1602:16
at Spacebars.call (http://localhost:8080/packages/spacebars.js?fa6d15347dd76a8b1464ca3a0d4605598857db91:169:18)
at Spacebars.mustacheImpl (http://localhost:8080/packages/spacebars.js?fa6d15347dd76a8b1464ca3a0d4605598857db91:106:25)
at Object.Spacebars.dataMustache (http://localhost:8080/packages/spacebars.js?fa6d15347dd76a8b1464ca3a0d4605598857db91:138:39)
at http://localhost:8080/packages/yogiben:admin.js?d00160e4f18b9859e40facb612b743ae314e4133:356:22
at null. (http://localhost:8080/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:2385:44)
at http://localhost:8080/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:1787:16
at Object.Blaze._withCurrentView (http://localhost:8080/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:2017:12) debug.js:41
Exception in template helper: TypeError: Cannot read property 'omitFields' of undefined
at Object. (http://localhost:8080/packages/yogiben:admin.js?d00160e4f18b9859e40facb612b743ae314e4133:1257:108)
at http://localhost:8080/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:2610:16
at http://localhost:8080/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:1602:16
at Object.Spacebars.call (http://localhost:8080/packages/spacebars.js?fa6d15347dd76a8b1464ca3a0d4605598857db91:169:18)
at http://localhost:8080/packages/yogiben:admin.js?d00160e4f18b9859e40facb612b743ae314e4133:381:33
at wrappedArgFunc (http://localhost:8080/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:2538:14)
at null. (http://localhost:8080/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:2365:26)
at http://localhost:8080/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:1787:16
at Object.Blaze._withCurrentView (http://localhost:8080/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:2017:12)
at viewAutorun (http://localhost:8080/packages/blaze.js?5ec4e54b22ab2196bcc772669c0619f71666393e:1786:18)

Question : Advice on package development

Greetings Ben
I am entering the rehlm of package development. I see that have had great success to building packages. I was wondering if you have any advice or tutorials for building meteor packages?

Thank you

Ryan

When opening dashboard get "Cannot read property 'templates' of undefined"

Get a following exception in client console when switching from a list of elements to dashboard (initial load of dashboard is OK):

Exception in template helper: TypeError: Cannot read property 'templates' of undefined
    at Object.<anonymous> (http://localhost:3000/packages/yogiben_admin.js?8b7c89faf3a3c8e1b1a09fc13d10dbf0289fef5d:1436:89)
    at http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:2693:16
    at http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:1602:16
    at Spacebars.call (http://localhost:3000/packages/spacebars.js?3c496d2950151d744a8574297b46d2763a123bdf:169:18)
    at Spacebars.mustacheImpl (http://localhost:3000/packages/spacebars.js?3c496d2950151d744a8574297b46d2763a123bdf:106:25)
    at Object.Spacebars.dataMustache (http://localhost:3000/packages/spacebars.js?3c496d2950151d744a8574297b46d2763a123bdf:138:39)
    at http://localhost:3000/packages/yogiben_admin.js?8b7c89faf3a3c8e1b1a09fc13d10dbf0289fef5d:411:22
    at null.<anonymous> (http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:2454:44)
    at http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:1795:16
    at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:2029:12)

At that line we have:

if collection.toLowerCase() != 'users' && typeof AdminConfig.collections[collection].templates != 'undefined'

And collection variable at this moment equals empty string ('').

how to include nested field data in the table view?

I have a document like:

UserGames: 

{
     "_id" : "yLfGZX94ReGSTkk5q",
     "result" : {
        "duration" : 20,
        "won" : true
    }
},
...

I want to show the "won" on the table view, for a type of summary.
is there a way to do this?

I tried:

    UserGames: {
      tableColumns: [
        {label: 'won', name: 'result.won'}
      ]
    }

but nothing shows up.
if i leave it as "result" then [Object] is displayed.

I believe I've got the method correct to define the nested SimpleSchema, as it is inserting data into the DB without complaining...

ResultSchema = new SimpleSchema
  won:
    type: Boolean
  duration:
    type: Number

UserGames.schema = new SimpleSchema
  result:
    type: ResultSchema
    optional: true

Datepicker issue

Fields that are define as dates should open a "Datetime" picker on the Admin panel

Car = new SimpleSchema({
adquiredAt: {
type: Date
}
});

examples with more structured documents?

I guess simpleschema/autoform will support more complex nested documents. do you have examples / have you tried this with your admin? eg having an array field?

naming?

not a bug per se, discussion:
maybe a more unique name would be good for this project too? i'm calling it "yogiben-admin" but maybe "tiles-admin" or sth to do with the striking design?

Cannot create first admin user

Hi,

I have created a JS file on the root containing

AdminConfig = {
  collections: {
    Posts: {}
  }
};

but when visiting /admin always getting You need to be an admin to view this page

Set adminEmail in settings.json

I want to be able to set the adminEmails property of the adminDashboard object in a settings.json file and it work the same was as setting it in the AdminConfig.

This action should be done in the Meteor.startup funciton

FR - sorting

I saw some code related to using a sortable table for display? are you planning to/have implemented this? ie clicking a column to sort the table output. lots of packages in normal JS world, but not sure the best one for meteor.


if you don't mind, i'm going to add some Feature Requests (FRs). feel free to tag/close/comment.
If you can let me know if these exist already, otherwise I may take some of these tickets and send PRs.

upgrade autoform etc...

my project has autoform/collection2 installed, installing meteor-admin downgraded my packages:

$ meteor add yogiben:admin
Refreshing package metadata. This may take a moment.
Figuring out the best package versions to use. This may take a moment.
  downloading raix:handlebar-helpers at version 0.1.2 ...  done
  downloading yogiben:admin at version 0.9.5 ...  done
  downloading alanning:roles at version 1.2.12 ...  done
  added raix:handlebar-helpers at version 0.1.2
  upgraded aldeed:autoform from version 2.0.2 to version 0.17.1
  upgraded aldeed:collection2 from version 2.1.0 to version 0.4.6
  added yogiben:admin at version 0.9.5
  upgraded aldeed:simple-schema from version 1.0.3 to version 0.7.0
  added alanning:roles at version 1.2.12

Version without bootstrap

Hey, I don't really want to import bootstrap as well in my application.
Would it be possible to make a version without bootstrap as dependency?

How to use object in tableColumns in config file

Example: like i have a document of collections
User
{
"currency":"usd",
"symbol":{"yahoo":"usd-y"}
}

Now i want to add in column in tableColumns:
{label: 'Currency', name: 'currency'},
{label: 'Symbol', name:"symbol.yahoo"}

== symbol.yahoo not showing any result or information.
Can you please tell me how can use this.

Thanks in advance

allowedValues from a collection

Hi,

Is there a way to define allowedValues from a mongo query?
something like that:

...
group: {
        type: Schemas.Groups,
        optional: true,
        allowedValues: Groups.find({},{fields:{_id:0}}).fetch()
    }
...

I've added

    auxCollections: ['Groups'],

to the main config, but when I get to the editing panel, the dropdown menu is empty..

Question : Changing user roles in meteor-admin

Hi Ben
This may be a very simple thing to do. What is the easiest way to add new roles to the admin panel for a user. For instance instead of just the admin role I would like to add maybe a clients role.

Question: How to add a profile image.

How exactly do you add a profile image. I can see in the form where you have the option to add the image but there is no button that allows you to add the image.

Support fields for autoform

In addition to omitFields, should support fields for autoform since that would be the easiest way to specify a certain override order for the fields, without needing to do a custom template.

FR: way to imply relations

(this maybe more an autoform issue?)

it would be great to have a way to create links for relations / related docs.
eg if i'm looking at a list of Players , and one field is "inventory"
clicking on the entry would load the relevant record, eg

/admin/Players/ -> links to
/admin/Inventory?player=123

FR filters

currently the table view shows everything. I assume you may add paging?
but a really neat feature would be if we could add filters

even without the UI just adding a filter string to the URL and picking that up would be useful.

http://localhost:3000/admin/Users
# shows all

http://localhost:3000/admin/Users?admin=1
# just show admin users

http://localhost:3000/admin/Users?email=x@y.com
# acts as a search feature

I can understand that with your highly configurable admin doing the abstracted UI would be some work, but other pages in the app could simply expose these type of links to allow a direct jump to the filtered view. eg:

http://localhost:3000/admin/Players?level=3

and we can add the proper UI touches later.

adding roles to a user

you can toggle to remove admin, but it seems the functionality to add an admin role to a user doesn't work, unless i'm missing something obvious?

image

image

^^ no roles to click

Question: How to customize the admin panel

Is it possible to customize the admin panel and site bar. For instance I am using the package to build a ticketing system. I would like to create a widget that has the current time remaining on the project. When the user clicks on the page I would like to take them to a custom area where they would See a list of projects that they can edit and add comments via the admin panel.

Outdated dependencies with forced versions causing problems with Meteor 1.0

When attempting to install this package in an application that already uses the most up to date versions of it's dependencies Meteor is unable to negotiate versions. All meteor operations hang after installing due to this for me and other developers working on the app.

Removing admin completely resolves the issue until it can be updated though, not ideal of course :)

auth with facebook login?

Is there anyway to set a different auth property than email?

I'm using facebook to authenticate users (inc admins)
if we could use profile.id or similar?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.