Skip to content

Commit

Permalink
Merge pull request #10 from kmtabish/master
Browse files Browse the repository at this point in the history
Added pull down to refresh
  • Loading branch information
RJASeoud authored Jul 14, 2016
2 parents 5fcfa87 + d45d176 commit adaf3ae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions widget/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
'use strict';

(function (angular) {
(function (angular,buildfire) {
angular.module('googleAppsSheetsPluginWidget', ['ui.bootstrap'])
.controller('WidgetHomeCtrl', ['$scope', 'Buildfire', 'DataStore', 'TAG_NAMES', 'STATUS_CODE',
function ($scope, Buildfire, DataStore, TAG_NAMES, STATUS_CODE) {
var WidgetHome = this;
buildfire.datastore.disableRefresh();
/*
* Fetch user's data from datastore
*/
Expand All @@ -32,7 +31,7 @@
var dummyData = {url: "https://docs.google.com/spreadsheets/d/1DRVGSGJh5s1w2giLbizZW6t6OT1Ea-YIewzX9D4meJ4/pubhtml#gid=0"};
WidgetHome.data.content.url = dummyData.url;
}
}
};
WidgetHome.error = function (err) {
if (err && err.code !== STATUS_CODE.NOT_FOUND) {
console.error('Error while getting data', err);
Expand Down Expand Up @@ -62,6 +61,20 @@

DataStore.onUpdate().then(null, null, WidgetHome.onUpdateCallback);

//Refresh web page on pulling the tile bar

buildfire.datastore.onRefresh(function () {
var iFrame = document.getElementById("sheetFrame"),
url = iFrame.src,
hashIndex = url.indexOf("#");

if(hashIndex !== -1) {
url = url.substr(0, hashIndex) + "?v=test" + url.substr(hashIndex);
}
iFrame.src = url + "";
});


WidgetHome.init();

}])
Expand All @@ -71,4 +84,4 @@
return $sce.trustAsResourceUrl(url);
}
}]);
})(window.angular);
})(window.angular, window.buildfire);
2 changes: 1 addition & 1 deletion widget/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div class="content"
style="-webkit-overflow-scrolling: touch !important;overflow: auto;height: 100%;"
ng-controller="WidgetHomeCtrl as WidgetHome">
<iframe ng-src="{{WidgetHome.data.content.url | returnUrl}}"
<iframe id="sheetFrame" ng-src="{{WidgetHome.data.content.url | returnUrl}}"
ng-if="WidgetHome.data.content.url"
style="height: 100%;position: relative" ></iframe>
</div>
Expand Down

0 comments on commit adaf3ae

Please sign in to comment.