Изменения исходников OctoberCMS octobercms filter
Компиляция ассетов php artisan october:util compile assets
Как использовать:
price_from:
label: Цена, от
conditions: buy_price >= (:filtered)
type: input
cssClass: small
<div
class="filter-scope input"
data-scope-name="<?= $scope->scopeName ?>">
<?= e(trans($scope->label)) ?> <input style="<?= $scope->cssClass=='small'? 'width: 60px;' : ''?>" type="text" id="<?= $scope->getId() ?>" value="<?= $scope->value ?>"/>
</div>
/* 325 line, modules/backend/assets/css */
.control-filter > .filter-scope.input:after{content:''}
/* filter.less, line 77 */
&.input {
&:after {
content: ''
}
}
// module/backend/widgets
switch ($scope->type) {
...
case 'input':
$this->setScopeValue($scope, post('value'));
break;
}
inArrayFunc = function(elem, array, testFunc) {
var i = array.length
do { if (i-- === 0) return false } while (!testFunc(array[i], elem))
return true
}
FilterWidget.prototype.init = function() {
...
this.$el.on('blur', '.filter-scope input[type="text"]', function(){
var value = $(this).val(),
$scope = $(this).closest('.filter-scope'),
scopeName = $scope.data('scope-name')
self.scopeValues[scopeName] = value
self.findByValue(scopeName, value)
})
}
// новый метод
FilterWidget.prototype.findByValue = function(scopeName, value) {
var $form = this.$el.closest('form'),
data = {
scopeName: scopeName,
value: value
}
$.oc.stripeLoadIndicator.show()
$form.request(this.options.updateHandler, {
data: data
}).always(function(){
$.oc.stripeLoadIndicator.hide()
})
}