mirror of
https://github.com/grocy/grocy.git
synced 2025-08-16 18:54:35 +00:00
Move public stuff into subdirectory
This commit is contained in:
38
public/viewjs/locationform.js
Normal file
38
public/viewjs/locationform.js
Normal file
@@ -0,0 +1,38 @@
|
||||
$('#save-location-button').on('click', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
if (Grocy.EditMode === 'create')
|
||||
{
|
||||
Grocy.PostJson('/api/add-object/locations', $('#location-form').serializeJSON(),
|
||||
function(result)
|
||||
{
|
||||
window.location.href = '/locations';
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
Grocy.PostJson('/api/edit-object/locations/' + Grocy.EditObjectId, $('#location-form').serializeJSON(),
|
||||
function(result)
|
||||
{
|
||||
window.location.href = '/locations';
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
$(function()
|
||||
{
|
||||
$('#name').focus();
|
||||
$('#location-form').validator();
|
||||
$('#location-form').validator('validate');
|
||||
});
|
Reference in New Issue
Block a user