upgrade showformscripts controller and template

This commit is contained in:
Jan Dittberner 2010-04-18 15:03:02 +02:00
parent 7e047e9b15
commit 21b8d883d8
2 changed files with 10 additions and 7 deletions

View file

@ -23,7 +23,11 @@
import logging
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 import dddatabuilder
@ -38,7 +42,7 @@ class ShowformscriptsController(BaseController):
def index(self):
"""This action generates the helper script for the showform
page."""
response.headers['Content-Type'] = 'text/javascript'
response.headers['Content-Type'] = 'text/javascript; charset=utf-8'
return render('/showformscript.mako')
def fetchdddata(self):

View file

@ -1,7 +1,7 @@
## -*- coding: utf-8 -*-
## -*- coding: utf-8 -*- \
<%doc>
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.
@ -18,8 +18,7 @@ Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public
License along with this program. If not, see
<http://www.gnu.org/licenses/>.
</%doc>
</%doc>\
function updateFields(data, textStatus) {
if (data.isdd == 1) {
$('#name').attr('value', data.name).attr('readonly', 'readonly');
@ -54,7 +53,7 @@ function updateFields(data, textStatus) {
function onBlurEmail() {
$.ajax({
'url' : '${h.url_for(action='fetchdddata')}',
'url' : '${h.url_for(controller="showformscripts", action="fetchdddata")}',
'data' : {'email' : $('#email').attr('value')},
'dataType' : 'json',
'success' : updateFields,