Skip to content

Commit 5d326a3

Browse files
committed
Merge pull request #26 from vish250491/master
Layout 10 issues fixed, Carousel placeholder issue fixed
2 parents 26ac76c + d5b6c5b commit 5d326a3

File tree

4 files changed

+52
-46
lines changed

4 files changed

+52
-46
lines changed

widget/controllers/widget.home.controller.js

Lines changed: 49 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@
1414
var deviceHeight = window.innerHeight;
1515
var detailedPluginInfoArray = [];
1616
var deviceWidth = window.innerWidth;
17-
var oldCarousalArray=[];
18-
var oldLayoutName=null;
17+
var oldCarousalArray = [];
18+
var oldLayoutName = null;
1919
WidgetHome.firstTime = true;
20-
$scope.layout12TotalItem=0;
21-
$scope.layout12Height='300px';
20+
$scope.layout12TotalItem = 0;
21+
$scope.layout12Height = '300px';
22+
23+
$scope.setWidth = function () {
24+
$rootScope.deviceWidth = window.innerWidth;
25+
};
2226

2327
WidgetHome.view = null;
2428
//Default initialise
@@ -51,7 +55,7 @@
5155

5256
/*declare the device width heights*/
5357
$rootScope.deviceHeight = window.innerHeight;
54-
$rootScope.deviceWidth = window.innerWidth;
58+
//$rootScope.deviceWidth = window.innerWidth;
5559

5660
WidgetHome.advancedFolderInfo = new DB(COLLECTIONS.advancedFolderInfo);
5761

