mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
1 line
1.4 KiB
JavaScript
1 line
1.4 KiB
JavaScript
define("mvc/grid/grid-shared",["exports","mvc/grid/grid-view","ui/loading-indicator"],function(e,t,a){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(e,"__esModule",{value:!0});var r=i(t),s=i(a),d=Backbone.View.extend({initialize:function(e){var t=this;s.default.markViewAsLoading(this),this.model=new Backbone.Model(e),this.item=this.model.get("item"),this.title=this.model.get("plural"),e&&e.active_tab&&(this.active_tab=e.active_tab),$.ajax({url:Galaxy.root+this.item+"/"+this.model.get("action_id")+"?"+$.param(Galaxy.params),success:function(e){t.model.set(e),t.render()}})},render:function(){var e=new r.default(this.model.attributes);this.$el.empty().append(e.$el),this.$el.append(this._templateShared())},_templateShared:function(){var e=this,t=$("<div><br/><h2>"+this.model.get("plural")+" shared with you by others</h2></div>"),a=this.model.attributes;if(a.shared_by_others&&a.shared_by_others.length>0){var i=$('<table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%"><tr class="header"><th>Title</th><th>Owner</th></tr></table>');_.each(a.shared_by_others,function(t,a){var r=Galaxy.root+e.item+"/display_by_username_and_slug?username="+t.username+"&slug="+t.slug;i.append('<tr><td><a href="'+r+'">'+_.escape(t.title)+"</a></td><td>"+_.escape(t.username)+"</td></tr>")}),t.append(i)}else t.append("No "+this.model.get("plural").toLowerCase()+" have been shared with you.");return t}});e.default={View:d}}); |