having some trouble getting my ember routing to work, and I'm a bit confused if I am doing it right. Seems like there has been quite a few changes to this part, which can be a bit confusing. I hope someone can help me see what is going wrong here.
refset.sparklingideas.co.uk:8000
Cloned Ember App Kit on Nov. 20th, 2013
Ember : 1.2.0-beta.4
Ember Data : 1.0.0-beta.2
Handlebars : 1.1.2
Query : 1.9.1
Node : v0.10.21
Chrome : 31.0.1650.16 beta
OS X : Maverick
All source code is available here:
https://github.com/sparkling/snomed-refset
Sorry, no luck in getting it hosted yet, but I do have screenshots to illustrate:
http://goo.gl/DGBSvf
I am having two problems with my current configuration.
When clicking on a link-to to return to the main screen (/, "refsets"), the contents of the child screen (/:publicid) gets prepended to the bottom of the main screen. This keeps stacking up as you navigate back and forth.
When clicking on the link-to for the buttons "show rules" or "show concepts", the screen goes blank, and ember returns this cryptic error (other custom and ember logging details provided, too):
Loading concepts in router ember.js:3227
GETing concepts for: {...} ember.js:3227
Rendering refset.concepts with default view <appkit@view:default::ember404>
Object {fullName: "view:refset.concepts"} ember.js:3227
Transitioned into 'refset.concepts' ember.js:3227
Uncaught TypeError: Cannot read property 'parentNode' of null ember.js:24102
Assertion failed: Emptying a view in the inBuffer state is not allowed and
should not happen under normal circumstances. Most likely there is a bug
in your application. This may be due to excessive property change notifications.
ember.js:3227
Uncaught Error: You cannot modify child views while in the inBuffer state
ember.js:22892
These problematic 'link-to' statements are located:
Source can be found at link above, and also copied in below.
var Router = Ember.Router.extend();
Router.map(function() {
this.resource('refsets', {path:'/'});
this.resource('create', {path:'/create'}, function(){});
this.resource('refset', {path:'/:publicId'}, function(){
this.route('concepts', {path:'/'});
this.route('plan', {path:'plan'});
});
});
Router.reopen({
location: 'history'
});
export default Router;
<secion id="concepts">
<h2>Concepts
{{#link-to 'refset.plan' refset}}<button class="toggle btn btn-sm btn-default">Show Rules</button>{{/link-to}}
</h2>
<table id="forums" class="table table-striped">
<thead>
<th>Title</th>
<th>Id</th>
<th>Effective on</th>
<thead>
<tbody>
{{#each concept in controller}}
<tr>
<td><a {{bind-attr href=concept.href}} target="_blank">{{concept.title}}</a></td>
<td>{{concept.id}}</td>
<td>{{date-format concept.effectiveTime}}</td>
</tr>
{{/each}}
</tbody>
</table>
</section>^0k334q5PK3Wcn#p^4CS#
<secion id="plan">
<h2>Plan
{{#link-to 'refset.concepts' refset}}<button class="toggle btn btn-sm btn-default">Show Concepts</button>{{/link-to}}
</h2>
<ul class="list-group">
{{#each rule in rules}}
<li class="list-group-item">
{{show-rule rule}}
</li>
{{/each}}
</ul>
<div class="terminal">Terminal: {{terminal}}</div>
</section>
<ol class="breadcrumb">
<li>{{#link-to 'refsets'}}Refsets{{/link-to}}</li>
<li class="active">{{title}}</li>
</ol>
<h1>{{title}}</h1>
<section id="details">
{{outlet details}}
<section id="details">
export default Ember.ArrayController.extend({
conceptsResponse: 'concepts-response-not-set',
needs: "refset",
refset: Ember.computed.alias("controllers.refset.model")
});
export default Ember.ObjectController.extend({
planResponse: 'plan-response-not-set',
needs: "refset",
refset: Ember.computed.alias("controllers.refset")
});
export default Ember.ObjectController.extend({});
import Refset from 'appkit/models/refset';
export default Ember.Route.extend({
model: function() {
Ember.Logger.log('Loading concepts in router');
return Refset.getConcepts(this.modelFor('refset'), this);
},
renderTemplate: function(){
this.render({outlet:'details'});
}
});
import Refset from 'appkit/models/refset';
export default Ember.Route.extend({
model: function() {
Ember.Logger.log('Loading plan in router');
return Refset.getPlan(this.modelFor('refset'), this);
},
renderTemplate: function(){
this.render({outlet:'details'});
}
});
import Refset from 'appkit/models/refset';
export default Ember.Route.extend({
model: function(args) {
return Refset.loadRefset(args.publicId, this);
}
});
{
"id":25,
"terminal":67,
"rules":[
{
"id":65,
"type":"LIST",
"left":null,
"right":null,
"concepts":[
{
"id":321987003,
"title":"Citalopram 20mg tablet (product)",
"active":false,
"effectiveTime":0
},
{
"id":441519008,
"title":"Contusion of infraorbital nerve (disorder)",
"active":false,
"effectiveTime":0
},
{
"id":17783003,
"title":"Car sickness (finding)",
"active":false,
"effectiveTime":0
},
{
"id":128665000,
"title":"Pituitary carcinoma (morphologic abnormality)",
"active":false,
"effectiveTime":0
}
]
},
{
"id":66,
"type":"LIST",
"left":null,
"right":null,
"concepts":[
{
"id":254597002,
"title":"Oleogranuloma of intestine (disorder)",
"active":false,
"effectiveTime":0
},
{
"id":412398008,
"title":"Griseofulvin microsize (product)",
"active":false,
"effectiveTime":0
},
{
"id":118831003,
"title":"Procedure on intestine (procedure)",
"active":false,
"effectiveTime":0
}
]
},
{
"id":67,
"type":"UNION",
"left":65,
"right":66,
"concepts":[
]
}
]
}
{
"concepts":[
{
"id":321987003,
"href":"http://browser.snomedtools.com/version/1/concept/xml/321987003",
"serialisedId":0,
"title":"Citalopram 20mg tablet (product)",
"effectiveTime":20020131,
"active":true
},
{
"id":441519008,
"href":"http://browser.snomedtools.com/version/1/concept/xml/441519008",
"serialisedId":0,
"title":"Contusion of infraorbital nerve (disorder)",
"effectiveTime":20090731,
"active":true
},
{
"id":17783003,
"href":"http://browser.snomedtools.com/version/1/concept/xml/17783003",
"serialisedId":0,
"title":"Car sickness (finding)",
"effectiveTime":20020131,
"active":true
},
{
"id":128665000,
"href":"http://browser.snomedtools.com/version/1/concept/xml/128665000",
"serialisedId":0,
"title":"Pituitary carcinoma (morphologic abnormality)",
"effectiveTime":20020131,
"active":true
},
{
"id":254597002,
"href":"http://browser.snomedtools.com/version/1/concept/xml/254597002",
"serialisedId":0,
"title":"Oleogranuloma of intestine (disorder)",
"effectiveTime":20020131,
"active":true
},
{
"id":412398008,
"href":"http://browser.snomedtools.com/version/1/concept/xml/412398008",
"serialisedId":0,
"title":"Griseofulvin microsize (product)",
"effectiveTime":20040731,
"active":true
},
{
"id":118831003,
"href":"http://browser.snomedtools.com/version/1/concept/xml/118831003",
"serialisedId":0,
"title":"Procedure on intestine (procedure)",
"effectiveTime":20020131,
"active":true
}
]
}
[
{
"id":41,
"concept":{
"id":2189000,
"href":"http://browser.snomedtools.com/version/1/concept/xml/2189000",
"serialisedId":0,
"title":"Hemoglobin F-Dammam (substance)",
"effectiveTime":20020131,
"active":true
},
"publicId":"ffff",
"title":"fffff",
"description":"ffffff",
"created":"2013-11-24",
"lastModified":"2013-11-24"
},
{
"id":44,
"concept":{
"id":27089009,
"href":"http://browser.snomedtools.com/version/1/concept/xml/27089009",
"serialisedId":0,
"title":"Blood group antibody Ce (substance)",
"effectiveTime":20020131,
"active":true
},
"publicId":"qqqqqqqqqqq",
"title":"qqqqqqq",
"description":"qqqqqqq",
"created":"2013-11-25",
"lastModified":"2013-11-25"
},
{
"id":23,
"concept":{
"id":21304000,
"href":"http://browser.snomedtools.com/version/1/concept/xml/21304000",
"serialisedId":0,
"title":"Hemoglobin A,c (substance)",
"effectiveTime":20020131,
"active":false
},
"publicId":"sdsdawaesf",
"title":"sdsdsdsd",
"description":"sdsdsdsd",
"created":"2013-10-10",
"lastModified":"2013-10-10"
},
{
"id":21,
"concept":{
"id":2156000,
"href":"http://browser.snomedtools.com/version/1/concept/xml/2156000",
"serialisedId":0,
"title":"Glial cell (cell)",
"effectiveTime":20020131,
"active":true
},
"publicId":"heyho",
"title":"This is a sample refset",
"description":"and I am a sample description",
"created":"2013-10-09",
"lastModified":"2013-10-09"
}
]
export default Ember.Handlebars.makeBoundHelper(function(rule) {
if (rule.get('type') === 'LIST'){
return new window.Handlebars.SafeString("<span style=\"color: lightgrey\">" + rule.get('id') + "</span> <strong>List</strong> <span style=\"padding-left: 0.5em;color:grey\">[" + rule.get('concepts').length + "]</span>");
}
else if (rule.get('type') === 'UNION'){
return new window.Handlebars.SafeString("<span style=\"color: lightgrey\">" + rule.get('id') + "</span> <strong></strong>Rule " + rule.get('left') + " <strong>Union</strong> Rule " + rule.get('right'));
}
else if (rule.get('type') === 'DIFFERENCE'){
return new window.Handlebars.SafeString("<span style=\"color: lightgrey\">" + rule.get('id') + "</span> <strong></strong>Rule " + rule.get('left') + " <strong>Difference</strong> Rule " + rule.get('right'));
}
else if (rule.get('type') === 'SYMMETRIC'){
return new window.Handlebars.SafeString("<span style=\"color: lightgrey\">" + rule.get('id') + "</span> <strong></strong>Rule " + rule.get('left') + " <strong>Symmetric Difference</strong> Rule " + rule.get('right'));
}
else if (rule.get('type') === 'INTERSECTION'){
return new window.Handlebars.SafeString("<span style=\"color: lightgrey\">" + rule.get('id') + "</span> <strong></strong>Rule " + rule.get('left') + " <strong>Intersection</strong> Rule " + rule.get('right'));
}
});
Most of the times I see this it's related to invalid HTML, mismatched divs/sections etc.
<section id="details">
{{outlet details}}
<section id="details">
should be
<section id="details">
{{outlet details}}
</section>
And in the plan.hbs section
is misspelled as secion
.
Additionally using the / as the concepts path seems to be confusing ember, it thinks that the url with the / at the end is still just refset (not concepts)
Router.map(function() {
this.resource('refsets', {path:'/'});
this.resource('create', {path:'/create'}, function(){});
this.resource('refset', {path:'/:publicId'}, function(){
this.route('concepts', {path:'concepts'});
this.route('plan', {path:'plan'});
});
});