pass trans object into the helper function

This commit is contained in:
Evgeny Anatskiy
2016-10-09 16:32:58 +02:00
parent 2bf0549a37
commit d821c2745c
9 changed files with 15 additions and 18 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ define([], function() {
icon : (typeof webhook.config.icon != 'undefined') ? webhook.config.icon : '',
url : (typeof webhook.config.url != 'undefined') ? webhook.config.url : '',
tooltip : (typeof webhook.config.tooltip != 'undefined') ? webhook.config.tooltip : '',
// onclick : function() {},
onclick : (typeof webhook.config.function != 'undefined') ? new Function(webhook.config.function) : '',
// visible : webhook.activate
});
}
@@ -3,6 +3,8 @@ type:
- masthead
activate: false
icon: fa-repeat
tooltip: Masthead Plugin Test
icon: fa-star-half-o
tooltip: Biostars Galaxy
function: >
window.open('https://biostar.usegalaxy.org', '_blank');
@@ -1,7 +0,0 @@
$(document).ready(function() {
function function_test() {
alert('It works!');
}
});
@@ -16,7 +16,7 @@ def get_latest_id():
])
def main(webhook):
def main(trans, webhook):
error = ''
data = {}
+4 -2
View File
@@ -64,5 +64,7 @@ class WebhooksController(BaseAPIController):
for webhook in self.app.webhooks_registry.webhooks
if webhook.name == webhook_name
]
return imp.load_source('helper', webhook[0].helper).main(webhook[0]) \
if webhook and webhook[0].helper != '' else {}
return imp.load_source('helper', webhook[0].helper).main(
trans,
webhook[0],
) if webhook and webhook[0].helper != '' else {}
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"webhooks.js","sources":["../../src/mvc/webhooks.js"],"names":["define","WebhookModel","Backbone","Model","extend","defaults","activate","Webhooks","Collection","model","WebhookView","View","el","initialize","options","me","this","urlRoot","fetch","success","render","webhook","toJSON","$el","html","name","styles","$","type","text","appendTo","script","addToMastheadMenu","webhooks","url","Galaxy","root","document","ready","each","models","index","page","masthead","collection","add","id","icon","config","tooltip","addToHistoryMenu","_l","menu","async","webhooks_menu","push","title","anon","length","unshift","header","merge"],"mappings":"AAGAA,UAAW,WAEP,GAAIC,GAAeC,SAASC,MAAMC,QAC9BC,UACIC,U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OhC,GACpC,GAAIY,GAAUZ,EAAMa,QAChBD,GAAQf,UACRgD,EAAcC,MACV/B,KAAO2B,EAAI9B,EAAQ2B,OAAOQ,OAE1BC,MAAO,MAKfH,EAAcI,OAAS,IACvBJ,EAAcK,SACVnC,KAAS2B,EAAI,YACbS,QAAS,IAEbjC,EAAEkC,MAAMT,EAAME,OAM9B,QACI/C,SAAUA,EACVG,YAAaA,EACbsB,kBAAmBA,EACnBkB,iBAAkBA"}
{"version":3,"file":"webhooks.js","sources":["../../src/mvc/webhooks.js"],"names":["define","WebhookModel","Backbone","Model","extend","defaults","activate","Webhooks","Collection","model","WebhookView","View","el","initialize","options","me","this","urlRoot","fetch","success","render","webhook","toJSON","$el","html","name","styles","$","type","text","appendTo","script","addToMastheadMenu","webhooks","url","Galaxy","root","document","ready","each","models","index","page","masthead","collection","add","id","icon","config","tooltip","onclick","function","Function","addToHistoryMenu","_l","menu","async","webhooks_menu","push","title","anon","length","unshift","header","merge"],"mappings":"AAGAA,UAAW,WAEP,GAAIC,GAAeC,SAASC,MAAMC,QAC9BC,UACIC,UAAU,KAIdC,EAAWL,SAASM,WAAWJ,QAC/BK,MAAOR,IAGPS,EAAcR,SAASS,KAAKP,QAC5BQ,GAAI,gBAEJC,WAAY,SAASC,GACjB,GAAIC,GAAKC,IAETA,MAAKP,MAAQ,GAAIR,GACjBe,KAAKP,MAAMQ,QAAUH,EAAQG,QAC7BD,KAAKP,MAAMS,OACPC,QAAS,WACLJ,EAAGK,aAKfA,OAAQ,WACJ,GAAIC,GAAUL,KAAKP,MAAMa,QAMzB,OALID,GAAQf,WACRU,KAAKO,IAAIC,KAAK,YAAcH,EAAQI,KAAO,YACvCJ,EAAQK,QAAQC,EAAE,YAAaC,KAAM,aAAaC,KAAKR,EAAQK,QAAQI,SAAS,QAChFT,EAAQU,QAAQJ,EAAE,aAAcC,KAAM,oBAAoBC,KAAKR,EAAQU,QAAQD,SAAS,SAEzFd,QAIXgB,EAAoB,WACpB,GAAIC,GAAW,GAAI1B,EACnB0B,GAASC,IAAMC,OAAOC,KAAO,4BAC7BH,EAASf,OACLC,QAAS,WACLQ,EAAEU,UAAUC,MAAM,WACdX,EAAEY,KAAKN,EAASO,OAAQ,SAASC,EAAOhC,GACpC,GAAIY,GAAUZ,EAAMa,QAChBD,GAAQf,UACR6B,OAAOO,KAAKC,SAASC,WAAWC,KAC5BC,GAAUzB,EAAQI,KAClBsB,KAAyC,mBAAvB1B,GAAQ2B,OAAOD,KAAuB1B,EAAQ2B,OAAOD,KAAO,GAC9Eb,IAAwC,mBAAtBb,GAAQ2B,OAAOd,IAAsBb,EAAQ2B,OAAOd,IAAM,GAC5Ee,QAA4C,mBAA1B5B,GAAQ2B,OAAOC,QAA0B5B,EAAQ2B,OAAOC,QAAU,GAEpFC,QAA6C,mBAA3B7B,GAAQ2B,OAAOG,SAA2B,GAAIC,UAAS/B,EAAQ2B,OAAOG,UAAY,aAU5HE,EAAmB,SAASC,EAAIC,GAChC,GAAItB,GAAW,GAAI1B,EACnB0B,GAASC,IAAMC,OAAOC,KAAO,gCAC7BH,EAASf,OACLsC,OAAO,EACPrC,QAAS,WACL,GAAIsC,KAEJ9B,GAAEY,KAAKN,EAASO,OAAQ,SAASC,EAAOhC,GACpC,GAAIY,GAAUZ,EAAMa,QAChBD,GAAQf,UACRmD,EAAcC,MACVlC,KAAO8B,EAAIjC,EAAQ2B,OAAOW,OAE1BC,MAAO,MAKfH,EAAcI,OAAS,IACvBJ,EAAcK,SACVtC,KAAS8B,EAAI,YACbS,QAAS,IAEbpC,EAAEqC,MAAMT,EAAME,OAM9B,QACIlD,SAAUA,EACVG,YAAaA,EACbsB,kBAAmBA,EACnBqB,iBAAkBA"}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,2 +1,2 @@
define([],function(){var a=Backbone.Model.extend({defaults:{activate:!1}}),b=Backbone.Collection.extend({model:a}),c=Backbone.View.extend({el:"#webhook-view",initialize:function(b){var c=this;this.model=new a,this.model.urlRoot=b.urlRoot,this.model.fetch({success:function(){c.render()}})},render:function(){var a=this.model.toJSON();return a.activate&&(this.$el.html('<div id="'+a.name+'"></div>'),a.styles&&$("<style/>",{type:"text/css"}).text(a.styles).appendTo("head"),a.script&&$("<script/>",{type:"text/javascript"}).text(a.script).appendTo("head")),this}}),d=function(){var a=new b;a.url=Galaxy.root+"api/webhooks/masthead/all",a.fetch({success:function(){$(document).ready(function(){$.each(a.models,function(a,b){var c=b.toJSON();c.activate&&Galaxy.page.masthead.collection.add({id:c.name,icon:"undefined"!=typeof c.config.icon?c.config.icon:"",url:"undefined"!=typeof c.config.url?c.config.url:"",tooltip:"undefined"!=typeof c.config.tooltip?c.config.tooltip:""})})})}})},e=function(a,c){var d=new b;d.url=Galaxy.root+"api/webhooks/history-menu/all",d.fetch({async:!1,success:function(){var b=[];$.each(d.models,function(c,d){var e=d.toJSON();e.activate&&b.push({html:a(e.config.title),anon:!0})}),b.length>0&&(b.unshift({html:a("Webhooks"),header:!0}),$.merge(c,b))}})};return{Webhooks:b,WebhookView:c,addToMastheadMenu:d,addToHistoryMenu:e}});
define([],function(){var a=Backbone.Model.extend({defaults:{activate:!1}}),b=Backbone.Collection.extend({model:a}),c=Backbone.View.extend({el:"#webhook-view",initialize:function(b){var c=this;this.model=new a,this.model.urlRoot=b.urlRoot,this.model.fetch({success:function(){c.render()}})},render:function(){var a=this.model.toJSON();return a.activate&&(this.$el.html('<div id="'+a.name+'"></div>'),a.styles&&$("<style/>",{type:"text/css"}).text(a.styles).appendTo("head"),a.script&&$("<script/>",{type:"text/javascript"}).text(a.script).appendTo("head")),this}}),d=function(){var a=new b;a.url=Galaxy.root+"api/webhooks/masthead/all",a.fetch({success:function(){$(document).ready(function(){$.each(a.models,function(a,b){var c=b.toJSON();c.activate&&Galaxy.page.masthead.collection.add({id:c.name,icon:"undefined"!=typeof c.config.icon?c.config.icon:"",url:"undefined"!=typeof c.config.url?c.config.url:"",tooltip:"undefined"!=typeof c.config.tooltip?c.config.tooltip:"",onclick:"undefined"!=typeof c.config.function?new Function(c.config.function):""})})})}})},e=function(a,c){var d=new b;d.url=Galaxy.root+"api/webhooks/history-menu/all",d.fetch({async:!1,success:function(){var b=[];$.each(d.models,function(c,d){var e=d.toJSON();e.activate&&b.push({html:a(e.config.title),anon:!0})}),b.length>0&&(b.unshift({html:a("Webhooks"),header:!0}),$.merge(c,b))}})};return{Webhooks:b,WebhookView:c,addToMastheadMenu:d,addToHistoryMenu:e}});
//# sourceMappingURL=../../maps/mvc/webhooks.js.map