Files
galaxy/static/scripts/mvc/grid/grid-shared.js
T

2 lines
1.2 KiB
JavaScript

define(["mvc/grid/grid-view"],function(a){var b=Backbone.View.extend({initialize:function(a){var b=this;this.setElement($("<div/>")),this.model=new Backbone.Model(a),this.item=this.model.get("item"),this.title=this.model.get("plural"),$.ajax({url:Galaxy.root+this.item+"/"+this.model.get("action_id"),success:function(a){a.dict_format=!0,b.model.set(a),b.render()}})},render:function(){var b=new a(this.model.attributes);this.$el.empty().append(b.$el),this.$el.append(this._templateShared())},_templateShared:function(){var a=this,b=$("<div><h2>"+this.model.get("plural")+" shared with you by others</h2></div>"),c=this.model.attributes;if(c.shared_by_others&&c.shared_by_others.length>0){var d=$('<table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%"><tr class="header"><th>Title</th><th>Owner</th></tr></table>');_.each(c.shared_by_others,function(b){var c=Galaxy.root+a.item+"/display_by_username_and_slug?username="+b.username+"&slug="+b.slug;d.append('<tr><td><a href="'+c+'">'+_.escape(b.title)+"</a></td><td>"+_.escape(b.username)+"</td></tr>")}),b.append(d)}else b.append("No "+this.model.get("plural").toLowerCase()+" have been shared with you.");return b}});return{View:b}});
//# sourceMappingURL=../../../maps/mvc/grid/grid-shared.js.map