Skip to content

Commit

Permalink
static initial data for components
Browse files Browse the repository at this point in the history
  • Loading branch information
Quickcorp committed May 8, 2018
1 parent ea58f7a commit b6fc6e1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions QCObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -861,13 +861,19 @@
Ready(function (){
var _buildComponent = function (components){
for (var _c = 0;_c<components.length;_c++){
var data = {};
var attributenames = components[_c].getAttributeNames().filter(function(a){return a.startsWith('data-')}).map(function(a){return a.split('-')[1]});
for (var attribute in attributenames){
data[attributenames[attribute]] = components[_c].getAttribute('data-'+attributenames[attribute]);
}
Class('ComponentBody',Component,{
'name':components[_c].getAttribute('name').toString(),
'reload':true
name:components[_c].getAttribute('name').toString(),
reload:true
});
var newComponent = New(ComponentBody,{
'name':components[_c].getAttribute('name').toString(),
'templateURI':'{{COMPONENTS_BASE_PATH}}{{COMPONENT_NAME}}.html'.replace('{{COMPONENT_NAME}}',components[_c].getAttribute('name').toString()).replace('{{COMPONENTS_BASE_PATH}}',CONFIG.get('componentsBasePath'))
name:components[_c].getAttribute('name').toString(),
data:data,
templateURI:'{{COMPONENTS_BASE_PATH}}{{COMPONENT_NAME}}.html'.replace('{{COMPONENT_NAME}}',components[_c].getAttribute('name').toString()).replace('{{COMPONENTS_BASE_PATH}}',CONFIG.get('componentsBasePath'))
});
newComponent.done = function (){
_buildComponent(this.body.querySelectorAll('component'));
Expand Down

0 comments on commit b6fc6e1

Please sign in to comment.