Changeset 374
- Timestamp:
- 07/24/12 16:39:41 (13 years ago)
- Location:
- Dev/branches/rest-dojo-ui/client/rft
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/css/layout.css
r366 r374 288 288 } 289 289 .claro .dijitAccordionContainer { 290 height: 600; 290 291 /* No styling for now, use this for margins and other layout-related business. This class does not affect the look of the AccordionContainer currently! */ 291 292 } … … 480 481 } 481 482 483 /* AccountListView */ 484 .claro .rftAccountListView .rftLineWithButtons .rftLineWithButtonsTitle { 485 max-width: 400px; 486 overflow: auto; 487 } 482 488 /* Generic list with lines */ 483 489 .claro .rftLineListView { 484 width: 400px;490 max-width: 200px; 485 491 max-height: 500px; 486 492 } 487 493 .claro .rftLineListView .rftLineListViewContent { 488 max-width: 400px;494 max-width: 200px; 489 495 overflow: auto; 490 496 } -
Dev/branches/rest-dojo-ui/client/rft/pages/question.js
r372 r374 1 1 define(['dojo/_base/declare', 2 2 'dojo/_base/lang', 3 'dojo/_base/event', 3 4 'dojo/_base/Deferred', 4 5 'rft/ui/LineWithActionsWidget', … … 14 15 'rft/ui/QuestionEditorToolkit', 15 16 'dijit/form/FilteringSelect'], 16 function(declare, lang, Deferred, LineWithActionsWidget, store, _Page, api, content, registry, on, behavior, query){17 function(declare, lang, event, Deferred, LineWithActionsWidget, store, _Page, api, content, registry, on, behavior, query){ 17 18 return declare('rft.pages.question', [_Page], { 18 19 question: null, … … 37 38 }, 38 39 _refresh: function () { 39 this._toolkit.propertiesForm.set('value', this.question); 40 this._toolkit.loadQuestion(this.question); 41 }, 42 _onSave: function() { 43 lang.mixin(this.question, this._toolkit.propertiesForm.get('value')); 44 this.question.categories = this._toolkit._categories; 45 store.put(this.question) 46 .then(function() { 47 content.goTo('questions'); 48 }); 49 return false; 50 }, 51 _onDiscard: function() { 52 this._toolkit.propertiesForm.reset(); 53 content.goTo('questions'); 54 return false; 40 55 }, 41 56 _setupButtons: function() { … … 43 58 "#btnSave": { 44 59 onclick: lang.hitch(this, function(){ 45 this._ saveSurvey();60 this._onSave(); 46 61 }) 47 62 }, 48 63 "#btnDiscard": { 49 64 onclick: lang.hitch(this, function(){ 50 this._ restartEditor();65 this._onDiscard(); 51 66 }) 52 67 } -
Dev/branches/rest-dojo-ui/client/rft/pages/session.html
r369 r374 31 31 <br/><br/> 32 32 33 <div data-rft-attach-point="listViewNode" class="rft LineListView">33 <div data-rft-attach-point="listViewNode" class="rftAccountListView"> 34 34 </div> 35 35 </fieldset> -
Dev/branches/rest-dojo-ui/client/rft/pages/session.js
r371 r374 55 55 }, 56 56 _addAccount: function(item) { 57 if (!this.session.accounts) 58 this.session.accounts = []; 57 59 this.session.accounts.push(item); 58 60 this._listView.insertItem(item); -
Dev/branches/rest-dojo-ui/client/rft/run.js
r366 r374 30 30 'dojox/data/QueryReadStore', 31 31 'rft/elastic/ElasticReadStore', 32 'rft/ui/ListView', 32 'rft/ui/List', 33 'rft/ui/OrderedList', 33 34 'rft/ui/AccountListView', 34 35 'rft/ui/MainMenu', -
Dev/branches/rest-dojo-ui/client/rft/ui/AccountListView.js
r373 r374 7 7 'dijit/_Container', 8 8 'rft/ui/LineWithActionsWidget', 9 'rft/ui/ ListView',9 'rft/ui/OrderedList', 10 10 'dojo/text!./templates/AccountListView.html' 11 11 ],function( … … 22 22 return declare('rft.ui.AccountListView',[OrderedList,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{ 23 23 templateString: templateString, 24 baseClass: 'rft LineListView',24 baseClass: 'rftAccountListView', 25 25 region: 'center', 26 26 … … 58 58 }; 59 59 return fullItem; 60 } ,60 } 61 61 62 62 -
Dev/branches/rest-dojo-ui/client/rft/ui/List.js
r364 r374 1 1 define([ 2 2 'dojo/_base/declare', 3 'dojo/_base/lang', 3 4 'dijit/_WidgetBase', 4 5 'dijit/_TemplatedMixin', 5 6 'dijit/_WidgetsInTemplateMixin', 6 7 'dijit/_Container', 8 'rft/ui/LineWithActionsWidget', 7 9 'dojo/text!./templates/List.html' 8 10 ],function( 9 11 declare, 12 lang, 10 13 _WidgetBase, 11 14 _TemplatedMixin, 12 15 _WidgetsInTemplateMixin, 13 16 _Container, 17 LineWithActionsWidget, 14 18 templateString 15 19 ){ 16 20 return declare('rft.ui.List',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{ 17 21 templateString: templateString, 18 baseClass: 'rftList' 22 baseClass: 'rftList', 23 removeCallback: null, 24 creator: null, 25 26 constructor: function() { 27 lang.mixin(this, arguments); 28 }, 29 30 postCreate: function() { 31 if (this.title) { 32 this.titleNode.innerHTML = this.title; 33 } else { 34 this.domNode.removeChild(this.titleNode); 35 } 36 37 this.source = new dojo.dnd.Source(this.sourceNode, { 38 isSource: false, 39 accept: ["LineListViewItem"], 40 horizontal: false, 41 withHandles: false, 42 selfCopy: false, 43 selfAccept: true, 44 delay: 0, 45 singular: true, 46 creator: lang.hitch(this, this.creatorMethod) 47 }) 48 }, 49 50 removeItem: function(item, widget) { 51 widget.destroy(); 52 if(this.removeCallback) 53 this.removeCallback(item); 54 }, 55 56 insertItem: function(item) { 57 this.source.insertNodes(false, [item]); 58 } 59 19 60 }); 20 61 }); -
Dev/branches/rest-dojo-ui/client/rft/ui/OrderedList.js
r373 r374 6 6 'dijit/_WidgetsInTemplateMixin', 7 7 'dijit/_Container', 8 'dojo/text!./templates/List.html' 8 'rft/ui/List', 9 'dojo/text!./templates/OrderedList.html' 9 10 ],function( 10 11 declare, … … 14 15 _WidgetsInTemplateMixin, 15 16 _Container, 17 List, 16 18 templateString 17 19 ){ 18 return declare('rft.ui. List',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{20 return declare('rft.ui.OrderedList',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container,List],{ 19 21 templateString: templateString, 20 baseClass: 'rftList', 21 22 removeCallback: null, 23 24 constructor: function() { 25 lang.mixin(this, arguments); 26 }, 22 baseClass: 'rftLineListView', 27 23 28 24 postCreate: function() { … … 100 96 this.source.insertNodes(false, [item]); 101 97 } 102 },103 removeItem: function(item, widget) {104 widget.destroy();105 if(this.removeCallback)106 this.removeCallback(item);107 98 } 99 108 100 }); 109 101 }); -
Dev/branches/rest-dojo-ui/client/rft/ui/QuestionEditorToolkit.js
r372 r374 6 6 'dijit/_Container', 7 7 'dojo/dom-construct', 8 'rft/store', 8 9 'rft/ui/QuestionEditorPreviewItem', 10 'rft/ui/CategoryListView', 9 11 'dijit/_TemplatedMixin', 10 12 'dijit/_WidgetsInTemplateMixin', 13 'dijit/form/ComboBox', 11 14 'dojo/text!./templates/QuestionEditorToolkit.html' 12 ], function(declare, lang, baseArray, _WidgetBase, _Container, domConstruct, QuestionEditorPreviewItem, _TemplatedMixin, _WidgetsInTemplateMixin, template) {15 ], function(declare, lang, baseArray, _WidgetBase, _Container, domConstruct, store, QuestionEditorPreviewItem, CategoryListView, _TemplatedMixin, _WidgetsInTemplateMixin, ComboBox, template) { 13 16 return declare("rft.ui.QuestionEditorToolkit", [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _Container], { 14 17 15 18 templateString: template, 16 question: null, 19 _list: null, 20 _categorySelect: null, 21 _categoryStore: null, 22 _categories : null, 23 24 // constructor: function() { 25 // lang.mixin(this, arguments); 26 // }, 17 27 18 28 postCreate: function(){ … … 42 52 this.inputsSource.insertNodes(false, inputsItems); 43 53 }, 54 loadQuestion: function(question) { 55 this.propertiesForm.set('value', question); 56 this._categories = question.categories; 57 this._setupListView(); 58 this._setupAutoComplete(); 59 }, 60 onCategoryAdd: function() { 61 this._addCategory(this._categorySelect.get('displayedValue')); 62 this._categorySelect.reset(); 63 }, 44 64 _creator: function(item, hint) { 45 65 var node; … … 47 67 node = document.createElement("span"); 48 68 node.innerHTML = item.widgetType; 49 // debugger;50 69 return {node: node, data: item, type: "ToolkitItem"}; 51 70 } else { … … 60 79 } 61 80 }, 81 _setupListView: function() { 82 this._list = new CategoryListView( { 83 controller: this, 84 removeCallback: lang.hitch(this, this._removeCategory), 85 }).placeAt(this.listNode); 86 for (category in this._categories) { 87 this._list.insertItem(this._categories[category]); 88 } 89 this._list.startup(); 90 }, 91 _setupAutoComplete: function() { 92 this._categoryStore = new dojo.store.Memory({data: [] }); 93 store.query("_design/default/_view/questions", {reduce:true, group:false, group_level:1}) 94 .forPairs(lang.hitch(this, function(value, key) { 95 this._categoryStore.put({ category: key[0] }); 96 })); 97 this._categorySelect = new ComboBox( { 98 id: "categoriesBox", 99 name: "categories", 100 store: this._categoryStore, 101 searchAttr: "category" 102 }, "categoriesBox"); 103 104 this._topicStore = new dojo.store.Memory( {data: [] }); 105 store.query("_design/default/_view/questions", {reduce:true, group:true, group_level:2}) 106 .forPairs(lang.hitch(this, function(value, key) { 107 this._topicStore.put({ topic: key[1]}); 108 })); 109 this._topicSelect = new ComboBox( { 110 id: "topicBox", 111 name: "topic", 112 store: this._topicStore, 113 searchAttr: "topic" 114 }, "topicBox"); 115 }, 116 _addCategory: function(item) { 117 this._categories.push(item); 118 this._list.insertItem(item); 119 }, 120 _removeCategory: function(item) { 121 this._categories.splice(this._categories.indexOf(item), 1); 122 }, 62 123 _contentItems: function() { 63 124 // Returns an array of objects, from which to generate buttons to populate the ToolkitContentSource list. -
Dev/branches/rest-dojo-ui/client/rft/ui/templates/List.html
r364 r374 1 1 <div> 2 <div data-dojo-attach-point="containerNode"></div> 3 <div style="float: right;"> 4 <span>Move selected: </span> 5 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftBlockButton', iconClass:'rftIcon rftIconFullArrowUp'" class="trans"></button> 6 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftBlockButton', iconClass:'rftIcon rftIconFullArrowDown'" class="trans"></button> 7 </div> 2 <h3 data-dojo-attach-point="titleNode"></h3> 3 <div data-dojo-attach-point="sourceNode" id="source" class="${baseClass}Content"></div> 8 4 </div> -
Dev/branches/rest-dojo-ui/client/rft/ui/templates/QuestionEditorToolkit.html
r372 r374 5 5 <fieldset class="align"> 6 6 <label for="propertiesTitle">Title:</label><input data-dojo-type="dijit.form.TextBox" id="propertiesTitle" name="title"/> 7 <label for="propertiesCode">Code:</label><input data-dojo-type="dijit.form.TextBox" id="propertiesCode" name= "code"/> 8 <label for="propertiesCategories">Categories:</label><input data-dojo-type="dijit.form.FilteringSelect" id="propertiesCategories" name="categories"/> 9 <label for="propertiesTopic">Topic:</label><input data-dojo-type="dijit.form.FilteringSelect" id="propertiesTopic" name="topic"/> 10 <label for="propertiesDescription">Description:</label><textarea data-dojo-type="dijit.form.Textarea" id="propertiesDescription" name="description"></textarea> 7 <label for="propertiesCode">Code:</label><input data-dojo-type="dijit.form.TextBox" id="propertiesCode" name= "_id"/> 8 <label for="propertiesCategories">Categories:</label> 9 <div data-dojo-attach-point="listNode" class="rftLineListView"></div> 10 <select id="categoriesBox"></select> 11 <button data-rft-attach-point="btnCategory" data-dojo-type="dijit.form.Button" data-dojo-attach-event="onClick:onCategoryAdd" data-dojo-props="baseClass:'rftBlockButton', class:'orange', iconClass: 'rftIcon rftIconPlus'">Add</button><br> 12 <label for="propertiesTopic">Topic:</label> 13 <select id="topicBox"></select> 14 <label for="propertiesDescription">Description:</label><textarea data-dojo-type="dijit.form.TextBox" id="propertiesDescription" name="description"></textarea> 11 15 </fieldset> 12 16 </div>
Note: See TracChangeset
for help on using the changeset viewer.