提交 2628f8c3 编写于 作者: T tfennelly

Resize new item page tabbar based on form resize.

上级 17514cfa
......@@ -32,12 +32,12 @@ $.when(getItems()).done(function(data){
.attr('action','createItem')
.prependTo($form);
var $navBox = $('<nav class="navbar navbar-default navbar-static form-config tabBarFrame"/>');
var $tabs = $('<div class="jenkins-config-widgets" />').appendTo($newView);
var $widgetBox = $('<div class="jenkins-config-widgets" />').appendTo($newView);
var $categories = $('<div class="categories" />').appendTo($newView);
var $subBtn = $('#bottom-sticker .yui-submit-button');
var sectionsToShow = [];
$tabs.prepend($navBox);
$widgetBox.prepend($navBox);
////////////////////////////////
// submit button click
......@@ -85,7 +85,7 @@ $.when(getItems()).done(function(data){
var winScoll = $window.scrollTop();
$tabs.find('.active').removeClass('active');
$widgetBox.find('.active').removeClass('active');
$.each(data.categories,function(i,cat){
var domId = '#j-add-item-type-'+cat.id;
var $cat = $(domId);
......@@ -93,7 +93,7 @@ $.when(getItems()).done(function(data){
$cat.offset().top + $cat.outerHeight() - createPanelOffset: 0;
if(winScoll < catHeight){
var $thisTab = $tabs.find(['[href="',cleanHref(domId),'"]'].join(''));
var $thisTab = $widgetBox.find(['[href="',cleanHref(domId),'"]'].join(''));
resetActiveTab($thisTab);
return false;
}
......@@ -102,14 +102,21 @@ $.when(getItems()).done(function(data){
function stickTabbar() {
var winScoll = $window.scrollTop();
var setWidth = function() {
$widgetBox.width($form.outerWidth() - 2);
};
if(winScoll > createPanelOffset - $breadcrumbBar.height()){
$tabs.width($tabs.width()).css({
setWidth();
$widgetBox.css({
'position':'fixed',
'top':($breadcrumbBar.height())+'px'});
$categories.css({'margin-top':$tabs.outerHeight()+'px'});
$categories.css({'margin-top':$widgetBox.outerHeight()+'px'});
$window.resize(setWidth);
return true;
} else{
$tabs.add($categories).removeAttr('style');
$widgetBox.add($categories).removeAttr('style');
$window.unbind('resize', setWidth);
return false;
}
}
......@@ -231,7 +238,7 @@ $.when(getItems()).done(function(data){
})
.appendTo($name);
$tabs.prepend($name);
$widgetBox.prepend($name);
setTimeout(function(){$input.focus();},100);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册