Ignore:
Timestamp:
02/16/12 14:47:39 (13 years ago)
Author:
hendrikvanantwerpen
Message:
  • [Client] Finished page framework. See rft/ui/content.js or test files for details.
  • [Client] Allow login by pressing Enter.
  • [API] On exception include details in json response.
  • [Server Use Exceptions when save() fails, iso return values.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui/client/rft/ui/LoginDialog.js

    r260 r263  
    1 define(['dojo/_base/declare','dojo/_base/lang','dijit/Dialog','dijit/_WidgetsInTemplateMixin',
    2     '../auth', 'dojo/text!./LoginDialog.html','../content',
    3     'dijit/form/Form','dijit/form/Button','dijit/form/TextBox'],
    4     function (declare, lang, Dialog, _WidgetsInTemplateMixin, auth, template, content) {
     1define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/event','dijit/Dialog',
     2    'dijit/_WidgetsInTemplateMixin','../auth', 'dojo/text!./LoginDialog.html',
     3    '../content','dijit/form/Form','dijit/form/Button','dijit/form/TextBox'],
     4    function (declare, lang, event, Dialog, _WidgetsInTemplateMixin, auth, template, content) {
    55        return declare([Dialog,_WidgetsInTemplateMixin], {
    66            templateString: template,
     
    88            title: "Login",
    99            baseClass: "rftLoginDialog",
     10            startup: function() {
     11                this.inherited(arguments);
     12                this.loginForm.on('submit',lang.hitch(this,'onLogin'));
     13            },
    1014            show: function() {
    1115                this.loginErrors.innerHTML = '';
     
    1317                this.inherited(arguments);
    1418            },
    15             onLogin: function() {
     19            onLogin: function(evt) {
    1620                this.loginErrors.innerHTML = '';
    1721                var data = this.loginForm.get('value');
    18                 var hide = lang.hitch(this,"hide");
    1922                auth.login(data.username,data.password)
    20                 .then(function() {
    21                     hide();
     23                .then(lang.hitch(this,function() {
     24                    this.hide();
    2225                    content.initial();
    23                 },function() {
     26                }),lang.hitch(this,function() {
    2427                    this.loginErrors.innerHTML = 'Login failed.';
    25                 })
     28                }));
     29                event.stop(evt);
    2630                return false;
    2731            }
Note: See TracChangeset for help on using the changeset viewer.