on xenial help sign in
Add max-count for attributes
commitfefea98b370e039bc2815273ad8a35fddaf0e69f authorYing-Chun Liu <paul.liu@canonical.com> dateFri 25 Jul 2014, 23:11 (12 years ago) parent173de16
3 files changed+6−4
qml/Dash/CardTool.qml+4−2 tests/plugins/Dash/cardcreator/7.tst+1−1 tests/qmltests/Dash/CardHelpers.js+1−1
qml/Dash/CardTool.qml+4−2
@@ -171,10 +171,12 @@ Item {
171171 property var model: []
172172 property bool hasAttributes: {
173173 var attributes = components["attributes"];
174− var hasAttributesFlag = attributes != undefined;
174+ var hasAttributesFlag = (attributes != undefined) && attributes["field"];
175175 // TODO: we should get num of attributes from components
176176 if (hasAttributesFlag) {
177− numOfAttributes = 3;
177+ if (attributes["max-count"]) {
178+ numOfAttributes = attributes["max-count"];
179+ }
178180 }
179181 return hasAttributesFlag
180182 }
tests/plugins/Dash/cardcreator/7.tst+1−1
@@ -1,3 +1,3 @@
11template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2−components: {"art":{"aspect-ratio":1,"fill-mode":"crop"},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{"field":"attributes"}}
2+components: {"art":{"aspect-ratio":1,"fill-mode":"crop"},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{"field":"attributes","max-count":2}}
33result: 7.res
tests/qmltests/Dash/CardHelpers.js+1−1
@@ -49,7 +49,7 @@ var defaultLayout = ' \
4949 }, \
5050 "alt-rating": null, \
5151 "summary": null, \
52− "attributes": null \
52+ "attributes": { "max-count": 2 } \
5353 }, \
5454 "resources": {} \
5555}'