Files
galaxy/static/toolshed/scripts/mvc/groups/group-list-view.js
T

2 lines
1.7 KiB
JavaScript

define(["libs/toastr","toolshed/scripts/mvc/groups/group-model","toolshed/scripts/mvc/groups/group-listrow-view"],function(a,b,c){var d=Backbone.View.extend({el:"#groups_element",defaults:{},initialize:function(c){this.options=_.defaults(this.options||{},this.defaults,c);var d=this;window.globalTS.groups.collection=new b.Groups,window.globalTS.groups.collection.fetch({success:function(a){console.log("received data: "),console.log(a),d.render()},error:function(b,c){a.error("undefined"!=typeof c.responseJSON?c.responseJSON.err_msg:"An error occurred.")}})},fetch:function(){},render:function(a){this.options=_.extend(this.options,a),$(".tooltip").hide();var b=this.templateGroupsList();this.$el.html(b({length:window.globalTS.groups.collection.models.length})),this.renderRows(window.globalTS.groups.collection.models),$("#center [data-toggle]").tooltip(),$("#center").css("overflow","auto")},renderRows:function(a){for(var b=0;b<a.length;b++){var c=a[b];this.renderOne({group:c})}},renderOne:function(a){var b=new c.GroupListRowView(a);this.$el.find("#group_list_body").append(b.el)},templateGroupsList:function(){var a=[];return a.push('<div id="groups">'),a.push("</div>"),a.push('<div class="groups_container table-responsive">'),a.push("<% if(length === 0) { %>"),a.push("<div>There are no groups yet.</div>"),a.push("<% } else{ %>"),a.push('<table class="grid table table-condensed">'),a.push(" <thead>"),a.push(" <th>Name</th>"),a.push(" <th>Members</th> "),a.push(" <th>Repositories</th>"),a.push(" </thead>"),a.push(' <tbody id="group_list_body">'),a.push(" </tbody>"),a.push("</table>"),a.push("<% }%>"),a.push("</div>"),_.template(a.join(""))}});return{GroupListView:d}});
//# sourceMappingURL=../../../maps/mvc/groups/group-list-view.js.map