BUGFIX: action buttons always visible (not need to scroll) ticket 5051

BUGFIX: got rid of double scroll
BUGFIX: do not show action buttons (delete/save) when showing result list
ENHANCEMENT: fixed forward button underneath result form


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@99942 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Carlos Barberis 2010-02-25 04:46:48 +00:00 committed by Sam Minnee
parent 8fe62100c6
commit c69df0f2b1
2 changed files with 49 additions and 5 deletions

View File

@ -67,7 +67,8 @@ body.ModelAdmin #ResultTable_holder {
}
body.ModelAdmin #right{
overflow:auto !important;
overflow:hidden !important;
}
body.ModelAdmin #right #ModelAdminPanel {
@ -130,10 +131,15 @@ body.ModelAdmin #statusMessage {
margin: 5px 0;
}
body.ModelAdmin #right .Actions {
position:absolute;
bottom:4px;
}
body.ModelAdmin #right .ajaxActions {
position: absolute;
right: 2px;
bottom: -25px;
position:absolute;
bottom:4px;
height: 30px;
}
#LeftPane .tab {

View File

@ -23,7 +23,14 @@ $(document).ready(function() {
* so it float to the right
*/
$('#Form_AddForm_action_doCreate').livequery(function(){
$(this).parent().addClass('ajaxActions');
if($(this)){
var parent = $(this).parent();
$("#right").append(parent);
parent.addClass('ajaxActions');
parent.attr('id','form_actions_right');
}
});
/*
@ -35,6 +42,26 @@ $(document).ready(function() {
$('input[name=action_search]').livequery('click', function() {
$('#contentPanel').fn('closeRightPanel');
if($('#Form_AddForm_action_doCreate')){
$('div[class=ajaxActions]').remove();
}
});
/*
* moves Forward button to the right and fixes it underneath result form.
*/
$('#Form_ResultsForm_action_goForward').livequery(function() {
$("#form_actions_right").append($(this));
});
/*
* we need an special case for results form since #ModelAdminPanel has overflow:hidden
* it calculates the form height, gives it a padding and overflow auto, so we can scroll down.
*/
$('#Form_ResultsForm').livequery( function(){
var newModelAdminPanelHeight = $("#right").height()-$(".ajaxActions").height();
$('#Form_ResultsForm').height(newModelAdminPanelHeight);
$('#Form_ResultsForm').css('overflow','auto');
});
@ -46,15 +73,22 @@ $(document).ready(function() {
positionActionArea();
});
/*
* Make the status message and ajax action button fixed
*/
function positionActionArea() {
var newModelAdminPanelHeight = $("#right").height()-$(".ajaxActions").height();
$('#ModelAdminPanel').height(newModelAdminPanelHeight);
$('#Form_ResultsForm').height(newModelAdminPanelHeight);
$('#ModelAdminPanel').css('padding-bottom','60px');
/*
if ( $.browser.msie && $.browser.version.indexOf("6.", 0)==0 ) {
newTopValue = $("#right").scrollTop()+$(window).height()-139;
$('.ajaxActions').css('top', newTopValue);
$('#statusMessage').css('top', newTopValue);
}
*/
}
//////////////////////////////////////////////////////////////////
@ -326,6 +360,10 @@ $(document).ready(function() {
}
if(!this.history || this.history.length <= 1) {
$('#Form_EditForm_action_goBack, #Form_ResultsForm_action_goBack').hide();
// we don't need save and delete button on result form
$('#Form_EditForm_action_doSave').hide();
$('#Form_EditForm_action_doDelete').hide();
}
Behaviour.apply(); // refreshes ComplexTableField