(function() {
'use strict';
angular.module('ionic.ui.content', [])
.directive('pane', function() {
return {
restrict: 'E',
replace: true,
transclude: true,
template: '
'
}
})
// The content directive is a core scrollable content area
// that is part of many View hierarchies
.directive('content', ['$parse', function($parse) {
return {
restrict: 'E',
replace: true,
template: '',
transclude: true,
scope: {
onRefresh: '&',
onRefreshOpening: '&',
scroll: '@'
},
compile: function(element, attr, transclude) {
return function($scope, $element, $attr) {
var c = $element.eq(0);
if(attr.padded) {
c.addClass('padding');
}
if(attr.hasHeader) {
c.addClass('has-header');
}
if(attr.hasFooter) {
c.addClass('has-footer');
}
if(attr.hasTabs) {
c.addClass('has-tabs');
}
// If they want plain overflows scrolling, add that as a class
if($scope.scroll === "false") {
// Do nothing for now
} else if(attr.overflowScroll === "true") {
c.addClass('overflow-scroll');
} else {
// Otherwise, supercharge this baby!
var sv = new ionic.views.Scroll({
el: $element[0].firstElementChild,
hasPullToRefresh: (typeof $scope.onRefresh !== 'undefined'),
onRefresh: function() {
$scope.onRefresh();
},
onRefreshOpening: function(amt) {
$scope.onRefreshOpening({amount: amt});
}
});
// Let child scopes access this
$scope.scrollView = sv;
}
// Pass the parent scope down to the child
var clone = transclude($scope.$parent);
angular.element($element[0].firstElementChild).append(clone);
};
}
};
}])
.directive('refresher', function() {
return {
restrict: 'E',
replace: true,
transclude: true,
template: ''
}
})
})();