Skip to content

Commit

Permalink
#4625 There's no need to display "values" panel for some attribute ty…
Browse files Browse the repository at this point in the history
…pes ("TextBox", "MultilineTextbox", "Datepicker", "FileUpload")
  • Loading branch information
AndreiMaz committed May 1, 2020
1 parent bef82e8 commit 5b96948
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
//these attributes don't support some control types
new[] { (int)AttributeControlType.FileUpload, (int)AttributeControlType.Datepicker, (int)AttributeControlType.ColorSquares, (int)AttributeControlType.ImageSquares });
}
<nop-select asp-for="AttributeControlTypeId" asp-items="@attributeControlTypes"/>
<nop-select asp-for="AttributeControlTypeId" asp-items="@attributeControlTypes" />
<span asp-validation-for="AttributeControlTypeId"></span>
</div>
</div>
Expand All @@ -66,4 +66,27 @@
</div>
</div>

</div>
</div>

<script>
$(document).ready(function() {
$("#@Html.IdFor(model => model.AttributeControlTypeId)").change(toggleAttributeControlType);
toggleAttributeControlType();
});
function toggleAttributeControlType() {
var selectedAttributeControlTypeId = $("#@Html.IdFor(model => model.AttributeControlTypeId)").val();
//values
if (selectedAttributeControlTypeId == @(((int) AttributeControlType.DropdownList).ToString()) ||
selectedAttributeControlTypeId == @(((int) AttributeControlType.RadioList).ToString()) ||
selectedAttributeControlTypeId == @(((int) AttributeControlType.Checkboxes).ToString()) ||
selectedAttributeControlTypeId == @(((int) AttributeControlType.ColorSquares).ToString()) ||
selectedAttributeControlTypeId == @(((int) AttributeControlType.ImageSquares).ToString()) ||
selectedAttributeControlTypeId == @(((int) AttributeControlType.ReadonlyCheckboxes).ToString())) {
$('[data-panel-name=address-values]').show();
} else {
$('[data-panel-name=address-values]').hide();
}
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
selectedAttributeControlTypeId == @(((int) AttributeControlType.ColorSquares).ToString()) ||
selectedAttributeControlTypeId == @(((int) AttributeControlType.ImageSquares).ToString()) ||
selectedAttributeControlTypeId == @(((int) AttributeControlType.ReadonlyCheckboxes).ToString())) {
$('[data-tab-name=tab-values]').show();
$('[data-panel-name=customerattribute-values]').show();
} else {
$('[data-tab-name=tab-values]').hide();
$('[data-panel-name=customerattribute-values]').hide();
}
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
selectedAttributeControlTypeId == @(((int) AttributeControlType.ColorSquares).ToString()) ||
selectedAttributeControlTypeId == @(((int) AttributeControlType.ImageSquares).ToString()) ||
selectedAttributeControlTypeId == @(((int) AttributeControlType.ReadonlyCheckboxes).ToString())) {
$('[data-tab-name=tab-values]').show();
$('[data-panel-name=product-attribute-mapping-values]').show();
} else {
$('[data-tab-name=tab-values]').hide();
$('[data-panel-name=product-attribute-mapping-values]').hide();
}
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
selectedAttributeControlTypeId == @(((int) AttributeControlType.ColorSquares).ToString()) ||
selectedAttributeControlTypeId == @(((int) AttributeControlType.ImageSquares).ToString()) ||
selectedAttributeControlTypeId == @(((int) AttributeControlType.ReadonlyCheckboxes).ToString())) {
$('[data-tab-name=tab-values]').show();
$('[data-panel-name=vendorattribute-values]').show();
} else {
$('[data-tab-name=tab-values]').hide();
$('[data-panel-name=vendorattribute-values]').hide();
}
}
</script>
Expand Down

0 comments on commit 5b96948

Please sign in to comment.