fixes datatype editor buttons not snapping to buttom

This commit is contained in:
perploug
2013-11-14 09:16:35 +01:00
parent 202ae1eafe
commit 378fc2c655
2 changed files with 51 additions and 47 deletions

View File

@@ -4,11 +4,59 @@
* @restrict E
**/
angular.module("umbraco.directives.html")
.directive('umbPanel', function(){
.directive('umbPanel', function($timeout){
return {
restrict: 'E',
replace: true,
transclude: 'true',
templateUrl: 'views/directives/html/umb-panel.html'
templateUrl: 'views/directives/html/umb-panel.html',
link: function (scope, el, attrs) {
function _setClass(resize){
var bar = $(".tab-content .active .umb-tab-buttons");
//incase this runs without any tabs
if(bar.length === 0){
bar = $(".tab-content .umb-tab-buttons");
}
//no need to process
if(resize){
bar.removeClass("umb-bottom-bar");
}
//already positioned
if(bar.hasClass("umb-bottom-bar")){
return;
}
var offset = bar.offset();
if(offset){
var bottom = bar.offset().top + bar.height();
if(bottom > $(window).height()){
bar.addClass("umb-bottom-bar");
$(".tab-content .active").addClass("with-buttons");
}else{
bar.removeClass("umb-bottom-bar");
$(".tab-content .active").removeClass("with-buttons");
}
}
}
//initial loading
$timeout(function(){
$('a[data-toggle="tab"]').on('shown', function (e) {
_setClass();
});
_setClass();
}, 1000, false);
$(window).bind("resize", function () {
_setClass(true);
});
}
};
});

View File

@@ -9,50 +9,6 @@ angular.module("umbraco.directives")
restrict: 'E',
replace: true,
transclude: 'true',
templateUrl: 'views/directives/umb-tab-view.html',
link: function (scope, el, attrs) {
function _setClass(resize){
var bar = $(".tab-content .active .umb-tab-buttons");
//no need to process
if(resize){
bar.removeClass("umb-bottom-bar");
}
//already positioned
if(bar.hasClass("umb-bottom-bar")){
return;
}
var offset = bar.offset();
if(offset){
var bottom = bar.offset().top + bar.height();
if(bottom > $(window).height()){
bar.addClass("umb-bottom-bar");
$(".tab-content .active").addClass("with-buttons");
}else{
bar.removeClass("umb-bottom-bar");
$(".tab-content .active").removeClass("with-buttons");
}
}
}
//initial loading
$timeout(function(){
$('a[data-toggle="tab"]').on('shown', function (e) {
_setClass();
});
_setClass();
}, 500, false);
$(window).bind("resize", function () {
_setClass(true);
});
}
templateUrl: 'views/directives/umb-tab-view.html'
};
});