add very basic plugin system (for tools)

This commit is contained in:
anatskiy
2016-10-05 16:07:49 +02:00
committed by Evgeny Anatskiy
parent 1f7a413531
commit adc92fd317
3 changed files with 43 additions and 1 deletions
@@ -0,0 +1,40 @@
/**
Webhooks
**/
define([], function() {
var galaxyRoot = typeof Galaxy != 'undefined' ? Galaxy.root : '/';
var WebhookModel = Backbone.Model.extend({
urlRoot: galaxyRoot + 'api/webhooks/toolview',
defaults: {
name: '',
path: ''
}
});
var WebhookView = Backbone.View.extend({
el: '#webhook-toolview',
webhookTemplate: _.template('<p>name: <%= name %><br>path: <%= path %></p>'),
initialize: function() {
var me = this;
this.model = new WebhookModel;
this.model.fetch({
success: function() {
me.render();
}
});
},
render: function() {
var webhookContent = this.model.toJSON();
if (webhookContent.css_styles) $('<style/>').text(webhookContent.css_styles).appendTo('head');
this.$el.html(this.webhookTemplate(webhookContent));
return this;
}
});
return {
WebhookView: WebhookView
};
});
@@ -1,2 +1,2 @@
name: Plugin 2
type: mainview
type: toolview
@@ -0,0 +1,2 @@
#webhook-toolview {border:1px solid #ccc;border-radius:3px;padding:10px;}
#webhook-toolview p {margin-bottom:0;}