Commit 41208c92 by Andy Armstrong

Convert to RequireJS text for templates

parent 16890041
define(["underscore", "js/views/baseview"], function(_, BaseView) {
define(["underscore", "backbone", "text!common/templates/components/paging-footer.underscore"],
function(_, Backbone, paging_footer_template) {
var PagingFooter = BaseView.extend({
var PagingFooter = Backbone.View.extend({
events : {
"click .next-page-link": "nextPage",
"click .previous-page-link": "previousPage",
......@@ -11,7 +12,6 @@ define(["underscore", "js/views/baseview"], function(_, BaseView) {
var view = options.view,
collection = view.collection;
this.view = view;
this.template = this.loadTemplate('paging-footer');
collection.bind('add', _.bind(this.render, this));
collection.bind('remove', _.bind(this.render, this));
collection.bind('reset', _.bind(this.render, this));
......@@ -23,7 +23,7 @@ define(["underscore", "js/views/baseview"], function(_, BaseView) {
collection = view.collection,
currentPage = collection.currentPage,
lastPage = collection.totalPages - 1;
this.$el.html(this.template({
this.$el.html(_.template(paging_footer_template, {
current_page: collection.currentPage,
total_pages: collection.totalPages
}));
......@@ -62,4 +62,4 @@ define(["underscore", "js/views/baseview"], function(_, BaseView) {
});
return PagingFooter;
}); // end define();
}); // end define();
define(["underscore", "gettext", "js/views/baseview"], function(_, gettext, BaseView) {
define(["underscore", "backbone", "gettext", "text!common/templates/components/paging-header.underscore"],
function(_, Backbone, gettext, paging_header_template) {
var PagingHeader = BaseView.extend({
var PagingHeader = Backbone.View.extend({
events : {
"click .next-page-link": "nextPage",
"click .previous-page-link": "previousPage"
......@@ -10,7 +11,6 @@ define(["underscore", "gettext", "js/views/baseview"], function(_, gettext, Base
var view = options.view,
collection = view.collection;
this.view = view;
this.template = this.loadTemplate('paging-header');
collection.bind('add', _.bind(this.render, this));
collection.bind('remove', _.bind(this.render, this));
collection.bind('reset', _.bind(this.render, this));
......@@ -22,7 +22,7 @@ define(["underscore", "gettext", "js/views/baseview"], function(_, gettext, Base
currentPage = collection.currentPage,
lastPage = collection.totalPages - 1,
messageHtml = this.messageHtml();
this.$el.html(this.template({
this.$el.html(_.template(paging_header_template, {
messageHtml: messageHtml
}));
this.$(".previous-page-link").toggleClass("is-disabled", currentPage === 0).attr('aria-disabled', currentPage === 0);
......@@ -110,4 +110,4 @@ define(["underscore", "gettext", "js/views/baseview"], function(_, gettext, Base
});
return PagingHeader;
}); // end define();
}); // end define();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment