Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Forwardport] Fix for Issue #4136, MAGETWO-53440 #19390

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/code/Magento/Rule/Model/Condition/AbstractCondition.php
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,9 @@ public function getValueElement()
// date format intentionally hard-coded
$elementParams['input_format'] = \Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT;
$elementParams['date_format'] = \Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT;
$elementParams['placeholder'] = \Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT;
$elementParams['autocomplete'] = 'off';
$elementParams['readonly'] = 'true';
}
return $this->getForm()->addField(
$this->getPrefix() . '__' . $this->getId() . '__value',
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Rule/view/adminhtml/web/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ define([

var elem = Element.down(elemContainer, 'input.input-text');

jQuery(elem).trigger('contentUpdated');

if (elem) {
elem.focus();

Expand Down
20 changes: 20 additions & 0 deletions app/design/adminhtml/Magento/backend/web/css/styles-old.less
Original file line number Diff line number Diff line change
Expand Up @@ -3840,6 +3840,26 @@

.rule-param-edit .element {
display: inline;
position: relative;
}

.rule-param-edit .element input.input-date,
.rule-param-edit .element input.input-date[readonly] {
background-color: @color-white;
min-width: 140px;
width: 140px !important;
cursor: pointer;
text-align: center;
opacity: 1;
margin-right: 10px;
padding-right: 40px;

+ .ui-datepicker-trigger {
position: absolute;
width: 140px;
text-align: right;
left: 0;
}
}

.rule-param-edit .element .addafter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ public function getHtmlAttributes()
'onchange',
'disabled',
'readonly',
'autocomplete',
'tabindex',
'placeholder',
'data-form-part',
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/Magento/Framework/Data/Form/Element/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function getValueInstance()
*/
public function getElementHtml()
{
$this->addClass('admin__control-text input-text');
$this->addClass('admin__control-text input-text input-date');
$dateFormat = $this->getDateFormat() ?: $this->getFormat();
$timeFormat = $this->getTimeFormat();
if (empty($dateFormat)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public function testGetHtmlAttributes()
'onchange',
'disabled',
'readonly',
'autocomplete',
'tabindex',
'placeholder',
'data-form-part',
Expand Down
6 changes: 6 additions & 0 deletions lib/web/mage/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
* Widget calendar
*/
$.widget('mage.calendar', {
options: {
autoComplete: true
},

/**
* Merge global options with options passed to widget invoke
Expand Down Expand Up @@ -379,6 +382,9 @@
.addClass('v-middle')
.text('') // Remove jQuery UI datepicker generated image
.append('<span>' + pickerButtonText + '</span>');

$(element).attr('autocomplete', this.options.autoComplete ? 'on' : 'off');

this._setCurrentDate(element);
},

Expand Down