Last active
August 29, 2015 13:56
-
-
Save AllenSH12/9266730 to your computer and use it in GitHub Desktop.
Marionette View Swapping Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if (typeof(title) !== 'undefined') { %> | |
<h2><%= title %> is inSync!</h2> | |
<% } %> | |
<table> | |
<% _.each(users, function(user) { %> | |
<tr> | |
<td><%= user.name %></td> | |
</tr> | |
<% }); %> | |
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h2 #{title} is inSync! | |
table | |
each user in users | |
tr | |
td= user.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | |
} | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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