Changeset 354
- Timestamp:
- 07/09/12 19:24:56 (13 years ago)
- Location:
- Dev/branches/rest-dojo-ui/client
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/mSurveyAdvanced.html
r349 r354 43 43 'rft/ui/LineWithActionsWidgetThijs', 44 44 'rft/ui/TitleGroup', 45 'rft/ui/SurveyEditorPreview', 45 46 'dojo/domReady!' 46 47 ],function(parser){ … … 48 49 }); 49 50 50 function goToPage(name) {51 window.location = "http://localhost/RESEARCHTOOL/Dev/branches/rest-dojo-ui/client/"+name+".html";52 }53 51 </script> 54 52 </head> 55 53 56 <body class="dijitReset claro ">54 <body class="dijitReset claro blue"> 57 55 <div class="page" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> 58 56 <!-- Top menu bar --> … … 76 74 </div> 77 75 76 77 78 78 79 <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="region:'left', design:'headline'" style="width: 300px;"> 79 80 <!-- Left toolbar --> 80 81 <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> 81 82 <!--Accordion--> 82 <div data-dojo-type="dijit.layout.AccordionContainer" class="orange"> 83 <div data-dojo-type="dijit.layout.ContentPane" title="Included questions" data-dojo-props="iconClass: 'rftIcon rftIconQuestion'"> 84 <div data-dojo-type="rft.ui.List"> 85 <div data-dojo-type="rft.ui.LineWithActionsWidgetThijs" data-dojo-props="title:'Question 1', actions:{'remove':{callback: function(){}, properties: {blockButton: false, modifiers: 'white', icon: 'Delete'}}}"></div> 86 <div data-dojo-type="rft.ui.LineWithActionsWidgetThijs" data-dojo-props="title:'Question 1', actions:{'remove':{callback: function(){}, properties: {blockButton: false, modifiers: 'white', icon: 'Delete'}}}"></div> 87 <div data-dojo-type="rft.ui.LineWithActionsWidgetThijs" data-dojo-props="title:'Question 1', actions:{'remove':{callback: function(){}, properties: {blockButton: false, modifiers: 'white', icon: 'Delete'}}}"></div> 88 <div data-dojo-type="rft.ui.LineWithActionsWidgetThijs" data-dojo-props="title:'Question 1', actions:{'remove':{callback: function(){}, properties: {blockButton: false, modifiers: 'white', icon: 'Delete'}}}"></div> 83 <div data-dojo-type="dijit.layout.AccordionContainer" class="blue"> 84 <div data-dojo-type="dijit.layout.ContentPane" title="Content" data-dojo-props="iconClass:'rftIcon rftIconPlus'"> 85 <div data-dojo-type="dojo.dnd.Source" id="toolkitSource" data-dojo-props="skipForm: true, accept:[], selfAccept: false, copyOnly: true, horizontal: false, singular: true"> 86 89 87 </div> 90 </div>91 <div data-dojo-type="dijit.layout.ContentPane" title="Content" data-dojo-props="iconClass:'rftIcon rftIconPlus'">92 <!-- Content objects here -->93 88 </div> 94 89 </div> 95 90 </div> 96 <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'"> 97 <!--Buttons--> 98 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconAccept'">Save</button> 99 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconCancel'">Discard</button> 100 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconUndo'">Exit Design</button> 101 </div> 91 <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'" 92 > <!--Buttons--> 93 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconAccept'">Save</button> 94 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconCancel'">Discard</button> 95 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconUndo'">Exit Design</button> 96 </div> 97 </div> 98 99 100 101 102 103 104 <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> 105 <div data-dojo-type="rft.ui.SurveyEditorPreview" data-dojo-id="SurveyEditorPreview"> 106 <!-- Center preview/editor --> 102 107 </div> 103 108 104 <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="region:'center'"> 105 <!-- Center preview/editor --> 106 <div class="QuestionEditor"> 107 <div class="PreviewWindow">Content here</div> 108 </div> 109 </div> 109 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconPlus', onClick: function(){SurveyEditorPreview.InsertObjects([{data:{title: 'New item', description: 'Default', code: 'QAB01F'}, type: 'editorToolkitItem'}]);}">Add new</button> 110 110 </div> 111 111 </div> 112 112 </div> 113 </div> 113 114 </body> 114 115 </html> -
Dev/branches/rest-dojo-ui/client/rft/css/layout.css
r349 r354 281 281 /* Nothing yet, put preview window styling options here after we've decided on a format to follow! */ 282 282 } 283 284 283 .claro .dijitAccordionContainer { 285 284 /* No styling for now, use this for margins and other layout-related business. This class does not affect the look of the AccordionContainer currently! */ … … 339 338 } 340 339 341 342 /* THIS IS AN EXPERIMENT ! 343 * This will allow to set one top colour, then all the "objectBgColor" or "objectHlColor" objects below it will inherit that colour, and apply it to the relevant CSS property. 344 * Not applying these classes to an object will make it bypass the background settings. 345 */ 346 347 .claro div.blue.objectBgColor, 348 .claro .blue .objectBgColor { 349 background-color: #0072bc; 350 } 351 .claro div.lblue.objectBgColor, 352 .claro .lblue .objectBgColor { 340 /* Experimental background colour inheritance */ 341 .claro div.blue.inheritBgColor, 342 .claro .blue .inheritBgColor, 343 .claro.blue .inheritBgColor { 344 background-color: #0072bc; 345 } 346 .claro div.green.inheritBgColor, 347 .claro .green .inheritBgColor, 348 .claro.green .inheritBgColor { 349 background-color: #3aa605; 350 } 351 .claro div.orange.inheritBgColor, 352 .claro .orange .inheritBgColor, 353 .claro.orange .inheritBgColor { 354 background-color: #ff5b12; 355 } 356 .claro div.purple.inheritBgColor, 357 .claro .purple .inheritBgColor, 358 .claro.purple .inheritBgColor { 359 background-color: #6529b7; 360 } 361 .claro div.red.inheritBgColor, 362 .claro .red .inheritBgColor, 363 .claro.red .inheritBgColor { 364 background-color: #8c0310; 365 } 366 .claro div.trans.inheritBgColor, 367 .claro .trans .inheritBgColor, 368 .claro.trans .inheritBgColor { 369 background-color: transparent; 370 } 371 .claro div.blue.inheritBgColor.light, 372 .claro .blue .inheritBgColor.light, 373 .claro.blue .inheritBgColor.light { 353 374 background-color: #0794d1; 354 375 } 355 .claro div.orange.objectBgColor, 356 .claro .orange .objectBgColor { 357 background-color: #ff5b12; 358 } 359 .claro div.lorange.objectBgColor, 360 .claro .lorange .objectBgColor { 376 .claro div.green.inheritBgColor.light, 377 .claro .green .inheritBgColor.light, 378 .claro.green .inheritBgColor.light { 379 background-color: #79ca0a; 380 } 381 .claro div.orange.inheritBgColor.light, 382 .claro .orange .inheritBgColor.light, 383 .claro.orange .inheritBgColor.light { 361 384 background-color: #ff9140; 362 385 } 363 .claro div.green.objectBgColor, 364 .claro .green .objectBgColor { 365 background-color: #3aa605; 366 } 367 .claro div.lgreen.objectBgColor, 368 .claro .lgreen .objectBgColor { 369 background-color: #79ca0a; 370 } 371 .claro div.purple.objectBgColor, 372 .claro .purple .objectBgColor { 373 background-color: #6529b7; 374 } 375 .claro div.lpurple.objectBgColor, 376 .claro .lpurple .objectBgColor { 386 .claro div.purple.inheritBgColor.light, 387 .claro .purple .inheritBgColor.light, 388 .claro.purple .inheritBgColor.light { 377 389 background-color: #993dec; 378 390 } 379 .claro div.red.objectBgColor, 380 .claro .red .objectBgColor { 381 background-color: #8c0310; 382 } 383 .claro div.lred.objectBgColor, 384 .claro .lred .objectBgColor { 391 .claro div.red.inheritBgColor.light, 392 .claro .red .inheritBgColor.light, 393 .claro.red .inheritBgColor.light { 385 394 background-color: #bd0013; 386 395 } 387 /* TODO: Apply these classes to display elements that need to inherit the interface's object colour! 388 Remove/disable other references to these colours from files like rftButtons, rftLineWithButtons, etc to make sure it works properly. 389 Put these settings in a separate "colours.css" file to separate the concern of styling these objects from other layout-oriented properties. 390 When we add things like highlightColours, borders, etc, the list could become quite long, especially if more colours are added to the colour scheme in time. 391 */ 392 393 394 395 396 397 /* Dropdown menu on MenuBar*/ 396 397 /*TODO: Apply these classes to display elements that need to inherit the interface's object colour! 398 Remove/disable other references to these colours from files like rftButtons, rftLineWithButtons, etc to make sure it works properly. 399 Put these settings in a separate "colours.css" file to separate the concern of styling these objects from other layout-oriented properties. 400 When we add things like highlightColours, borders, etc, the list could become quite long, especially if more colours are added to the colour scheme in time. 401 402 403 Dropdown menu on MenuBar*/ 398 404 .claro .dijitMenuPopup { 399 405 400 406 } 401 407 .claro .dijitMenuPopup .dijitMenu { 402 border: none;403 background-color: #333333;404 background-image: none;405 color: #999999;408 border: none; 409 background-color: #333333; 410 background-image: none; 411 color: #999999; 406 412 } 407 413 .claro .dijitMenuPopup .dijitMenu .dijitMenuItem { … … 445 451 background-image: url('images/icons/rftIcons16b.png'); 446 452 } 453 454 455 456 457 /* Alignment */ 458 .claro .floatRight { 459 float: right; 460 margin: 0; 461 padding: 0; 462 } -
Dev/branches/rest-dojo-ui/client/rft/css/main.css
r346 r354 10 10 @import url('rftObjectBox.css'); 11 11 @import url('sessionEditor.css'); 12 @import url('surveyEditor.css'); -
Dev/branches/rest-dojo-ui/client/rft/pages/index.html
r347 r354 10 10 <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> 11 11 12 <div class="rftIndexMenuBlock" >12 <div class="rftIndexMenuBlock" title="Sessions"> 13 13 <div class="rftIndexMenuMask"> 14 14 <span class="rftIcon rftIconSession"></span><span class="label">Sessions</span> 15 15 </div> 16 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftIndexMenuButton', class: 'green twoHeight', iconClass: 'rftIcon rftIconPlus'" onClick="goToPage('mSessions');">Create and edit</button>17 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftIndexMenuButton', class: 'green twoHeight', iconClass: 'rftIcon rftIconForward'" onClick="goToPage('mSessions');">Facilitate</button>16 <button id="btnContentCreate" data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftIndexMenuButton', class: 'green twoHeight', iconClass: 'rftIcon rftIconPlus'">Create and edit</button> 17 <button id="btnContentFacilitate" data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftIndexMenuButton', class: 'green twoHeight', iconClass: 'rftIcon rftIconForward'">Facilitate</button> 18 18 </div> 19 19 20 <div class="rftIndexMenuBlock" >20 <div class="rftIndexMenuBlock" title="Content"> 21 21 <div class="rftIndexMenuMask"> 22 22 <span class="rftIcon rftIconInspect"></span><span class="label">Content</span> 23 23 </div> 24 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftIndexMenuButton', class: 'blue oneHeight', iconClass: 'rftIcon rftIconSurvey'" onClick="goToPage('mSurveys');">Surveys</button> 25 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftIndexMenuButton', class: 'orange oneHeight', iconClass: 'rftIcon rftIconQuestion'" onClick="goToPage('mQuestions');">Questions</button> 26 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftIndexMenuButton', class: 'purple oneHeight', iconClass: 'rftIcon rftIconApplication'" onClick="goToPage('mApplications');">Applications</button> 27 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftIndexMenuButton', class: 'red oneHeight', iconClass: 'rftIcon rftIconDashboard'" onClick="goToPage('mDashboards');">Dashboards</button> 28 24 <button id="btnSurveys" data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftIndexMenuButton', class: 'blue oneHeight', iconClass: 'rftIcon rftIconSurvey'">Surveys</button> 25 <button id="btnQuestions" data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftIndexMenuButton', class: 'orange oneHeight', iconClass: 'rftIcon rftIconQuestion'">Questions</button> 26 <button id="btnApplications" data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftIndexMenuButton', class: 'purple oneHeight', iconClass: 'rftIcon rftIconApplication'">Applications</button> 27 <button id="btnDashboards" data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftIndexMenuButton', class: 'red oneHeight', iconClass: 'rftIcon rftIconDashboard'">Dashboards</button> 29 28 </div> 30 29 31 <div class="rftIndexMenuBlock"> 32 <div data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftIndexMenuButton', class: 'blue fourHeight', iconClass: 'rftIcon rftIconGameData'" onClick="goToPage('mResults')">Results</div> 30 <div class="rftIndexMenuBlock" title="results"> 31 <div class="rftIndexMenuMask"> 32 <span class="rftIcon rftIconGameData"></span><span class="label">Results</span> 33 </div> 34 <button id="btnResults" data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftIndexMenuButton', class: 'blue fourHeight', iconClass: 'rftIcon rftIconGameData'">Results</button> 33 35 </div> 34 36 </div> 35 37 </div> 38 39 <script> 40 require([ 41 'dojo/on', 42 'dojo/query', 43 'dijit/registry', 44 'rft/content' 45 ], function(on, query, registry, content){ 46 registry.byId("btnSessionsCreate").on("click", function(){ 47 content.goTo("sessions", null); 48 }); 49 registry.byId("btnSessionsFacilitate").on("click", function(){ 50 content.goTo("sessions", null); 51 }); 52 53 registry.byId("btnSurveys").on("click", function(){ 54 content.goTo("surveys", null); 55 }); 56 registry.byId("btnQuestions").on("click", function(){ 57 content.goTo("questions", null); 58 }); 59 registry.byId("btnApplications").on("click", function(){ 60 content.goTo("applications", null); 61 }); 62 registry.byId("btnDashboards").on("click", function(){ 63 content.goTo("dashboards", null); 64 }); 65 66 registry.byId("btnResults").on("click", function(){ 67 content.goTo("results", null); 68 }); 69 70 }); 71 </script> 36 72 </div> -
Dev/branches/rest-dojo-ui/client/rft/pages/survey.html
r350 r354 1 <div data-dojo-type="rft.pages.survey" >1 <div data-dojo-type="rft.pages.survey" id="survey"> 2 2 <div data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="region:'center'" style="height: 500px;"> 3 3 <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"> 4 4 <h2> 5 5 <span class="rftIcon rftIconSurvey"></span> 6 <span class="headerText" >Survey A [editing]</span>6 <span class="headerText" data-dojo-attach-point="header">Survey A [editing]</span> 7 7 </h2> 8 8 </div> … … 11 11 Presets 12 12 </div> 13 <div data-dojo-type="dijit.layout.TabContainer" class="blue" data-dojo-props="tabPosition:'left-h',region:'center'"> 14 <div data-dojo-type="dijit.layout.ContentPane" title="Category One, this is a very long title to see how overflow works. This part is cut off because it passes two lines at 200px wide."> 15 <div data-dojo-type="rft.ui.Selector" data-dojo-props="Title:'Subcat one'"></div> 16 <div data-dojo-type="rft.ui.Selector" data-dojo-props="Title:'Subcat two'"></div> 17 </div> 18 <div data-dojo-type="dijit.layout.ContentPane" title="Category Two"> 19 <div data-dojo-type="rft.ui.Selector" data-dojo-props="Title:'Subcat one'"></div> 20 <div data-dojo-type="rft.ui.Selector" data-dojo-props="Title:'Subcat two'"></div> 21 </div> 22 <div data-dojo-type="dijit.layout.ContentPane" title="Category Three"> 23 <div data-dojo-type="rft.ui.Selector" data-dojo-props="Title:'Subcat one'"></div> 24 </div> 25 <div data-dojo-type="dijit.layout.ContentPane" title="Category Four"> 26 <div data-dojo-type="rft.ui.Selector" data-dojo-props="Title:'Green Question Subcat one'"></div> 27 <div data-dojo-type="rft.ui.Selector" data-dojo-props="Title:'Subcat two'"></div> 28 <div data-dojo-type="rft.ui.Selector" data-dojo-props="Title:'Subcat three'"></div> 29 </div> 30 <div data-dojo-type="dijit.layout.ContentPane" title="Category Five"> 31 <div data-dojo-type="rft.ui.Selector" data-dojo-props="Title:'Subcat one'"></div> 32 <div data-dojo-type="rft.ui.Selector" data-dojo-props="Title:'Subcat two'"></div> 33 <div data-dojo-type="rft.ui.Selector" data-dojo-props="Title:'Subcat three'"></div> 34 <div data-dojo-type="rft.ui.Selector" data-dojo-props="Title:'Subcat four'"></div> 35 </div> 13 <div id="tabList" data-dojo-type="dijit.layout.TabContainer" class="blue" data-dojo-props="tabPosition:'left-h',region:'center'"> 14 <!-- tabs go here --> 36 15 </div> 37 16 </div> … … 47 26 </div> 48 27 <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region: 'bottom'"> 49 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconProperties'">Properties</button>50 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconAccept'">Save Changes</button>51 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconCancel'">Discard changes</button>52 <button data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconPreview'">Preview</button>28 <button id="btnProperties" data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconProperties'">Properties</button> 29 <button id="btnSave" data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconAccept'">Save Changes</button> 30 <button id="btnDiscard" data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconCancel'">Discard changes</button> 31 <button id="btnPreview" data-dojo-type="dijit.form.Button" data-dojo-props="baseClass: 'rftLargeButton', iconClass: 'rftIcon rftIconPreview'">Preview</button> 53 32 </div> 54 33 </div> -
Dev/branches/rest-dojo-ui/client/rft/pages/survey.js
r343 r354 1 define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/event', 2 'dojo/_base/Deferred','rft/ui/AccordionList','rft/ui/LineWithActionsWidget', 3 'rft/store','rft/ui/_Page','rft/api'], 4 function(declare,lang,event,Deferred,AccordionList,LineWithActionsWidget,store,_Page,api){ 1 define(['dojo/_base/declare', 2 'dojo/_base/lang', 3 'dojo/_base/event', 4 'dojo/_base/Deferred', 5 'rft/ui/AccordionList', 6 'rft/ui/LineWithActionsWidget', 7 'rft/store', 8 'rft/ui/_Page', 9 'rft/api', 10 'dijit/registry', 11 'rft/content', 12 'dojo/on', 13 'dojo/query'], 14 function(declare,lang,event,Deferred,AccordionList,LineWithActionsWidget,store,_Page,api,registry,content, on, query){ 5 15 return declare('rft.pages.survey',[_Page],{ 6 16 object: null, … … 9 19 Deferred.when(store.get(this.pageArgs.uid)) 10 20 .then(lang.hitch(this,function(obj){ 11 this.object = obj; 12 this.setFields(obj); 13 return Deferred.when( obj.creator && store.dereference(obj.creator) ); 14 })) 15 .then(lang.hitch(this,function(obj){ 16 this.creator.innerHTML = (obj && obj.email) || 'unknown'; 17 })); 18 Deferred.when(store.query('_design/default/_view/by_type',{key:'Question'})) 19 .then(lang.hitch(this,function(items){ 20 this._questionList = new AccordionList({ 21 actions: { 22 'Add': lang.hitch(this,'_addQuestion') 23 }, 24 categoryProperty: 'category', 25 titleProperty: 'title' 26 },this.allQuestions); 27 this._questionList.startup(); 28 this._questionList.setItems(items); 29 })); 21 this.object = obj; 22 return Deferred.when( obj.creator && store.dereference(obj.creator) ); 23 })); 24 this._createQuestionBrowser(); 30 25 } else { 31 this.header.innerHTML = "Error: no uid for survey!"26 //this.header.innerHTML = "Error: no uid for survey!" 32 27 } 28 this._setupButtons(this); 29 this._insertQuestion({title: "This is the question title!", sorting: {categories: ['CategoryOne', 'CategoryB123'], topic: 'The first question topic'}}); 30 this._insertQuestion({title: "BLablabla question text!", sorting: {categories: ['CategoryOne'], topic: 'The first question topic'}}); 31 this._insertQuestion({title: "Yaddayaddayaddaa ... sigh", sorting: {categories: ['CategoryThree', 'CategoryB123'], topic: 'Another topic'}}); 32 }, 33 onLeave: function() { 34 this.inherited(arguments); 33 35 }, 34 36 onReset: function() { … … 36 38 }, 37 39 onSave: function(evt) { 38 lang.mixin(this.object,this.form.get('value'));40 /*lang.mixin(this.object,this.form.get('value')); 39 41 Deferred.when( store.put(this.object) ) 40 42 .then(lang.hitch(this,function(obj){ … … 48 50 evt.stopPropagation(); 49 51 return false; 52 */ 50 53 }, 51 setFields: function(obj) { 52 this.form.reset(); 53 this.header.innerHTML = "Edit survey '"+(obj.title || '(undefined)')+"'"; 54 obj && this.form.set('value',obj); 54 _goToPreview: function() { 55 content.goTo('surveyAdvanced', {uid: this.object._id}); 56 /* 57 * TODO: How to prevent widgets with identical id's on different pages clashing? 58 * For example: btnSave clashes when going from survey to surveyAdvanced, since both contain one. survey.btnSave is not destroyed when loading surveyAdvanced.btnSave! 59 * Since there is no page reload, only a contentPane content swap! 60 * Talk to Hendrik about this! 61 * TEMPORARY FIX IN THIS.ONLEAVE! 62 */ 55 63 }, 56 _addQuestion: function(obj) { 57 var d = {}; 58 d.widget = new LineWithActionsWidget({ 59 title:obj.title, 60 userObj: obj, 61 actions:{ 62 "Remove": lang.hitch(this,'_removeQuestion',d) 64 _setupButtons: function() { 65 // Setup button events 66 registry.byId("btnSave").on("click", lang.hitch(this, function(){ 67 this.onSave(arguments); 68 })); 69 registry.byId("btnPreview").on("click", lang.hitch(this, function(){ 70 this._goToPreview(); 71 })); 72 }, 73 _createQuestionBrowser: function() { 74 Deferred.when(store.query('_design/default/_view/by_type',{key:'Question'})) 75 .then(lang.hitch(this,function(questions){ 76 questions.forEach(function(question) { 77 this._insertQuestion(question); 78 }, this); 79 })); 80 }, 81 _insertQuestion: function(question) { 82 // MASSIVE TODO: The question categories cannot have spaces currently, due to the way we append them to the ID property of the container. ID's cannot have spaces. 83 // Easy fix: Replace spaces with underscores for the time being? The alternative is to make these containers have an actual "questioncategory" property in the governing widget. Not fun. 84 var tabs = registry.byId("tabList"); 85 for (var c in question.sorting.categories) { 86 var cat = question.sorting.categories[c]; 87 var catPane = query("#tab"+cat, tabs.containerNode)[0]; 88 if (catPane) { 89 this._insertIntoCategory(question, catPane); 90 } else { 91 catPane = this._createCategoryTab(cat); 92 if (catPane) { 93 this._insertIntoCategory(question, catPane); 94 } else { 95 throw "Error: could not find or create category pane!"; 96 } 63 97 } 98 } 99 }, 100 _createCategoryTab: function(category) { 101 var tabs = registry.byId("tabList"); 102 var newCat = new dijit.layout.ContentPane({ 103 title: category 64 104 }); 65 d.widget.placeAt(this.surveyQuestions); 105 newCat.domNode.id = "tab"+category; 106 tabs.addChild(newCat); 107 var pane = query("#tab"+category, tabs.containerNode)[0]; 108 return (pane) ? pane : false; 66 109 }, 67 _removeQuestion: function(data,obj) { 68 data.widget.destroy(); 69 } 110 _insertIntoCategory: function(question, container) { 111 debugger; 112 var selector = query(".rftSelector[title='"+question.sorting.topic+"']", container)[0]; 113 var selectorWidget; 114 if (selector) { 115 selectorWidget = registry.byNode(selector); 116 117 } else { 118 selectorWidget = new rft.ui.Selector({ 119 title: question.sorting.topic 120 }); 121 selectorWidget.placeAt(container); 122 } 123 selectorWidget.addQuestion(question); 124 }, 125 126 127 128 70 129 }); 71 130 }); 72 131 -
Dev/branches/rest-dojo-ui/client/rft/run.js
r350 r354 44 44 'rft/pages/surveys', 45 45 'rft/pages/survey', 46 'rft/pages/surveyAdvanced' 46 47 ], 47 48 function(win,parser,LoginDialog,dom,connect,auth,content) { -
Dev/branches/rest-dojo-ui/client/rft/ui/Selector.js
r350 r354 26 26 title: "The professional as a participant", 27 27 baseClass: 'rftSelector', 28 modifiers: 'blue', // Extra CSS classes28 modifiers: 'blue', 29 29 postCreate: function() { 30 30 domClass.add(this.domNode, this.modifiers); 31 31 domClass.add(this.selectedColorNode, "pending"); 32 var infoFunction = function() { 33 alert("Show info here"); 34 } 32 35 33 new LineWithActionsWidget({ 36 34 title: this.title, … … 48 46 } 49 47 },this.titleNode); 50 var selectorLine = new LineWithActionsWidget({ 48 49 this.selectorLine = new LineWithActionsWidget({ 51 50 title: 'None', 52 51 modifiers: this.modifiers, 53 52 actions: { 54 53 "ToggleDropdown" : { 55 callback: lang.hitch(this,function(){ 56 var node = this.optionsNode; 57 var show = fx.wipeIn({ 58 node: node 59 }); 60 var hide = fx.wipeOut({ 61 node: node 62 }); 63 hide.play(); 64 var folded = true; 65 return function(e) { 66 if ( folded ) { 67 // Bit of an ugly solution, really. Limit workload by limiting search to child elements of selecorLine.buttonsNode 68 var downArrowIcon = dojo.query(".rftBlockButton .rftIconHalfArrowDown", selectorLine.buttonsNode)[0]; // Query the down arrow rftIcon span 69 if (downArrowIcon){ 70 domClass.replace(downArrowIcon, "rftIconHalfArrowUp", "rftIconHalfArrowDown"); 71 } 72 show.play(); 73 folded = false; 74 } else { 75 // Bit of an ugly solution, really. Limit workload by limiting search to child elements of selecorLine.buttonsNode 76 var upArrowIcon = dojo.query(".rftBlockButton .rftIconHalfArrowUp", selectorLine.buttonsNode)[0]; // Query the up arrow rftIcon span 77 if (upArrowIcon){ 78 domClass.replace(upArrowIcon, "rftIconHalfArrowDown", "rftIconHalfArrowUp"); 79 } 80 hide.play(); 81 folded = true; 82 83 } 84 e.preventDefault(); 85 e.stopPropagation(); 86 }; 87 })(), 54 callback: lang.hitch(this, this._toggleDropdown()), 88 55 properties: { 89 56 blockButton: true, … … 95 62 } 96 63 },this.selectedItemNode); 64 }, 65 _toggleDropdown: function(selectorLine) { 66 var node = this.optionsNode; 67 var show = fx.wipeIn({ 68 node: node 69 }); 70 var hide = fx.wipeOut({ 71 node: node 72 }); 73 hide.play(); 74 var folded = true; 75 return function(e) { 76 if ( folded ) { 77 var downArrowIcon = dojo.query(".rftBlockButton .rftIconHalfArrowDown", this.selectorLine.buttonsNode)[0]; 78 if (downArrowIcon){ 79 domClass.replace(downArrowIcon, "rftIconHalfArrowUp", "rftIconHalfArrowDown"); 80 } 81 show.play(); 82 folded = false; 83 } else { 84 var upArrowIcon = dojo.query(".rftBlockButton .rftIconHalfArrowUp", this.selectorLine.buttonsNode)[0]; 85 if (upArrowIcon){ 86 domClass.replace(upArrowIcon, "rftIconHalfArrowDown", "rftIconHalfArrowUp"); 87 } 88 hide.play(); 89 folded = true; 90 91 } 92 e.preventDefault(); 93 e.stopPropagation(); 94 }; 95 }, 96 addQuestion: function(question) { 97 97 new LineWithActionsWidget({ 98 title: 'Are there direct colleagues among the other participants?', 98 title: question.title, 99 question: question, 99 100 actions: { 100 101 "InfoHover" : { 101 callback: infoFunction,102 callback: this.infoFunction, 102 103 properties: { 103 104 blockButton: false, … … 108 109 } 109 110 }).placeAt(this.optionsNode); 111 }, 112 infoFunction: function(){ 113 alert("Some info here!");text 110 114 } 111 115 }); 112 116 }); -
Dev/branches/rest-dojo-ui/client/rft/ui/_Page.js
r292 r354 35 35 onVisit: function(){}, 36 36 /** Event fired before leaving the page. Return false to prevent */ 37 onLeave: function(){} 37 onLeave: function(){ 38 dijit.findWidgets(this.domNode).forEach(function(w){ 39 w.destroyRecursive(false); 40 }); 41 } 38 42 }); 39 43 });
Note: See TracChangeset
for help on using the changeset viewer.