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/questions.js

    r487 r490  
    11define([
    2     "../app/Content",
    32    "../app/Page",
    43    "../app/Router",
     
    109    "dojo/_base/lang",
    1110    "dojo/text!./templates/questions.html"
    12 ], function(Content, Page, Router, questions, TabbedQuestionBrowser, Deferred, declare, event, lang, template) {
     11], function(Page, Router, questions, TabbedQuestionBrowser, Deferred, declare, event, lang, template) {
    1312    return declare([Page],{
    1413        templateString: template,
     
    4140        },
    4241        onNewQuestion: function() {
    43             Router.go("/question/new");
     42            Router.go(questions.getObjectPath('new'));
    4443        },
    4544        onDeleteQuestion: function(question) {
    4645            questions.remove(question)
    47             .then(function(){
    48                 Content.notify("Question deleted.");
    49             },function(err){
    50                 Content.notify(err,'error');
    51             });
     46            .then(lang.hitch(this,function(){
     47                this.notify("Question deleted.");
     48            }),lang.hitch(this,function(err){
     49                this.notify(err.error,'error');
     50            }));
    5251        },
    5352        onEditQuestion: function(question) {
    54             Router.go("/question/"+question._id);
     53            Router.go(questions.getObjectPath(question));
    5554        },
    5655        onPublishQuestion: function(question) {
    5756            question.publicationDate = new Date();
    5857            questions.save(question)
    59             .then(function(){
    60                 Content.notify("Question published.");
    61             },function(err){
    62                 Content.notify(err,'error');
    63             });
     58            .then(lang.hitch(this,function(){
     59                this.notify("Question published.");
     60            }),lang.hitch(this,function(err){
     61                this.notify(err.error,'error');
     62            }));
    6463        }
    6564    });
Note: See TracChangeset for help on using the changeset viewer.