2.1.7 • Published 8 months ago

meteor-smart-router v2.1.7

Weekly downloads
2
License
MIT
Repository
github
Last release
8 months ago

This is a Meteor FlowRouter helper which allows setting up routes with less boilerplate. Basically, the routes are being prepared as a set of properties.

Still much to do.

Should be called before all other files to ensure that our custom routes (e.g. signup) have a priority over useraccounts

ROUTE SETTINGS

  • layout (optional) - the layout to use
  • main - the template to use for main slot
  • top - template to put in top slot of the layout
  • left - template to put in left slot of the layout

ROUTE INHERITANCE

Route can be marked as a child of another route, by using a "parent" field. Currently this only affects a page title generation.

DYNAMIC TEMPLATES

Route can load template dynamically, thus allowing other pages load faster. This is being done using Meteor dynamic module loading.

To have route template load dynamically, add the following function to route:

dynamicTemplate: () =>
	{ return import("/imports/ui/pages/maintenance/code.js") },

This makes template module dynamic, and its code will load only on actual route request.

Important: as of 1.5.2, Meteor requires to see an IMPICIT module load directive "import('/import/...../code.js')" in the code. Thus, "dynamicTemplate" have to stay a function with an implicit code inside.

PAGE BODY CLASSES

To allow styling individual pages, router automatically ads the class named according to the page route, e.g.: page-index, page-new-message

This class is being added on route render and removed just before the new route is being rendered.

Also, to (possibly) notify user about page loading, router adds "routers-switching" class to the body while new route is loading.

Custom body classes

The custom body classes can be set for the specific route or the whole website. Set route.bodyClass, defaultSet.bodyClass to string or array of strings.

PAGE TITLE

Page title is being constructed using the following parts:

  1. session.get("document.title")
  2. current route "title" value
  3. the value of the "parent" route (see ROUTE INHERITANCE)
  4. the default title

These values are being joined with " - ".

TODO

  1. Add redirectIfLogged support (it is being used somewhere)
2.1.1

8 months ago

2.1.7

8 months ago

2.1.0

8 months ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.0.9

5 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago