Changeset 428


Ignore:
Timestamp:
04/10/13 20:08:44 (12 years ago)
Author:
hendrikvanantwerpen
Message:

Allow Selector to be a drag source.

Location:
Dev/trunk/client/qed
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/client/qed/css/layout.less

    r425 r428  
    273273
    274274                .rftLineListView {
    275                         max-width: 200px;
     275                        max-width: 300px;
    276276                        max-height: 500px;
    277277                       
  • Dev/trunk/client/qed/css/main.css

    r425 r428  
    466466}
    467467#rft.claro .rftLineListView {
    468   max-width: 200px;
     468  max-width: 300px;
    469469  max-height: 500px;
    470470}
  • Dev/trunk/client/qed/model/widgets/QuestionEditorToolkit.js

    r427 r428  
    118118                node = w.domNode;
    119119            }
    120             return {node: node, data: item, type: ["questionContent"]};
     120            return {
     121                node: node,
     122                data: item,
     123                type: ["questionContent"]
     124            };
    121125        },
    122126        _setupListView: function() {
  • Dev/trunk/client/qed/model/widgets/TabbedQuestionBrowser.js

    r417 r428  
    77    'dojox/widget/Standby',
    88    '../../store',
    9     '../../widgets/Selector',
    10     'dojo/domReady!'
     9    '../../widgets/Selector'
    1110],function(declare,lang,win,ContentPane,TabContainer,Standby,store,Selector){
    1211    return declare([TabContainer],{
     
    7574                    __category: category,
    7675                    __topic: topic,
     76                    dndType: "question",
    7777                    title: (topic || '[No topic]')+" ("+count+")",
    7878                    selectedActions: this.selectedActions,
  • Dev/trunk/client/qed/widgets/Selector.js

    r426 r428  
    11define([
    2     'dojo/_base/array',
    3     'dojo/_base/declare',
    4     'dojo/_base/event',
    5     'dojo/_base/lang',
    6     'dojo/dom-class',
    7     'dojo/fx',
    8     'dojo/query',
    9     'dijit/_Container',
    10     'dijit/_TemplatedMixin',
    11     'dijit/_WidgetBase',
    12     'dijit/_WidgetsInTemplateMixin',
    13     'dijit/registry',
    14     './LineWithActionsWidget',
    15     'dojo/text!./templates/Selector.html'
    16 ],function(
    17     baseArray,
    18     declare,
    19     event,
    20     lang,
    21     domClass,
    22     fx,
    23     query,
    24     _Container,
    25     _TemplatedMixin,
    26     _WidgetBase,
    27     _WidgetsInTemplateMixin,
    28     registry,
    29     LineWithActionsWidget,
    30     templateString
    31 ){
     2    "./LineWithActionsWidget",
     3    "dijit/_Container",
     4    "dijit/_TemplatedMixin",
     5    "dijit/_WidgetBase",
     6    "dijit/_WidgetsInTemplateMixin",
     7    "dijit/registry",
     8    "dojo/_base/array",
     9    "dojo/_base/declare",
     10    "dojo/_base/event",
     11    "dojo/_base/lang",
     12    "dojo/dnd/Source",
     13    "dojo/dom-class",
     14    "dojo/dom-construct",
     15    "dojo/fx",
     16    "dojo/query",
     17    "dojo/text!./templates/Selector.html"
     18], function(LineWithActionsWidget, _Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, registry, baseArray, declare, event, lang, Source, domClass, domConstruct, fx, query, templateString) {
     19
    3220    return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{
    3321        templateString: templateString,
     
    4129        //    description:
    4230        //    icon:
    43 
     31        dndType: null,
     32
     33        _source: null,
    4434        _folded: true,
    4535        _titleLine: null,
     
    5444            this._createTitleLine();
    5545            this._createSelectorLine();
     46            if (this.dndType) {
     47                this._createSource();
     48            }
    5649
    5750            fx.wipeOut({
     
    10396            this._selectorLine.on('click',lang.hitch(this, this.onToggle));
    10497        },
     98        _createSource: function() {
     99            this._source = new Source(this.optionsNode, {
     100                singular: true,
     101                delay: 5,
     102                selfAccept: false,
     103                copyOnly: true,
     104                withHandles: this.withHandles,
     105                creator: lang.hitch(this, "_createNode")
     106            });
     107        },
    105108        _onSelect: function(item, widget) {
    106109            this._selectedItem = item;
     
    149152        },
    150153
    151         addItem: function(item,displayTitle) {
     154        addItem: function(item) {
     155            if ( this._source ) {
     156                this._source.insertNodes(false,[item]);
     157            } else {
     158                var node = this._createLineNode(item);
     159                domConstruct.place(node, this.optionsNode, "last");
     160            }
     161        },
     162        _createNode: function(item, hint) {
     163            var node = hint === "avatar" ?
     164                    this._createAvatarNode(item) : this._createLineNode(item);
     165            return node && {
     166                node: node,
     167                data: lang.clone(item),
     168                type: [this.dndType]
     169            };
     170        },
     171        _createAvatarNode: function(item) {
     172            return domConstruct.create("div",{
     173                'class': 'dragAvatar',
     174                innerHTML: item.title
     175            });
     176        },
     177        _createLineNode: function(item) {
    152178            var actions = {};
    153179            var action;
     
    167193            }
    168194            var w = new LineWithActionsWidget({
    169                 title: displayTitle || item.title,
     195                title: item.title,
    170196                actions: actions
    171             }).placeAt(this.optionsNode);
     197            });
    172198            w.startup();
    173199            w.on("click", lang.hitch(this, this._onSelect, item, w));
     200            return w.domNode;
    174201        },
    175202
  • Dev/trunk/client/qed/widgets/list/List.js

    r426 r428  
    4949                node: node,
    5050                data: item,
    51                 type: this.type
     51                type: [this.type]
    5252            };
    5353        },
Note: See TracChangeset for help on using the changeset viewer.