10 回中 9 回は正しくレンダリングされているテンプレートがありますが、そうでない場合もあり、表示されません。ログにエラー メッセージが記録されていないようですが、これをデバッグするにはどうすればよいですか? どうなり得るか?
メイン テンプレート (application.hbs) は次のように構築されます。
<div class="row-fluid">
<div class="span12 page_top_header base_color_background"></div>
</div>
<div class="container-fluid">
<div class="row-fluid header_container">
<!-- Logo -->
<!-- Menu -->
</div>
</div>
<!-- Line Divider -->
<div class="row-fluid ">
<div class="span12 page_top_header line-divider"></div>
</div>
</div>
{{outlet}}
{{render footer}}
フッター自体は主にテキストで、コントローラーにはいくつかの小道具があり、派手なものは何もありません。次のログがあります。
App = Ember.Application.create({
LOG_TRANSITIONS: true,
LOG_VIEW_LOOKUPS: true,
LOG_ACTIVE_GENERATION: true,
LOG_BINDINGS: true,
currentUser: null
});
どんな提案でも大歓迎です。
編集
アプリケーションコントローラーとルーター:
App.ApplicationController = Ember.Controller.extend({
needs: ['currentUser'],
init: function() {
'use strict';
this._super();
$.pnotify.defaults.history = false;
$.pnotify.defaults.delay = 5000;
},
logout: function() {
'use strict';
var self = this;
$.ajax({
url: '/users/sign_out.json',
type: 'DELETE',
success: function(){
$.pnotify({type: 'success', title: 'Afmelden', text: 'U ben succesvol afgemeld.'});
self.set('controllers.currentUser.content', null);
self.transitionToRoute('index');
window.location.href = window.location.href;
window.location.reload();
}
});
}
});
App.ApplicationRoute = Ember.Route.extend({
beforeModel: function() {
var attributes = $('meta[name="current-user"]').attr('content');
if (attributes) {
var user = App.User.create().setProperties(JSON.parse(attributes));
this.controllerFor('currentUser').set('content', user);
}
}
});