Skip to content

Commit

Permalink
Merge pull request #31 from sakshityagi/master
Browse files Browse the repository at this point in the history
Showed init data for carousel and wysiwyg text in both content and widget section
  • Loading branch information
DanielHindi committed Apr 26, 2016
2 parents 475a579 + ae34166 commit 66d6edf
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
28 changes: 27 additions & 1 deletion control/content/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,38 @@
return;
}

if (result && result.data && !angular.equals({}, result.data)) {
if (result && result.data && !angular.equals({}, result.data) && result.id) {
$scope.data = result.data;
$scope.id = result.id;
if($scope.data.content && $scope.data.content.carouselImages)
editor.loadItems($scope.data.content.carouselImages);
if (tmrDelay) clearTimeout(tmrDelay);
} else{
$scope.data = { content :{
text :
'<p>The WYSIWYG (which stands for What You See Is What You Get) allows you to do some really cool stuff. You can add images like this</p>\
<p><img src="https://static.pexels.com/photos/12057/pexels-photo-12057-large.jpeg" alt="" width="100%" height="auto" /></p>\
<p>You can even create links like these:<br /> Link to web content like <a href="http://www.google.com">this</a><br /> Link to a phone number like this <a href="tel: 8005551234">8005551234</a><br /> Link to an email like this <a href="mailto:[email protected]">[email protected]</a></p>\
<p>Want to add some super cool videos about this item? You can do that too!</p>\
<p><iframe src="https://www.youtube.com/embed/wTcNtgA6gHs" width="100%" height="auto" frameborder="0" allowfullscreen="allowfullscreen"></iframe></p>\
<p>You can create bulleted and numbered lists like this:</p>\
<ul>\
<li>This is an item in a list</li>\
<li>This is another item in a list</li>\
<li>This is a last item in a list</li>\
</ul>\
<p>Want more info? Check out our tutorial by clicking the help button at the top of this page.</p>',

carouselImages :
[{"action":"noAction","iconUrl":"http://imageserver.prod.s3.amazonaws.com/b55ee984-a8e8-11e5-88d3-124798dea82d/5db61d30-0854-11e6-8963-f5d737bc276b.jpg","title":"image 1"},{"action":"noAction","iconUrl":"http://imageserver.prod.s3.amazonaws.com/b55ee984-a8e8-11e5-88d3-124798dea82d/31c88a00-0854-11e6-8963-f5d737bc276b.jpeg","title":"image 2"}]
},
design: {
backgroundImage: null,
backgroundBlur: 0,
selectedLayout: 1
}
};
editor.loadItems($scope.data.content.carouselImages);
}

/*
Expand Down
32 changes: 31 additions & 1 deletion widget/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
function initDeviceSize(callback) {
$scope.deviceHeight = window.innerHeight;
$scope.deviceWidth = window.innerWidth;

console.log(">>>>>>>>>>>>>>>>>>>", $scope.data);
if ($scope.data.design.selectedLayout == 1) {
$scope.sliderHeight = Math.ceil(9 * $scope.deviceWidth / 16);
} else {
Expand Down Expand Up @@ -99,7 +101,35 @@
* */
function loadData() {
buildfire.datastore.get(function (err, result) {
if (result && result.data && !angular.equals({}, result.data)) bind(result.data);
if (result && result.data && !angular.equals({}, result.data) && result.id){
bind(result.data);
} else{
$scope.data = { content :{
text :
'<p>The WYSIWYG (which stands for What You See Is What You Get) allows you to do some really cool stuff. You can add images like this</p>\
<p><img src="https://static.pexels.com/photos/12057/pexels-photo-12057-large.jpeg" alt="" width="100%" height="auto" /></p>\
<p>You can even create links like these:<br /> Link to web content like <a href="http://www.google.com">this</a><br /> Link to a phone number like this <a href="tel: 8005551234">8005551234</a><br /> Link to an email like this <a href="mailto:[email protected]">[email protected]</a></p>\
<p>Want to add some super cool videos about this item? You can do that too!</p>\
<p><iframe src="https://www.youtube.com/embed/wTcNtgA6gHs" width="100%" height="auto" frameborder="0" allowfullscreen="allowfullscreen"></iframe></p>\
<p>You can create bulleted and numbered lists like this:</p>\
<ul>\
<li>This is an item in a list</li>\
<li>This is another item in a list</li>\
<li>This is a last item in a list</li>\
</ul>\
<p>Want more info? Check out our tutorial by clicking the help button at the top of this page.</p>',

carouselImages :
[{"action":"noAction","iconUrl":"http://imageserver.prod.s3.amazonaws.com/b55ee984-a8e8-11e5-88d3-124798dea82d/5db61d30-0854-11e6-8963-f5d737bc276b.jpg","title":"image 1"},{"action":"noAction","iconUrl":"http://imageserver.prod.s3.amazonaws.com/b55ee984-a8e8-11e5-88d3-124798dea82d/31c88a00-0854-11e6-8963-f5d737bc276b.jpeg","title":"image 2"}]
},
design: {
backgroundImage: null,
backgroundBlur: 0,
selectedLayout: 1
}
};
bind($scope.data);
}
});
}

Expand Down

0 comments on commit 66d6edf

Please sign in to comment.