on xenial help sign in
split the card generating code to a different function
commite121fe0c70c34820fbb44f69f0d589a5e21455c1 authorAlbert Astals <albert.astals@canonical.com> dateMon 5 May 2014, 17:47 (12 years ago) parent1b0ce5b
1 file changed+9−7
plugins/Dash/CardCreator.js+9−7
plugins/Dash/CardCreator.js+9−7
@@ -16,10 +16,7 @@
1616
1717.pragma library
1818
19−function createCardComponent(parent, template, components) {
20− var imports = 'import QtQuick 2.2; \
21− import Ubuntu.Components 0.1; \
22− import Ubuntu.Thumbnailer 0.1;';
19+function cardString(template, components) {
2320 var code;
2421 code = 'AbstractButton { \
2522 id: root; \
@@ -418,9 +415,14 @@ function createCardComponent(parent, template, components) {
418415 }
419416 code += '}';
420417
418+ return code;
419+}
421420
422−
423− code = imports + 'Component {' + code + '}';
424−// console.log(code)
421+function createCardComponent(parent, template, components) {
422+ var imports = 'import QtQuick 2.2; \
423+ import Ubuntu.Components 0.1; \
424+ import Ubuntu.Thumbnailer 0.1;';
425+ var card = cardString(template, components);
426+ var code = imports + 'Component {' + card + '}';
425427 return Qt.createQmlObject(code, parent, "createCardComponent");
426428}