Commit 8783862c authored by Bertrand PINEL's avatar Bertrand PINEL

Add a detail page for displaying the bottle of a rack

parent 4499deba
......@@ -8,6 +8,7 @@ rackTableColumns: Ember.computed(function() {
Ember.Object.create({
propertyName: "name",
title: "Name",
routeName: "rack"
}),
Ember.Object.create({
propertyName: 'nbColumns',
......
......@@ -8,6 +8,7 @@ const Router = Ember.Router.extend({
Router.map(function() {
this.route('racks');
this.route('rack', { path: '/rack/:rack_id' });
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
let pid = params.rack_id;
let rack = this.store.peekRecord('rack', pid);
if (rack == null) {
this.transitionTo('racks');
} else {
return rack;
}
}
});
<div class="col-md-12 phase-container">
<h4><strong>Rack Name:</strong> {{model.name}} ({{model.nbRows}} rows by {{model.nbColumns}} columns)</h4>
<ul>
{{#each model.bottles as |bottle|}}
<li>{{bottle.name}} : row {{bottle.yrow}}, column {{bottle.xcolumn}}</li>
{{/each}}
</ul>
{{outlet}}
</div>
import { moduleFor, test } from 'ember-qunit';
moduleFor('route:rack', 'Unit | Route | rack', {
// Specify the other units that are required for this test.
// needs: ['controller:foo']
});
test('it exists', function(assert) {
let route = this.subject();
assert.ok(route);
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment