/*! * teeble - v0.3.15 - 2015-03-03 * https://github.com/HubSpot/teeble * Copyright (c) 2015 HubSpot, Marc Neuwirth, Jonathan Kim; * Licensed MIT */ (function(){this.Teeble={}}).call(this),function(){var e=function(e,t){return function(){return e.apply(t,arguments)}};this.Teeble.TableRenderer=function(){function t(t){this.options=t,this.update_template=e(this.update_template,this),this.generate_columns=e(this.generate_columns,this),this.render_empty=e(this.render_empty,this),this.render_footer=e(this.render_footer,this),this.render_header=e(this.render_header,this),this.render_row=e(this.render_row,this),this._render=e(this._render,this),this._getExtraData=e(this._getExtraData,this),this._initialize=e(this._initialize,this),this._initialize(),this}return t.prototype.key="rows",t.prototype.hasFooter=!1,t.prototype.data=null,t.prototype.header_template=null,t.prototype.row_template=null,t.prototype.rows_template=null,t.prototype.table_class=null,t.prototype.table_template=null,t.prototype.table_template_compiled=null,t.prototype.empty_message="No data to display",t.prototype.classes={sorting:{sortable_class:"sorting"}},t.prototype.compile=_.template,t.prototype._initialize=function(){var e,t,n,r;t=["table_class","partials","hasFooter","empty_message","cid","classes","compile"];for(n=0,r=t.length;n<r;n++)e=t[n],this.options[e]!=null&&(this[e]=this.options[e]);if(this.partials)return this.update_template(this.partials)},t.prototype._getExtraData=function(){return{}},t.prototype._render=function(e,t){return e?t?(t=_.extend({},this._getExtraData(),t),e(t)):(console.log("no data"),!1):(console.log("no compiled template"),!1)},t.prototype.render_row=function(e){this.row_template_compiled||(this.row_template_compiled=this.compile(this.row_template));if(e)return this._render(this.row_template_compiled,e)},t.prototype.render_header=function(e){this.header_template_compiled||(this.header_template_compiled=this.compile(this.header_template));if(e)return this._render(this.header_template_compiled,e)},t.prototype.render_footer=function(e){this.footer_template_compiled||(this.footer_template_compiled=this.compile(this.footer_template));if(e)return this._render(this.footer_template_compiled,e)},t.prototype.render_empty=function(e){this.table_empty_template_compiled||(this.table_empty_template_compiled=this.compile(this.table_empty_template));if(e)return e.message||(e.message=this.empty_message),this._render(this.table_empty_template_compiled,e)},t.prototype._get_template_attributes=function(e,t,n){var r,i,s,o,u,a,f,l;o=t.sortable,s=t[e],f=!1;if(typeof s=="string")u=s;else{f=!0,s.template&&(u=s.template),s.attributes||(s.attributes={}),o&&(s.attributes["data-sort"]=o,s.attributes["class"]?(typeof s.attributes["class"]=="string"&&(s.attributes["class"]=[s.attributes["class"]]),s.attributes["class"].push(this.classes.sorting.sortable_class)):s.attributes["class"]=[this.classes.sorting.sortable_class]),i=[],l=s.attributes;for(r in l)a=l[r],a instanceof Array&&(a=a.join(" ")),i.push({name:r,value:a})}return u?{attributes:i,wrap:f,partial:u}:{attributes:{},wrap:f,partial:""}},t.prototype._generate_template=function(e,t,n,r){var i,s,o,u,a,f,l,c,h,p,d;r==null&&(r="td"),l="";if(t){for(u in t){o=t[u],f=o[e];if(f){a=""+f.partial;if(f.wrap){s="";if((p=f.attributes)!=null?p.length:void 0){d=f.attributes;for(c=0,h=d.length;c<h;c++)i=d[c],s+=""+i.name+'="'+i.value+'" '}a="<"+r+" "+s+">"+a+"</"+r+">"}l+=a}}n&&(l="<"+n+">"+l+"</"+n+">")}return l},t.prototype.generate_columns=function(e,t){var n,r,i,s;e==null&&(e=this.partials),t==null&&(t=!1);if(this.columns&&!t)return this.columns;r=0,this.columns=[];for(s in e)i=e[s],n={},i.header&&(n.header=this._get_template_attributes("header",i,r)),i.footer&&(n.footer=this._get_template_attributes("footer",i,r)),i.cell&&(n.cell=this._get_template_attributes("cell",i,r)),this.columns.push(n),r++;return this.columns},t.prototype.update_template=function(e){var t;return e==null&&(e=this.partials),t=this.generate_columns(),this.header_template=this._generate_template("header",t,"tr","th"),this.footer_template=this._generate_template("footer",t,"tr"),this.row_template=this._generate_template("cell",t),this.table_empty_template='<td valign="top" colspan="'+t.length+'" class="teeble_empty">{{{message}}}</td>'},t}()}.call(this),function(){var e=function(e,t){return function(){return e.apply(t,arguments)}},t={}.hasOwnProperty,n=function(e,n){function i(){this.constructor=e}for(var r in n)t.call(n,r)&&(e[r]=n[r]);return i.prototype=n.prototype,e.prototype=new i,e.__super__=n.prototype,e};this.Teeble.EmptyView=function(t){function r(){return this.render=e(this.render,this),this.initialize=e(this.initialize,this),r.__super__.constructor.apply(this,arguments)}return n(r,t),r.prototype.initialize=function(e){return this.options=e,this.renderer=this.options.renderer},r.prototype.render=function(){return this.renderer&&(this.el=this.renderer.render_empty(this.options)),this},r}(Backbone.View)}.call(this),function(){var e=function(e,t){return function(){return e.apply(t,arguments)}},t={}.hasOwnProperty,n=function(e,n){function i(){this.constructor=e}for(var r in n)t.call(n,r)&&(e[r]=n[r]);return i.prototype=n.prototype,e.prototype=new i,e.__super__=n.prototype,e};this.Teeble.FooterView=function(t){function r(){return this.stopListening=e(this.stopListening,this),this.render=e(this.render,this),this.initialize=e(this.initialize,this),r.__super__.constructor.apply(this,arguments)}return n(r,t),r.prototype.tagName="tfoot",r.prototype.initialize=function(e){var t=this;return this.options=e,this.renderer=this.options.renderer,this.collection.footer?(this.collection.footer instanceof Backbone.Model&&this.collection.footer.on("change",function(){return t.render()}),this.data=this.collection.footer):this.data=this.options,this.collection.footer},r.prototype.render=function(){var e;return this.renderer&&(this.data.toJSON?e=this.data.toJSON():e=this.data,this.$el.html(this.renderer.render_footer(e))),this},r.prototype.stopListening=function(){var e;return(e=this.collection.footer)!=null&&e.off("change"),r.__super__.stopListening.apply(this,arguments)},r}(Backbone.View)}.call(this),function(){var e=function(e,t){return function(){return e.apply(t,arguments)}},t={}.hasOwnProperty,n=function(e,n){function i(){this.constructor=e}for(var r in n)t.call(n,r)&&(e[r]=n[r]);return i.prototype=n.prototype,e.prototype=new i,e.__super__=n.prototype,e};this.Teeble.HeaderView=function(t){function r(){return this.setSort=e(this.setSort,this),this.sort=e(this.sort,this),this._sort=e(this._sort,this),this.render=e(this.render,this),this.initialize=e(this.initialize,this),r.__super__.constructor.apply(this,arguments)}return n(r,t),r.prototype.events={"click .sorting":"sort"},r.prototype.tagName="thead",r.prototype.initialize=function(e){return this.options=e,this.renderer=this.options.renderer,this.classes=this.options.classes},r.prototype.delegateEvents=function(){return r.__super__.delegateEvents.apply(this,arguments),this.collection.on("reset",this.setSort,this)},r.prototype.undelegateEvents=function(){return r.__super__.undelegateEvents.apply(this,arguments),this.collection.off("reset",this.setSort)},r.prototype.render=function(){return this.renderer&&(this.$el.html(this.renderer.render_header(this.options)),this.setSort()),this},r.prototype._sort=function(e,t){var n,r,i;return e.preventDefault(),n=this.$(e.target),n.hasClass(this.classes.sorting.sortable_class)||(n=n.parents("."+this.classes.sorting.sortable_class)),r=n.attr("data-sort"),!n.hasClass(this.classes.sorting.sorted_desc_class)&&!n.hasClass(this.classes.sorting.sorted_asc_class)&&(t=(i=this.collection.sortDirections[r])!=null?i:t),this.collection.setSort(r,t)},r.prototype.sort=function(e){var t;return t=this.$(e.currentTarget),t.hasClass(this.classes.sorting.sorted_desc_class)?this._sort(e,"asc"):this._sort(e,"desc")},r.prototype.setSort=function(){var e,t;if(this.collection.sortColumn)return t="desc",this.collection.sortDirection&&(t=this.collection.sortDirection),e="sorted_"+t+"_class",this.$el.find("."+this.classes.sorting.sortable_class).removeClass(""+this.classes.sorting.sorted_desc_class+" "+this.classes.sorting.sorted_asc_class).filter('.sorting[data-sort="'+this.collection.sortColumn+'"]').addClass(""+this.classes.sorting[e])},r}(Backbone.View)}.call(this),function(){var e=function(e,t){return function(){return e.apply(t,arguments)}},t={}.hasOwnProperty,n=function(e,n){function i(){this.constructor=e}for(var r in n)t.call(n,r)&&(e[r]=n[r]);return i.prototype=n.prototype,e.prototype=new i,e.__super__=n.prototype,e};this.Teeble.PaginationView=function(t){function r(){return this.gotoPage=e(this.gotoPage,this),this.gotoLast=e(this.gotoLast,this),this.gotoNext=e(this.gotoNext,this),this.gotoPrev=e(this.gotoPrev,this),this.gotoFirst=e(this.gotoFirst,this),this.render=e(this.render,this),r.__super__.constructor.apply(this,arguments)}return n(r,t),r.prototype.initialize=function(e){this.options=e},r.prototype.tagName="div",r.prototype.events={"click a.first":"gotoFirst","click a.previous":"gotoPrev","click a.next":"gotoNext","click a.last":"gotoLast","click a.pagination-page":"gotoPage"},r.prototype.template='<div class=" <%= pagination_class %>">\n <ul>\n <li>\n <a href="#" class="pagination-previous previous <% if (prev_disabled){ %><%= pagination_disabled %><% } %>">\n <span class="left"></span>\n Previous\n </a>\n </li>\n <% _.each(pages, function(page) { %>\n <li>\n <a href="#" class="pagination-page <% if (page.active){ %><%= pagination_active %><% } %>" data-page="<%= page.number %>"><%= page.number %></a>\n </li>\n <% }); %>\n <li>\n <a href="#" class="pagination-next next <% if(next_disabled){ %><%= pagination_disabled %><% } %>">\n Next\n <span class="right"></span>\n </a>\n </li>\n </ul>\n</div>',r.prototype.render=function(){var e,t,n,r;return this.collection.information||this.collection.pager(),t=this.collection.information,t.totalPages>1&&(r=function(){var e,r,i,s;i=t.pageSet,s=[];for(e=0,r=i.length;e<r;e++)n=i[e],s.push({active:n===t.currentPage?this.options.pagination.pagination_active:void 0,number:n});return s}.call(this),e=_.template(this.template,{pagination_class:this.options.pagination.pagination_class,pagination_disabled:this.options.pagination.pagination_disabled,pagination_active:this.options.pagination.pagination_active,prev_disabled:t.previous===!1,next_disabled:t.next===!1,pages:r}),this.$el.html(e)),this},r.prototype.gotoFirst=function(e){return e.preventDefault(),this.collection.goTo(1)},r.prototype.gotoPrev=function(e){return e.preventDefault(),this.collection.previousPage()},r.prototype.gotoNext=function(e){return e.preventDefault(),this.collection.nextPage()},r.prototype.gotoLast=function(e){return e.preventDefault(),this.collection.goTo(this.collection.information.lastPage)},r.prototype.gotoPage=function(e){var t;return e.preventDefault(),t=this.$(e.target).text(),this.collection.goTo(t)},r}(Backbone.View)}.call(this),function(){var e=function(e,t){return function(){return e.apply(t,arguments)}},t={}.hasOwnProperty,n=function(e,n){function i(){this.constructor=e}for(var r in n)t.call(n,r)&&(e[r]=n[r]);return i.prototype=n.prototype,e.prototype=new i,e.__super__=n.prototype,e};this.Teeble.RowView=function(t){function r(){return this.render=e(this.render,this),this.undelegateEvents=e(this.undelegateEvents,this),this.delegateEvents=e(this.delegateEvents,this),this.initialize=e(this.initialize,this),r.__super__.constructor.apply(this,arguments)}return n(r,t),r.prototype.tagName="tr",r.prototype.initialize=function(e){return this.options=e,this.renderer=this.options.renderer},r.prototype.delegateEvents=function(){return r.__super__.delegateEvents.apply(this,arguments),this.model.bind("change",this.render,this),this.model.bind("destroy",this.remove,this)},r.prototype.undelegateEvents=function(){return r.__super__.undelegateEvents.apply(this,arguments),this.model.unbind("change",this.render,this),this.model.unbind("destroy",this.remove,this)},r.prototype.render=function(){return this.renderer&&(this.$el.html(this.renderer.render_row(this.model.toJSON({teeble:!0}))),this.options.sortColumnIndex!=null&&this.$el.find("td").eq(this.options.sortColumnIndex).addClass(this.options.sortableClass)),this},r}(Backbone.View)}.call(this),function(){var e=function(e,t){return function(){return e.apply(t,arguments)}},t={}.hasOwnProperty,n=function(e,n){function i(){this.constructor=e}for(var r in n)t.call(n,r)&&(e[r]=n[r]);return i.prototype=n.prototype,e.prototype=new i,e.__super__=n.prototype,e};this.Teeble.TableView=function(t){function r(){return this.remove=e(this.remove,this),this.addOne=e(this.addOne,this),this.renderEmpty=e(this.renderEmpty,this),this.renderBody=e(this.renderBody,this),this.renderFooter=e(this.renderFooter,this),this.renderHeader=e(this.renderHeader,this),this.renderPagination=e(this.renderPagination,this),this.render=e(this.render,this),this.setOptions=e(this.setOptions,this),this.initialize=e(this.initialize,this),r.__super__.constructor.apply(this,arguments)}return n(r,t),r.prototype.tagName="div",r.prototype.rendered=!1,r.prototype.classes={sorting:{sortable_class:"sorting",sorted_desc_class:"sorting_desc",sorted_asc_class:"sorting_asc",sortable_cell:"sorting_1"},pagination:{pagination_class:"pagination",pagination_active:"active",pagination_disabled:"disabled"}},r.prototype.subviews={header:Teeble.HeaderView,row:Teeble.RowView,footer:Teeble.FooterView,pagination:Teeble.PaginationView,renderer:Teeble.TableRenderer,empty:Teeble.EmptyView},r.prototype.initialize=function(e){var t,n,i,s;this.options=e,this.rows=[],this.subviews=_.extend({},this.subviews,this.options.subviews),this.setOptions(),r.__super__.initialize.apply(this,arguments),this.sortIndex={},t=0,s=this.options.partials;for(i in s)n=s[i],n.sortable&&(this.sortIndex[n.sortable]=t),t++;return this.renderer=new this.subviews.renderer({partials:this.options.partials,table_class:this.options.table_class,cid:this.cid,classes:this.classes,collection:this.collection,compile:this.options.compile})},r.prototype.delegateEvents=function(){return r.__super__.delegateEvents.apply(this,arguments),this.collection.on("add",this.addOne,this),this.collection.on("reset",this.renderBody,this),this.collection.on("reset",this.renderFooter,this),this.collection.on("reset",this.renderPagination,this)},r.prototype.undelegateEvents=function(){var e,t;return r.__super__.undelegateEvents.apply(this,arguments),(e=this.header)!=null&&e.undelegateEvents(),(t=this.footer)!=null&&t.undelegateEvents(),this.collection.off("add",this.addOne),this.collection.off("reset",this.renderBody),this.collection.off("reset",this.renderFooter),this.collection.off("reset",this.renderPagination)},r.prototype.setOptions=function(){return this},r.prototype.render=function(){var e;return!this.collection.origModels&&this.collection.whereAll!=null&&typeof (e=this.collection).pager=="function"&&e.pager(),this.$el.empty().append("<table><tbody></tbody></table>"),this.table=this.$("table").addClass(this.options.table_class),this.body=this.$("tbody"),this.rendered=!0,this.renderHeader(),this.renderBody(),this.renderFooter(),this.renderPagination(),this.trigger("teeble.render",this),this},r.prototype.renderPagination=function(){var e;if(this.options.pagination&&this.rendered)return(e=this.pagination)!=null&&e.remove(),this.pagination=new this.subviews.pagination({collection:this.collection,pagination:this.classes.pagination}),this.$el.append(this.pagination.render().el),this.trigger("pagination.render",this)},r.prototype.renderHeader=function(){var e;if(this.rendered)return(e=this.header)!=null&&e.remove(),this.header=new this.subviews.header({renderer:this.renderer,collection:this.collection,classes:this.classes}),this.table.prepend(this.header.render().el),this.trigger("header.render",this)},r.prototype.renderFooter=function(){var e;if(this.options.footer&&this.rendered){(e=this.footer)!=null&&e.remove();if(this.collection.length>0)return this.footer=new this.subviews.footer({renderer:this.renderer,collection:this.collection}),this.table.append(this.footer.render().el),this.trigger("footer.render",this)}},r.prototype.renderBody=function(){if(this.rendered)return this.body.empty(),this.collection.length>0?(this.collection.each(this.addOne),this.trigger("body.render",this)):this.renderEmpty()},r.prototype.renderEmpty=function(){var e;if(this.rendered)return e=_.extend({},this.options,{renderer:this.renderer,collection:this.collection}),this.empty=new this.subviews.empty(e),this.body.append(this.empty.render().el),this.trigger("empty.render",this)},r.prototype.addOne=function(e){var t,n;return this.collection.sortColumn&&(t=this.sortIndex[this.collection.sortColumn]),n=new this.subviews.row({model:e,renderer:this.renderer,sortColumnIndex:t,sortableClass:this.classes.sorting.sortable_cell}),this.rows.push(n),this.body.append(n.render().el),this.trigger("row.render",n)},r.prototype.remove=function(){var e,t,n,i,s,o;r.__super__.remove.apply(this,arguments),i=this.rows;for(t=0,n=i.length;t<n;t++)e=i[t],e.undelegateEvents(),e.remove();return this.rows=[],(s=this.header)!=null&&s.remove(),(o=this.footer)!=null?o.remove():void 0},r}(Backbone.View)}.call(this),function(){var e=function(e,t){return function(){return e.apply(t,arguments)}},t={}.hasOwnProperty,n=function(e,n){function i(){this.constructor=e}for(var r in n)t.call(n,r)&&(e[r]=n[r]);return i.prototype=n.prototype,e.prototype=new i,e.__super__=n.prototype,e},r=[].slice;this.Teeble.ClientCollection=function(t){function i(){return this.eachAll=e(this.eachAll,this),this.getFromAll=e(this.getFromAll,this),this.whereAll=e(this.whereAll,this),this.initialize=e(this.initialize,this),i.__super__.constructor.apply(this,arguments)}return n(i,t),i.prototype.sortDirections={},i.prototype.default_paginator_core={dataType:"json",url:function(){return this.url()}},i.prototype.default_paginator_ui={sortColumn:"",sortDirection:"desc",firstPage:1,currentPage:1,perPage:10,pagesInRange:3},i.prototype.initialize=function(){return this.paginator_ui=_.extend({},this.default_paginator_ui,this.paginator_ui),this.paginator_core=_.extend({},this.default_paginator_core,this.paginator_core),i.__super__.initialize.apply(this,arguments)},i.prototype.whereAll=function(e){return _.isEmpty(e)?[]:_.filter(this.origModels,function(t){var n,r;for(n in e){r=e[n];if(r!==t.get(n))return!1}return!0})},i.prototype.getFromAll=function(e){var t;return e==null?void 0:(t=e.id||e.cid||e,this._byId[t]||_.findWhere(this.origModels,{id:t}))},i.prototype.eachAll=function(){var e,t;return(t=_.each).call.apply(t,[_,(e=this.origModels)!=null?e:this.models].concat(r.call(arguments)))},i}(Backbone.Paginator.clientPager)}.call(this),function(){var e=function(e,t){return function(){return e.apply(t,arguments)}},t={}.hasOwnProperty,n=function(e,n){function i(){this.constructor=e}for(var r in n)t.call(n,r)&&(e[r]=n[r]);return i.prototype=n.prototype,e.prototype=new i,e.__super__=n.prototype,e};this.Teeble.ServerCollection=function(t){function r(){return this.pager=e(this.pager,this),this.setSort=e(this.setSort,this),this.previousPage=e(this.previousPage,this),this.nextPage=e(this.nextPage,this),this.initialize=e(this.initialize,this),r.__super__.constructor.apply(this,arguments)}return n(r,t),r.prototype.sortDirections={},r.prototype.default_paginator_core={dataType:"json",url:function(){return this.url()}},r.prototype.default_paginator_ui={firstPage:1,currentPage:1,perPage:10,pagesInRange:3},r.prototype.default_server_api={offset:function(){return(this.currentPage-1)*this.perPage},limit:function(){return this.perPage}},r.prototype.initialize=function(){return this.paginator_ui=_.extend({},this.default_paginator_ui,this.paginator_ui),this.paginator_core=_.extend({},this.default_paginator_core,this.paginator_core),this.server_api=_.extend({},this.default_server_api,this.server_api),this.on("reset",this.info),r.__super__.initialize.apply(this,arguments)},r.prototype.nextPage=function(e){if(this.currentPage<this.information.totalPages)return this.promise=this.requestNextPage(e)},r.prototype.previousPage=function(e){if(this.currentPage>1)return this.promise=this.requestPreviousPage(e)},r.prototype.setSort=function(e,t){if(e!==void 0&&t!==void 0)return this.lastSortColumn=this.sortColumn,this.sortColumn=e,this.sortDirection=t,this.pager(),this.info()},r.prototype.pager=function(e){var t;return e==null&&(e={}),this.lastSortColumn!==this.sortColumn&&this.sortColumn!=null&&(this.currentPage=1,this.lastSortColumn=this.sortColumn),(t=e.reset)==null&&(e.reset=!0),r.__super__.pager.call(this,e),this.info()},r}(Backbone.Paginator.requestPager)}.call(this),function(){var e=function(e,t){return function(){return e.apply(t,arguments)}},t={}.hasOwnProperty,n=function(e,n){function i(){this.constructor=e}for(var r in n)t.call(n,r)&&(e[r]=n[r]);return i.prototype=n.prototype,e.prototype=new i,e.__super__=n.prototype,e};this.Teeble.SortbarHeaderView=function(t){function r(){return this.sort=e(this.sort,this),this.sortFieldChange=e(this.sortFieldChange,this),this.sortBarChange=e(this.sortBarChange,this),r.__super__.constructor.apply(this,arguments)}return n(r,t),r.prototype.events={"change .sortbar-column":"sortBarChange","change .sortbar-field-select":"sortFieldChange","click .sort-reverser":"sort"},r.prototype.sortBarChange=function(e){var t,n,r,i,s;return t=this.$(e.currentTarget),n=~~t.attr("data-column"),s=t.val(),i=this.collection.sortbarColumns[n],r=_.indexOf(this.collection.sortbarColumns,s),r>=0&&(this.collection.sortbarColumns[r]=i),this.collection.sortbarColumns[n]=s,this.renderer.update_template(),this.render(),this.collection.trigger("reset")},r.prototype.sortFieldChange=function(e){return this.sort(e,"asc")},r.prototype.sort=function(e,t){var n,r;return e!=null&&e.preventDefault(),n=this.$(".sort-reverser"),n.hasClass("reverse")||t?(n.removeClass("reverse"),t="asc"):(n.addClass("reverse"),t="desc"),r=this.$(".sortbar-field-select").val(),this.collection.setSort(r,t)},r}(this.Teeble.HeaderView)}.call(this),function(){var e=function(e,t){return function(){return e.apply(t,arguments)}},t={}.hasOwnProperty,n=function(e,n){function i(){this.constructor=e}for(var r in n)t.call(n,r)&&(e[r]=n[r]);return i.prototype=n.prototype,e.prototype=new i,e.__super__=n.prototype,e};this.Teeble.SortbarRenderer=function(t){function r(){return this.update_template=e(this.update_template,this),this._generate_template=e(this._generate_template,this),this._getExtraData=e(this._getExtraData,this),r.__super__.constructor.apply(this,arguments)}return n(r,t),r.prototype._getExtraData=function(){return{sortbarColumns:this.options.collection.sortbarColumns,sortbarSortOptions:this.options.collection.sortbarSortOptions,sortbarColumnOptions:this.options.collection.sortbarColumnOptions,sortColumn:this.options.collection.sortColumn,sortDirection:this.options.collection.sortDirection,partials:this.partials}},r.prototype._generate_template=function(e,t,n){var i,s,o,u,a;s=r.__super__._generate_template.call(this,e,t),a=this.options.collection.sortbarColumns;for(o=0,u=a.length;o<u;o++)i=a[o],s+="<td><%= "+i+" %></td>";return n&&(s="<"+n+">"+s+"</"+n+">"),s},r.prototype.update_template=function(e){var t;return e==null&&(e=this.partials),t=this.generate_columns(),this.header_template='<tr>\n <th colspan="'+_.size(e)+'">\n <div class="sort-label">Sorted by: </div>\n <div class="sort">\n <select class="sortbar-field-select">\n <% _.each(sortbarSortOptions, function(name, value) { %>\n <option value="<%= value %>" <% if (sortColumn === value){ %>selected<% } %>><%= name %></option>\n <% }); %>\n <% _.each(sortbarColumnOptions, function(name, value) { %>\n <option value="<%= value %>" <% if (sortColumn === value){ %>selected<% } %>><%= name %></option>\n <% }); %>\n </select>\n </div>\n <div class="sort-reverser <% if( sortDirection === \'desc\' ){ %>reverse<% } %>">\n <div class="up"></div>\n <div class="down"></div>\n </div>\n <div class="columns-label">Showing:</div>\n </th>\n <% for(var i = 0; i < sortbarColumns.length; i++) { %>\n <th>\n <select data-column="<%= i %>" class="sortbar-column sortbar-column-<%= i %>">\n <% _.each(sortbarColumnOptions, function(name, value) { %>\n <option value="<%= value %>" <% if(value === sortbarColumns[i]){%>selected<%}%> ><%= name %></option>\n <% }); %>\n </th>\n <% } %>\n</tr>',this.footer_template=this._generate_template("footer",t,"tr"),this.row_template=this._generate_template("cell",t),this.table_empty_template='<td valign="top" colspan="'+t.length+'" class="teeble_empty">{{message}}</td>',this.row_template_compiled=null,this.header_template_compiled=null,this.footer_template_compiled=null,this.table_empty_template_compiled=null},r}(this.Teeble.TableRenderer)}.call(this);