Ignore:
Timestamp:
03/08/14 22:51:23 (11 years ago)
Author:
hendrikvanantwerpen
Message:
  • Mark content as dirty to prevent moving away from unsaved data.
  • Better change propagation from lists and our own widgets.
  • Generate notifications for errors and show correct message.
  • Moved all path/url generation to the class stores, not everywhere we use it.
  • Give user always a choice between Save and Save & Close.
  • Better refresh behaviour on form changes and saves.
  • Don't generate duplicate code error when existing object is the one you're storing.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/client/qed-client/pages/surveys.js

    r487 r490  
    11define([
    2     "../app/Content",
    32    "../app/Page",
    43    "../app/Router",
     4    "../model/classes/surveyRuns",
    55    "../model/classes/surveys",
    6     "../model/classes/surveyRuns",
    76    "../widgets/LineWithActionsWidget",
    87    "dojo/_base/array",
     
    1110    "dojo/when",
    1211    "dojo/text!./templates/surveys.html"
    13 ], function(Content, Page, Router, surveys, surveyRuns, LineWithActionsWidget, array, declare, lang, when, template) {
     12], function(Page, Router, surveyRuns, surveys, LineWithActionsWidget, array, declare, lang, when, template) {
    1413    return declare([Page],{
    1514        templateString: template,
     
    2019        },
    2120        _onNewSurvey: function(){
    22             Router.go('/survey/new');
     21            Router.go(surveys.getObjectPath('new'));
    2322        },
    2423        _onPublishSurvey:function(survey){
     
    2928                self.refreshDrafts();
    3029                self.refreshPublished();
    31             },function(err){
    32                 Content.notify(err,'error');
    33             });
     30            },lang.hitch(this,function(err){
     31                this.notify(err.error,'error');
     32            }));
    3433        },
    3534        _onDeleteSurvey:function(survey){
     
    3837            .then(function(){
    3938                self.refreshDrafts();
    40             },function(err){
    41                 Content.notify(err,'error');
    42             });
     39            },lang.hitch(this,function(err){
     40                this.notify(err.error,'error');
     41            }));
    4342        },
    4443        _onEditSurvey:function(survey){
    45             Router.go('/survey/'+survey._id);
     44            Router.go(surveys.getObjectPath(survey));
    4645        },
    4746        _onPreviewSurvey:function(survey){
    48             Router.go('/previewSurvey/'+survey._id);
     47            Router.go(surveys.getPreviewPath(survey));
    4948        },
    5049        _onRunSurvey:function(survey){
     
    5453            .then(lang.hitch(this,function(surveyRun){
    5554                this._onRunDetails(surveyRun);
    56             }),function(err){
    57                 Content.notify(err);
    58             });
     55            }),lang.hitch(this,function(err){
     56                this.notify(err.error,'error');
     57            }));
    5958        },
    6059        _onRunDetails: function(surveyRun) {
    61             Router.go('/surveyRun/'+surveyRun._id);
     60            Router.go(surveyRuns.getObjectPath(surveyRun));
    6261        },
    6362        refresh: function() {
Note: See TracChangeset for help on using the changeset viewer.