diff options
| author | Nick Palmer <nick@sluggardy.net> | 2010-12-15 19:31:43 -0500 |
|---|---|---|
| committer | Nick Palmer <nick@sluggardy.net> | 2010-12-15 19:31:43 -0500 |
| commit | 8f1cb1cace65672024ed64e6c2bf7a2214dc5839 (patch) | |
| tree | fd1abd3c4824504fcae83060d4fcf7c9da6d2a03 | |
| parent | 1f88d8915c29a7bc75c0126b8053327871d78c92 (diff) | |
| download | util-8f1cb1cace65672024ed64e6c2bf7a2214dc5839.tar.gz util-8f1cb1cace65672024ed64e6c2bf7a2214dc5839.tar.bz2 util-8f1cb1cace65672024ed64e6c2bf7a2214dc5839.zip | |
Latest multiform to handle table based layouts.
| -rw-r--r-- | javascript/JQuery.BitMultiForm.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/javascript/JQuery.BitMultiForm.js b/javascript/JQuery.BitMultiForm.js index 616900f..5ecf035 100644 --- a/javascript/JQuery.BitMultiForm.js +++ b/javascript/JQuery.BitMultiForm.js @@ -30,6 +30,7 @@ BitMultiForm = { $jq( '#'+name+" .multiform_input" ).val(value);
$jq( '#'+name+" .multiform_input" ).after(title);
$jq( '#ordering_' + index ).val(index);
+ $jq( '#'+name ).css('display', 'table-row');
// Refresh sortable
$jq( '#'+name+"_sortable" ).sortable( "refresh" );
},
@@ -49,7 +50,8 @@ BitMultiForm = { index = BitMultiForm.seqs[target] = curr_units.length;
BitMultiForm.total[button] = curr_units.length;
}
- if (typeof(max) != 'undefined' && BitMultiForm.total[button] >= max - 1) {
+ BitMultiForm.total[button]++;
+ if (typeof(max) != 'undefined' && BitMultiForm.total[button] >= max) {
$jq( '#' + button ).css('display', 'none');
$jq( '.multiform_add' ).css('display', 'none');
}
@@ -78,6 +80,7 @@ BitMultiForm = { }
$jq('#'+target).append(cloneElm);
+ $jq('#no_multiform_unit').css('display','none');
if( typeof( BitBase.setPlaceholders ) != 'undefined' ){
BitBase.setPlaceholders();
@@ -90,9 +93,12 @@ BitMultiForm = { button = elmId.replace(/_[0-9]+/, '_add_button');
if( typeof( BitMultiForm.total[button] ) != 'undefined' ){
BitMultiForm.total[button]--;
+ if (BitMultiForm.total[button] == 0) {
+ $jq('#no_multiform_unit').css('display','block');
+ }
}
BitBase.setElementDisplay(button, 'block', false);
- $jq( '.multiform_add' ).css('display', 'block');
+ $jq( '.multiform_add' ).css('display', 'inline-block');
BitBase.$(elmId).parentNode.removeChild( BitBase.$(elmId) );
},
'seqs':{},
|
