|
51 | 51 | }); |
52 | 52 | } |
53 | 53 |
|
| 54 | + var isCarouselImageChanged = false; |
| 55 | + |
54 | 56 | $scope.$on('$viewContentLoaded', function () { |
55 | 57 | $timeout(function () { |
56 | 58 | // create a new instance of the buildfire carousel editor |
57 | | - editor = new Buildfire.components.carousel.editor("#carousel2"); |
58 | | - console.log(editor); |
59 | | - |
| 59 | + editor = new Buildfire.components.carousel.editor("#carousel2",{},5000,0,0); |
60 | 60 | // this method will be called when a new item added to the list |
61 | 61 | editor.onAddItems = function (items) { |
62 | 62 | if (!ContentItem.item.data.carouselImages) |
63 | 63 | ContentItem.item.data.carouselImages = []; |
64 | 64 | ContentItem.item.data.carouselImages.push.apply(ContentItem.item.data.carouselImages, items); |
| 65 | + isCarouselImageChanged = true; |
65 | 66 | $scope.$digest(); |
66 | 67 | }; |
67 | 68 | // this method will be called when an item deleted from the list |
68 | 69 | editor.onDeleteItem = function (item, index) { |
69 | 70 | ContentItem.item.data.carouselImages.splice(index, 1); |
| 71 | + isCarouselImageChanged = true; |
| 72 | + |
70 | 73 | $scope.$digest(); |
71 | 74 | }; |
72 | 75 | // this method will be called when you edit item details |
73 | 76 | editor.onItemChange = function (item, index) { |
74 | 77 | ContentItem.item.data.carouselImages.splice(index, 1, item); |
| 78 | + isCarouselImageChanged = true; |
| 79 | + |
75 | 80 | $scope.$digest(); |
76 | 81 | }; |
77 | 82 | // this method will be called when you change the order of items |
|
92 | 97 | items[newIndex] = tmp; |
93 | 98 |
|
94 | 99 | ContentItem.item.data.carouselImages = items; |
| 100 | + isCarouselImageChanged = true; |
| 101 | + |
| 102 | + $scope.$digest(); |
| 103 | + }; |
| 104 | + editor.onOptionSpeedChange = function (speed) { |
| 105 | + ContentItem.item.data.speed = speed; |
| 106 | + isCarouselImageChanged = true; |
| 107 | + |
| 108 | + $scope.$digest(); |
| 109 | + }; |
| 110 | + |
| 111 | + editor.onOptionOrderChange = function (order) { |
| 112 | + ContentItem.item.data.order = order; |
| 113 | + isCarouselImageChanged = true; |
| 114 | + |
| 115 | + $scope.$digest(); |
| 116 | + }; |
| 117 | + |
| 118 | + editor.onOptionDisplayChange = function (display) { |
| 119 | + ContentItem.item.data.display = display; |
| 120 | + isCarouselImageChanged = true; |
| 121 | + |
95 | 122 | $scope.$digest(); |
96 | 123 | }; |
97 | 124 |
|
|
222 | 249 | if (ContentItem.item.data.listImage) { |
223 | 250 | listImage.loadbackground(ContentItem.item.data.listImage); |
224 | 251 | } |
225 | | - if (!ContentItem.item.data.carouselImages) |
226 | | - editor.loadItems([]); |
227 | | - else |
228 | | - editor.loadItems(ContentItem.item.data.carouselImages); |
| 252 | + |
| 253 | + // editor = new Buildfire.components.carousel.editor("#carousel2"); |
| 254 | + if (ContentItem.item && ContentItem.item.data && ContentItem.item.data.speed) { |
| 255 | + editor.setOptionSpeed(ContentItem.item.data.speed); |
| 256 | + } |
| 257 | + if (ContentItem.item && ContentItem.item.data && ContentItem.item.data.order) { |
| 258 | + editor.setOptionOrder(ContentItem.item.data.order); |
| 259 | + } |
| 260 | + if (ContentItem.item && ContentItem.item.data && ContentItem.item.data.display) { |
| 261 | + editor.setOptionDisplay(ContentItem.item.data.display); |
| 262 | + } |
| 263 | + if (!ContentItem.item.data.carouselImages) |
| 264 | + editor.loadItems([]); |
| 265 | + else |
| 266 | + editor.loadItems(ContentItem.item.data.carouselImages); |
229 | 267 | if (ContentItem.item.data.itemListBgImage) { |
230 | 268 | background.loadbackground(ContentItem.item.data.itemListBgImage); |
231 | 269 | } |
|
305 | 343 | ContentItem.unchangedData = angular.equals(_data, ContentItem.item.data); |
306 | 344 |
|
307 | 345 | ContentItem.isItemValid = ContentItem.isValidItem(ContentItem.item.data); |
308 | | - if (!ContentItem.isUpdating && !isUnchanged(ContentItem.item) && ContentItem.isItemValid) { |
| 346 | + if (!ContentItem.isUpdating && (!isUnchanged(ContentItem.item) || isCarouselImageChanged) && ContentItem.isItemValid) { |
| 347 | + isCarouselImageChanged = false |
309 | 348 | tmrDelayForItem = setTimeout(function () { |
310 | 349 | if (item.id) { |
311 | 350 | ContentItem.updateItemData(); |
|
0 commit comments