Ignore:
Timestamp:
12/09/12 16:49:22 (12 years ago)
Author:
hendrikvanantwerpen
Message:

Put all model dependent code in one place. More separation of general and domain code.

File:
1 edited

Legend:

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

    r416 r417  
    44    'dojo/_base/lang',
    55    'dojo/when',
     6    'rx/rx.dojo',
    67    '../store',
    78    '../app/Content',
    89    '../app/Page',
    910    '../app/Router',
    10     '../ui/LineWithActionsWidget',
    11     'dojo/text!./surveys.html'
    12 ],function(array,declare,lang,when,store,Content,Page,Router,LineWithActionsWidget,template){
     11    '../widgets/LineWithActionsWidget',
     12    'dojo/text!./templates/surveys.html'
     13],function(array,declare,lang,when,Rx,store,Content,Page,Router,LineWithActionsWidget,template){
    1314    return declare([Page],{
    1415        templateString: template,
     
    4748        },
    4849        _onRunSurvey:function(survey){
     50            this.surveyRun = {
     51                type: 'SurveyRun',
     52                surveyId: store.getIdentity(survey),
     53                publicationDate: store.timestamp()
     54            };
     55            this.surveyRunDialog.set('value',this.surveyRun);
    4956            this.surveyRunDialog.show();
     57        },
     58        _onSurveyRunOk: function() {
     59            var surveyRun = lang.mixin(lang.clone(this.surveyRun),this.surveyRunDialog.get('value'));
     60            store.put(surveyRun)
     61            .then(lang.hitch(this,function(){
     62                this.surveyRunDialog.hide();
     63                this.refreshRuns();
     64            }),function(err){
     65                Content.notify(err);
     66            });
     67        },
     68        _onSurveyRunCancel: function() {
     69            this.surveyRunDialog.hide();
    5070        },
    5171        refresh: function() {
     
    131151                array.forEach(surveyRuns,function(surveyRun){
    132152                    var w = new LineWithActionsWidget({
    133                         title: survey.title,
     153                        title: surveyRun.title+" (from "+surveyRun.startDate+" to "+surveyRun.endDate+")",
    134154                        actions:[{
    135155                            callback: lang.hitch(this,'_onCloseRun',surveyRun),
Note: See TracChangeset for help on using the changeset viewer.