ember-frost-navigation
Dependencies
Health
Security
Ember Observer score
Navigation made easy. Makes use of liquid fire and the RouterDSL
prototype to make a clean and concise way of
creating, and navigating routes.
Also supports ember-engines
Installation
ember install ember-frost-navigation
Usage
Add the {{frost-navigation}}
component to the template where you want the navigation to appear, then configure
your navigation in app/router.js
Template
{{frost-navigation logo=(component ...) menu=(component ...) navActions=(hash myAction=(action 'custom-action') )}}
Router (Full Example)
Router
Documentation
this.nav
/** * Initializes the navigation bar * @parent Ember.RouterDSL * @param * @param * @param */
this.category
/** * Category as a navigation bar entry * @parent {type:nav} * @param * @param * @param */
this.column
/** * Creates a column viewable within a category * @parent {type:category} * @param * @param * @param */
this.section
/** * Creates a section under within a category * @parent {type:category} * @param * @param * @param */
this.app
/** * Creates a routable route instance * @parent {type:[column, section]} * @param * @param * @param * @param * @param */
this.engine
/** * Creates a routable engine instance * @parent {type:[column, section]} * @param * @param * @param * @param * @param * @param */
this.action
/** * Creates a menu item that serves as an action, * without performing a transition * @parent {type:[column, section]} * @param * @param * @param * @param * @param */
this.link
/** * Creates a link accessible from frost-navigation * @parent {type:[column, section]} * @param * @param * @param * @param * @param * @param */
CSS
The following CSS classes are defined by this addon to make it easier to layout a page using frost-navigation
:
frost-application
: This class should be applied to, the parent of thefrost-navigation
element.frost-application-content
: This class should be applied to the element below thefrost-navigation
element. It will ensure that that element takes up all the space below the navigation.
<div class='frost-application'> {{frost-navigation ...}} <div class='frost-application-content'> <!-- the rest of your page here --> </div></div>
User menu
An example of a user-menu is defined in the dummy app at tests/dummy/app/pods/components/user-menu
There are also
a couple classes defined in this addon that will format your own user-menu properly:
frost-navigation-user
for the actual user menu buttonfrost-navigation-user-menu
for the popover menu that is expanded when clicking on the above buttonfrost-navigation-user-menu-list
for the<ul>
that holds the list items of the user menu
ember-hook
Testing withThe navigation component is accessible using ember-hook with the top level hook names, or you can access the internal components as well -
Property | Hook |
---|---|
top level hook | $hook('frost-nav') |
modal hook | $hook('frost-nav-modal') |
category hook | $hook('frost-nav-category-<index>') |
section / column hook | $hook('frost-nav-modal-section-<index>') |
section actions hook| $hook('frost-nav-modal-section-actions')` |
|
inline action from section context | $hook('frost-nav-modal-section-<sectionIndex>-action-<actionIndex>') |
route hook | $hook('frost-nav-modal-section-<sectionIndex>-route-<routeIndex>') |
frost-link within the route / action context | $hook('frost-nav-modal-section-<sectionIndex>-(route / action)-<index>-link') |
action from section actions context | $hook('frost-nav-modal-section-actions-<index>') |
Setup
git clone git@github.com:ciena-frost/ember-frost-navigation.git
cd ember-frost-navigation
npm install && bower install
Development Server
A dummy application for development is available under ember-frost-navigation/tests/dummy
.
To run the server run ember server
(or npm start
) from the root of the repository and
visit the app at http://localhost:4200.
Testing
Run npm test
from the root of the project to run linting checks as well as execute the test suite
and output code coverage.