Skip to content

Commit 5b96948

Browse files
committed
#4625 There's no need to display "values" panel for some attribute types ("TextBox", "MultilineTextbox", "Datepicker", "FileUpload")
1 parent bef82e8 commit 5b96948

File tree

4 files changed

+31
-8
lines changed

4 files changed

+31
-8
lines changed

src/Presentation/Nop.Web/Areas/Admin/Views/AddressAttribute/_CreateOrUpdate.Info.cshtml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
//these attributes don't support some control types
5252
new[] { (int)AttributeControlType.FileUpload, (int)AttributeControlType.Datepicker, (int)AttributeControlType.ColorSquares, (int)AttributeControlType.ImageSquares });
5353
}
54-
<nop-select asp-for="AttributeControlTypeId" asp-items="@attributeControlTypes"/>
54+
<nop-select asp-for="AttributeControlTypeId" asp-items="@attributeControlTypes" />
5555
<span asp-validation-for="AttributeControlTypeId"></span>
5656
</div>
5757
</div>
@@ -66,4 +66,27 @@
6666
</div>
6767
</div>
6868

69-
</div>
69+
</div>
70+
71+
<script>
72+
$(document).ready(function() {
73+
$("#@Html.IdFor(model => model.AttributeControlTypeId)").change(toggleAttributeControlType);
74+
toggleAttributeControlType();
75+
});
76+
77+
function toggleAttributeControlType() {
78+
var selectedAttributeControlTypeId = $("#@Html.IdFor(model => model.AttributeControlTypeId)").val();
79+
80+
//values
81+
if (selectedAttributeControlTypeId == @(((int) AttributeControlType.DropdownList).ToString()) ||
82+
selectedAttributeControlTypeId == @(((int) AttributeControlType.RadioList).ToString()) ||
83+
selectedAttributeControlTypeId == @(((int) AttributeControlType.Checkboxes).ToString()) ||
84+
selectedAttributeControlTypeId == @(((int) AttributeControlType.ColorSquares).ToString()) ||
85+
selectedAttributeControlTypeId == @(((int) AttributeControlType.ImageSquares).ToString()) ||
86+
selectedAttributeControlTypeId == @(((int) AttributeControlType.ReadonlyCheckboxes).ToString())) {
87+
$('[data-panel-name=address-values]').show();
88+
} else {
89+
$('[data-panel-name=address-values]').hide();
90+
}
91+
}
92+
</script>

src/Presentation/Nop.Web/Areas/Admin/Views/CustomerAttribute/_CreateOrUpdate.Info.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
selectedAttributeControlTypeId == @(((int) AttributeControlType.ColorSquares).ToString()) ||
1919
selectedAttributeControlTypeId == @(((int) AttributeControlType.ImageSquares).ToString()) ||
2020
selectedAttributeControlTypeId == @(((int) AttributeControlType.ReadonlyCheckboxes).ToString())) {
21-
$('[data-tab-name=tab-values]').show();
21+
$('[data-panel-name=customerattribute-values]').show();
2222
} else {
23-
$('[data-tab-name=tab-values]').hide();
23+
$('[data-panel-name=customerattribute-values]').hide();
2424
}
2525
}
2626
</script>

src/Presentation/Nop.Web/Areas/Admin/Views/Product/_CreateOrUpdateProductAttributeMapping.Info.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
selectedAttributeControlTypeId == @(((int) AttributeControlType.ColorSquares).ToString()) ||
4747
selectedAttributeControlTypeId == @(((int) AttributeControlType.ImageSquares).ToString()) ||
4848
selectedAttributeControlTypeId == @(((int) AttributeControlType.ReadonlyCheckboxes).ToString())) {
49-
$('[data-tab-name=tab-values]').show();
49+
$('[data-panel-name=product-attribute-mapping-values]').show();
5050
} else {
51-
$('[data-tab-name=tab-values]').hide();
51+
$('[data-panel-name=product-attribute-mapping-values]').hide();
5252
}
5353
}
5454
</script>

src/Presentation/Nop.Web/Areas/Admin/Views/VendorAttribute/_CreateOrUpdate.Info.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
selectedAttributeControlTypeId == @(((int) AttributeControlType.ColorSquares).ToString()) ||
1919
selectedAttributeControlTypeId == @(((int) AttributeControlType.ImageSquares).ToString()) ||
2020
selectedAttributeControlTypeId == @(((int) AttributeControlType.ReadonlyCheckboxes).ToString())) {
21-
$('[data-tab-name=tab-values]').show();
21+
$('[data-panel-name=vendorattribute-values]').show();
2222
} else {
23-
$('[data-tab-name=tab-values]').hide();
23+
$('[data-panel-name=vendorattribute-values]').hide();
2424
}
2525
}
2626
</script>

0 commit comments

Comments
 (0)