Skip to content

Commit f25d0b8

Browse files
committed
MAGETWO-89168: Develop UI component
1 parent fc6ac35 commit f25d0b8

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed

app/code/Magento/Ui/Model/UrlInput/LinksProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ public function __construct(
3838
$this->objectManager = $objectManager;
3939
}
4040

41-
41+
/**
42+
* {@inheritdoc}
43+
*/
4244
public function getConfig()
4345
{
4446
$config = [];

app/code/Magento/Ui/view/base/ui_component/etc/definition/ui_settings.xsd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,12 @@
610610
</xs:choice>
611611
</xs:complexType>
612612

613+
<xs:complexType name="linksType">
614+
<xs:sequence minOccurs="0" maxOccurs="unbounded">
615+
<xs:element name="link" type="linkType"/>
616+
</xs:sequence>
617+
</xs:complexType>
618+
613619
<xs:complexType name="exportsType">
614620
<xs:sequence minOccurs="0" maxOccurs="unbounded">
615621
<xs:element name="link" type="linkType"/>

app/code/Magento/Ui/view/base/web/js/form/element/url-input.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
*/
99
define([
1010
'underscore',
11-
'mageUtils',
1211
'uiLayout',
1312
'mage/translate',
14-
'Magento_Ui/js/lib/validation/validator',
1513
'Magento_Ui/js/form/element/abstract'
16-
], function (_, utils, layout, $t, validator, Abstract) {
14+
], function (_, layout, $t, Abstract) {
1715
'use strict';
1816

1917
return Abstract.extend({
@@ -56,10 +54,8 @@ define([
5654
* @returns {Abstract} Chainable.
5755
*/
5856
initObservable: function () {
59-
60-
this._super();
61-
62-
this.observe('componentTemplate options value linkType settingValue checked isDisplayAdditionalSettings')
57+
this._super()
58+
.observe('componentTemplate options value linkType settingValue checked isDisplayAdditionalSettings')
6359
.processLinkTypes()
6460
.setOptions();
6561

@@ -148,9 +144,7 @@ define([
148144
* @return void
149145
*/
150146
updateSettingValue: function (checked) {
151-
if (checked) {
152-
this.source.set(this.dataScope + '.setting', checked);
153-
}
147+
this.source.set(this.dataScope + '.setting', checked);
154148
},
155149

156150
/**
@@ -161,22 +155,21 @@ define([
161155
* @return void
162156
*/
163157
renderComponent: function (value) {
164-
165158
if (!_.isUndefined(value) && value) {
166-
this.getChildUrlInputComponent(value);
159+
this.setChildUrlInputComponent(value);
167160
//to store current element
168161
this.linkedElement = this.linkedElementInstances[value];
169162
this.linkType(value);
170163
}
171164
},
172165

173166
/**
174-
* Returns child component by value
167+
* Set child component by value
175168
*
176169
* @param {String} value
177170
* @return void
178171
*/
179-
getChildUrlInputComponent: function (value) {
172+
setChildUrlInputComponent: function (value) {
180173
var elementConfig;
181174

182175
if (_.isUndefined(this.linkedElementInstances[value])) {
@@ -198,7 +191,9 @@ define([
198191
* Add ability to choose check box by clicking on label
199192
*/
200193
checkboxClick: function () {
201-
this.checked(!this.checked());
194+
if (!this.disabled()) {
195+
this.checked(!this.checked());
196+
}
202197
}
203198
});
204199
});

app/code/Magento/Ui/view/base/web/templates/form/element/urlInput/setting.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
-->
77
<!--display container to specify url options(Example: open in new tab)-->
8-
<div class="admin__field admin__field-option url-input-setting">
8+
<div class="admin__field admin__field-option url-input-setting" visible="visible" click="checkboxClick">
99
<input type="checkbox"
1010
class="admin__control-checkbox"
1111
ko-checked="$data.checked"

app/code/Magento/Ui/view/base/web/templates/form/element/urlInput/typeSelector.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
name: inputName,
1010
id: uid,
1111
disabled: disabled,
12+
visible: visible,
1213
'aria-describedby': noticeId
1314
},
1415
hasFocus: focused,

0 commit comments

Comments
 (0)