Changeset 477 for Dev/trunk/src/client/qed-client
- Timestamp:
- 08/06/13 01:48:17 (12 years ago)
- Location:
- Dev/trunk/src/client/qed-client
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/client/qed-client/css/fonts.less
r447 r477 3 3 font-size: @font_size; 4 4 color: @text; 5 &.light { 6 color: black; // FIXME : hack for readability 7 } 5 8 6 9 a { -
Dev/trunk/src/client/qed-client/css/layout.less
r443 r477 7 7 height: 100%; 8 8 background-color: @base; 9 .light { 10 background-color: white; // FIXME : hack for readability 11 } 9 12 } -
Dev/trunk/src/client/qed-client/model/widgets/TabbedQuestionBrowser.js
r443 r477 78 78 title: (topic || '[No topic]')+" ("+count+")", 79 79 selectedActions: this.selectedActions, 80 itemActions: this.itemActions 80 itemActions: this.itemActions, 81 itemTitle: this._itemTitle 81 82 }).placeAt(categoryMap._widget.containerNode); 82 83 w.startup(); … … 87 88 } 88 89 }, 90 _itemTitle: function(item) { 91 var title = '['+item.code+']'+item.title; 92 if ( this.include === 'all' ) { 93 title += (item.publicationDate?' (published on '+item.publicationDate+')':' (unpublished)'); 94 } 95 return title; 96 }, 89 97 _fillTopicSelector: function(topic,category) { 90 98 var categoryMap = this._dataMap[category]; … … 93 101 topicMap._filled = true; 94 102 this._busy(); 95 store.query(this._query, {reduce:false,include_docs:true,key:[category,topic]}) 96 .forEach(lang.hitch(this,function(value){ 97 var title; 98 if ( this.include === 'all' ) { 99 title = value.title+(value.publicationDate?' (published on '+value.publicationDate+')':' (unpublished)'); 100 } 101 topicMap._widget.addItem(value,title); 103 store.query(this._query, { 104 reduce:false, 105 include_docs:true, 106 key:[category,topic] 107 }).forEach(lang.hitch(this,function(value){ 108 topicMap._widget.addItem(value); 102 109 })).then(lang.hitch(this,function(){ 103 110 this._done(); -
Dev/trunk/src/client/qed-client/pages/response.js
r461 r477 9 9 "dojo/_base/declare", 10 10 "dojo/_base/event", 11 "dojo/_base/json", 11 12 "dojo/_base/lang", 12 13 "dojo/promise/all", 14 "dojo/request", 13 15 "dojo/when", 14 16 "require", 15 17 "dojo/text!./templates/response.html" 16 ], function(Content, Page, async, Response, Survey, SurveyRun, store, declare, event, lang, all, when, require, template) {18 ], function(Content, Page, async, Response, Survey, SurveyRun, store, declare, event, json, lang, all, request, when, require, template) { 17 19 return declare([Page],{ 18 20 contextRequire: require, … … 37 39 this._enableSubmit(); 38 40 } 39 }), function() {41 }), lang.hitch(this,function() { 40 42 this._showInfo("<div>The url seems to be incorrect, no survey found.</div>"); 41 }) ;43 })); 42 44 } else { 43 45 throw new Error("No valid uid or survey passed!"); … … 45 47 }, 46 48 _loadSurveyAndResponse: function(surveyRunId,responseId){ 47 return all([store.get(surveyRunId),store.get(responseId)]) 49 return all([request.get('/api/surveyRuns/'+surveyRunId,{handleAs:'json'}), 50 request.get('/api/responses/'+responseId,{handleAs:'json'})]) 48 51 .then(lang.hitch(this,function(surveyAndResponse){ 49 52 var surveyRun = surveyAndResponse[0]; … … 73 76 var answers = this.surveyWidget.get('value'); 74 77 this.response.answers = answers; 75 return store.put(this.response).then(function(){ 78 return request.put('/api/responses/'+store.getIdentity(this.response),{ 79 handleAs:'json', 80 data:json.toJson(this.response), 81 headers:{"Content-Type": "application/json"} 82 }).then(function(){ 76 83 Content.notify("Your response is saved."); 77 84 }, function(err){ … … 82 89 this.response.publicationDate = store.timestamp(); 83 90 this._getAnswersAndSaveResponse() 84 .then( function(){91 .then(lang.hitch(this,function(){ 85 92 this._showInfo("<div>Thanks for filling in the survey. You cannot edit your answers anymore.</div>"); 86 93 this._disableSubmit(); 87 }) ;94 })); 88 95 if ( e ) { event.stop(e); } 89 96 return false; -
Dev/trunk/src/client/qed-client/response.js
r443 r477 1 1 define([ 2 'dojo/date', 3 'dojo/date/locale', 4 'dojo/hash', 5 'dojo/parser', 6 './store', 7 './app/Content', 8 './app/Page', 9 './app/Path', 10 './lib/async', 11 './model/classes/Response', 12 './model/classes/SurveyRun', 13 './pages/response', 14 'dojo/domReady!', 15 './stddeps' 16 ],function(date,locale,hash,parser,store,Content,Page,Path,async,Response,SurveyRun,ResponsePage) { 2 "./app/Content", 3 "./app/Page", 4 "./app/Path", 5 "./lib/async", 6 "./model/classes/Response", 7 "./model/classes/SurveyRun", 8 "./pages/response", 9 "./store", 10 "dojo/_base/json", 11 "dojo/date", 12 "dojo/date/locale", 13 "dojo/hash", 14 "dojo/parser", 15 "dojo/request", 16 "./stddeps", 17 "dojo/domReady!" 18 ], function(Content, Page, Path, async, Response, SurveyRun, ResponsePage, store, json, date, locale, hash, parser, request) { 17 19 parser.parse(); 18 20 Content.startup(); … … 49 51 } 50 52 51 store.get(surveyRunId)53 request.get('/api/surveyRuns/'+surveyRunId,{handleAs:'json'}) 52 54 .then(function(surveyRun){ 53 55 checkDates(surveyRun); … … 58 60 var response = Response.create(); 59 61 response.surveyRunId = surveyRunId; 60 return store.put(response).then(function(res){ 61 return store.getIdentity(res); 62 return request.post('/api/responses',{ 63 handleAs:'json', 64 data:json.toJson(response), 65 headers:{"Content-Type": "application/json"} 66 }).then(function(res){ 67 return res.id; 62 68 }); 63 69 } else { -
Dev/trunk/src/client/qed-client/widgets/Selector.js
r472 r477 18 18 ], function(LineWithActionsWidget, _Container, _TemplatedMixin, _WidgetBase, _WidgetsInTemplateMixin, registry, baseArray, declare, event, lang, Source, domClass, domConstruct, fx, query, templateString) { 19 19 20 function get(selector, item) { 21 if ( lang.isFunction(selector) ) { 22 return selector(item); 23 } else { 24 return item[selector || 'title']; 25 } 26 } 27 20 28 return declare([_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,_Container],{ 21 29 templateString: templateString, … … 25 33 selectedActions: null, 26 34 itemActions: null, 35 itemTitle: 'title', 27 36 // main selector action: Object 28 37 // title: … … 111 120 this._selectedItem = item; 112 121 this.onToggle(); 113 this._selectorLine.set("title", item.title);122 this._selectorLine.set("title", get(this.itemTitle,item)); 114 123 baseArray.forEach(this.optionsNode.childNodes, function(node){ 115 124 var line = registry.byNode(node); … … 174 183 return domConstruct.create("div",{ 175 184 'class': 'dragAvatar', 176 innerHTML: item.title185 innerHTML: get(this.itemTitle,item) 177 186 }); 178 187 }, … … 197 206 } 198 207 var w = new LineWithActionsWidget({ 199 title: item.title,208 title: get(this.itemTitle,item), 200 209 actions: actions 201 210 });
Note: See TracChangeset
for help on using the changeset viewer.