Index: branches/5.0.x/core/admin_templates/js/template_manager.js =================================================================== diff -u -r12320 -r12382 --- branches/5.0.x/core/admin_templates/js/template_manager.js (.../template_manager.js) (revision 12320) +++ branches/5.0.x/core/admin_templates/js/template_manager.js (.../template_manager.js) (revision 12382) @@ -38,27 +38,24 @@ $head_frame.$('#extra_toolbar').html( $extra_toolbar.html() ); + var $hover_effect = []; + + if ($template_manager.editingMode > 1) { + // all modes except for "Browse Mode" + $hover_effect.push('div.cms-section-properties-btn:first'); + } + if ($template_manager.editingMode == 2) { // Content Mode + $hover_effect.push('div.cms-edit-btn'); - $('div.cms-edit-btn') - .mouseover( - function(e) { - $(this).css('opacity', 1); - } - ) - .mouseout( - function(e) { - $(this).css('opacity', 0.5); - } - ); - // make all spans with phrases clickable $template_manager.setupEditTranslationButtons(document); } if ($template_manager.editingMode == 3) { // Design Mode +// $hover_effect.push('div.cms-save-layout-btn:first, div.cms-cancel-layout-btn:first'); $template_manager.renumberMovableElements(); @@ -86,6 +83,19 @@ } ); } + + // make requested elements fully visible on mouseover + $($hover_effect.join(', ')) + .mouseover( + function(e) { + $(this).css('opacity', 1); + } + ) + .mouseout( + function(e) { + $(this).css('opacity', 0.5); + } + ); } ); } @@ -232,7 +242,14 @@ if ($element.hasClass('block-edit-design-btn-container')) { $($element).addClass('block-edit-design-btn-container-over'); - $('div.cms-edit-design-btn:first', $element).show(); + + var $button_group = $('div.cms-edit-design-btn-container:first', $element); + if ($button_group.length) { + $button_group.show(); + } + else { + $('div.cms-edit-design-btn:first', $element).show(); + } } else { $($element).addClass('block-edit-block-btn-container-over'); @@ -251,7 +268,14 @@ if ($element.hasClass('block-edit-design-btn-container')) { $($element).removeClass('block-edit-design-btn-container-over'); - $('div.cms-edit-design-btn:first', $element).hide(); + + var $button_group = $('div.cms-edit-design-btn-container:first', $element); + if ($button_group.length) { + $button_group.hide(); + } + else { + $('div.cms-edit-design-btn:first', $element).hide(); + } } else { $($element).removeClass('block-edit-block-btn-container-over'); @@ -262,21 +286,59 @@ } TemplateManager.prototype.searchBlocks = function () { - $('div').each ( - function () { - var $id = $(this).attr('id'); + var $design_containers = $('div.block-edit-design-btn-container'); + var $block_containers = $('div.block-edit-block-btn-container'); - if (!$id || $id.match(/parser_block\[.*\].*_btn$/) || !$id.match(/parser_block\[.*\]/)) { - // skip other divs - return true; + $design_containers.each( + function() { + var $block_container = $('div.block-edit-block-btn-container:first', this); + + if ($block_container.length) { + $block_containers = $block_containers.not($block_container); + + // place "Edit Block" button near "Edit Design" button + var $edit_design_btn = $('div.cms-edit-design-btn:first', this); + var $edit_block_btn = $('div.cms-edit-block-btn:first', $block_container); + + $edit_design_btn + .wrap('
') + .before( $edit_block_btn.clone() ); + + $edit_block_btn.remove(); + + // make "hint" from "Edit Block" button container main + $(this).attr('title', $block_container.attr('title')); + $block_container.attr('title', ''); + + TemplateManager.prototype.registerBlock.call(aTemplateManager, $block_container.get(0), ['hover']); } + TemplateManager.prototype.registerBlock.call(aTemplateManager, this, ['dblclick']); + } + ); + + $block_containers.each( + function() { TemplateManager.prototype.registerBlock.call(aTemplateManager, this); } ); + +// $('div').each ( +// function () { +// /*var $id = $(this).attr('id'); +// +// if (!$id || $id.match(/parser_block\[.*\].*_btn$/) || !$id.match(/parser_block\[.*\]/)) { +// // skip other divs +// return true; +// }*/ +// +// +// TemplateManager.prototype.registerBlock.call(aTemplateManager, this); +// } +// ); } -TemplateManager.prototype.registerBlock = function ($element) { +TemplateManager.prototype.registerBlock = function ($element, $skip_events) { var $params = $element.getAttribute('params').split(':'); this._blocks[$element.id] = { @@ -292,22 +354,32 @@ } ); - $($element) - .dblclick( - function(ev) { - TemplateManager.prototype.onBtnClick.call(aTemplateManager, ev, this); - } - ) - .mouseover( - function(ev) { - TemplateManager.prototype.onMouseOver.call(aTemplateManager, ev, this); - } - ) - .mouseout( - function(ev) { - TemplateManager.prototype.onMouseOut.call(aTemplateManager, ev, this); - } - ); + if ($skip_events === undefined) { + $skip_events = []; + } + if (!in_array('dblclick', $skip_events)) { + $($element) + .dblclick( + function(ev) { + TemplateManager.prototype.onBtnClick.call(aTemplateManager, ev, this); + } + ) + } + + if (!in_array('hover', $skip_events)) { + $($element) + .mouseover( + function(ev) { + TemplateManager.prototype.onMouseOver.call(aTemplateManager, ev, this); + } + ) + .mouseout( + function(ev) { + TemplateManager.prototype.onMouseOut.call(aTemplateManager, ev, this); + } + ); + } + this._blockOrder.push($element.id); } \ No newline at end of file