source: Dev/branches/rest-dojo-ui/client/rft/ui/LineWithActionsWidget.js @ 288

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

[Client] MultipleChoiceWidget? for editing multiple choice questions
[Client] Move templates to separate directories.
[Client] Created QuestionWidget? to edit complete questions.
[Client] Fixed startup race condition where parsing was started before all classes were loaded.

File size: 1.2 KB
Line 
1define(['dojo/_base/declare','dojo/_base/lang','dijit/form/Button',
2    'dijit/_WidgetBase','dijit/_TemplatedMixin','dijit/_WidgetsInTemplateMixin',
3    'dojo/text!./templates/LineWithActionsWidget.html'],
4    function(declare,lang,Button,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,templateString){
5        return declare('rft.ui.LineWithActionsWidget',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{
6            templateString: templateString,
7            title: '',
8            userObject: null,
9            actions: {},
10            startup: function() {
11                this.inherited(arguments);
12                this._setupActions();
13                this.refresh();
14            },
15            _setupActions: function() {
16                for (var action in this.actions) {
17                    new Button({
18                        label: action,
19                        onClick: lang.hitch(this,function(){
20                            this.actions[action](this.userObject);
21                        })
22                    }).placeAt(this.actionBar);
23                }
24            },
25            refresh: function() {
26                this.titleNode.innerHTML = this.title;
27            }
28        });
29    });
Note: See TracBrowser for help on using the repository browser.