yogiben / meteor-admin

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

Admin Config... Example not Clear #384

Closed kenshinman closed 6 years ago

kenshinman commented 7 years ago

Hi, this is not meant to be an issue but I need help with this piece (config example) of code from the documentation:

    @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)

I may be worng but I don't it's in a JavaScript format or not formatted properly.

Can someone help me format it to look like JS,. I wrote earlier I may be wrong but i need a clearer version. Thanks Guys

Also, Is this meant to be in the server directory or client

Fotso commented 7 years ago

Hi, this question have been answered many times... This script is a coffee script. If you want a Javascript file just used an online converter. Then once you have it, create a lib directory and put your script under this directory your_project_name/lib/AdminConfig.js