mirror of
https://github.com/grocy/grocy.git
synced 2025-09-29 19:12:24 +00:00
Varios small UI changes / improve UI consistency
This commit is contained in:
68
public/viewjs/components/locationpicker.js
Normal file
68
public/viewjs/components/locationpicker.js
Normal file
@@ -0,0 +1,68 @@
|
||||
Grocy.Components.LocationPicker = { };
|
||||
|
||||
Grocy.Components.LocationPicker.GetPicker = function()
|
||||
{
|
||||
return $('#location_id');
|
||||
}
|
||||
|
||||
Grocy.Components.LocationPicker.GetInputElement = function()
|
||||
{
|
||||
return $('#location_id_text_input');
|
||||
}
|
||||
|
||||
Grocy.Components.LocationPicker.GetValue = function()
|
||||
{
|
||||
return $('#location_id').val();
|
||||
}
|
||||
|
||||
Grocy.Components.LocationPicker.SetValue = function(value)
|
||||
{
|
||||
Grocy.Components.LocationPicker.GetInputElement().val(value);
|
||||
Grocy.Components.LocationPicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.LocationPicker.SetId = function(value)
|
||||
{
|
||||
Grocy.Components.LocationPicker.GetPicker().val(value);
|
||||
Grocy.Components.LocationPicker.GetPicker().data('combobox').refresh();
|
||||
Grocy.Components.LocationPicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.LocationPicker.Clear = function()
|
||||
{
|
||||
Grocy.Components.LocationPicker.SetValue('');
|
||||
Grocy.Components.LocationPicker.SetId(null);
|
||||
}
|
||||
|
||||
$('.location-combobox').combobox({
|
||||
appendId: '_text_input',
|
||||
bsVersion: '4',
|
||||
clearIfNoMatch: true
|
||||
});
|
||||
|
||||
var prefillByName = Grocy.Components.LocationPicker.GetPicker().parent().data('prefill-by-name').toString();
|
||||
if (typeof prefillByName !== "undefined")
|
||||
{
|
||||
possibleOptionElement = $("#location_id option:contains('" + prefillByName + "')").first();
|
||||
|
||||
if (possibleOptionElement.length > 0)
|
||||
{
|
||||
$('#location_id').val(possibleOptionElement.val());
|
||||
$('#location_id').data('combobox').refresh();
|
||||
$('#location_id').trigger('change');
|
||||
|
||||
var nextInputElement = $(Grocy.Components.LocationPicker.GetPicker().parent().data('next-input-selector').toString());
|
||||
nextInputElement.focus();
|
||||
}
|
||||
}
|
||||
|
||||
var prefillById = Grocy.Components.LocationPicker.GetPicker().parent().data('prefill-by-id').toString();
|
||||
if (typeof prefillById !== "undefined")
|
||||
{
|
||||
$('#location_id').val(prefillById);
|
||||
$('#location_id').data('combobox').refresh();
|
||||
$('#location_id').trigger('change');
|
||||
|
||||
var nextInputElement = $(Grocy.Components.LocationPicker.GetPicker().parent().data('next-input-selector').toString());
|
||||
nextInputElement.focus();
|
||||
}
|
@@ -21,6 +21,19 @@ Grocy.Components.ProductPicker.SetValue = function(value)
|
||||
Grocy.Components.ProductPicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.ProductPicker.SetId = function(value)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetPicker().val(value);
|
||||
Grocy.Components.ProductPicker.GetPicker().data('combobox').refresh();
|
||||
Grocy.Components.ProductPicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.ProductPicker.Clear = function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
Grocy.Components.ProductPicker.SetId(null);
|
||||
}
|
||||
|
||||
Grocy.Components.ProductPicker.InProductAddWorkflow = function()
|
||||
{
|
||||
return typeof GetUriParam('createdproduct') !== "undefined" || typeof GetUriParam('product') !== "undefined";
|
||||
|
@@ -21,6 +21,19 @@ Grocy.Components.RecipePicker.SetValue = function(value)
|
||||
Grocy.Components.RecipePicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.RecipePicker.SetId = function(value)
|
||||
{
|
||||
Grocy.Components.RecipePicker.GetPicker().val(value);
|
||||
Grocy.Components.RecipePicker.GetPicker().data('combobox').refresh();
|
||||
Grocy.Components.RecipePicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.RecipePicker.Clear = function()
|
||||
{
|
||||
Grocy.Components.RecipePicker.SetValue('');
|
||||
Grocy.Components.RecipePicker.SetId(null);
|
||||
}
|
||||
|
||||
$('.recipe-combobox').combobox({
|
||||
appendId: '_text_input',
|
||||
bsVersion: '4',
|
||||
|
@@ -21,6 +21,19 @@ Grocy.Components.UserPicker.SetValue = function(value)
|
||||
Grocy.Components.UserPicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.UserPicker.SetId = function(value)
|
||||
{
|
||||
Grocy.Components.UserPicker.GetPicker().val(value);
|
||||
Grocy.Components.UserPicker.GetPicker().data('combobox').refresh();
|
||||
Grocy.Components.UserPicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.UserPicker.Clear = function()
|
||||
{
|
||||
Grocy.Components.UserPicker.SetValue('');
|
||||
Grocy.Components.UserPicker.SetId(null);
|
||||
}
|
||||
|
||||
$('.user-combobox').combobox({
|
||||
appendId: '_text_input',
|
||||
bsVersion: '4'
|
||||
|
Reference in New Issue
Block a user