Changeset 275 for Dev/branches
- Timestamp:
- 02/21/12 13:03:21 (13 years ago)
- Location:
- Dev/branches/rest-dojo-ui
- Files:
-
- 4 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/pages/questions.html
r274 r275 4 4 <div data-dojo-type="dijit.layout.AccordionContainer" data-dojo-props="doLayout: false" style="width: 100%; height: 100%;" data-rft-attach-point="accordion"> 5 5 </div> 6 <div data-dojo-type="dijit.Dialog" title="Question" data-rft-attach-point="questionDialog" style="width: 400px; height: 300px;">6 <div data-dojo-type="dijit.Dialog" title="Question" data-rft-attach-point="questionDialog"> 7 7 <form data-dojo-type="dijit.form.Form" data-rft-attach-point="questionForm" data-rft-attach-event="onSubmit:onSaveQuestion"> 8 8 <fieldset> -
Dev/branches/rest-dojo-ui/client/rft/pages/questions.js
r274 r275 1 1 define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/array','dojo/_base/event', 2 2 'dojo/_base/Deferred','dojo/store/JsonRest','dijit/layout/ContentPane', 3 'rft/ui/_Page','rft/ui/ QuestionWidget'],4 function(declare,lang,array,event,Deferred,JsonRest,ContentPane,_Page, QuestionWidget) {3 'rft/ui/_Page','rft/ui/LineWithActionsWidget'], 4 function(declare,lang,array,event,Deferred,JsonRest,ContentPane,_Page,LineWithActionsWidget) { 5 5 return declare('rft.pages.questions',[_Page],{ 6 6 constructor: function() { … … 26 26 if ( !categoryContainer ) { 27 27 var ac = new ContentPane({ 28 title:category 28 title:category, 29 doLayout: false 29 30 }); 30 31 categoryContainer = this.containers[category] = { … … 40 41 var question = this.questions[uid]; 41 42 if ( !question ) { 42 var qw = new QuestionWidget({ 43 question: q 43 var qw = new LineWithActionsWidget({ 44 title: q.title, 45 userObject: q, 46 actions: { 47 'Edit': lang.hitch(this,'_editQuestion') 48 } 44 49 }); 45 50 qw.startup(); … … 48 53 widget: qw 49 54 } 55 } else { 56 // update info 57 question.question = q; 58 question.widget.title = q.title; 59 question.widget.userObject = q; 60 question.widget.refresh(); 50 61 } 51 62 var container = this._getContainerForQuestion(q); 52 63 question.widget.placeAt(container.containerNode); 53 container.resize();54 64 }, 55 65 onNewQuestion: function() { 56 66 Deferred.when( this._store.add({}) ) 57 67 .then(lang.hitch(this,function(question){ 58 this.questionForm.reset(); 59 this.questionForm.set('value',question); 60 this.questionDialog.show(); 68 this._editQuestion(question); 61 69 })); 70 }, 71 _editQuestion: function(question) { 72 this.questionForm.reset(); 73 this.questionForm.set('value',question); 74 this.questionDialog.show(); 62 75 }, 63 76 onSaveQuestion: function(evt) { -
Dev/branches/rest-dojo-ui/client/rft/run.js
r274 r275 16 16 'rft/ui/MenuBarLink', 17 17 'rft/ui/MenuLink', 18 'rft/ui/ QuestionWidget',18 'rft/ui/LineWithActionsWidget', 19 19 'rft/pages/questions' // could this be done dynamically? 20 20 ]); -
Dev/branches/rest-dojo-ui/client/rft/ui/LineWithActionsWidget.html
r274 r275 1 1 <div> 2 <h2>Question</h2> 3 <table> 4 <tr><td>Code</td><td data-dojo-attach-point="codeField"></td></tr> 5 <tr><td>Title</td><td data-dojo-attach-point="titleField"></td></tr> 6 <tr><td>Description</td><td data-dojo-attach-point="descriptionField"></td></tr> 7 </table> 2 <span data-dojo-attach-point="actionBar"></span> 3 <span data-dojo-attach-point="titleNode"></span> 8 4 </div> -
Dev/branches/rest-dojo-ui/client/rft/ui/LineWithActionsWidget.js
r274 r275 1 define(['dojo/_base/declare','d ijit/_WidgetBase','dijit/_TemplatedMixin','dijit/_WidgetsInTemplateMixin','dojo/text!rft/ui/QuestionWidget.html'],2 function(declare, _WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,templateString){3 return declare('rft.ui. QuestionWidget',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{1 define(['dojo/_base/declare','dojo/_base/lang','dijit/form/Button','dijit/_WidgetBase','dijit/_TemplatedMixin','dijit/_WidgetsInTemplateMixin','dojo/text!rft/ui/LineWithActionsWidget.html'], 2 function(declare,lang,Button,_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,templateString){ 3 return declare('rft.ui.LineWithActionsWidget',[_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin],{ 4 4 templateString: templateString, 5 question: null, 5 title: '', 6 userObject: null, 7 actions: {}, 6 8 startup: function() { 7 if ( this.question ) { 8 this.codeField.innerHTML = this.question.code; 9 this.titleField.innerHTML = this.question.title; 10 this.descriptionField.innerHTML = this.question.description; 9 this.inherited(arguments); 10 this._setupActions(); 11 this.refresh(); 12 }, 13 _setupActions: function() { 14 for (var action in this.actions) { 15 new Button({ 16 label: action, 17 onClick: lang.hitch(this,function(){ 18 this.actions[action](this.userObject); 19 }) 20 }).placeAt(this.actionBar); 11 21 } 22 }, 23 refresh: function() { 24 this.titleNode.innerHTML = this.title; 12 25 } 13 26 }); -
Dev/branches/rest-dojo-ui/server/api.php
r274 r275 142 142 } 143 143 144 function put($request) { 145 return $this->post($request); 146 } 147 144 148 } 145 149 … … 171 175 } 172 176 173 function p ut($request) {177 function post($request) { 174 178 $response = new Response($request); 175 179 restore_session($response); … … 204 208 $response->body = $object; 205 209 return $response; 210 } 211 212 function put($request) { 213 return $this->post($request); 206 214 } 207 215
Note: See TracChangeset
for help on using the changeset viewer.