@@ -87,15 +91,17 @@
8791
console.log('>>result<<', result);
8892
if (result && result.data && result.id) {
8993
WidgetHome.info = result;
90-
loadData();
94+
$timeout(function () {
95+
loadData();
96+
}, 1000);
9197
if (WidgetHome.info.data && WidgetHome.info.data.design) {
9298
setBackgroundImage();
93-
oldLayoutName=WidgetHome.info.data.design.itemListLayout;
99+
oldLayoutName = WidgetHome.info.data.design.itemListLayout;
94100
}
95101
$timeout(function () {
96102
WidgetHome.initCarousel();
97-
oldCarousalArray=WidgetHome.info.data.content.images;
98-
}, 1500);
103+
oldCarousalArray = WidgetHome.info.data.content.images;
104+
}, 1500);
99105
}
100106
else {
101107
WidgetHome.info = DEFAULT_DATA.ADVANCED_FOLDER_INFO;
@@ -162,16 +168,16 @@
162168

163169
function preparePluginsData(plugins) {
164170

165-
var matrix = [], i, k;
166-
var matrix = []
167-
for (i = 0, k = -1; i < plugins.length; i++) {
168-
if (i % 8 === 0) {
169-
k++;
170-
matrix[k] = [];
171-
}
172-
matrix[k].push(plugins[i]);
171+
var matrix = [], i, k;
172+
var matrix = []
173+
for (i = 0, k = -1; i < plugins.length; i++) {
174+
if (i % 8 === 0) {
175+
k++;
176+
matrix[k] = [];
173177
}
174-
$scope.layout12Plugins = matrix;
178+
matrix[k].push(plugins[i]);
179+
}
180+
$scope.layout12Plugins = matrix;
175181

176182
}
177183

@@ -303,6 +309,7 @@
303309
console.log('dynamic store fetching');
304310
buildfire.datastore.getWithDynamicData('advancedFolderInfo', function (err, result) {
305311
if (err) {
312+
$('body').hide();
306313
console.log('eror in dynamic store fetching');
307314
console.error("Error: ", err);
308315
return;
@@ -323,23 +330,22 @@
323330
*/
324331

325332
WidgetHome.onUpdateCallback = function (event) {
326-
327333
if (event.data) {
328334
WidgetHome.info = event;
329335
layout12Skeleton();
330336
ViewStack.popAllViews();
331337
if (WidgetHome.info.data && WidgetHome.info.data.design)
332338
$rootScope.bgImage = WidgetHome.info.data.design.bgImage;
333339
setBackgroundImage();
334-
var newCarousalArray=WidgetHome.info.data.content.images;
335-
var newLayoutName=WidgetHome.info.data.design.itemListLayout;
336-
337-
if(( (oldLayoutName != newLayoutName )|| !angular.equals(oldCarousalArray,newCarousalArray)) ){
338-
setTimeout(function(){
339-
WidgetHome.initCarousel();
340-
oldCarousalArray=newCarousalArray;
341-
oldLayoutName=newLayoutName;
342-
},500);
340+
var newCarousalArray = WidgetHome.info.data.content.images;
341+
var newLayoutName = WidgetHome.info.data.design.itemListLayout;
342+
343+
if (( (oldLayoutName != newLayoutName ) || !angular.equals(oldCarousalArray, newCarousalArray))) {
344+
setTimeout(function () {
345+
WidgetHome.initCarousel();
346+
oldCarousalArray = newCarousalArray;
347+
oldLayoutName = newLayoutName;
348+
}, 500);
343349
}
344350

345351

@@ -351,7 +357,7 @@
351357

352358

353359
function dataLoadedHandler(result) {
354-
console.log('success in dynamic store fetching', result);
360+
console.log('success in dynamic store fetching', result.data._buildfire.plugins.result.length);
355361
var pluginsList = null;
356362
if (result && result.data && result.data._buildfire && result.data._buildfire.plugins && result.data._buildfire.plugins.result) {
357363
pluginsList = result.data._buildfire.plugins;
@@ -366,7 +372,7 @@
366372

367373
})
368374
}
369-
}else{
375+
} else {
370376
if (WidgetHome.info.data.content.entity.length) {
371377
layout12Skeleton();
372378
}
@@ -375,12 +381,12 @@
375381
console.log('success in dynamic store fetching post', WidgetHome.info);
376382
}
377383

378-
function layout12Skeleton(){
379-
if(WidgetHome.info.data.design.itemListLayout=="list-layout12"){
380-
var currentCount =Number(WidgetHome.info.data.content.entity.length);
384+
function layout12Skeleton() {
385+
if (WidgetHome.info.data.design.itemListLayout == "list-layout12") {
386+
var currentCount = Number(WidgetHome.info.data.content.entity.length);
381387
preparePluginsData(WidgetHome.info.data.content.entity);
382-
if(currentCount){
383-
$scope.layout12TotalItem=currentCount;
388+
if (currentCount) {
389+
$scope.layout12TotalItem = currentCount;
384390
}
385391
}
386392
}
@@ -485,22 +491,22 @@
485491

486492
};
487493

488-
$rootScope.$on("CallHomeMethod", function (event,d) {
494+
$rootScope.$on("CallHomeMethod", function (event, d) {
489495
if (d.data && d.method == 'navigateToPlugin')
490496
WidgetHome.navigateToPlugin(d.data);
491497
});
492498

493-
$scope.$on('LastRepeaterElement', function(){
499+
$scope.$on('LastRepeaterElement', function () {
494500
// $('.plugin-slider.text-center.owl-carousel').trigger("destroy.owl.carousel");
495-
$scope.layout12Height= $('.plugin-slider .plugin-slide').first().height()+240+'px';
501+
$scope.layout12Height = $('.plugin-slider .plugin-slide').first().height() + 240 + 'px';
496502
var slides = $('.plugin-slider .plugin-slide').length;
497-
$scope.layout12TotalItem=$scope.layout12TotalItem+1;
503+
$scope.layout12TotalItem = $scope.layout12TotalItem + 1;
498504
// Slider needs at least 2 slides or you'll get an error.
499-
if(slides > 1){
505+
if (slides > 1) {
500506
$('.plugin-slider').owlCarousel({
501-
loop:false,
502-
nav:false,
503-
items:1
507+
loop: false,
508+
nav: false,
509+
items: 1
504510
});
505511
}
506512
});

widget/templates/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<div style="height:100%;" ng-if="WidgetHome.info.data.design.itemListLayout" ng-include="'templates/layouts/' + WidgetHome.info.data.design.itemListLayout + '.html'">
1+
<div data-ng-init="setWidth()" style="height:100%;" ng-if="WidgetHome.info.data.design.itemListLayout" ng-include="'templates/layouts/' + WidgetHome.info.data.design.itemListLayout + '.html'">
22
</div>

widget/templates/layouts/list-layout1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="holder padding-zero ">
1+
<div class="holder padding-zero ">
22
<div class="media-center-plugin layout3 text-overlay">
33
<div ng-if="!WidgetHome.noCarouselBody" class="plugin-banner clearfix border-bottom-grey">
44
<div id="carousel" build-fire-carousel=""

widget/templates/layouts/list-layout10.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<div class="blackLayer"></div>
2929
<div class="backgroundLayer" style="background:url('{{ WidgetHome.cropImage(plugin.data.iconUrl? plugin.data.iconUrl : '../../../styles/media/holder-4x1.png', {width: 640, height: 200}) }}');"></div>
3030
<img load-image="4x1" data-final-src="{{ WidgetHome.cropImage(plugin.data.iconUrl, {width: 640, height: 200}) }}" ng-if="plugin.data.iconUrl">
31-
<img src="../../../styles/media/holder-4x1.png" ng-if="! plugin.fileUrl && plugin.items.length!=0">
31+
<img src="../../../styles/media/holder-4x1.png" ng-if="!plugin.data.iconUrl">
3232
<p class="ellipsis item-text whiteTheme text-center">{{ plugin.data.title }}</p>
3333
</div>
3434

0 commit comments

Comments
 (0)