|
37 | 37 | </tr>
|
38 | 38 | </thead>
|
39 | 39 | <tbody id="media_gallery_content_list">
|
40 |
| - <?php foreach ($this->getImages() as $image): ?> |
41 |
| - <tr> |
42 |
| - <td class="cell-image" id="cloudinary_preview_container_<?php echo $image->getValueId(); ?>"> |
43 |
| - </td> |
44 |
| - <td class="cell-label"><?php echo $image->getLabel(); ?></td> |
| 40 | + <tr v-for="image in images"> |
| 41 | + <td class="cell-image" v-bind:id="'cloudinary_preview_container_' + image.value_id"></td> |
| 42 | + <td class="cell-label">{{ image.label }}</td> |
45 | 43 | <td>
|
46 | 44 | <input type="text"
|
47 |
| - id="cloudinary_input_<?php echo $image->getValueId(); ?>" |
48 |
| - name="cloudinary_free[<?php echo $image->getValueId(); ?>]" |
49 |
| - value="<?php echo $image->getFreeTransformation(); ?>" |
50 |
| - style="width: 80%;" /> |
| 45 | + v-bind:id="'cloudinary_input_' + image.value_id" |
| 46 | + v-bind:name="'cloudinary_free[' + image.value_id + ']'" |
| 47 | + v-bind:value="image.free_transformation" |
| 48 | + style="width: 80%;" /> |
51 | 49 | <input type="hidden"
|
52 |
| - id="cloudinary_input_updated_<?php echo $image->getValueId(); ?>" |
53 |
| - name="cloudinary_free_updated[<?php echo $image->getValueId(); ?>]" |
54 |
| - value="" /> |
| 50 | + v-bind:id="'cloudinary_input_updated_' + image.value_id" |
| 51 | + v-bind:name="'cloudinary_free_updated[' + image.value_id + ']'" |
| 52 | + v-bind:value="''" /> |
55 | 53 | </td>
|
56 | 54 | <td>
|
57 |
| - <button id="cloudinary_preview_button_<?php echo $image->getValueId(); ?>" |
58 |
| - class="cloudinary_preview_button" |
59 |
| - type="button" |
60 |
| - data-file="<?php echo $image->getFile(); ?>" |
61 |
| - data-id="<?php echo $image->getValueId(); ?>"> |
| 55 | + <button class="cloudinary_preview_button" type="button" |
| 56 | + v-bind:id="'cloudinary_preview_button_' + image.value_id" |
| 57 | + v-bind:data-id="image.value_id" |
| 58 | + v-bind:data-file="image.file"> |
62 | 59 | Preview
|
63 | 60 | </button>
|
64 | 61 | </td>
|
65 | 62 | </tr>
|
66 |
| - <?php endforeach; ?> |
67 | 63 | </tbody>
|
68 | 64 | </table>
|
69 | 65 | </div>
|
|
217 | 213 | var self = this,
|
218 | 214 | input = $('cloudinary_input_' + id);
|
219 | 215 |
|
| 216 | + |
220 | 217 | input.on('change', function() { self.setPreviewActiveState(id, true); });
|
221 | 218 | input.on('keydown', function() { self.setPreviewActiveState(id, true); });
|
222 | 219 | input.on('paste', function() { self.setPreviewActiveState(id, true); });
|
223 | 220 | input.on('input', function() { self.setPreviewActiveState(id, true); });
|
224 | 221 | },
|
225 |
| - }; |
226 | 222 |
|
227 |
| - $$('.cloudinary_preview_button').each(function(button) { |
228 |
| - window.cloudinary.updatePreview(button.getAttribute('data-id')); |
229 |
| - window.cloudinary.addPreviewButtonListener(button); |
230 |
| - window.cloudinary.addTextChangeListener(button.getAttribute('data-id')); |
231 |
| - }); |
| 223 | + init: function() { |
| 224 | + $$('.cloudinary_preview_button').each(function(button) { |
| 225 | + window.cloudinary.updatePreview(button.getAttribute('data-id')); |
| 226 | + window.cloudinary.addPreviewButtonListener(button); |
| 227 | + window.cloudinary.addTextChangeListener(button.getAttribute('data-id')); |
| 228 | + }); |
| 229 | + } |
| 230 | + }; |
232 | 231 |
|
233 | 232 | window.cloudinary_transformation_tab_images = <?php echo $jsonData; ?>;
|
234 |
| - |
235 | 233 | window.cloudinaryTransformationTabApp = new Vue({
|
236 | 234 | el: '#cloudinary_transformation_tab',
|
237 | 235 | data: {
|
238 | 236 | images: window.cloudinary_transformation_tab_images
|
| 237 | + }, |
| 238 | + mounted: function () { |
| 239 | + window.cloudinary.init(); |
| 240 | + }, |
| 241 | + updated: function () { |
| 242 | + window.cloudinary.init(); |
239 | 243 | }
|
240 |
| - }) |
| 244 | + }); |
241 | 245 |
|
242 | 246 | </script>
|
0 commit comments