Commit 01021c2f0be8d18fa025d052456c1a5ed1c0a7e3

  • Tree SHA1: b9a7d51
  • Parent SHA1: e319d5d (Removing left over code from the previous<a95188bbfca8e102d4ba4142deb3f73160fadab6> merge.)
  • raw diff | raw patch
Fix bugs and UI issues

  - The annotator editing interface had some bugs regarding selecting fields
    like comment, title, tags etc.
  - Fix some UI issues.
  
1body {
2 overflow-y: scroll;
3}
4/* styles modifying annotorious editor default styles */
5.annotorious-editor {
6 min-width: 250px;
7}
8.annotorious-editor-text {
9 font-size: 12px;
10 min-height: 35px;
11}
12
13
114#swt-maker {
215}
316#signinview {
  
217217 },
218218 error: function(jqxhr, error, text) {
219219 console.log(jqxhr, error, text);
220 swtr.appView.$overlay.hide();
221 swtr.appView.helpview.step(10);
220222 }
221223 });
222224 } catch(e) {
337337 swtr.sweets.getAll({
338338 where: this.imgURL,
339339 success: function(data) {
340 console.log(data);
341340 if(_.isArray(data)) {
342 console.log('data is array');
343341 swtr.sweets.add(data);
344342 _.each(data, function(swt) {
345343 swt.how['editable'] = false;
346 /*if(typeof swt.how.text === 'object') {
347 swt.how.text1 = swt.how.text;
348 swt.how.text = '\n - by ' + swt.who;
349 } else {
350 swt.how.text1 = undefined;
351 swt.how.text += '\n -by ' + swt.who;
352 }*/
353344 swt.how.text = self.createPopupText(swt.how);
354345 swt.how.text += '\n - by ' + swt.who;
355 //console.log(swt.how);
356346 anno.addAnnotation(swt.how);
357347 });
358348 self.$overlay.hide();
399399 console.log('hideOriginalEditor()');
400400 var self = swtr.appView;
401401 self.new_anno = {};
402 $('.annotorious-editor-text').hide();
402 //$('.annotorious-editor-text').hide();
403403 //$('.annotorious-editor').css('width', '100%');
404 //window.annotation = annotation; // to use annotation.shape in new_anno
405 //annotation.text = {}; // creating new text object - to contain comments, labels, links and tags
406404 },
407405
408406 //dropdown event
409407 getFormValue: function(event) {
410408 console.log('getFormValue()');
409
411410 var self = swtr.appView;
412411 // show the editor field to input text
413412 var $anno_form = $('.annotorious-editor-text');
414 $anno_form.slideDown();
413 //$anno_form.slideDown();
415414 // get the previous item entered
416415 var $selected = $('select option:selected');
417416 var text_input = $anno_form.val();
418 if(text_input && !($selected.prev().text() === "Tags")) {
417
418 // if there was a input and it was not tags..
419 if(text_input && $selected.prev().text() !== 'Tags') {
419420 var field = $selected.prev().text().toLowerCase();
420421 // update it in our annotation object
421422 self.new_anno[field] = text_input;
422423 }
423 if($selected.text() === 'Tags') {
424 //TODO: open up the tag sprayer component
424 // if it was tags..
425 else if ($selected.prev().text() === 'Tags') {
426 // directly save it..
427 self.new_anno['tags'] = $('#tags-input').tags().getTags();
428 }
425429
426 $("#tagsInput").tags({
427 tagData:["default", "tags"],
428 suggestions:["basic", "suggestions"]
430 // if the current selected is tags
431 if($selected.text() === 'Tags') {
432 $('#tags-input').tags({
433 tagData: ['foo', 'bar'],
434 //suggestions: ["basic", "suggestions"]
429435 });
430 field = $selected.text().toLowerCase();
431 self.new_anno[field] = $("#tagsInput").tags().getTags();
432 $("#tagsInput").show();
433
434 } else {
435 $("#tagsInput").hide();
436 $('#tags-input').show();
437 $('.annotorious-editor-text').hide();
436438 }
439 else {
440 $('#tags-input').hide();
441 $('.annotorious-editor-text').show();
442 }
437443 $anno_form.val('');
438444 $anno_form.attr('placeholder', 'Add ' + $selected.text());
439445 console.log(self.new_anno);
453453 var selected = $('select option:selected').text().toLowerCase();
454454 var text_input = $('.annotorious-editor-text').val();
455455 if( selected === "tags") {
456 self.new_anno[selected] = $("#tagsInput").tags().getTags();
457 } else {
456 self.new_anno[selected] = $('#tags-input').tags().getTags();
457 }
458 else {
458459 // update it in our annotation object
459460 self.new_anno[selected] = text_input;
460461 }
484484 text += (annotation.comment) ? '<p>' + annotation.comment + '</p>' : '';
485485 text += (annotation.link) ? '<p>' + annotation.link + '</p>' : '';
486486 text += (annotation.tags) ? '<p>' + annotation.tags + '</p>' : '';
487
488 // if older annotation i.e w/o comment,title etc fields
489 // add text field as text
490 if(!text) {
491 text = annotation.text;
492 }
487493 return text;
488494 },
489495 // to sign in the user to swtstore..just make a call to the oauth endpoint
542542 break;
543543 case 9: text = 'You have to be <i>signed in</i> to sweet store to post sweets';
544544 break;
545 case 10: text = 'Oops! Something went wrong. We couldn\'t publish the sweets. Try again.'
546 break;
545547 }
546548 $(this.el).html(text);
547549 $(window).scrollTop(0, 0);
  
114114 </li>
115115 </script>
116116 <script type="text/template" id="dropdown-template">
117 <div id="tagsInput"></div>
117 <div id="tags-input"></div>
118118 <select class="form-control" id="custom-dropdown">
119 <option id="">Choose an Option</option>
120 <option id="comment" >Comment</option>
121 <option id="title" >Title</option>
122 <option id="tags">Tags</option>
123 <option id="link">Link</option>
119 <option value="comment" selected>Comment</option>
120 <option value="title" >Title</option>
121 <option value="tags">Tags</option>
122 <option value="link">Link</option>
124123 </select>
125124 </script>
126125 <!-- script type="text/template" id="dropdown-template">