mirror of
https://github.com/grocy/grocy.git
synced 2026-04-07 21:26:16 +02:00
Fix scoped jQuery proxy in components
This commit is contained in:
parent
6b5440cf7a
commit
438a559897
|
|
@ -7,7 +7,7 @@ class BasePicker
|
||||||
|
|
||||||
this.scopeSelector = scopeSelector;
|
this.scopeSelector = scopeSelector;
|
||||||
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
||||||
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
|
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
|
||||||
|
|
||||||
this.picker = null;
|
this.picker = null;
|
||||||
this.input_element = null;
|
this.input_element = null;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ class barcodescanner
|
||||||
|
|
||||||
this.scopeSelector = scopeSelector;
|
this.scopeSelector = scopeSelector;
|
||||||
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
||||||
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
|
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
|
||||||
|
|
||||||
// init component
|
// init component
|
||||||
this.LiveVideoSizeAdjusted = false;
|
this.LiveVideoSizeAdjusted = false;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ class batterycard
|
||||||
|
|
||||||
this.scopeSelector = scopeSelector;
|
this.scopeSelector = scopeSelector;
|
||||||
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
||||||
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
|
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
|
||||||
}
|
}
|
||||||
|
|
||||||
Refresh(batteryId)
|
Refresh(batteryId)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ class calendarcard
|
||||||
|
|
||||||
this.scopeSelector = scopeSelector;
|
this.scopeSelector = scopeSelector;
|
||||||
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
||||||
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
|
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
|
||||||
|
|
||||||
this.$('#calendar').datetimepicker(
|
this.$('#calendar').datetimepicker(
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ class chorecard
|
||||||
|
|
||||||
this.scopeSelector = scopeSelector;
|
this.scopeSelector = scopeSelector;
|
||||||
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
||||||
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
|
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
|
||||||
}
|
}
|
||||||
|
|
||||||
Refresh(choreId)
|
Refresh(choreId)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ class datetimepicker
|
||||||
|
|
||||||
this.scopeSelector = scopeSelector;
|
this.scopeSelector = scopeSelector;
|
||||||
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
||||||
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
|
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
|
||||||
|
|
||||||
this.basename = basename;
|
this.basename = basename;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ class numberpicker
|
||||||
|
|
||||||
this.scopeSelector = scopeSelector;
|
this.scopeSelector = scopeSelector;
|
||||||
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
||||||
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
|
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.$(".numberpicker-down-button").unbind('click').on("click", () => self.valueDownHandler(this));
|
this.$(".numberpicker-down-button").unbind('click').on("click", () => self.valueDownHandler(this));
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ class productamountpicker
|
||||||
|
|
||||||
this.scopeSelector = scopeSelector;
|
this.scopeSelector = scopeSelector;
|
||||||
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
||||||
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
|
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
|
||||||
|
|
||||||
Grocy.Use("numberpicker");
|
Grocy.Use("numberpicker");
|
||||||
this.AllowAnyQuEnabled = false;
|
this.AllowAnyQuEnabled = false;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ class productcard
|
||||||
|
|
||||||
this.scopeSelector = scopeSelector;
|
this.scopeSelector = scopeSelector;
|
||||||
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
||||||
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
|
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
|
||||||
this.PriceHistoryChart = null;
|
this.PriceHistoryChart = null;
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ class userfieldsform
|
||||||
|
|
||||||
this.scopeSelector = scopeSelector;
|
this.scopeSelector = scopeSelector;
|
||||||
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
this.scope = scopeSelector != null ? $(scopeSelector) : $(document);
|
||||||
this.$ = scopeSelector != null ? $(scopeSelector).find : $;
|
this.$ = scopeSelector != null ? (selector) => this.scope.find(selector) : $;
|
||||||
|
|
||||||
this.$(".userfield-link").keyup();
|
this.$(".userfield-link").keyup();
|
||||||
|
|
||||||
|
|
@ -181,15 +181,16 @@ class userfieldsform
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
self.$('.datetimepicker-wrapper').each(() =>
|
var pickers = $('.datetimepicker-wrapper');
|
||||||
|
for (let elem of pickers)
|
||||||
{
|
{
|
||||||
let picker = $(this);
|
let picker = $(elem);
|
||||||
|
|
||||||
var scopeId = uuid.v4();
|
var scopeId = uuid.v4();
|
||||||
picker.attr('id', scopeId);
|
picker.prop('id', scopeId);
|
||||||
|
|
||||||
this.components.push(new datetimepicker(self.Grocy, "#" + scopeId));
|
self.components.push(new datetimepicker(self.Grocy, "#" + scopeId));
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
@php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp
|
@php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp
|
||||||
@php if(empty($activateNumberPad)) { $activateNumberPad = false; } @endphp
|
@php if(empty($activateNumberPad)) { $activateNumberPad = false; } @endphp
|
||||||
|
|
||||||
<div id="datetimepicker-wrapper"
|
<div class="datetimepicker-wrapper"
|
||||||
class="form-group {{ $additionalGroupCssClasses }}">
|
class="form-group {{ $additionalGroupCssClasses }}">
|
||||||
<label for="{{ $id }}">{{ $__t($label) }}
|
<label for="{{ $id }}">{{ $__t($label) }}
|
||||||
@if(!empty($hint))
|
@if(!empty($hint))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user