Ignore:
Timestamp:
09/07/12 16:59:14 (13 years ago)
Author:
hendrikvanantwerpen
Message:

Next steps to actually make taking surveys possible.

Split Controller in Router and Content. Updated the view.html to work
with the new app/Content mechanism. Include view page in build profile.

Rearranged Couch design documents per type. Changed config tool so the
docs.js can be more readable, functions don't have to be on one line
anymore but are serialized later. Because the .htaccess proxy is limited
to the rft database for security reasons, the config tool has to be run
on Node.js, to be able to access the Couch port (which is limited by
cross domain security in the browser).

Added elastic search to .htaccess proxy as well. Seperated CouchStore?
from rft/store, which contains application specific data.

Removed some old API files that were hanging around still.

Introduced preview mode for viewSurvey page. Changed survey page to
only show published questions to be included. The surveys page has
three categories: drafts, published and runs. Creating survey runs is
not yet implemented.

File:
1 edited

Legend:

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

    r407 r410  
    55    'dojo/_base/event',
    66    'dojo/_base/lang',
    7     '../app/Controller',
     7    '../app/Router',
    88    '../store',
    99    '../app/Page',
     
    1111    '../ui/TabbedQuestionBrowser',
    1212    'dojo/text!./survey.html'
    13 ],function(array,declare,Deferred,event,lang,Controller,store,Page,
     13],function(array,declare,Deferred,event,lang,Router,store,Page,
    1414         QuestionListView,TabbedQuestionBrowser,template){
    1515    return declare([Page],{
     
    2727                this._setupQuestionBrowser();
    2828                this._setupListView();
    29                 Deferred.when(store.get(this.surveyId))
    30                 .then(lang.hitch(this,function(obj){
    31                     this.survey = obj;
    32                     store.query(null,{keys:this.survey.questions,include_docs:true})
    33                     .forEach(lang.hitch(this.questionList,'appendItem'));
    34                     this.refresh();
    35                 }));
     29                this._setupSurvey();
    3630            } else {
    3731                throw "No valid uid or survey passed!";
     
    4236                region: 'center',
    4337                'class': 'blue',
     38                include: 'published',
    4439                selectedActions: {
    4540                    "Include": {
     
    5954            this.questionBrowser.startup();
    6055        },
    61         _includeQuestion: function(question) {
    62             this.questionList.insertItem(question);
    63         },
    6456        _setupListView: function() {
    6557            this.questionList = new QuestionListView({
     
    6759            },this.surveyListViewNode);
    6860            this.questionList.startup();
     61        },
     62        _setupSurvey: function() {
     63            Deferred.when(store.get(this.surveyId))
     64            .then(lang.hitch(this,function(survey){
     65                this.survey = survey;
     66                store.query(null,{keys:this.survey.questions || [], include_docs: true})
     67                .forEach(lang.hitch(this.questionList,'appendItem'));
     68                this.refresh();
     69            }));
     70        },
     71        _includeQuestion: function(question) {
     72            this.questionList.insertItem(question);
    6973        },
    7074        refresh: function() {
     
    9498            store.put(this.survey)
    9599            .then(function() {
    96                 Controller.go('/surveys');
     100                Router.go('/surveys');
    97101            });
    98102            event.stop(evt);
     
    100104        },
    101105        _onDiscard: function(evt) {
     106            Router.go('/surveys');
    102107        },
    103108        _onShowPreview: function() {
    104             Controller.go('/viewSurvey/'+store.getIdentity(this.survey));
     109            Router.go('/viewSurvey/'+store.getIdentity(this.survey),{
     110                preview: true
     111            });
    105112        }
    106113    });
Note: See TracChangeset for help on using the changeset viewer.