Skip to content

Instantly share code, notes, and snippets.

View sagar-ganatra's full-sized avatar

Sagar Ganatra sagar-ganatra

View GitHub Profile
page.base('/backbone-router');
page('/', loadPage);
page('/orders', loadPage, triggerPageChangeEvent);
page('/customers', loadPage, triggerPageChangeEvent);
page('/search', loadPage, triggerPageChangeEvent);
page('*', notFound);
<script src="config.js"></script>
<script data-main="main" src="vendor/require.min.js"></script>
<!--(if target dist)>
<script>
require.config({
urlArgs: '{{bustVersion}}'
});
</script>
<!(endif)-->
targethtml: {
dist: {
options: {
curlyTags: {
bustVersion: '<%= grunt.template.today("yyyymmdd") %>'
}
},
files: {
'dist/index.html': 'dev/index.html'
'.js-timezoneSelect': {
observe: 'timezone',
selectOptions: {
collection: Repository.getTimezoneCollection(),
labelPath: 'timeZoneName',
valuePath: 'timeZoneId',
defaultOption: {
label: 'Select One',
bindings: {
'.js-adminConsole': {
observe : 'message',
visible : function () {
return this.user.type = 'admin';
},
bindings: {
'.js-startDate': {
observe : 'startDate',
onGet : function (value) {
return Formatter.convertToDDMMYYYY(value);
},
events: {
'keyup .js-full-name' : 'updateFullName'
}
updateFullName: function() {
this.model.set('fullName', this.$el.find('.js-full-name'));
}
bindings: {
'.js-full-name' : 'fullName',
'.js-address-line-1' : 'addressLine1',
'.js-address-line-2' : 'addressLine2',
'.js-city' : 'city',
initialize: function() {
this.listenTo(this.model, 'change:modelAttribute', this.updateView);
}
fetch: function (options) {
options.reset = true;
return Backbone.Collection.prototype.fetch.call(this, options);
}