Changeset 365
- Timestamp:
- Apr 21, 2010, 12:30:18 PM (13 years ago)
- Location:
- trunk/web-app
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web-app/css/default_style.css
r362 r365 252 252 253 253 /* START :: special select option styles */ 254 option.add Term{254 option.addMore { 255 255 background: url(../images/icons/famfamfam/add.png) no-repeat left top; 256 256 background-color: #333; -
trunk/web-app/js/SelectAddMore.js
r363 r365 17 17 * </select> 18 18 * ... 19 * new SelectAddMore().init('cars','http://my.site/addCars','myList',function(scope) { alert('cars closed : '+scope);}); 19 * new SelectAddMore().init({ 20 * 'rel' : 'cars', 21 * 'url' : 'http://my.site/modifyCars', 22 * 'label' : 'modify cars...', 23 * 'class' : 'myCSSClass', 24 * 'onClose' : function(scope) { 25 * alert('cars closed : ' + scope ); 26 * } 27 * }); 20 28 * 21 29 * @author Jeroen Wesbeek … … 32 40 } 33 41 SelectAddMore.prototype = { 34 rel: 'myRel', 35 url: 'http://www.youtube.com/watch?v=2WNrx2jq184', 36 vars: 'myVar', 37 width: 800, 38 height: 500, 39 onClose: function(scope) { 40 alert('the dialog was closed! --> ' + scope) 42 // default options 43 options: { 44 rel : 'addmore', 45 url : 'http://www.youtube.com/watch?v=2WNrx2jq184', 46 vars : 'vars', 47 label : 'add more...', 48 class : 'addmore', 49 width : 800, 50 height : 500, 51 onClose : function(scope) { 52 // onClose handler does nothing by default 53 } 41 54 }, 42 55 … … 44 57 * initialize object 45 58 */ 46 init: function( rel, url, vars, onClose) {59 init: function(options) { 47 60 var that = this; 48 61 49 62 // set class parameters 50 that.rel = rel; 51 that.url = url; 52 that.vars = vars; 53 that.onClose = onClose; 63 $.each(options, function(key,value) { 64 that.options[key] = value; 65 }); 54 66 55 67 // find all matching select elements 56 $("select[rel*='" + th at.rel + "']").each(function() {68 $("select[rel*='" + this.options.rel + "']").each(function() { 57 69 // add the magic option 58 70 that.addTermEditorOption(this); … … 69 81 70 82 // add a magic option to the end of the select element 71 e.append('<option value="" class=" addTerm">add more...</option>');83 e.append('<option value="" class="' + this.options.class + '">' + this.options.label + '</option>'); 72 84 73 85 // and bind and onChange event … … 79 91 // the dialog integrate with the application! 80 92 // @see http://www.w3schools.com/html5/tag_iframe.asp 81 $('<iframe src="' + that. url + '?' + that.vars + '=' + e.attr(that.vars) + '" sanbox="allow-same-origin" seamless />').dialog({82 title: 'Add more...',93 $('<iframe src="' + that.options.url + '?' + that.options.vars + '=' + e.attr(that.options.vars) + '" sanbox="allow-same-origin" seamless />').dialog({ 94 title: that.options.label, 83 95 autoOpen: true, 84 width: that. width,85 height: that. height,96 width: that.options.width, 97 height: that.options.height, 86 98 modal: true, 87 99 close: function() { 88 that.o nClose(this);100 that.options.onClose(this); 89 101 } 90 }).width(that. width - 10).height(that.height)102 }).width(that.options.width - 10).height(that.options.height) 91 103 } 92 104 }) -
trunk/web-app/js/wizard.js
r359 r365 48 48 49 49 // handle term selects 50 new SelectAddMore().init('term','/gscf/termEditor','ontology',function(scope) { refreshWebFlow(); }); 50 new SelectAddMore().init({ 51 rel : 'term', 52 url : '/gscf/termEditor', 53 vars : 'ontology', 54 label : 'add more...', 55 class : 'addMore', 56 onClose : function(scope) { 57 refreshWebFlow(); 58 } 59 }); 51 60 52 61 // initialize accordeon(s)
Note: See TracChangeset
for help on using the changeset viewer.