Skip to content

Commit

Permalink
Handle conditional_display of fieldsets
Browse files Browse the repository at this point in the history
  • Loading branch information
dvlpp committed Nov 10, 2015
1 parent 3d59dcd commit 53806b9
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 deletions.
14 changes: 12 additions & 2 deletions resources/assets/js/sharp.conditional_display.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,19 @@ function selectShowHide($select, value, $field, fieldShowIfSelected) {

function showHideField($field, show) {
if(show) {
$field.show();
$field.removeClass("hidden");
} else {
$field.hide();
$field.addClass("hidden");
}

// Check fieldset visibility if there's one.
var $fieldset = $field.parents(".fieldset");
if($fieldset.length) {
if($fieldset.find(".sharp-field:not(.hidden)").length) {
$fieldset.removeClass("hidden");
} else {
$fieldset.addClass("hidden");
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion resources/assets/sharp.form.min.js

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions resources/assets/sharp.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -12804,9 +12804,19 @@ function selectShowHide($select, value, $field, fieldShowIfSelected) {

function showHideField($field, show) {
if(show) {
$field.show();
$field.removeClass("hidden");
} else {
$field.hide();
$field.addClass("hidden");
}

// Check fieldset visibility if there's one.
var $fieldset = $field.parents(".fieldset");
if($fieldset.length) {
if($fieldset.find(".sharp-field:not(.hidden)").length) {
$fieldset.removeClass("hidden");
} else {
$fieldset.addClass("hidden");
}
}
}

Expand Down
12 changes: 6 additions & 6 deletions resources/assets/sharp.ui.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/views/cms/entityForm.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
@if(!is_numeric($group))

{{--Form field panel--}}
<div class="panel">
<div class="panel fieldset">
<div class="panel-heading">
<label class="control-label">{{ $group }}</label>
</div>
Expand Down

0 comments on commit 53806b9

Please sign in to comment.