source: Dev/branches/rest-dojo-ui/client/rft/pages/questions.js @ 403

Last change on this file since 403 was 370, checked in by hendrikvanantwerpen, 13 years ago

Seperated question browser in TabbedQuestionBrowser? widget.
Made configuring Selector actions more flexible (both for top actions and item actions).
Fixed lowercase/uppercase problem in SurveyListView?.
Fixed whitespace and toolyip in LineWithActionsWidget?.
Added question browser to questions page. Removed the old dialog that was there and redirect to questionEditor page.

File size: 1.6 KB
Line 
1define([
2    'dojo/_base/declare',
3    'dojo/_base/Deferred',
4    'dojo/_base/event',
5    'dojo/_base/lang',
6    'rft/content',
7    'rft/store',
8    'rft/ui/_Page',
9    'rft/ui/TabbedQuestionBrowser'
10    ],function(declare,Deferred,event,lang,content,store,_Page,TabbedQuestionBrowser) {
11        return declare('rft.pages.questions',[_Page],{
12            constructor: function() {
13                this.inherited(arguments);
14            },
15            onVisit: function() {
16                this.questionBrowser = new TabbedQuestionBrowser({
17                    region: 'center',
18                    'class': 'blue',
19                    itemActions: {
20                        'Edit': {
21                            callback: lang.hitch(this,"onEditQuestion"),
22                               icon: 'Edit',
23                               description: 'Edit question'
24                        }
25                    }
26                },this.questionBrowser);
27                this.questionBrowser.startup();
28            },
29            _refresh: function() {
30                Deferred.when(store.query('_design/default/_view/by_type',{key: 'Question'}))
31                .then(lang.hitch(this,function(items){
32                    this._list.setItems(items);
33                }));
34            },
35            onNewQuestion: function() {
36                Deferred.when(store.add({type:'Question'}))
37                .then(lang.hitch(this,function(question){
38                    this.onEditQuestion(question);
39                }));
40            },
41            onEditQuestion: function(question) {
42                content.goTo("question", {uid: question._id});
43            }
44        });
45});
Note: See TracBrowser for help on using the repository browser.