upgrade showformscripts controller and template
This commit is contained in:
parent
7e047e9b15
commit
21b8d883d8
2 changed files with 10 additions and 7 deletions
|
@ -23,7 +23,11 @@
|
||||||
import logging
|
import logging
|
||||||
import simplejson
|
import simplejson
|
||||||
|
|
||||||
from ddportfolioservice.lib.base import BaseController
|
from pylons import request, response
|
||||||
|
import formencode.api
|
||||||
|
import formencode.validators
|
||||||
|
|
||||||
|
from ddportfolioservice.lib.base import BaseController, render
|
||||||
from ddportfolioservice.model.form import DDDataRequest
|
from ddportfolioservice.model.form import DDDataRequest
|
||||||
from ddportfolioservice.model import dddatabuilder
|
from ddportfolioservice.model import dddatabuilder
|
||||||
|
|
||||||
|
@ -38,7 +42,7 @@ class ShowformscriptsController(BaseController):
|
||||||
def index(self):
|
def index(self):
|
||||||
"""This action generates the helper script for the showform
|
"""This action generates the helper script for the showform
|
||||||
page."""
|
page."""
|
||||||
response.headers['Content-Type'] = 'text/javascript'
|
response.headers['Content-Type'] = 'text/javascript; charset=utf-8'
|
||||||
return render('/showformscript.mako')
|
return render('/showformscript.mako')
|
||||||
|
|
||||||
def fetchdddata(self):
|
def fetchdddata(self):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## -*- coding: utf-8 -*-
|
## -*- coding: utf-8 -*- \
|
||||||
<%doc>
|
<%doc>
|
||||||
Helper JavaScript for the data input form.
|
Helper JavaScript for the data input form.
|
||||||
Copyright (c) 2009 Jan Dittberner <jan@dittberner.info>
|
Copyright © 2009, 2010 Jan Dittberner <jan@dittberner.info>
|
||||||
|
|
||||||
This file is part of DDPortfolio service.
|
This file is part of DDPortfolio service.
|
||||||
|
|
||||||
|
@ -18,8 +18,7 @@ Affero General Public License for more details.
|
||||||
You should have received a copy of the GNU Affero General Public
|
You should have received a copy of the GNU Affero General Public
|
||||||
License along with this program. If not, see
|
License along with this program. If not, see
|
||||||
<http://www.gnu.org/licenses/>.
|
<http://www.gnu.org/licenses/>.
|
||||||
</%doc>
|
</%doc>\
|
||||||
|
|
||||||
function updateFields(data, textStatus) {
|
function updateFields(data, textStatus) {
|
||||||
if (data.isdd == 1) {
|
if (data.isdd == 1) {
|
||||||
$('#name').attr('value', data.name).attr('readonly', 'readonly');
|
$('#name').attr('value', data.name).attr('readonly', 'readonly');
|
||||||
|
@ -54,7 +53,7 @@ function updateFields(data, textStatus) {
|
||||||
|
|
||||||
function onBlurEmail() {
|
function onBlurEmail() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
'url' : '${h.url_for(action='fetchdddata')}',
|
'url' : '${h.url_for(controller="showformscripts", action="fetchdddata")}',
|
||||||
'data' : {'email' : $('#email').attr('value')},
|
'data' : {'email' : $('#email').attr('value')},
|
||||||
'dataType' : 'json',
|
'dataType' : 'json',
|
||||||
'success' : updateFields,
|
'success' : updateFields,
|
||||||
|
|
Loading…
Reference in a new issue