-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed guideline violations to bring the plugin back to the WordPress directory
- Loading branch information
1 parent
bb773c8
commit 511a380
Showing
9 changed files
with
637 additions
and
556 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
jQuery(document).ready(function($){ | ||
var fieldGroupId = 'pricing_plans'; | ||
var $fieldGroupTable = $( document.getElementById( fieldGroupId + '_repeat' ) ); | ||
|
||
var countRows = function() { | ||
return $fieldGroupTable.find( '> .cmb-row.cmb-repeatable-grouping' ).length; | ||
}; | ||
|
||
var disableAdder = function() { | ||
$fieldGroupTable.find('.cmb-add-group-row.button-secondary').prop( 'disabled', true ); | ||
}; | ||
|
||
var enableAdder = function() { | ||
$fieldGroupTable.find('.cmb-add-group-row.button-secondary').prop( 'disabled', false ); | ||
}; | ||
|
||
if ( countRows() >= limit ) { | ||
disableAdder(); | ||
} | ||
|
||
$fieldGroupTable | ||
.on( 'cmb2_add_row', function() { | ||
if ( countRows() >= limit ) { | ||
disableAdder(); | ||
} | ||
}) | ||
.on( 'cmb2_remove_row', function() { | ||
if ( countRows() < limit ) { | ||
enableAdder(); | ||
} | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.