Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can do something like this: (using my derived <a href="https://github.com/pjlammertyn/ember-bootstrap/blob/master/packages/ember-bootstrap/lib/views/tabs.js" rel="nofollow">Bootstrap.Tabs</a> implementation)</p> <pre><code>{{#view Bootstrap.TabContainerView currentView="patient"}} &lt;ul class="nav nav-tabs"&gt; {{#view Bootstrap.TabView value="patient"}}&lt;a&gt;Patient&lt;/a&gt;{{/view}} {{#view Bootstrap.TabView value="visits"}}&lt;a&gt;Visits&lt;/a&gt;{{/view}} {{#view Bootstrap.TabView value="contacts"}}&lt;a&gt;Contacts&lt;/a&gt;{{/view}} {{#view Bootstrap.TabView value="sessions"}}&lt;a&gt;Sessions&lt;/a&gt;{{/view}} &lt;/ul&gt; {{#view Bootstrap.TabPaneView viewName="patient"}} {{render "patient"}} {{/view}} {{#view Bootstrap.TabPaneView viewName="visits"}} {{render "visits"}} {{/view}} {{#view Bootstrap.TabPaneView viewName="contacts"}} {{render "contacts"}} {{/view}} {{#view Bootstrap.TabPaneView viewName="sessions"}} {{render "sessions"}} {{/view}} {{/view}} </code></pre> <p>or using the router:</p> <pre><code>&lt;ul class="nav nav-tabs"&gt; {{#view Bootstrap.TabItem item="patient"}} {{#linkTo "tab.patient" content}}Patient{{/linkTo}} {{/view}} {{#view Bootstrap.TabItem item="visits"}} {{#linkTo "tab.visits" content}}Visits{{/linkTo}} {{/view}} {{#view Bootstrap.TabItem item="contacts"}} {{#linkTo "tab.contacts" content}}Contacts{{/linkTo}} {{/view}} {{#view Bootstrap.TabItem item="sessions"}} {{#linkTo "tab.sessions" content}}Sessions{{/linkTo}} {{/view}} &lt;/ul&gt; {{outlet}} </code></pre> <p>the magic is done by the Bootstrap.TabItem, it gets the active state from the linkTo helper</p> <pre><code>Bootstrap.TabItem = Ember.View.extend({ tagName: 'li', classNameBindings: ['active'], activeChanged: function () { var self = this; Ember.run.next(this, function () { //delay if (!self.isDestroyed) { self.set('active', self.get('childViews.firstObject.active')); } }); }.observes('childViews.firstObject.active') //get the active state from the linkTo helper }); </code></pre> <p>now you only need a router, something like this:</p> <pre><code>App.Router.map(function (match) { ... this.resource('tab', { path: '/tab' }, function () { this.route('patient'); this.route('visits'); this.route('contacts'); this.route('sessions'); }); ... }); </code></pre> <p>a jsFiddle might help</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload