<center>
<container>
<row>
- <columns large="6">
+ <columns large="6" small="12">
<callout>
<img src="http://placehold.it/100x100">
</p>
</callout>
</columns>
- <columns large="6">
+ <columns large="6" small="12">
<callout>
<img src="http://placehold.it/100x100">
</callout>
</columns>
<columns large="6">
- <callout class="success">
- <p>
- got some success yo
- </p>
- </callout>
+ <p>great success</p>
</columns>
</row>
<row>
<columns large="12">
- <callout class="warning">
- <p>
- Watch out there, cowboy. Watch out there, cowboy. Watch out there, cowboy. Watch out there, cowboy. Watch out there, cowboy. Watch out there, cowboy. Watch out there, cowboy. Watch out there, cowboy. Watch out there, cowboy. Watch out there, cowboy. Watch oasdfasdfaout there, cowboy. Watch out there, cowboy. Watch out there, cowboy.
- </p>
- </callout>
+ <button>Biggest button</button>
+ </columns>
+ </row>
+ <row>
+ <columns large='2'>
+ <inline-list-v>
+ <a href="#">Link 4</a>
+ <a href="#">Link 4</a>
+ <a href="#">Link 4</a>
+ <a href="#">Link 4</a>
+ <a href="#">Link 4</a>
+ <a href="#">Link 4</a>
+ </inline-list-v>
+ </columns>
+ <columns large='10'>
+ <h1> Some side content </h1>
</columns>
</row>
</container>
callout: 'callout',
columns: 'columns',
subcolumns: 'subcolumns',
- container: 'container'
+ container: 'container',
+ inlineListH: 'inline-list-h',
+ inlineListV: 'inline-list-v'
}
};
self.zfArray = arr;
},
+ isZfElement: function(elType) {
+ var self = this;
+ // create an array of our custom tags, if we haven't done so already
+ if(!self.zfArray) {
+ self.setTagArray();
+ }
+
+ // if the element is a custom element
+ if (self.zfArray.indexOf(elType) !== -1) {
+ // return true
+ return true;
+ }
+ else {
+ return false;
+ }
+ },
+
+ isTdElement: function(elType) {
+ var tdEls = ['subcolumns', 'callout']
+
+ // if the element is an element that comes with td
+ if (tdEls.indexOf(elType) !== -1) {
+ // return true
+ return true;
+ }
+ else {
+ return false;
+ }
+
+ },
+
// Description:
// Takes in HTML loaded via Cheerio as an argument, checks if there are any custom components.
// If there are, it replaces the nested components, traverses the DOM and replaces them with
output = '<table class="row ' + compClass + '"><tbody><tr>'+ inner + '</tr></tbody></table>';
break;
+ case self.zfTags.inlineListH:
+ inner = self.makeInlineList($, component, 'horizontal');
+ output = '<table class="inline-list ' + compClass + '"><tbody><tr>' + inner + '</tr></tbody></table>';
+ break;
+
+ case self.zfTags.inlineListV:
+ inner = self.makeInlineList($, component, 'vertical');
+ output = '<table class="inline-list ' + compClass + '"><tbody>' + inner + '</tbody></table>';
+ break;
+
default:
// unless it's a special element, just grab the inside
// another cheerio quirk
return output;
},
+ makeInlineList: function($, list, orientation) {
+ var output = '';
+ var children = list.children();
+
+ $(children).each(function(idx, el) {
+ var innerChild = $.html(el);
+
+ if (orientation === 'horizontal') {
+ output += '<td>' + innerChild + '</td>';
+ }
+ else if (orientation === 'vertical') {
+ output += '<tr><td class="vertical">' + innerChild + '</td></tr>';
+ }
+ else {
+ return;
+ }
+ });
+ return output;
+ },
+
// Description:
// Returns output for column elements. TODO: this could be refactored to handle both cols and subcols
//
wrapperHTML = '',
colSize = '',
colClass = '',
- inner = $(col).html();
+ inner = $(col).html(),
+ self = this;
if ($(col).attr('class')) {
if ($(col).attr('small')) {
colSize += 'small' + '-' + $(col).attr('small') + ' ';
}
+
if ($(col).attr('large')) {
colSize += 'large' + '-' + $(col).attr('large') + ' ';
}
output += '<table class="' + colSize + 'columns"><tr>';
- // subcolumns do not need an extra td
+
+ // if the column has children, put them in a td
+ // if the child already has a td with it (i.e subcolumns/callouts), just place them inside
// otherwise, place stuff inside columns in a td
- if ($(col).children()[0] && $(col).children()[0].name !== 'subcolumns') {
+
+ if ($(col).children()[0] && !self.isTdElement($(col).children()[0].name)) {
output += '<td>' + inner + '</td>';
}
else {
}
output += '<td class="expander"></td></tr></table>';
-
return output;
}
};