From 5046963d04244b5d1b4d51200e97cc44578c129c Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Sat, 13 Nov 2010 16:52:40 +0100 Subject: [PATCH] make submit button text translateable (and translate it :P ) --- pyweb/djextdirect/formprovider.py | 26 ++++++++++++++--------- pyweb/mumble/templates/mumble/mumble.html | 2 ++ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/pyweb/djextdirect/formprovider.py b/pyweb/djextdirect/formprovider.py index a85dbd6..ebeed24 100644 --- a/pyweb/djextdirect/formprovider.py +++ b/pyweb/djextdirect/formprovider.py @@ -35,6 +35,22 @@ Ext.namespace('Ext.ux'); Ext.ux.%(clsname)s = function( config ){ Ext.apply( this, config ); + Ext.applyIf( this, { + defaults: { "anchor": "-20px" }, + paramsAsHash: true, + baseParams: {}, + autoScroll: true, + submitButtonText: "Submit" + } ); + Ext.applyIf( this, { + buttons: [{ + text: this.submitButtonText, + handler: this.submit, + id: '%(clsname)s_submit', + scope: this + }] + }); + var defaultconf = %(defaultconf)s; Ext.applyIf( this, defaultconf ); @@ -276,16 +292,6 @@ class FormProvider(Provider): 'defaultconf': '{' 'items:' + simplejson.dumps(items, indent=4) + ',' 'fileUpload: ' + simplejson.dumps(hasfiles) + ',' - 'defaults: { "anchor": "-20px" },' - 'paramsAsHash: true,' - 'baseParams: {},' - 'autoScroll: true,' - """buttons: [{ - text: "Submit", - handler: this.submit, - id: '"""+clsname+"""_submit', - scope: this - }]""" '}', 'apiconf': ('{' 'load: ' + ("XD_%s.get" % clsname) + "," diff --git a/pyweb/mumble/templates/mumble/mumble.html b/pyweb/mumble/templates/mumble/mumble.html index ebee206..e1274c0 100644 --- a/pyweb/mumble/templates/mumble/mumble.html +++ b/pyweb/mumble/templates/mumble/mumble.html @@ -117,6 +117,7 @@ { title: "{% trans "Registration" %}", xtype: "{{ RegForm|lower }}", + submitButtonText: "{% trans 'Submit' %}", pk: {% if MumbleAccount %}{{ MumbleAccount.id }}{% else %}-1{% endif %}, labelWidth: 150, baseParams: {serverid: {{MumbleServer.id}} }, @@ -154,6 +155,7 @@ pk: {{ MumbleServer.id }}, labelWidth: 150, xtype: 'mumbleform', + submitButtonText: "{% trans 'Submit' %}", listeners: { submitSuccess: function( form, action ){ form.savetip = new Ext.ToolTip({