yogiben / meteor-admin

A complete admin dashboard solution
https://atmospherejs.com/yogiben/admin
GNU General Public License v3.0
827 stars 261 forks source link

router pathFor problem #317

Closed JackyXiong closed 8 years ago

JackyXiong commented 8 years ago

I run meteor-starter, in admin/Post page ,I got a warning message,

pathFor couldn't find a route named "adminDashboardNew"

It cause add one button is not work. And I check the meteor adminsource code.

In /lib/client/js/templates.coffee, code is this:

Template.AdminDashboardView.helpers
    hasDocuments: ->
        AdminCollectionsCount.findOne({collection: Session.get 'admin_collection_name'})?.count > 0
    newPath: ->
        Router.path 'adminDashboard' + Session.get('admin_collection_name') + 'New'

But i find the JavaScript file in .meteor/local/build/programs/web.browser/packages/yogiben_admin.js, there is no newPath function in in AdminDashboardView.helpers.

Template.AdminDashboardView.helpers({
  hasDocuments: function() {
    var _ref;
    return ((_ref = AdminCollectionsCount.findOne({
      collection: Session.get('admin_collection_name')
    })) != null ? _ref.count : void 0) > 0;
  }
});

Why this happened?

snamoah commented 8 years ago

@JackyXiong do you have a collection called Post or Posts?

JackyXiong commented 8 years ago

@snamoah yes, I had Post colletion. And I can open the admin/Post page, but in this page, when Iron-router parse route , it's failed.

snamoah commented 8 years ago

@JackyXiong this page is supposed to be a views page and if the error is coming from the newPath helper then it means that Session.get("admin_collection_name") is not being set and hence resulting in a route name adminDashboardNew instead of adminDashboardPostNew as to why... I'd need more info now how you're creating the posts in the adminConfig file

JackyXiong commented 8 years ago

@snamoah I found my problem. My meteor-admin version is 1.2.0. This version has a bug, the newPath is not provided but used in template AdminDashboardView.So this happened. Thank you very much.

snamoah commented 8 years ago

@JackyXiong great! thanks for sharing your solution