0
1
Fork 0

CSS class inherithed in components, bugs solved

This commit is contained in:
Juan Ferrer Toribio 2018-01-16 09:10:44 +01:00
parent 6666304332
commit 2ca8a09acd
8 changed files with 54 additions and 38 deletions

View File

@ -93,13 +93,12 @@
<htk-image <htk-image
directory="catalog" directory="catalog"
subdir="200x200" subdir="200x200"
lot="item" value="{{image}}"
name="image"
full-dir="900x900"/> full-dir="900x900"/>
<div class="item-info"> <div class="item-info">
<htk-button <htk-button
lot="item" lot="item"
value="{{item.id}}" value="{{id}}"
tip="_AddToBasket" tip="_AddToBasket"
icon="add" icon="add"
on-click="onAddItemClick" on-click="onAddItemClick"
@ -108,9 +107,6 @@
<p class="producer"> <p class="producer">
{{producer}} {{producer}}
</p> </p>
<p>
@{{id}}
</p>
<p> <p>
{{tag1}} {{val1}}, {{tag2}} {{val2}} {{tag1}} {{val1}}, {{tag2}} {{val2}}
</p> </p>
@ -237,7 +233,7 @@
{{card.name}} {{card.name}}
</h2> </h2>
<p> <p>
{{card.id}} @{{card.id}}
</p> </p>
<p class="producer"> <p class="producer">
{{card.producer}} {{card.producer}}

View File

@ -8,9 +8,8 @@ Hedera.Ticket = new Class
if (!ticket.value) if (!ticket.value)
return; return;
var batch = new Sql.Batch (); var params = {ticket: ticket.value};
batch.addValue ('ticket', ticket.value); this.conn.execQuery ('CALL myTicketLogAccess (#ticket)', params);
this.conn.execQuery ('CALL myTicketLogAccess (#ticket)', null, batch);
} }
,onPrintClick: function () ,onPrintClick: function ()
@ -37,7 +36,7 @@ Hedera.Ticket = new Class
,onPackagesChanged: function (model) ,onPackagesChanged: function (model)
{ {
this.$('packages').node.style.display = this.$.packages.node.style.display =
model.numRows > 0 ? 'block' : 'none'; model.numRows > 0 ? 'block' : 'none';
} }
}); });

View File

@ -66,8 +66,7 @@
{{concept}} {{size}} {{category}} {{concept}} {{size}} {{category}}
</p> </p>
<p class="amount"> <p class="amount">
{{quantity}} x {{quantity}} x <htk-text lot="iter" name="price" format="%.2d€"/>
<htk-text lot="iter" name="price" format="%.2d€"/>
<span class="subtotal"> <span class="subtotal">
<htk-text id="subtotal" format="%.2d€"/> <htk-text id="subtotal" format="%.2d€"/>
</span> </span>
@ -80,28 +79,25 @@
<db-model <db-model
property="model" property="model"
on-status-changed="onPackagesChanged" on-status-changed="onPackagesChanged"
batch="batch"> lot="params">
<custom> CALL myTicketGetPackages (#ticket)
CALL myTicketGetPackages (#ticket)
</custom>
</db-model> </db-model>
<custom> <custom>
<div class="line"> <div class="line">
<htk-image <htk-image
form="iter" value="{{image}}"
column="image"
class="photo" class="photo"
directory="catalog" directory="catalog"
subdir="200x200" subdir="200x200"
full-dir="900x900"/> full-dir="900x900"/>
<p class="subtotal"> <p class="subtotal">
<htk-text form="iter" column="quantity"/> {{quantity}}
</p> </p>
<p class="concept"> <p class="concept">
<htk-text form="iter" column="name"/> {{name}}
</p> </p>
<p class="amount"> <p class="amount">
@<htk-text form="iter" column="id"/> {{id}}
</p> </p>
<div class="clear"/> <div class="clear"/>
</div> </div>

View File

@ -7,8 +7,15 @@ var nativeEvents = {
,focusout : 1 ,focusout : 1
}; };
var Klass = new Class (); var Klass = new Class ();
module.exports = Klass.implement module.exports = Klass;
Klass.extend
({
Classes: ''
});
Klass.implement
({ ({
Extends: NodeBuilder Extends: NodeBuilder
,Properties: ,Properties:
@ -112,8 +119,8 @@ module.exports = Klass.implement
{ {
if (this.htmlId) if (this.htmlId)
node.id = this.htmlId; node.id = this.htmlId;
if (this.$constructor.Tag) if (this.$constructor.Classes)
node.className = this.$constructor.Tag; node.className = this.$constructor.Classes;
this._node = node; this._node = node;
} }

View File

@ -1,22 +1,39 @@
require ('mootools');
vnCustomTags = {}; vnCustomTags = {};
var Mutators = Class.Mutators; var Mutators = Class.Mutators;
var _Extends = Mutators.Extends;
Mutators.Extends = function () {
_Extends.apply (this, arguments);
if (this.Properties === undefined)
this.implement ({Properties: {}});
};
Mutators.Tag = function (tagName) Mutators.Tag = function (tagName)
{ {
vnCustomTags[tagName] = this; vnCustomTags[tagName] = this;
if (this.parent)
this.implement ({Properties: {}});
this.extend ({Tag: tagName}); this.extend ({Tag: tagName});
var parent = this.parent;
if (parent && parent.Classes !== undefined)
{
var Classes = tagName
if (parent.Classes !== '')
Classes += ' '+ parent.Classes;
this.extend ({Classes: Classes});
}
}; };
Mutators.Properties = function (props) Mutators.Properties = function (props)
{ {
var parentProps;
for (var propName in props) for (var propName in props)
{ {
var prop = props[propName]; var prop = props[propName];
@ -26,6 +43,8 @@ Mutators.Properties = function (props)
prop.writable = true; prop.writable = true;
} }
var parentProps;
if (this.parent && (parentProps = this.parent.Properties)) if (this.parent && (parentProps = this.parent.Properties))
for (var propName in parentProps) for (var propName in parentProps)
if (!props[propName]) if (!props[propName])

View File

@ -6,7 +6,8 @@
module.exports = new Class module.exports = new Class
({ ({
/** /**
* Tag to be used when the class instance is defined via XML. * Tag to be used when the class instance is defined via XML. All classes
* must define this attribute, even if it is not used.
*/ */
Tag: 'vn-object' Tag: 'vn-object'

View File

@ -17,7 +17,7 @@ Hedera.DeliveryNote = new Class
,onPackagesChanged: function (model) ,onPackagesChanged: function (model)
{ {
this.$('packages').node.style.display = this.$.packages.node.style.display =
model.numRows > 0 ? 'block' : 'none'; model.numRows > 0 ? 'block' : 'none';
} }
}); });

View File

@ -44,12 +44,10 @@
</htk-grid> </htk-grid>
<div class="footer"> <div class="footer">
<p> <p>
_Total _Total <htk-text lot="ticket" name="taxBase" format="%.2d€"/>
<htk-text lot="ticket" name="taxBase" format="%.2d€"/>
</p> </p>
<p> <p>
_Total + tax _Total + tax <htk-text lot="ticket" name="total" format="%.2d€"/>
<htk-text lot="ticket" name="total" format="%.2d€"/>
</p> </p>
</div> </div>
<htk-grid id="packages" class="packages"> <htk-grid id="packages" class="packages">