Commit 037d8ec85f792113219ba08959b147580abb045d
1 parent
49cc918f
selection controllet and card update
Showing
1 changed file
with
44 additions
and
14 deletions
controllets/create-card-controllet/create-card-controllet.html
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | <link rel="import" href="../../bower_components/iron-icons/iron-icons.html"/> |
| 5 | 5 | <link rel="import" href="../../bower_components/paper-input/paper-textarea.html"/> |
| 6 | 6 | |
| 7 | +<link rel="import" href="../../datalets/preview-datalet/preview-datalet.html" /> | |
| 7 | 8 | <link rel="import" href="../../controllets/paper-card-controllet/paper-card-controllet.html"/> |
| 8 | 9 | |
| 9 | 10 | <dom-module id="create-card-controllet"> |
| ... | ... | @@ -171,7 +172,6 @@ |
| 171 | 172 | label="" |
| 172 | 173 | char-counter |
| 173 | 174 | max-rows="6" |
| 174 | - rows="6" | |
| 175 | 175 | maxlength="1024" |
| 176 | 176 | value="{{text}}"> |
| 177 | 177 | |
| ... | ... | @@ -204,16 +204,7 @@ |
| 204 | 204 | |
| 205 | 205 | <paper-fab mini icon="add-circle" on-click="_handleFabClick"></paper-fab> |
| 206 | 206 | |
| 207 | - <div id="card_preview"> | |
| 208 | - <paper-card-controllet | |
| 209 | - class="grid-item" | |
| 210 | - width="300" | |
| 211 | - height="300" | |
| 212 | - type="{{type}}" | |
| 213 | - text="{{comment}}" | |
| 214 | - legend="{{title}}"> | |
| 215 | - </paper-card-controllet> | |
| 216 | - </div> | |
| 207 | + <div id="card_preview"></div> | |
| 217 | 208 | </div> |
| 218 | 209 | |
| 219 | 210 | |
| ... | ... | @@ -234,15 +225,28 @@ |
| 234 | 225 | |
| 235 | 226 | title:{ |
| 236 | 227 | type: String, |
| 237 | - value: "Title" | |
| 228 | + value: "Title", | |
| 229 | + observer : '_valueChanged' | |
| 230 | + }, | |
| 231 | + text:{ | |
| 232 | + type: String, | |
| 233 | + value: "Text content", | |
| 234 | + observer : '_valueChanged' | |
| 238 | 235 | }, |
| 239 | 236 | content:{ |
| 240 | 237 | type: String, |
| 241 | - value: undefined | |
| 238 | + value: undefined, | |
| 239 | + observer : '_valueChanged' | |
| 242 | 240 | }, |
| 243 | 241 | comment:{ |
| 244 | 242 | type: String, |
| 245 | - value: "comment" | |
| 243 | + value: "comment", | |
| 244 | + observer : '_valueChanged' | |
| 245 | + }, | |
| 246 | + | |
| 247 | + timer :{ | |
| 248 | + type: Number, | |
| 249 | + value : 0 | |
| 246 | 250 | } |
| 247 | 251 | }, |
| 248 | 252 | |
| ... | ... | @@ -256,6 +260,32 @@ |
| 256 | 260 | |
| 257 | 261 | _handleFabClick: function(e){ |
| 258 | 262 | this.fire('create-card-controllet_button-clicked', {data : this}); |
| 263 | + }, | |
| 264 | + | |
| 265 | + _valueChanged: function(oldvalue, newValue) { | |
| 266 | + var card = '<paper-card-controllet' + | |
| 267 | + ' class="grid-item"' + | |
| 268 | + ' width="300"' + | |
| 269 | + ' height="300"' + | |
| 270 | + ' type="'+ this.type + '"' + | |
| 271 | + ' text="'+ this.comment + '"' + | |
| 272 | + ' legend="'+ this.title + '">'; | |
| 273 | + if(this.type == 'link'){ | |
| 274 | + card += '<preview-datalet data-url="'+ this.link + '" url="'+ this.link + '"></preview-datalet>'; | |
| 275 | + }else{ | |
| 276 | + card += this.text; | |
| 277 | + } | |
| 278 | + | |
| 279 | + card += '</paper-card-controllet>'; | |
| 280 | + | |
| 281 | + clearTimeout (this.timer); | |
| 282 | + //Firefox stuff | |
| 283 | + var _this = this; | |
| 284 | + this.timer = setTimeout(function(){ | |
| 285 | + _this.$.card_preview.innerHTML = card; | |
| 286 | + }, 1000); | |
| 287 | + | |
| 288 | + | |
| 259 | 289 | } |
| 260 | 290 | }) |
| 261 | 291 | </script> | ... | ... |