interpolate v1, camelCase htmlId
This commit is contained in:
parent
63158d335e
commit
60a1d7cf9e
|
@ -5,8 +5,8 @@ Hedera.AddressList = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.$('user-model').setInfo ('c', 'customer_view', 'hedera');
|
||||
this.$('addresses').setInfo ('a', 'address_view', 'hedera');
|
||||
this.$.userModel.setInfo ('c', 'customer_view', 'hedera');
|
||||
this.$.addresses.setInfo ('a', 'address_view', 'hedera');
|
||||
}
|
||||
|
||||
,onAddAddressClick: function ()
|
||||
|
@ -33,9 +33,9 @@ Hedera.AddressList = new Class
|
|||
|
||||
,repeaterFunc: function (res, form)
|
||||
{
|
||||
res.$('link').href = this.hash.make ({
|
||||
'form': 'account/address',
|
||||
'address': form.get ('id')
|
||||
res.$.link.href = this.hash.make ({
|
||||
form: 'account/address',
|
||||
address: form.$.id
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -47,14 +47,13 @@
|
|||
on-click="onRemoveAddressClick"/>
|
||||
</div>
|
||||
<p class="important">
|
||||
<htk-text lot="iter" name="consignee"/>
|
||||
{{consignee}}
|
||||
</p>
|
||||
<p>
|
||||
<htk-text lot="iter" name="name"/>
|
||||
{{name}}
|
||||
</p>
|
||||
<p>
|
||||
<htk-text lot="iter" name="zip_code"/>,
|
||||
<htk-text lot="iter" name="city"/>
|
||||
{{zip_code}}, {{city}}
|
||||
</p>
|
||||
</a>
|
||||
</custom>
|
||||
|
|
|
@ -5,14 +5,14 @@ Hedera.Address = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.$('model').setInfo ('a', 'address_view', 'hedera', ['id'], 'id');
|
||||
this.$('model').setDefault ('customer_id', 'a',
|
||||
this.$.model.setInfo ('a', 'address_view', 'hedera', ['id'], 'id');
|
||||
this.$.model.setDefault ('customer_id', 'a',
|
||||
new Sql.Function ({schema: 'account', name: 'userGetId'}));
|
||||
}
|
||||
|
||||
,onStatusChange: function (form)
|
||||
{
|
||||
if (form.ready && this.$('params').$.address == 0)
|
||||
if (form.ready && this.$.params.$.address == 0)
|
||||
form.insertRow ();
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ Hedera.Address = new Class
|
|||
|
||||
,onAcceptClick: function ()
|
||||
{
|
||||
this.$('iter').performOperations ();
|
||||
this.$.iter.performOperations ();
|
||||
}
|
||||
|
||||
,onReturnClick: function ()
|
||||
|
|
|
@ -5,31 +5,31 @@ Hedera.Conf = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.$('user-model').setInfo ('c', 'customer_view', 'hedera');
|
||||
this.$.userModel.setInfo ('c', 'customer_view', 'hedera');
|
||||
}
|
||||
|
||||
,onPassChangeClick: function ()
|
||||
{
|
||||
this.$('old-password').value = '';
|
||||
this.$('new-password').value = '';
|
||||
this.$('repeat-password').value = '';
|
||||
this.$.oldPassword.value = '';
|
||||
this.$.newPassword.value = '';
|
||||
this.$.repeatPassword.value = '';
|
||||
|
||||
var recoverPass = this.$('user').get ('recoverPass');
|
||||
this.$('old-password').style.display = recoverPass ? 'none' : 'block';
|
||||
this.$('change-password').show ();
|
||||
var recoverPass = this.$.user.get ('recoverPass');
|
||||
this.$.oldPassword.style.display = recoverPass ? 'none' : 'block';
|
||||
this.$.changePassword.show ();
|
||||
|
||||
if (recoverPass)
|
||||
this.$('new-password').focus ();
|
||||
this.$.newPassword.focus ();
|
||||
else
|
||||
this.$('old-password').focus ();
|
||||
this.$.oldPassword.focus ();
|
||||
}
|
||||
|
||||
,onPassModifyClick: function ()
|
||||
{
|
||||
try {
|
||||
var oldPassword = this.$('old-password').value;
|
||||
var newPassword = this.$('new-password').value;
|
||||
var repeatedPassword = this.$('repeat-password').value;
|
||||
var oldPassword = this.$.oldPassword.value;
|
||||
var newPassword = this.$.newPassword.value;
|
||||
var repeatedPassword = this.$.repeatPassword.value;
|
||||
|
||||
if (newPassword == '' && repeatedPassword == '')
|
||||
throw new Error (_('Passwords empty'));
|
||||
|
@ -37,8 +37,8 @@ Hedera.Conf = new Class
|
|||
throw new Error (_('Passwords doesn\'t match'));
|
||||
|
||||
var params = {
|
||||
'oldPassword': oldPassword,
|
||||
'newPassword': newPassword
|
||||
oldPassword: oldPassword,
|
||||
newPassword: newPassword
|
||||
};
|
||||
this.conn.send ('core/change-password', params,
|
||||
this._onPassChange.bind (this));
|
||||
|
@ -53,25 +53,25 @@ Hedera.Conf = new Class
|
|||
{
|
||||
if (json)
|
||||
{
|
||||
this.$('change-password').hide ();
|
||||
this.$.changePassword.hide ();
|
||||
Htk.Toast.showMessage (_('Password changed!'));
|
||||
this.$('user').refresh ();
|
||||
this.$.user.refresh ();
|
||||
}
|
||||
else
|
||||
{
|
||||
Htk.Toast.showError (error.message);
|
||||
this.$('old-password').select ();
|
||||
this.$.oldPassword.select ();
|
||||
}
|
||||
}
|
||||
|
||||
,onPassInfoClick: function ()
|
||||
{
|
||||
this.$('password-info').show ();
|
||||
this.$.passwordInfo.show ();
|
||||
}
|
||||
|
||||
,onAddressesClick: function ()
|
||||
{
|
||||
this.hash.setAll ({'form': 'account/address-list'});
|
||||
this.hash.setAll ({form: 'account/address-list'});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -23,14 +23,14 @@ Hedera.Connections = new Class
|
|||
|
||||
,onRefreshClick: function ()
|
||||
{
|
||||
this.$('sessions').refresh ();
|
||||
this.$.sessions.refresh ();
|
||||
}
|
||||
|
||||
,repeaterFunc: function (res, form)
|
||||
{
|
||||
res.$('link').href = this.hash.make ({
|
||||
'form': 'admin/access-log',
|
||||
'user': form.get ('userId')
|
||||
res.$.link.href = this.hash.make ({
|
||||
form: 'admin/access-log',
|
||||
user: form.$.userId
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ Hedera.Connections = new Class
|
|||
|
||||
,_onUserSupplant: function ()
|
||||
{
|
||||
this.hash.setAll ({'form': 'ecomerce/orders'});
|
||||
this.hash.setAll ({form: 'ecomerce/orders'});
|
||||
}
|
||||
|
||||
,sessionsFunc: function ()
|
||||
|
|
|
@ -2,10 +2,5 @@
|
|||
Hedera.Links = new Class
|
||||
({
|
||||
Extends: Hedera.Form
|
||||
|
||||
,repeaterFunc: function (res, form)
|
||||
{
|
||||
res.$('link').href = form.get ('link');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -4,23 +4,23 @@
|
|||
</h1>
|
||||
<div id="main" class="cpanel">
|
||||
<div class="card list">
|
||||
<htk-repeater form-id="iter" renderer="repeaterFunc">
|
||||
<htk-repeater>
|
||||
<db-model property="model">
|
||||
SELECT image, name, description, link FROM link
|
||||
ORDER BY name
|
||||
</db-model>
|
||||
<custom>
|
||||
<a id="link" class="list-row" target="_blank">
|
||||
<a class="list-row" href="{{link}}" target="_blank">
|
||||
<htk-image
|
||||
lot="iter"
|
||||
name="image"
|
||||
directory="link"
|
||||
subdir="full"/>
|
||||
<p class="important">
|
||||
<htk-text lot="iter" name="name"/>
|
||||
{{name}}
|
||||
</p>
|
||||
<p>
|
||||
<htk-text lot="iter" name="description"/>
|
||||
{{description}}
|
||||
</p>
|
||||
</a>
|
||||
</custom>
|
||||
|
|
|
@ -18,7 +18,7 @@ Hedera.Photos = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.$('schema').value = 'catalog';
|
||||
this.$.schema.value = 'catalog';
|
||||
}
|
||||
|
||||
,addFiles: function (files)
|
||||
|
@ -70,7 +70,7 @@ Hedera.Photos = new Class
|
|||
this.filesData.push (fileData);
|
||||
button.value = fileData;
|
||||
|
||||
this.$('file-list').appendChild (div);
|
||||
this.$.fileList.appendChild (div);
|
||||
}
|
||||
|
||||
,onUploadClick: function ()
|
||||
|
@ -112,7 +112,7 @@ Hedera.Photos = new Class
|
|||
var formData = new FormData();
|
||||
formData.append ('image', fileData.file);
|
||||
formData.append ('name', fileData.name.value);
|
||||
formData.append ('schema', this.$('schema').value);
|
||||
formData.append ('schema', this.$.schema.value);
|
||||
formData.append ('srv', 'json:image/upload');
|
||||
this.conn.sendFormData (formData,
|
||||
this.onFileUpload.bind (this, fileData));
|
||||
|
@ -163,7 +163,7 @@ Hedera.Photos = new Class
|
|||
,onFileRemove: function (button)
|
||||
{
|
||||
var fileData = button.value;
|
||||
this.$('file-list').removeChild (fileData.div);
|
||||
this.$.fileList.removeChild (fileData.div);
|
||||
|
||||
for (var i = 0; i < this.filesData.length; i++)
|
||||
if (this.filesData[i] === fileData)
|
||||
|
@ -176,27 +176,27 @@ Hedera.Photos = new Class
|
|||
,onClearClick: function ()
|
||||
{
|
||||
this.filesData = [];
|
||||
Vn.Node.removeChilds (this.$('file-list'));
|
||||
Vn.Node.removeChilds (this.$.file-list);
|
||||
}
|
||||
|
||||
,onDropzoneClick: function ()
|
||||
{
|
||||
this.$('file').click ();
|
||||
this.$.file.click ();
|
||||
}
|
||||
|
||||
,onFileChange: function ()
|
||||
{
|
||||
this.addFiles (this.$('file').files);
|
||||
this.addFiles (this.$.file.files);
|
||||
}
|
||||
|
||||
,onDragEnter: function ()
|
||||
{
|
||||
Vn.Node.addClass (this.$('dropzone'), 'dragover');
|
||||
Vn.Node.addClass (this.$.dropzone, 'dragover');
|
||||
}
|
||||
|
||||
,onDragLeave: function ()
|
||||
{
|
||||
Vn.Node.removeClass (this.$('dropzone'), 'dragover');
|
||||
Vn.Node.removeClass (this.$.dropzone, 'dragover');
|
||||
}
|
||||
|
||||
,onDragOver: function (event)
|
||||
|
@ -206,7 +206,7 @@ Hedera.Photos = new Class
|
|||
|
||||
,onDragEnd: function (event)
|
||||
{
|
||||
Vn.Node.removeClass (this.$('dropzone'), 'dragover');
|
||||
Vn.Node.removeClass (this.$.dropzone, 'dragover');
|
||||
event.dataTransfer.clearData ();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,14 +5,14 @@ Hedera.Queries = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.$('result-index').value = 0;
|
||||
this.$.resultIndex.value = 0;
|
||||
}
|
||||
|
||||
,clean: function ()
|
||||
{
|
||||
if (this._grid)
|
||||
{
|
||||
this.$('grid-holder').removeChild (this._grid.node);
|
||||
this.$.gridHolder.removeChild (this._grid.node);
|
||||
this._grid.unref ();
|
||||
this._grid = null;
|
||||
}
|
||||
|
@ -24,9 +24,9 @@ Hedera.Queries = new Class
|
|||
|
||||
var model = new Db.Model ({
|
||||
conn: this.conn,
|
||||
query: this.$('sql').value,
|
||||
resultIndex: this.$('result-index').value,
|
||||
updatable: this.$('updatable').value
|
||||
query: this.$.sql.value,
|
||||
resultIndex: this.$.resultIndex.value,
|
||||
updatable: this.$.updatable.value
|
||||
});
|
||||
model.on ('status-changed', this._onModelChange, this);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ Hedera.Queries = new Class
|
|||
|
||||
Htk.Toast.showMessage (_('Query executed!'));
|
||||
|
||||
var gridHolder = this.$('grid-holder');
|
||||
var gridHolder = this.$.gridHolder;
|
||||
|
||||
if (gridHolder.firstChild)
|
||||
gridHolder.removeChilds (gridHolder.firstChild);
|
||||
|
@ -86,7 +86,7 @@ Hedera.Queries = new Class
|
|||
|
||||
column.setProperties ({
|
||||
title: c.name,
|
||||
editable: this.$('updatable').value,
|
||||
editable: this.$.updatable.value,
|
||||
columnIndex: i
|
||||
});
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</div>
|
||||
<div id="main" class="users">
|
||||
<div class="card list">
|
||||
<htk-repeater form-id="iter" renderer="repeaterFunc">
|
||||
<htk-repeater>
|
||||
<db-model property="model" lot="hash">
|
||||
SELECT u.id, u.name, c.Cliente
|
||||
FROM account.user u
|
||||
|
@ -18,7 +18,10 @@
|
|||
ORDER BY u.name LIMIT 200
|
||||
</db-model>
|
||||
<custom>
|
||||
<a id="link" class="list-row" title="_AccessLog">
|
||||
<a
|
||||
class="list-row"
|
||||
href="#!form=admin/access-log&user={{id}}"
|
||||
title="_AccessLog">
|
||||
<div class="actions">
|
||||
<htk-button
|
||||
lot="iter"
|
||||
|
@ -28,11 +31,10 @@
|
|||
on-click="onChangeUserClick"/>
|
||||
</div>
|
||||
<p class="important">
|
||||
<htk-text lot="iter" name="Cliente"/>
|
||||
{{Cliente}}
|
||||
</p>
|
||||
<p>
|
||||
<htk-text lot="iter" name="id"/> -
|
||||
<htk-text lot="iter" name="name"/>
|
||||
{{id}} - {{name}}
|
||||
</p>
|
||||
</a>
|
||||
</custom>
|
||||
|
|
|
@ -2,24 +2,16 @@
|
|||
Hedera.Users = new Class
|
||||
({
|
||||
Extends: Hedera.Form
|
||||
|
||||
,repeaterFunc: function (res, form)
|
||||
{
|
||||
res.$('link').href = this.hash.make ({
|
||||
'form': 'admin/access-log',
|
||||
'user': form.get ('id')
|
||||
});
|
||||
}
|
||||
|
||||
,onChangeUserClick: function (button, form)
|
||||
{
|
||||
this.gui.supplantUser (form.get ('name'),
|
||||
this.gui.supplantUser (form.$.name,
|
||||
this.onUserSupplant.bind (this));
|
||||
}
|
||||
|
||||
,onUserSupplant: function ()
|
||||
{
|
||||
this.hash.setAll ({'form': 'ecomerce/orders'});
|
||||
this.hash.setAll ({form: 'ecomerce/orders'});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -5,23 +5,21 @@ Hedera.Visits = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
var hash = this.hash;
|
||||
|
||||
if (!hash.get ('to'))
|
||||
{
|
||||
hash.set ('from', new Date ());
|
||||
hash.set ('to', new Date ());
|
||||
}
|
||||
if (!this.hash.$.to)
|
||||
this.hash.assign ({
|
||||
from: new Date (),
|
||||
to: new Date ()
|
||||
});
|
||||
}
|
||||
|
||||
,onRefreshClick: function ()
|
||||
{
|
||||
this.$('visits').refresh ();
|
||||
this.$.visits.refresh ();
|
||||
}
|
||||
|
||||
,onSessionsClick: function ()
|
||||
{
|
||||
this.hash.setAll ({'form': 'admin/connections'});
|
||||
this.hash.setAll ({form: 'admin/connections'});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ Hedera.Contact = new Class
|
|||
,activate: function ()
|
||||
{
|
||||
var self = this;
|
||||
this.$('contact-form').onsubmit = function ()
|
||||
this.$.contactForm.onsubmit = function ()
|
||||
{ self._onSubmit (); return false; };
|
||||
|
||||
this.refreshCaptcha ();
|
||||
|
@ -18,18 +18,18 @@ Hedera.Contact = new Class
|
|||
'srv': 'rest:core/captcha',
|
||||
'stamp': new Date ().getTime ()
|
||||
};
|
||||
this.$('captcha-img').src = '?'+ Vn.Url.makeUri (params);
|
||||
this.$.captchaImg.src = '?'+ Vn.Url.makeUri (params);
|
||||
}
|
||||
|
||||
,_onSubmit: function ()
|
||||
{
|
||||
this.conn.sendForm (this.$('contact-form'),
|
||||
this.conn.sendForm (this.$.contactForm,
|
||||
this._onResponse.bind (this));
|
||||
}
|
||||
|
||||
,_onResponse: function (json, error)
|
||||
,_onResponse: function (json)
|
||||
{
|
||||
var form = this.$('contact-form');
|
||||
var form = this.$.contactForm;
|
||||
|
||||
if (json)
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</div>
|
||||
<div id="main" class="home">
|
||||
<div class="column mansonry" id="news-column">
|
||||
<htk-repeater form-id="new">
|
||||
<htk-repeater>
|
||||
<db-model property="model">
|
||||
SELECT title, date_time, text, image, id FROM news
|
||||
WHERE tag != 'course'
|
||||
|
@ -21,20 +21,20 @@
|
|||
<div class="masonry-box">
|
||||
<div class="new">
|
||||
<div class="top">
|
||||
<h2><htk-text lot="new" name="title"/></h2>
|
||||
<h2>{{title}}</h2>
|
||||
<!--
|
||||
<p class="new-info">
|
||||
<htk-text format="_%a, %e %b %Y" lot="new" name="date_time"/>
|
||||
</p>
|
||||
-->
|
||||
<div class="new-text">
|
||||
<htk-html lot="new" name="text"/>
|
||||
<htk-html lot="iter" name="text"/>
|
||||
</div>
|
||||
</div>
|
||||
<htk-image
|
||||
directory="news"
|
||||
subdir="full"
|
||||
lot="new"
|
||||
lot="iter"
|
||||
name="image"
|
||||
editable="false"
|
||||
full-dir="full"/>
|
||||
|
|
|
@ -48,7 +48,7 @@ Hedera.Location = new Class
|
|||
,center: new google.maps.LatLng (46.0, 4.0)
|
||||
};
|
||||
|
||||
var div = this.$('form');
|
||||
var div = this.$.form;
|
||||
var gmap = new google.maps.Map (div, options);
|
||||
var row;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ Hedera.Basket = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.$('items').setInfo ('i', 'basket_item', 'hedera');
|
||||
this.$.items.setInfo ('i', 'basket_item', 'hedera');
|
||||
}
|
||||
|
||||
,onConfigureClick: function ()
|
||||
|
@ -41,7 +41,7 @@ Hedera.Basket = new Class
|
|||
|
||||
,repeaterFunc: function (res, form)
|
||||
{
|
||||
res.$('subtotal').value = this.subtotal (form);
|
||||
res.$.subtotal.value = this.subtotal (form);
|
||||
}
|
||||
|
||||
,onDeleteClick: function (button, form)
|
||||
|
|
|
@ -36,8 +36,8 @@ Hedera.Catalog = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.$('items').setInfo ('a', 'Articles', 'vn2008', ['item_id']);
|
||||
document.body.appendChild (this.$('right-panel'));
|
||||
this.$.items.setInfo ('a', 'Articles', 'vn2008', ['item_id']);
|
||||
document.body.appendChild (this.$.rightPanel);
|
||||
|
||||
if (localStorage.getItem ('hederaView'))
|
||||
this.setView (parseInt (localStorage.getItem ('hederaView')));
|
||||
|
@ -52,15 +52,15 @@ Hedera.Catalog = new Class
|
|||
,deactivate: function ()
|
||||
{
|
||||
this.hideMenu ();
|
||||
this.gui.$('top-bar').style.backgroundColor = '';
|
||||
Vn.Node.remove (this.$('right-panel'));
|
||||
this.gui.$.topBar.style.backgroundColor = '';
|
||||
Vn.Node.remove (this.$.rightPanel);
|
||||
}
|
||||
|
||||
,setView: function (view)
|
||||
{
|
||||
if (view === View.GRID)
|
||||
{
|
||||
this.$('view-button').setProperties ({
|
||||
this.$.viewButton.setProperties ({
|
||||
icon: 'view-list',
|
||||
tip: _('List view')
|
||||
});
|
||||
|
@ -69,7 +69,7 @@ Hedera.Catalog = new Class
|
|||
}
|
||||
else
|
||||
{
|
||||
this.$('view-button').setProperties ({
|
||||
this.$.viewButton.setProperties ({
|
||||
icon: 'view-grid',
|
||||
tip: _('Grid view')
|
||||
});
|
||||
|
@ -77,7 +77,7 @@ Hedera.Catalog = new Class
|
|||
var className = 'list-view';
|
||||
}
|
||||
|
||||
var node = this.$('grid-view').node;
|
||||
var node = this.$.gridView.node;
|
||||
node.className = className;
|
||||
localStorage.setItem ('hederaView', this.view);
|
||||
}
|
||||
|
@ -91,9 +91,9 @@ Hedera.Catalog = new Class
|
|||
,onBasketReady: function (form)
|
||||
{
|
||||
if (form.get ('method') != 'PICKUP')
|
||||
Vn.Node.setText (this.$('method'), _('Agency'));
|
||||
Vn.Node.setText (this.$.method, _('Agency'));
|
||||
else
|
||||
Vn.Node.setText (this.$('method'), _('Warehouse'));
|
||||
Vn.Node.setText (this.$.method, _('Warehouse'));
|
||||
}
|
||||
|
||||
,onOrderChange: function (e)
|
||||
|
@ -104,7 +104,7 @@ Hedera.Catalog = new Class
|
|||
Db.Model.SortWay.ASC : Db.Model.SortWay.DESC;
|
||||
|
||||
if (sortField)
|
||||
this.$('items').sortByName (sortField, sortWay);
|
||||
this.$.items.sortByName (sortField, sortWay);
|
||||
|
||||
this.hideMenu ();
|
||||
}
|
||||
|
@ -123,47 +123,33 @@ Hedera.Catalog = new Class
|
|||
|
||||
if (shouldRefresh)
|
||||
{
|
||||
var filterSql = this.$('filter').render (params);
|
||||
var filterSql = this.$.filter.render (params);
|
||||
var modelParams = {
|
||||
filter: new Sql.String ({query: filterSql})
|
||||
};
|
||||
this.$('items').refresh (modelParams);
|
||||
this.$.items.refresh (modelParams);
|
||||
|
||||
this.hideMenu ();
|
||||
this.$('order').style.display = 'block';
|
||||
this.$.order.style.display = 'block';
|
||||
}
|
||||
else
|
||||
{
|
||||
this.$('items').clean ();
|
||||
this.$('order').style.display = 'none';
|
||||
this.$.items.clean ();
|
||||
this.$.order.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
,realmRenderer: function (builder, form)
|
||||
{
|
||||
var link = builder.$('link');
|
||||
link.href = this.hash.make ({
|
||||
form: this.hash.$.form,
|
||||
realm: form.$.id
|
||||
});
|
||||
|
||||
var img = builder.$('image');
|
||||
img.src = 'image/family/light/'+ form.$.id +'.svg';
|
||||
img.title = form.$.name;
|
||||
img.alt = img.title;
|
||||
}
|
||||
|
||||
,onRealmChange: function ()
|
||||
{
|
||||
var newValue = this.params.$.realm;
|
||||
this.$('filters').style.display = newValue ? 'block' : 'none';
|
||||
this.$('realm-msg').style.display = newValue ? 'none' : 'block';
|
||||
this.$.filters.style.display = newValue ? 'block' : 'none';
|
||||
this.$.realmMsg.style.display = newValue ? 'none' : 'block';
|
||||
this.refreshTitleColor ();
|
||||
}
|
||||
|
||||
,refreshTitleColor: function ()
|
||||
{
|
||||
var realms = this.$('realms');
|
||||
var realms = this.$.realms;
|
||||
var realm = this.params.$.realm;
|
||||
var color = null;
|
||||
|
||||
|
@ -175,12 +161,12 @@ Hedera.Catalog = new Class
|
|||
color = '#'+ realms.get (row, 'color');
|
||||
}
|
||||
|
||||
this.gui.$('top-bar').style.backgroundColor = color;
|
||||
this.gui.$.topBar.style.backgroundColor = color;
|
||||
}
|
||||
|
||||
,refreshTitle: function ()
|
||||
{
|
||||
var types = this.$('types');
|
||||
var types = this.$.types;
|
||||
var type = this.params.$.type;
|
||||
var title = _('Catalog');
|
||||
|
||||
|
@ -192,7 +178,7 @@ Hedera.Catalog = new Class
|
|||
title = types.get (row, 'name');
|
||||
}
|
||||
|
||||
Vn.Node.setText (this.$('title'), title);
|
||||
Vn.Node.setText (this.$.title, title);
|
||||
}
|
||||
|
||||
,onRightPanelClick: function (event)
|
||||
|
@ -205,7 +191,7 @@ Hedera.Catalog = new Class
|
|||
this._menuShown = true;
|
||||
event.stopPropagation ();
|
||||
this.gui.showBackground ();
|
||||
Vn.Node.addClass (this.$('right-panel'), 'show');
|
||||
Vn.Node.addClass (this.$.rightPanel, 'show');
|
||||
this.hideMenuCallback = this.hideMenu.bind (this);
|
||||
document.addEventListener ('click', this.hideMenuCallback);
|
||||
}
|
||||
|
@ -216,7 +202,7 @@ Hedera.Catalog = new Class
|
|||
return;
|
||||
|
||||
this.gui.hideBackground ();
|
||||
Vn.Node.removeClass (this.$('right-panel'), 'show');
|
||||
Vn.Node.removeClass (this.$.rightPanel, 'show');
|
||||
document.removeEventListener ('click', this.hideMenuCallback);
|
||||
this.hideMenuCallback = null;
|
||||
}
|
||||
|
@ -254,14 +240,14 @@ Hedera.Catalog = new Class
|
|||
return;
|
||||
|
||||
this.onEraseClick ();
|
||||
this.$('card').row = form.row;
|
||||
this.$('card-lot').assign ({item: form.$.item_id});
|
||||
this.$('card-popup').show (button.node);
|
||||
this.$.card.row = form.row;
|
||||
this.$.cardLot.assign ({item: form.$.item_id});
|
||||
this.$.cardPopup.show (button.node);
|
||||
}
|
||||
|
||||
,onAddLotClick: function (column, value, rowIndex)
|
||||
{
|
||||
var row = this.$('item-lots').getObject (rowIndex);
|
||||
var row = this.$.itemLots.getObject (rowIndex);
|
||||
var lotAmount = this.items[row.warehouse];
|
||||
|
||||
if (lotAmount === undefined)
|
||||
|
@ -275,7 +261,7 @@ Hedera.Catalog = new Class
|
|||
newAmount = row.available;
|
||||
|
||||
this.items[row.warehouse] = newAmount;
|
||||
this.$('amount').value += newAmount - lotAmount;
|
||||
this.$.amount.value += newAmount - lotAmount;
|
||||
}
|
||||
else
|
||||
Htk.Toast.showError (_('NoMoreAmountAvailable'));
|
||||
|
@ -293,7 +279,7 @@ Hedera.Catalog = new Class
|
|||
amountSum += amount;
|
||||
|
||||
var params = {
|
||||
item: this.$('card-item').value,
|
||||
item: this.$.cardItem.value,
|
||||
warehouse: warehouse,
|
||||
amount: amount
|
||||
};
|
||||
|
@ -304,30 +290,30 @@ Hedera.Catalog = new Class
|
|||
{
|
||||
this.conn.execQuery (sql);
|
||||
|
||||
var itemName = this.$('card').$.Article;
|
||||
var itemName = this.$.card.$.Article;
|
||||
Htk.Toast.showMessage (
|
||||
sprintf (_('Added%dOf%s'), amountSum, itemName));
|
||||
}
|
||||
|
||||
this.$('card-popup').hide ();
|
||||
this.$.cardPopup.hide ();
|
||||
}
|
||||
|
||||
,onEraseClick: function ()
|
||||
{
|
||||
this.$('amount').value = 0;
|
||||
this.$.amount.value = 0;
|
||||
this.items = {};
|
||||
}
|
||||
|
||||
,onPopupClose: function ()
|
||||
{
|
||||
this.onEraseClick ();
|
||||
this.$('card').row = -1;
|
||||
this.$('card-item').value = undefined;
|
||||
this.$.card.row = -1;
|
||||
this.$.cardItem.value = undefined;
|
||||
}
|
||||
|
||||
,onStatusChange: function ()
|
||||
{
|
||||
this.$('card-popup').reset ();
|
||||
this.$.cardPopup.reset ();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -143,17 +143,15 @@
|
|||
icon="add"
|
||||
on-click="onAddItemClick"
|
||||
class="add-button"/>
|
||||
<h2>
|
||||
<htk-text lot="item" name="Article"/>
|
||||
</h2>
|
||||
<h2>{{Article}}</h2>
|
||||
<p class="producer">
|
||||
<htk-text lot="item" name="producer"/>
|
||||
{{producer}}
|
||||
</p>
|
||||
<p>
|
||||
<htk-text lot="item" name="item_id"/>
|
||||
@{{item_id}}
|
||||
</p>
|
||||
<p>
|
||||
_Size <htk-text lot="item" name="Medida"/>,
|
||||
_Size <htk-text lot="item" name="Medida"/>
|
||||
_Category <htk-text lot="item" name="Categoria"/>
|
||||
</p>
|
||||
<p class="color">
|
||||
|
@ -191,7 +189,6 @@
|
|||
<div class="categories">
|
||||
<div class="realms">
|
||||
<htk-repeater
|
||||
renderer="realmRenderer"
|
||||
class="realms-box">
|
||||
<db-model
|
||||
id="realms"
|
||||
|
@ -204,8 +201,11 @@
|
|||
ORDER BY name
|
||||
</db-model>
|
||||
<custom>
|
||||
<a id="link" class="clickable">
|
||||
<img id="image"/>
|
||||
<a class="clickable" href="#!form={{form}}&realm={{id}}">
|
||||
<img
|
||||
src="image/family/light/{{id}}.svg"
|
||||
title="{{name}}"
|
||||
alt="{{name}}"/>
|
||||
</a>
|
||||
</custom>
|
||||
</htk-repeater>
|
||||
|
|
|
@ -17,8 +17,8 @@ Hedera.Checkout = new Class
|
|||
|
||||
,onValuesReady: function ()
|
||||
{
|
||||
var orderForm = this.$('order-form');
|
||||
var defaultsForm = this.$('defaults');
|
||||
var orderForm = this.$.orderForm;
|
||||
var defaultsForm = this.$.defaults;
|
||||
|
||||
if (!(orderForm.ready && defaultsForm.ready))
|
||||
return;
|
||||
|
@ -43,7 +43,7 @@ Hedera.Checkout = new Class
|
|||
date.setHours (0, 0, 0, 0);
|
||||
}
|
||||
|
||||
this.$('lot').assign ({
|
||||
this.$.lot.assign ({
|
||||
date: date,
|
||||
method: i.get ('delivery_method'),
|
||||
agency: i.get ('agency_id'),
|
||||
|
@ -54,9 +54,9 @@ Hedera.Checkout = new Class
|
|||
|
||||
,disableButtons: function (disable)
|
||||
{
|
||||
this.$('confirm-agency').disabled = disable;
|
||||
this.$('confirm-delivery').disabled = disable;
|
||||
this.$('confirm-pickup').disabled = disable;
|
||||
this.$.confirmAgency.disabled = disable;
|
||||
this.$.confirmDelivery.disabled = disable;
|
||||
this.$.confirmPickup.disabled = disable;
|
||||
}
|
||||
|
||||
,onConfirmClick: function ()
|
||||
|
@ -65,7 +65,7 @@ Hedera.Checkout = new Class
|
|||
|
||||
var query = 'CALL basketConfigure (#date, #method, #agency, #address)';
|
||||
this.conn.execQuery (query,
|
||||
this.onBasketConfigured.bind (this), this.$('lot').params);
|
||||
this.onBasketConfigured.bind (this), this.$.lot.params);
|
||||
}
|
||||
|
||||
,onBasketConfigured: function (resultSet)
|
||||
|
@ -75,7 +75,7 @@ Hedera.Checkout = new Class
|
|||
if (!resultSet.fetchResult ())
|
||||
return;
|
||||
|
||||
if (this.$('order-form').numRows > 0)
|
||||
if (this.$.orderForm.numRows > 0)
|
||||
Htk.Toast.showMessage (_('OrderUpdated'));
|
||||
else
|
||||
Htk.Toast.showMessage (_('OrderStarted'));
|
||||
|
@ -85,7 +85,7 @@ Hedera.Checkout = new Class
|
|||
|
||||
,onCancelClick: function ()
|
||||
{
|
||||
if (this.$('order-form').numRows > 0)
|
||||
if (this.$.orderForm.numRows > 0)
|
||||
window.history.back();
|
||||
else
|
||||
this.hash.setAll ({'form': 'ecomerce/orders'});
|
||||
|
@ -100,7 +100,7 @@ Hedera.Checkout = new Class
|
|||
var steps;
|
||||
var isDelivery;
|
||||
|
||||
switch (this.$('rg-method').value)
|
||||
switch (this.$.rgMethod.value)
|
||||
{
|
||||
case 'AGENCY':
|
||||
steps = this.agencySteps;
|
||||
|
@ -125,18 +125,18 @@ Hedera.Checkout = new Class
|
|||
switch (stepId)
|
||||
{
|
||||
case 'date':
|
||||
Vn.Node.setText (this.$('date-question'), isDelivery ?
|
||||
Vn.Node.setText (this.$.dateQuestion, isDelivery ?
|
||||
_('OrderDateDeliveryQuestion'):
|
||||
_('OrderDatePickupQuestion'));
|
||||
this.$('calendar').goToSelectedMonth ();
|
||||
this.$.calendar.goToSelectedMonth ();
|
||||
break;
|
||||
case 'agency':
|
||||
case 'pickup':
|
||||
this.$('agencies').refresh ();
|
||||
this.$.agencies.refresh ();
|
||||
break;
|
||||
}
|
||||
|
||||
return this.$(stepId +'-step');
|
||||
return this.$[stepId +'Step'];
|
||||
}
|
||||
|
||||
,onFieldChange: function ()
|
||||
|
@ -147,18 +147,18 @@ Hedera.Checkout = new Class
|
|||
|
||||
,goNextStep: function ()
|
||||
{
|
||||
this.$('assistant').moveNext ();
|
||||
this.$.assistant.moveNext ();
|
||||
}
|
||||
|
||||
,addressRenderer: function (builder, form)
|
||||
{
|
||||
builder.$('address').addEventListener ('click',
|
||||
builder.$.address.addEventListener ('click',
|
||||
this.onAddressClick.bind (this, form.get ('id')));
|
||||
}
|
||||
|
||||
,onAddressClick: function (addressId)
|
||||
{
|
||||
this.$('lot').set ('address', addressId);
|
||||
this.$.lot.set ('address', addressId);
|
||||
this.goNextStep ();
|
||||
}
|
||||
|
||||
|
@ -167,17 +167,17 @@ Hedera.Checkout = new Class
|
|||
if (this.selectedNode)
|
||||
Vn.Node.removeClass (this.selectedNode, 'selected');
|
||||
|
||||
var row = this.$('addresses').search ('id', this.$('lot').get ('address'));
|
||||
var row = this.$.addresses.search ('id', this.$.lot.get ('address'));
|
||||
|
||||
if (row != -1)
|
||||
{
|
||||
var builder = this.$('repeater').getScope (row);
|
||||
var builder = this.$.repeater.getScope (row);
|
||||
|
||||
this.selectedNode = builder.$('address');
|
||||
this.selectedNode = builder.$.address;
|
||||
Vn.Node.addClass (this.selectedNode, 'selected');
|
||||
}
|
||||
|
||||
this.$('address-form').row = row;
|
||||
this.$.addressForm.row = row;
|
||||
}
|
||||
|
||||
,onAgenciesReady: function (model)
|
||||
|
|
|
@ -27,13 +27,13 @@ Hedera.Confirm = new Class
|
|||
|
||||
if (order.method != 'PICKUP')
|
||||
{
|
||||
Vn.Node.show (this.$('address'));
|
||||
Vn.Node.setText (this.$('method'), _('Agency'));
|
||||
Vn.Node.show (this.$.address);
|
||||
Vn.Node.setText (this.$.method, _('Agency'));
|
||||
}
|
||||
else
|
||||
{
|
||||
Vn.Node.hide (this.$('address'));
|
||||
Vn.Node.setText (this.$('method'), _('Warehouse'));
|
||||
Vn.Node.hide (this.$.address);
|
||||
Vn.Node.setText (this.$.method, _('Warehouse'));
|
||||
}
|
||||
|
||||
var total = order.taxBase + order.vat;
|
||||
|
@ -57,12 +57,12 @@ Hedera.Confirm = new Class
|
|||
|
||||
if (order.credit > 0)
|
||||
{
|
||||
this.$('credit-info').style.display = 'table-row';
|
||||
this.$.creditInfo.style.display = 'table-row';
|
||||
|
||||
if (creditExceededCond)
|
||||
{
|
||||
this.$('amount-selector').style.display = 'block';
|
||||
this.$('exceeded-info').style.display = 'table-row';
|
||||
this.$.amountSelector.style.display = 'block';
|
||||
this.$.exceededInfo.style.display = 'table-row';
|
||||
lot.payAmount = 'EXCEEDED';
|
||||
}
|
||||
}
|
||||
|
@ -88,9 +88,9 @@ Hedera.Confirm = new Class
|
|||
}
|
||||
|
||||
for (var i = 0; i < methods.length; i++)
|
||||
this.$(methods[i] +'-method').style.display = 'block';
|
||||
this.$[methods[i] +'Method'].style.display = 'block';
|
||||
|
||||
this.$('lot').assign (lot);
|
||||
this.$.lot.assign (lot);
|
||||
}
|
||||
|
||||
,onPayMethodChange: function (payMethod)
|
||||
|
@ -98,21 +98,21 @@ Hedera.Confirm = new Class
|
|||
var id = this.displayedInfo;
|
||||
|
||||
if (id)
|
||||
Vn.Node.removeClass (this.$(id), 'selected');
|
||||
Vn.Node.removeClass (this.$[id], 'selected');
|
||||
|
||||
switch (payMethod.value)
|
||||
{
|
||||
case 'BALANCE':
|
||||
id = 'balance-method';
|
||||
id = 'balanceMethod';
|
||||
break;
|
||||
case 'CREDIT':
|
||||
id = 'credit-method';
|
||||
id = 'creditMethod';
|
||||
break;
|
||||
case 'CARD':
|
||||
id = 'card-method';
|
||||
id = 'cardMethod';
|
||||
break;
|
||||
case 'TRANSFER':
|
||||
id = 'transfer-method';
|
||||
id = 'transferMethod';
|
||||
break;
|
||||
default:
|
||||
id = null;
|
||||
|
@ -121,13 +121,13 @@ Hedera.Confirm = new Class
|
|||
this.displayedInfo = id;
|
||||
|
||||
if (id)
|
||||
Vn.Node.addClass (this.$(id), 'selected');
|
||||
Vn.Node.addClass (this.$[id], 'selected');
|
||||
}
|
||||
|
||||
,disableButtons: function (disable)
|
||||
{
|
||||
this.$('modify').disabled = disable;
|
||||
this.$('confirm').disabled = disable;
|
||||
this.$.modify.disabled = disable;
|
||||
this.$.confirm.disabled = disable;
|
||||
}
|
||||
|
||||
,onModifyClick: function ()
|
||||
|
@ -137,9 +137,9 @@ Hedera.Confirm = new Class
|
|||
|
||||
,onConfirmClick: function ()
|
||||
{
|
||||
console.log (this.$('lot').params);
|
||||
console.log (this.$.lot.params);
|
||||
this.disableButtons (true);
|
||||
this.$('confirm-query').execute ();
|
||||
this.$.confirmQuery.execute ();
|
||||
}
|
||||
|
||||
,onConfirm: function (query, resultSet)
|
||||
|
@ -147,16 +147,16 @@ Hedera.Confirm = new Class
|
|||
this.disableButtons (false);
|
||||
|
||||
if (resultSet.fetchResult ())
|
||||
this.$('success-dialog').show ();
|
||||
this.$.successDialog.show ();
|
||||
}
|
||||
|
||||
,onDialogResponse: function ()
|
||||
{
|
||||
var lot = this.$('lot').params;
|
||||
var lot = this.$.lot.params;
|
||||
|
||||
if (this.$('pay-method').value === 'CARD')
|
||||
if (this.$.payMethod.value === 'CARD')
|
||||
{
|
||||
if (this.$('pay-amount').value === 'EXCEEDED')
|
||||
if (this.$.payAmount.value === 'EXCEEDED')
|
||||
var payAmount = lot.exceededCredit;
|
||||
else
|
||||
var payAmount = lot.totalDebt;
|
||||
|
@ -165,7 +165,7 @@ Hedera.Confirm = new Class
|
|||
conn: this.conn,
|
||||
hash: this.hash
|
||||
});
|
||||
tpv.pay (payAmount, this.$('order').get ('company'));
|
||||
tpv.pay (payAmount, this.$.order.get ('company'));
|
||||
}
|
||||
else
|
||||
this.hash.params = {form: 'ecomerce/orders'};
|
||||
|
|
|
@ -25,7 +25,7 @@ Hedera.Orders = new Class
|
|||
,_onTpvCheck: function (tpv, tpvOrder, tpvStatus)
|
||||
{
|
||||
if (tpvStatus === 'ko')
|
||||
this.$('error-dialog').show ();
|
||||
this.$.errorDialog.show ();
|
||||
}
|
||||
|
||||
,onBasketClick: function ()
|
||||
|
@ -35,7 +35,7 @@ Hedera.Orders = new Class
|
|||
|
||||
,repeaterFunc: function (res, form)
|
||||
{
|
||||
res.$('link').href = this.hash.make ({
|
||||
res.$.link.href = this.hash.make ({
|
||||
form: 'ecomerce/ticket',
|
||||
ticket: form.get ('ticket_id')
|
||||
});
|
||||
|
@ -46,14 +46,14 @@ Hedera.Orders = new Class
|
|||
,balanceConditionalFunc: function (field, value)
|
||||
{
|
||||
if (value >= 0)
|
||||
Vn.Node.removeClass (this.$('balance'), 'negative');
|
||||
Vn.Node.removeClass (this.$.balance, 'negative');
|
||||
else
|
||||
Vn.Node.addClass (this.$('balance'), 'negative');
|
||||
Vn.Node.addClass (this.$.balance, 'negative');
|
||||
}
|
||||
|
||||
,onPayButtonClick: function ()
|
||||
{
|
||||
var amount = -this.$('debt').get('debt');
|
||||
var amount = -this.$.debt.$.debt;
|
||||
|
||||
amount = amount <= 0 ? null : amount;
|
||||
|
||||
|
|
|
@ -60,15 +60,9 @@
|
|||
<p class="important">
|
||||
<htk-text lot="iter" name="date" format="%D"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text lot="iter" name="ticket_id"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text lot="iter" name="consignee"/>
|
||||
</p>
|
||||
<p>
|
||||
<htk-text lot="iter" name="type"/>
|
||||
</p>
|
||||
<p>@{{ticket_id}}</p>
|
||||
<p>{{consignee}}</p>
|
||||
<p>{{type}}</p>
|
||||
</a>
|
||||
</custom>
|
||||
</htk-repeater>
|
||||
|
|
|
@ -24,9 +24,9 @@ Hedera.Ticket = new Class
|
|||
column.value = this.subtotal (form);
|
||||
}
|
||||
|
||||
,repeaterFunc: function (res, form)
|
||||
,repeaterFunc: function (scope, form)
|
||||
{
|
||||
res.$('subtotal').value = this.subtotal (form);
|
||||
scope.$.subtotal.value = this.subtotal (form);
|
||||
}
|
||||
|
||||
,subtotal: function (form)
|
||||
|
|
|
@ -68,12 +68,10 @@
|
|||
subdir="200x200"
|
||||
full-dir="900x900"/>
|
||||
<p class="concept">
|
||||
<htk-text lot="iter" name="concept"/>
|
||||
<htk-text lot="iter" name="Medida"/>
|
||||
<htk-text lot="iter" name="Categoria"/>
|
||||
{{concept}} {{Medida}} {{Categoria}}
|
||||
</p>
|
||||
<p class="amount">
|
||||
<htk-text lot="iter" name="amount"/> x
|
||||
{{amount}} x
|
||||
<htk-text lot="iter" name="price" format="%.2d€"/>
|
||||
<span class="subtotal">
|
||||
<htk-text id="subtotal" format="%.2d€"/>
|
||||
|
|
|
@ -10,13 +10,13 @@ Hedera.New = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.$('model').mode = Db.Model.Mode.ON_DEMAND;
|
||||
this.$('model').setDefault ('user_id', 'news',
|
||||
this.$.model.mode = Db.Model.Mode.ON_DEMAND;
|
||||
this.$.model.setDefault ('user_id', 'news',
|
||||
new Sql.Function ({schema: 'account', name: 'userGetId'}));
|
||||
|
||||
tinymce.init ({
|
||||
mode : 'exact'
|
||||
,target: this.$('html-editor')
|
||||
,target: this.$.htmlEditor
|
||||
,plugins: [
|
||||
"advlist autolink lists link image charmap print preview hr"
|
||||
,"anchor pagebreak searchreplace wordcount visualblocks"
|
||||
|
@ -53,7 +53,7 @@ Hedera.New = new Class
|
|||
if (!this.editor)
|
||||
return;
|
||||
|
||||
var newHtml = this.$('iter').get ('text');
|
||||
var newHtml = this.$.iter.get ('text');
|
||||
|
||||
if (!newHtml)
|
||||
newHtml = '';
|
||||
|
@ -80,8 +80,8 @@ Hedera.New = new Class
|
|||
|
||||
,onAcceptClick: function ()
|
||||
{
|
||||
this.$('iter').set ('text', this.editor.getContent ());
|
||||
this.$('iter').performOperations ();
|
||||
this.$.iter.set ('text', this.editor.getContent ());
|
||||
this.$.iter.performOperations ();
|
||||
}
|
||||
|
||||
,onReturnClick: function ()
|
||||
|
|
|
@ -11,17 +11,17 @@ Hedera.News = new Class
|
|||
|
||||
,repeaterFunc: function (res, form)
|
||||
{
|
||||
res.$('link').href = this.hash.make ({
|
||||
'form': 'news/new',
|
||||
'new': form.get ('id')
|
||||
res.$.link.href = this.hash.make ({
|
||||
form: 'news/new',
|
||||
new: form.$.id
|
||||
});
|
||||
}
|
||||
|
||||
,onAddClick: function ()
|
||||
{
|
||||
this.hash.setAll ({
|
||||
'form': 'news/new',
|
||||
'new': 0
|
||||
form: 'news/new',
|
||||
new: 0
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
editable="true"
|
||||
conn="conn"/>
|
||||
<p class="important">
|
||||
<htk-text lot="iter" name="title"/>
|
||||
{{title}}
|
||||
</p>
|
||||
<p>
|
||||
<htk-text lot="iter" name="Cliente"/>
|
||||
{{Cliente}}
|
||||
</p>
|
||||
<p>
|
||||
_Priority
|
||||
|
|
|
@ -5,7 +5,7 @@ Hedera.ItemsForm = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.$('lot').assign ({
|
||||
this.$.lot.assign ({
|
||||
warehouse: 7,
|
||||
realm: null
|
||||
});
|
||||
|
@ -13,7 +13,7 @@ Hedera.ItemsForm = new Class
|
|||
|
||||
,onShowClick: function ()
|
||||
{
|
||||
this.gui.openReport ('items-report', this.$('lot').params);
|
||||
this.gui.openReport ('items-report', this.$.lot.$);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ Hedera.Shelves = new Class
|
|||
|
||||
,activate: function ()
|
||||
{
|
||||
this.$('lot').assign ({
|
||||
this.$.lot.assign ({
|
||||
date: new Date (),
|
||||
useIds: false
|
||||
});
|
||||
|
@ -13,12 +13,12 @@ Hedera.Shelves = new Class
|
|||
|
||||
,onConfigChange: function ()
|
||||
{
|
||||
this.$('lot').assignLot (this.$('config'));
|
||||
this.$.lot.assignLot (this.$.config);
|
||||
}
|
||||
|
||||
,onShowClick: function ()
|
||||
{
|
||||
this.gui.openReport ('shelves-report', this.$('lot').params);
|
||||
this.gui.openReport ('shelves-report', this.$.lot.$);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -41,11 +41,12 @@ module.exports = new Class
|
|||
conn: this.conn,
|
||||
hash: this.hash
|
||||
};
|
||||
var scope = builder.load (this.doc, this, null, extraObjects);
|
||||
var scope = builder.load (this.doc, this, null, extraObjects, this.hash);
|
||||
this.scope = scope;
|
||||
this._node = this.$('main');
|
||||
this.$ = scope.$;
|
||||
this._node = this.$.main;
|
||||
|
||||
var paramsLot = this.$('params');
|
||||
var paramsLot = this.$.params;
|
||||
|
||||
if (paramsLot)
|
||||
{
|
||||
|
@ -68,8 +69,8 @@ module.exports = new Class
|
|||
if (this.node)
|
||||
{
|
||||
this.gui.setForm (this.node);
|
||||
this.gui.setTitle (scope.$('title'));
|
||||
this.gui.setActions (scope.$('actions'));
|
||||
this.gui.setTitle (scope.$.title);
|
||||
this.gui.setActions (scope.$.actions);
|
||||
this.activate ();
|
||||
}
|
||||
|
||||
|
|
|
@ -57,22 +57,22 @@ module.exports = new Class
|
|||
this.loadTemplateFromString (Tpl);
|
||||
this.loadingCount = 0;
|
||||
|
||||
this.$('background').onclick = function () {};
|
||||
this.$.background.onclick = function () {};
|
||||
|
||||
this.$('menu-button').addEventListener ('click', function (event)
|
||||
this.$.menuButton.addEventListener ('click', function (event)
|
||||
{
|
||||
event.stopPropagation ();
|
||||
this.showMenu ();
|
||||
}.bind (this));
|
||||
|
||||
this.$('left-panel').addEventListener ('click', function (event)
|
||||
this.$.leftPanel.addEventListener ('click', function (event)
|
||||
{
|
||||
event.stopPropagation ();
|
||||
});
|
||||
|
||||
this.parent (props);
|
||||
|
||||
this.$('social-bar').conn = this._conn;
|
||||
this.$.socialBar.conn = this._conn;
|
||||
|
||||
var sql = 'SELECT name FROM customer_user;'
|
||||
+'SELECT default_form, image_dir, image_host FROM config;'
|
||||
|
@ -89,7 +89,7 @@ module.exports = new Class
|
|||
|
||||
this._shown = true;
|
||||
this.doc.body.appendChild (this.node);
|
||||
Htk.Toast.pushTop (this.$('form-holder'));
|
||||
Htk.Toast.pushTop (this.$.formHolder);
|
||||
|
||||
if (Vn.isMobile ())
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ module.exports = new Class
|
|||
// Retrieving the user name
|
||||
|
||||
var userName = resultSet.fetchValue ();
|
||||
Vn.Node.setText (this.$('user-name'), userName);
|
||||
Vn.Node.setText (this.$.userName, userName);
|
||||
|
||||
// Retrieving configuration parameters
|
||||
|
||||
|
@ -178,11 +178,11 @@ module.exports = new Class
|
|||
var linkField = 'test_domain';
|
||||
}
|
||||
|
||||
Vn.Node.setText (this.$('test-link'), _(linkText));
|
||||
this.$('test-link').href = '//'+ row[linkField];
|
||||
Vn.Node.setText (this.$.testLink, _(linkText));
|
||||
this.$.testLink.href = '//'+ row[linkField];
|
||||
}
|
||||
else
|
||||
Vn.Node.hide (this.$('test-link'));
|
||||
Vn.Node.hide (this.$.testLink);
|
||||
|
||||
// Loading the default form
|
||||
|
||||
|
@ -214,8 +214,8 @@ module.exports = new Class
|
|||
sectionMap[parent].push (i);
|
||||
}
|
||||
|
||||
Vn.Node.removeChilds (this.$('main-menu'));
|
||||
this.createMenu (res, sectionMap, null, this.$('main-menu'));
|
||||
Vn.Node.removeChilds (this.$.mainMenu);
|
||||
this.createMenu (res, sectionMap, null, this.$.mainMenu);
|
||||
}
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Menu
|
||||
|
@ -301,7 +301,7 @@ module.exports = new Class
|
|||
,showMenu: function ()
|
||||
{
|
||||
this.showBackground ();
|
||||
Vn.Node.addClass (this.$('left-panel'), 'show');
|
||||
Vn.Node.addClass (this.$.leftPanel, 'show');
|
||||
this._menuShown = true;
|
||||
|
||||
this.hideMenuCallback = this.hideMenu.bind (this);
|
||||
|
@ -314,7 +314,7 @@ module.exports = new Class
|
|||
return;
|
||||
|
||||
this.hideBackground ();
|
||||
Vn.Node.removeClass (this.$('left-panel'), 'show');
|
||||
Vn.Node.removeClass (this.$.leftPanel, 'show');
|
||||
this._menuShown = false;
|
||||
|
||||
this.doc.removeEventListener ('click', this.hideMenuCallback);
|
||||
|
@ -335,7 +335,7 @@ module.exports = new Class
|
|||
if (!this._shown)
|
||||
return;
|
||||
|
||||
var navbar = this.$('top-bar');
|
||||
var navbar = this.$.topBar;
|
||||
var yOffset = window.pageYOffset;
|
||||
var showNavbar = this._lastYOffset > yOffset || yOffset < navbar.offsetHeight;
|
||||
|
||||
|
@ -359,12 +359,12 @@ module.exports = new Class
|
|||
|
||||
,showBackground: function ()
|
||||
{
|
||||
Vn.Node.addClass (this.$('background'), 'show');
|
||||
Vn.Node.addClass (this.$.background, 'show');
|
||||
}
|
||||
|
||||
,hideBackground: function ()
|
||||
{
|
||||
Vn.Node.removeClass (this.$('background'), 'show');
|
||||
Vn.Node.removeClass (this.$.background, 'show');
|
||||
}
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Spinner
|
||||
|
@ -374,7 +374,7 @@ module.exports = new Class
|
|||
this.loadingCount++;
|
||||
|
||||
if (this.loadingCount == 1)
|
||||
this.$('loader').start ();
|
||||
this.$.loader.start ();
|
||||
}
|
||||
|
||||
,loaderPop: function ()
|
||||
|
@ -385,7 +385,7 @@ module.exports = new Class
|
|||
this.loadingCount--;
|
||||
|
||||
if (this.loadingCount == 0)
|
||||
this.$('loader').stop ();
|
||||
this.$.loader.stop ();
|
||||
}
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++ Forms
|
||||
|
@ -447,31 +447,31 @@ module.exports = new Class
|
|||
|
||||
,setForm: function (form)
|
||||
{
|
||||
Vn.Node.removeChilds (this.$('form-holder'));
|
||||
Vn.Node.removeChilds (this.$.formHolder);
|
||||
|
||||
if (form)
|
||||
{
|
||||
var div = this.createElement('div');
|
||||
div.appendChild (form);
|
||||
|
||||
this.$('form-holder').appendChild (div);
|
||||
this.$.formHolder.appendChild (div);
|
||||
setTimeout (this._onSetFormTimeout.bind (this), 10);
|
||||
}
|
||||
}
|
||||
|
||||
,_onSetFormTimeout: function ()
|
||||
{
|
||||
Vn.Node.addClass (this.$('form-holder').firstChild, 'slide');
|
||||
Vn.Node.addClass (this.$.formHolder.firstChild, 'slide');
|
||||
}
|
||||
|
||||
,setTitle: function (title)
|
||||
{
|
||||
Vn.Node.setChild (this.$('title'), title);
|
||||
Vn.Node.setChild (this.$.title, title);
|
||||
}
|
||||
|
||||
,setActions: function (actions)
|
||||
{
|
||||
Vn.Node.setChild (this.$('action-bar'), actions);
|
||||
Vn.Node.setChild (this.$.actionBar, actions);
|
||||
}
|
||||
|
||||
,closeForm: function ()
|
||||
|
@ -525,13 +525,13 @@ module.exports = new Class
|
|||
,_onSupplantName: function (resultSet)
|
||||
{
|
||||
var userName = resultSet.fetchValue ();
|
||||
Vn.Node.setText (this.$('supplanted'), userName);
|
||||
Vn.Node.show (this.$('supplant'));
|
||||
Vn.Node.setText (this.$.supplanted, userName);
|
||||
Vn.Node.show (this.$.supplant);
|
||||
}
|
||||
|
||||
,onSupplantExitClick: function ()
|
||||
{
|
||||
Vn.Node.hide (this.$('supplant'));
|
||||
Vn.Node.hide (this.$.supplant);
|
||||
this._conn.supplantEnd ();
|
||||
this.loadMenu ();
|
||||
this._onFormChange ();
|
||||
|
|
|
@ -33,10 +33,10 @@ module.exports = new Class
|
|||
this.parent (props);
|
||||
this.loadTemplateFromString (Tpl);
|
||||
|
||||
this.$('social-bar').conn = this._conn;
|
||||
this.$.socialBar.conn = this._conn;
|
||||
|
||||
var self = this;
|
||||
this.$('form').onsubmit = function ()
|
||||
this.$.form.onsubmit = function ()
|
||||
{
|
||||
self._onSubmit ();
|
||||
return false;
|
||||
|
@ -50,7 +50,7 @@ module.exports = new Class
|
|||
var lastUser = localStorage.getItem ('hederaLastUser');
|
||||
|
||||
if (lastUser)
|
||||
this.$('user').value = lastUser;
|
||||
this.$.user.value = lastUser;
|
||||
|
||||
this._focusUserInput ();
|
||||
}
|
||||
|
@ -63,17 +63,17 @@ module.exports = new Class
|
|||
,_onConnLoadChange: function (conn, isLoading)
|
||||
{
|
||||
if (isLoading)
|
||||
this.$('spinner').start ();
|
||||
this.$.spinner.start ();
|
||||
else
|
||||
this.$('spinner').stop ();
|
||||
this.$.spinner.stop ();
|
||||
}
|
||||
|
||||
,_onSubmit: function ()
|
||||
{
|
||||
this._conn.open (
|
||||
this.$('user').value,
|
||||
this.$('pass').value,
|
||||
this.$('remember').checked,
|
||||
this.$.user.value,
|
||||
this.$.pass.value,
|
||||
this.$.remember.checked,
|
||||
this._onConnOpen.bind (this)
|
||||
);
|
||||
this._disableUi (true);
|
||||
|
@ -81,12 +81,12 @@ module.exports = new Class
|
|||
|
||||
,_onConnOpen: function (conn, success, error)
|
||||
{
|
||||
this.$('pass').value = '';
|
||||
this.$.pass.value = '';
|
||||
this._disableUi (false);
|
||||
|
||||
if (success)
|
||||
{
|
||||
var user = this.$('user').value;
|
||||
var user = this.$.user.value;
|
||||
|
||||
if (user)
|
||||
localStorage.setItem ('hederaLastUser', user);
|
||||
|
@ -102,21 +102,21 @@ module.exports = new Class
|
|||
|
||||
,_focusUserInput: function ()
|
||||
{
|
||||
var userEntry = this.$('user');
|
||||
var userEntry = this.$.user;
|
||||
userEntry.focus ();
|
||||
userEntry.select ();
|
||||
}
|
||||
|
||||
,_disableUi: function (disabled)
|
||||
{
|
||||
this.$('user').disabled = disabled;
|
||||
this.$('pass').disabled = disabled;
|
||||
this.$('submit').disabled = disabled;
|
||||
this.$.user.disabled = disabled;
|
||||
this.$.pass.disabled = disabled;
|
||||
this.$.submit.disabled = disabled;
|
||||
}
|
||||
|
||||
,onPasswordLost: function ()
|
||||
{
|
||||
var user = this.$('user').value;
|
||||
var user = this.$.user.value;
|
||||
|
||||
if (!user)
|
||||
Htk.Toast.showError (_('Please write your user name'));
|
||||
|
|
|
@ -53,6 +53,6 @@ module.exports = new Class
|
|||
hash: this.hash
|
||||
};
|
||||
this.loadScope (builder, null, extraObjects);
|
||||
this.body.appendChild (this.$('report'));
|
||||
this.body.appendChild (this.$.report);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -25,7 +25,7 @@ module.exports = new Class
|
|||
this.loadTemplateFromString (Tpl);
|
||||
|
||||
var self = this;
|
||||
this.$('form').onsubmit = function ()
|
||||
this.$.form.onsubmit = function ()
|
||||
{ self._onSubmit (); return false; };
|
||||
|
||||
this.parent (props);
|
||||
|
@ -33,7 +33,7 @@ module.exports = new Class
|
|||
|
||||
,onNameChange: function ()
|
||||
{
|
||||
var newValue = this.$('name').value;
|
||||
var newValue = this.$.name.value;
|
||||
|
||||
if (!newValue)
|
||||
newValue = null
|
||||
|
@ -43,29 +43,29 @@ module.exports = new Class
|
|||
|
||||
,_onSubmit: function ()
|
||||
{
|
||||
this.$('submit').disabled = true;
|
||||
this.$('spinner').start ();
|
||||
this.$.submit.disabled = true;
|
||||
this.$.spinner.start ();
|
||||
|
||||
this.conn.sendFormMultipart (this.$('form'),
|
||||
this.conn.sendFormMultipart (this.$.form,
|
||||
this._onResponse.bind (this));
|
||||
}
|
||||
|
||||
,_onResponse: function (json, error)
|
||||
{
|
||||
this.$('submit').disabled = false;
|
||||
this.$('spinner').stop ();
|
||||
this.$.submit.disabled = false;
|
||||
this.$.spinner.stop ();
|
||||
|
||||
if (error)
|
||||
throw error;
|
||||
|
||||
Toast.showMessage (_('ImageAdded'));
|
||||
this.emit ('file-uploaded', this.$('name').value);
|
||||
this.emit ('file-uploaded', this.$.name.value);
|
||||
}
|
||||
|
||||
,setData: function (image, directory)
|
||||
{
|
||||
this.$('name').value = image;
|
||||
this.$('schema').value = directory;
|
||||
this.$.name.value = image;
|
||||
this.$.schema.value = directory;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ module.exports = new Class
|
|||
}
|
||||
|
||||
,_builder: null
|
||||
,_formId: 'form'
|
||||
,_formId: 'iter'
|
||||
,_parentScope: null
|
||||
|
||||
,render: function ()
|
||||
|
@ -119,7 +119,7 @@ module.exports = new Class
|
|||
var extraObjects = {};
|
||||
extraObjects[this._formId] = set;
|
||||
|
||||
var scope = this._builder.load (this.doc, null, this._parentScope, extraObjects);
|
||||
var scope = this._builder.load (this.doc, null, this._parentScope, extraObjects, set);
|
||||
scope.link ();
|
||||
|
||||
this._childsData.push ({
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
var VnObject = require ('./object');
|
||||
var Scope = require ('./scope');
|
||||
var kebabToCamel = require ('./string-util').kebabToCamel;
|
||||
|
||||
var CompilerObject = require ('./compiler-object');
|
||||
var CompilerElement = require ('./compiler-element');
|
||||
|
@ -148,7 +149,7 @@ module.exports = new Class
|
|||
|
||||
if (nodeId)
|
||||
{
|
||||
this._contextMap[nodeId] = context.id;
|
||||
this._contextMap[kebabToCamel (nodeId)] = context.id;
|
||||
context.nodeId = nodeId;
|
||||
}
|
||||
|
||||
|
@ -170,9 +171,10 @@ module.exports = new Class
|
|||
* @param {Document} dstDocument The document used to create the nodes
|
||||
* @param {Object} signalData The object where to bind methods
|
||||
* @param {Scope} parentScope The parent scope or %null for no parent
|
||||
* @param {Lot} lot The default lot
|
||||
* @return {Scope} The created scope
|
||||
*/
|
||||
,load: function (dstDocument, signalData, parentScope, extraObjects)
|
||||
,load: function (dstDocument, signalData, parentScope, extraObjects, lot)
|
||||
{
|
||||
if (this._contexts === null)
|
||||
return null;
|
||||
|
@ -181,7 +183,7 @@ module.exports = new Class
|
|||
var contexts = this._contexts;
|
||||
var len = contexts.length;
|
||||
var objects = new Array (len);
|
||||
var scope = new Scope (this, objects, signalData, parentScope, extraObjects)
|
||||
var scope = new Scope (this, objects, signalData, parentScope, lot)
|
||||
|
||||
for (var i = 0; i < len; i++)
|
||||
{
|
||||
|
@ -189,6 +191,7 @@ module.exports = new Class
|
|||
objects[i] = context.compiler.instantiate (doc, context, scope);
|
||||
}
|
||||
|
||||
scope.init (extraObjects);
|
||||
return scope;
|
||||
}
|
||||
|
||||
|
@ -241,12 +244,7 @@ module.exports = new Class
|
|||
{
|
||||
return result.objects[this._mainContext];
|
||||
}
|
||||
|
||||
,getById: function (objectId)
|
||||
{
|
||||
return this._contextMap[objectId];
|
||||
}
|
||||
|
||||
|
||||
,getByTagName: function (scope, tagName)
|
||||
{
|
||||
var tags = this._tags[tagName];
|
||||
|
|
|
@ -65,7 +65,7 @@ module.exports = new Class
|
|||
|
||||
var props = context.props;
|
||||
for (var prop in props)
|
||||
object.setAttribute (prop, props[prop]);
|
||||
object.setAttribute (prop, scope.interpolate (props[prop]));
|
||||
|
||||
if (context.nodeId)
|
||||
object.setAttribute ('id', scope.getHtmlId (context.nodeId));
|
||||
|
@ -78,7 +78,7 @@ module.exports = new Class
|
|||
var props = context.objectProps;
|
||||
for (var prop in props)
|
||||
{
|
||||
var objectValue = scope.$(props[prop]);
|
||||
var objectValue = scope.$[props[prop]];
|
||||
var htmlId;
|
||||
|
||||
if (objectValue instanceof Component)
|
||||
|
|
|
@ -178,9 +178,9 @@ module.exports = new Class
|
|||
,addLink: function (context, prop, objectId)
|
||||
{
|
||||
this._links.push ({
|
||||
context: context
|
||||
context: context
|
||||
,prop: prop
|
||||
,objectId: objectId
|
||||
,objectId: kebabToCamel (objectId)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ module.exports = new Class
|
|||
{
|
||||
var link = links[i];
|
||||
var object = objects[link.context.id];
|
||||
var objectRef = scope.$(link.objectId);
|
||||
var objectRef = scope.$[link.objectId];
|
||||
|
||||
if (objectRef == null)
|
||||
{
|
||||
|
|
|
@ -31,8 +31,8 @@ module.exports = new Class
|
|||
return {text: text};
|
||||
}
|
||||
|
||||
,instantiate: function (doc, context)
|
||||
,instantiate: function (doc, context, scope)
|
||||
{
|
||||
return doc.createTextNode (context.text);
|
||||
return doc.createTextNode (scope.interpolate (context.text));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -57,11 +57,12 @@ module.exports = new Class
|
|||
{
|
||||
return this._htmlId;
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
,_node: null
|
||||
,scope: null
|
||||
,$: {}
|
||||
|
||||
,initialize: function (props)
|
||||
{
|
||||
|
@ -127,29 +128,16 @@ module.exports = new Class
|
|||
{
|
||||
var scope = builder.load (this.doc, this, parentScope, extraObjects);
|
||||
this.scope = scope;
|
||||
this._node = this.$('main');
|
||||
scope.link ();
|
||||
this.$ = scope.$;
|
||||
this._node = this.$.main;
|
||||
return scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an object from the scope associated to this component.
|
||||
*
|
||||
* @param {String} id The object identifier
|
||||
* @return {Object} The object, or %null if not found
|
||||
*/
|
||||
,$: function (id)
|
||||
{
|
||||
if (this.scope)
|
||||
return this.scope.$(id);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
,_destroy: function ()
|
||||
{
|
||||
if (this.builder)
|
||||
this.builder.unref ();
|
||||
if (this.scope)
|
||||
this.scope.unref ();
|
||||
|
||||
this.parent ();
|
||||
}
|
||||
|
|
|
@ -7,14 +7,14 @@ module.exports = new Class
|
|||
({
|
||||
Extends: VnObject
|
||||
|
||||
,initialize: function (builder, objects, signalData, parentScope, extraObjects)
|
||||
,initialize: function (builder, objects, signalData, parentScope, lot)
|
||||
{
|
||||
this.builder = builder;
|
||||
this.objects = objects;
|
||||
this.signalData = signalData;
|
||||
this.parentScope = parentScope;
|
||||
this.uid = ++scopeUid;
|
||||
this.extraObjects = extraObjects;
|
||||
this.lot = lot;
|
||||
|
||||
if (!signalData && parentScope)
|
||||
this.signalData = parentScope.signalData;
|
||||
|
@ -22,46 +22,23 @@ module.exports = new Class
|
|||
this.parent ();
|
||||
}
|
||||
|
||||
,init: function (extraObjects)
|
||||
{
|
||||
var contextMap = this.builder._contextMap;
|
||||
var objectMap = this.parentScope ? Object.create (this.parentScope.$) : {};
|
||||
this.$ = objectMap;
|
||||
|
||||
for (var id in extraObjects)
|
||||
objectMap[id] = extraObjects[id];
|
||||
for (var id in contextMap)
|
||||
objectMap[id] = this.objects[contextMap[id]];
|
||||
}
|
||||
|
||||
,getMain: function ()
|
||||
{
|
||||
return this.builder.getMain (this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetchs an element by it's identifier.
|
||||
*
|
||||
* @param {String} id The node identifier
|
||||
* @return {Object} The object or %null if it doesn't exists
|
||||
*/
|
||||
,$: function (id)
|
||||
{
|
||||
var object;
|
||||
var index = this.builder.getById (id);
|
||||
|
||||
if (index !== undefined)
|
||||
object = this.objects[index];
|
||||
else
|
||||
{
|
||||
object = this.extraObjects[id];
|
||||
|
||||
if (object === undefined && this.parentScope)
|
||||
object = this.parentScope.getById (id);
|
||||
}
|
||||
|
||||
return object ? object : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetchs an element by it's identifier.
|
||||
*
|
||||
* @param {String} id The node identifier
|
||||
* @return {Object} The object or %null if it doesn't exists
|
||||
*/
|
||||
,getById: function (id)
|
||||
{
|
||||
return this.$(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetchs a set of elements by it's tag name.
|
||||
*
|
||||
|
@ -81,6 +58,34 @@ module.exports = new Class
|
|||
this.builder.link (this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces all ocurrences of {{value}} by it's corresponding value in the
|
||||
* scope lot.
|
||||
*/
|
||||
,interpolate: function (string)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
function replaceFunc (token)
|
||||
{
|
||||
var key = token.substr (2, token.length - 4);
|
||||
var value = self.getLotValue (key);
|
||||
return value ? value : '';
|
||||
}
|
||||
|
||||
return string.replace (/{{[\w_]+}}/g, replaceFunc);
|
||||
}
|
||||
|
||||
,getLotValue: function (key)
|
||||
{
|
||||
var value = this.lot.$[key];
|
||||
|
||||
if (value === undefined && this.parentScope)
|
||||
return this.parentScope.getLotValue (key);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
,getMethod: function (value, binded)
|
||||
{
|
||||
if (this.signalData)
|
||||
|
|
Loading…
Reference in New Issue