Instantly share code, notes, and snippets.

Embed
What would you like to do?
Marionette View Swapping Test
define(function (require) {
var Room_View = require('views/Room_Backbone');
//var Room_View = require('views/Room_Marionette');
var App_Layout = Marionette.Layout.extend({
template: app_template_compiled,
regions: {
menu: "#menu",
content: "#content_container"
},
initialize: function() {
App.on('show_room', function(room_to_display) {
var new_room = new Room_View({
model: room_to_display
});
layout.content.show(new_room);
});
}
});
var layout = new App_Layout();
});
<h2>{{title}} is inSync!</h2>
<table>
{{#each users}}
<tr>
<td>{{name}}</td>
</tr>
{{/each}}
</table>
<% if (typeof(title) !== 'undefined') { %>
<h2><%= title %> is inSync!</h2>
<% } %>
<table>
<% _.each(users, function(user) { %>
<tr>
<td><%= user.name %></td>
</tr>
<% }); %>
</table>
h2 #{title} is inSync!
table
each user in users
tr
td= user.name
define(function (require) {
'use strict';
var Room_Underscore = _.template(require('text!templates/room.html')),
Room_HBS = require('hbs!templates/room'),
Room_Jade = require('jade!templates/room');
return Backbone.View.extend({
id: 'content',
render: function () {
this.$el.append(Room_Underscore(this.model.attributes));
}
});
});
define(function (require) {
'use strict';
var Room_Underscore = _.template(require('text!templates/room.html')),
Room_HBS = require('hbs!templates/room'),
Room_Jade = require('jade!templates/room');
return Marionette.ItemView.extend({
id: 'content',
template: Room_Underscore
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment