Ignore:
Timestamp:
06/18/12 12:51:58 (13 years ago)
Author:
hendrikvanantwerpen
Message:

[Client] Changed store and pages to use CouchDB.
[Client] Disabled login for now, have to figure out some more details about CouchDB.

Location:
Dev/branches/rest-dojo-ui/client/rft/pages
Files:
3 edited

Legend:

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

    r316 r343  
    88            },
    99            onVisit: function() {
    10                 this._store = store.getStore('Question');
    1110                this._list = new AccordionList({
    1211                    actions: {
    1312                        'Edit': lang.hitch(this,'_editQuestion')
    1413                    },
    15                     idProperty: this._store.idProperty,
     14                    idProperty: store.idProperty,
    1615                    categoryProperty: 'category',
    1716                    titleProperty: 'title'
     
    2120            },
    2221            _refresh: function() {
    23                 Deferred.when(this._store.query())
     22                Deferred.when(store.query('_design/default/_view/by_type',{key: 'Question'}))
    2423                .then(lang.hitch(this,function(items){
    2524                    this._list.setItems(items);
     
    2726            },
    2827            onNewQuestion: function() {
    29                 Deferred.when( this._store.add({}) )
     28                Deferred.when(store.add({type:'Question'}))
    3029                .then(lang.hitch(this,function(question){
    3130                    this._editQuestion(question);
     
    3938            onSaveQuestion: function(evt) {
    4039                var value = this.questionWidget.get('value');
    41                 Deferred.when( this._store.put(value) )
     40                Deferred.when(store.put(value))
    4241                .then(lang.hitch(this,function(){
    4342                    this.questionDialog.hide();
  • Dev/branches/rest-dojo-ui/client/rft/pages/survey.js

    r316 r343  
    55        return declare('rft.pages.survey',[_Page],{
    66            object: null,
    7             postCreate: function() {
    8                 this.inherited(arguments);
    9                 this._surveyStore = store.getStore('Survey');
    10                 this._questionStore = store.getStore('Question');
    11             },
    127            onVisit: function() {
    138                if ( this.pageArgs.uid ) {
    14                     Deferred.when(this._surveyStore.get(this.pageArgs.uid))
     9                    Deferred.when(store.get(this.pageArgs.uid))
    1510                    .then(lang.hitch(this,function(obj){
    1611                        this.object = obj;
     
    2116                        this.creator.innerHTML = (obj && obj.email) || 'unknown';
    2217                    }));
    23                     Deferred.when(this._questionStore.query())
     18                    Deferred.when(store.query('_design/default/_view/by_type',{key:'Question'}))
    2419                    .then(lang.hitch(this,function(items){
    2520                        this._questionList = new AccordionList({
    26                             store: this._surveyStore,
    2721                            actions: {
    2822                                'Add': lang.hitch(this,'_addQuestion')
    2923                            },
    30                             idProperty: this._questionStore.idProperty,
    3124                            categoryProperty: 'category',
    3225                            titleProperty: 'title'
     
    4437            onSave: function(evt) {
    4538                lang.mixin(this.object,this.form.get('value'));
    46                 Deferred.when( this._store.put(this.object) )
     39                Deferred.when( store.put(this.object) )
    4740                .then(lang.hitch(this,function(obj){
    4841                    this.object = obj;
     
    5346                }));
    5447                event.stop(evt);
     48                evt.stopPropagation();
    5549                return false;
    5650            },
  • Dev/branches/rest-dojo-ui/client/rft/pages/surveys.js

    r303 r343  
    33        return declare('rft.pages.surveys',[_Page],{
    44            selectedObject: null,
    5             postCreate: function() {
    6                 this._store = store.getStore('Survey');
    7             },
    85            onVisit: function() {
    9                 this.grid.setStore(ObjectStore({objectStore: this._store}));
     6                this.grid.setStore(
     7                    ObjectStore({objectStore: store}),
     8                    "_design/default/_view/by_type",{key:'Survey'});
    109               
    1110                this.grid.on('rowclick',lang.hitch(this,function(evt){
     
    1615                this.grid.on('rowdblclick',lang.hitch(this,function(evt){
    1716                    var obj = evt.grid.getItem(evt.rowIndex);
    18                     content.goTo('/survey',{uid:obj.getUid()});
     17                    content.goTo('/survey',{uid:store.getIdentity(obj)});
    1918                }));
    2019                               
    2120                this.btnNew.on('click',lang.hitch(this,function(){
    22                     Deferred.when( this._store.add({'creator':auth.getUser()}) )
     21                    Deferred.when( store.add({type:'Survey',creator:auth.getUser()}) )
    2322                    .then(function(obj) {
    24                         content.goTo('/survey',{uid:obj.getUid()});
     23                        content.goTo('/survey',{uid:store.getIdentity(obj)});
    2524                    });
    2625                }));
     
    2827                this.btnEdit.on('click',lang.hitch(this,function(){
    2928                    if ( this.selectedObject ) {
    30                         content.goTo('/survey',{uid:this.selectedObject.getUid()});
     29                        content.goTo('/survey',{uid:store.getIdentity(this.selectedObject)});
    3130                    }
    3231                   
Note: See TracChangeset for help on using the changeset viewer.