Where to put a separate admin interface for a Meteor app?

后端 未结 6 2172
时光说笑
时光说笑 2021-02-14 08:56

I\'m trying to build a smart package for Meteor app that provides some monitoring capabilities and other tools based on the features of the smart package. For more details read

6条回答
  •  滥情空心
    2021-02-14 09:48

    Isn't this doable by simply using Meteor router and template helpers:

    Specify your routes:

    Meteor.Router.add({
        '/foo'  : 'foo',
        '/admin': 'admin'
    });
    

    Let's say you have a 3 column layout. Create your template like this:

    
    

    Then specify your template helpers:

    Template.body.helpers({
      LeftLayoutName: function() {
        switch (Meteor.Router.page()) {
          case 'foo':
            return 'foo_left';
          case 'admin':
            return 'admin_left';
        }
      },
      MiddleLayoutName: function() {
        switch (Meteor.Router.page()) {
          case 'foo':
            return 'foo_middle';
          case 'admin':
            return 'admin_middle';
        }
      },
      RightLayoutName: function() {
        switch (Meteor.Router.page()) {
          case 'foo':
            return 'foo_right';
          case 'admin':
            return 'admin_right';
        }
      }
    });
    

提交回复
热议问题