Changeset 349 for trunk/web-app/js


Ignore:
Timestamp:
Apr 19, 2010, 1:05:48 PM (11 years ago)
Author:
duh
Message:
  • added more templates to bootstrap
  • added a 300ms delay to ontology-chooser
  • refactored wizard subject page's "add subjects" dialogue (not working yet!) to incorporate an ontology field instead of a term select... this has to change though...
  • added template elements to tag library (ajaxButtonField and ontologyField)
  • minified ontology-chooser javascript
  • minified wizard.css
Location:
trunk/web-app/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/web-app/js/ontology-chooser.js

    r310 r349  
    2424 * @package     wizard
    2525 * @requires    jquery, jquery-ui
    26  * @see         http://www.bioontology.org/wiki/index.php/NCBO_Widgets#Term-selection_field_on_a_form
     26 * @see         http://bioportal.bioontology.org/ontologies/
    2727 * @see         http://bioportal.bioontology.org/search/json_search/?q=musculus
    2828 *
     
    3535}
    3636OntologyChooser.prototype = {
    37     minLength   : 2,    // minimum input length before launching Ajax request
     37    minLength   : 3,    // minimum input length before launching Ajax request
    3838    cache       : [],   // ontology cache
    3939
     
    6868        inputElement.autocomplete({
    6969            minLength: that.minLength,
     70            delay: 300,
    7071            search: function(event, ui) {
    7172                selected = false;
  • trunk/web-app/js/ontology-chooser.min.js

    r310 r349  
    1 function OntologyChooser(){}OntologyChooser.prototype={minLength:2,cache:[],init:function(){var a=this;$("input[rel*='ontology']").each(function(){a.initAutocomplete(this)})},initAutocomplete:function(d){var f=this;var g=$(d);var e=false;var c=g.attr("rel").split("-");var b=c[1];var a=c[2];if(b=="all"){b=""}g.autocomplete({minLength:f.minLength,search:function(h,i){e=false},source:function(j,h){var k=$.trim(j.term);var i="http://bioportal.bioontology.org/search/json_search/"+b+"?q="+j.term+"&response=json&callback=?";if(f.cache[k]){h(f.cache[k])}else{$.getJSON(i,function(m){var l=f.parseData(m.data);f.cache[k]=l;h(f.parseData(m.data))})}},select:function(i,j){e=true;var h=g;f.setInputValue(h,"concept_id",j.item.concept_id);f.setInputValue(h,"ontology_id",j.item.ontology_id);f.setInputValue(h,"full_id",j.item.full_id);h.removeClass("error")},close:function(i,j){if(!e){var h=g;g.val("");f.setInputValue(h,"concept_id","");f.setInputValue(h,"ontology_id","");f.setInputValue(h,"full_id","");h.addClass("error")}}})},setInputValue:function(e,c,d){var a=e.attr("name")+"-"+c;var b=e.parent().find("input[name='"+a+"']");if(b.size()>0){$(b[0]).val(d)}else{e.after('<input type="hidden" name="'+a+'" value="'+d+'"/>')}},parseData:function(d){var a=[];var c=d.split("~!~");for(var b=0;b<c.length;b++){var f=$.trim(c[b]);if(f){var e=f.split("|");a[a.length]={value:e[0],label:e[0]+' <span class="about">('+e[2]+')</span> <span class="from">from: '+e[(e.length-1)]+"</span>",preferred_name:e[0],concept_id:e[1],ontology_id:e[3],full_id:e[4]}}}return a}};
     1function OntologyChooser(){}OntologyChooser.prototype={minLength:3,cache:[],init:function(){var a=this;$("input[rel*='ontology']").each(function(){a.initAutocomplete(this)})},initAutocomplete:function(d){var f=this;var g=$(d);var e=false;var c=g.attr("rel").split("-");var b=c[1];var a=c[2];if(b=="all"){b=""}g.autocomplete({minLength:f.minLength,delay:300,search:function(h,i){e=false},source:function(j,h){var k=$.trim(j.term);var i="http://bioportal.bioontology.org/search/json_search/"+b+"?q="+j.term+"&response=json&callback=?";if(f.cache[k]){h(f.cache[k])}else{$.getJSON(i,function(m){var l=f.parseData(m.data);f.cache[k]=l;h(f.parseData(m.data))})}},select:function(i,j){e=true;var h=g;f.setInputValue(h,"concept_id",j.item.concept_id);f.setInputValue(h,"ontology_id",j.item.ontology_id);f.setInputValue(h,"full_id",j.item.full_id);h.removeClass("error")},close:function(i,j){if(!e){var h=g;g.val("");f.setInputValue(h,"concept_id","");f.setInputValue(h,"ontology_id","");f.setInputValue(h,"full_id","");h.addClass("error")}}})},setInputValue:function(e,c,d){var a=e.attr("name")+"-"+c;var b=e.parent().find("input[name='"+a+"']");if(b.size()>0){$(b[0]).val(d)}else{e.after('<input type="hidden" name="'+a+'" value="'+d+'"/>')}},parseData:function(d){var a=[];var c=d.split("~!~");for(var b=0;b<c.length;b++){var f=$.trim(c[b]);if(f){var e=f.split("|");a[a.length]={value:e[0],label:e[0]+' <span class="about">('+e[2]+')</span> <span class="from">from: '+e[(e.length-1)]+"</span>",preferred_name:e[0],concept_id:e[1],ontology_id:e[3],full_id:e[4]}}}return a}};
Note: See TracChangeset for help on using the changeset viewer.