forked from verdnatura/hedera-web
43 lines
824 B
JavaScript
43 lines
824 B
JavaScript
|
|
Vn.Photos = new Class
|
|
({
|
|
Extends: Vn.Form
|
|
|
|
,activate: function ()
|
|
{
|
|
this.$('schema').value = 'catalog';
|
|
this.$('photo-id').focus ();
|
|
|
|
var self = this;
|
|
this.$('html-form').onsubmit = function ()
|
|
{ self.onSubmit (); return false; };
|
|
}
|
|
|
|
,onSubmit: function ()
|
|
{
|
|
this.$('schema-field').value = this.$('schema').value;
|
|
this.$('submit').disabled = true;
|
|
this.gui.loaderPush ();
|
|
|
|
var request = new Vn.JsonRequest ();
|
|
request.sendFormMultipart (this.$('html-form'),
|
|
this.onResponse.bind (this));
|
|
}
|
|
|
|
,onResponse: function (request, json, error)
|
|
{
|
|
this.gui.loaderPop ();
|
|
this.$('submit').disabled = false;
|
|
|
|
if (json)
|
|
{
|
|
this.$('photo-id').value = '';
|
|
this.$('photo-id').focus ();
|
|
Htk.Toast.showMessage (_('ImageAdded'));
|
|
}
|
|
else
|
|
Htk.Toast.showError (error.message);
|
|
}
|
|
});
|
|
|