Skip to content

Commit

Permalink
Merge branch 'master' of github.com:t3framework/t3
Browse files Browse the repository at this point in the history
  • Loading branch information
joomlart committed Feb 2, 2013
2 parents 2df7702 + eef13b3 commit a2f61fd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
41 changes: 24 additions & 17 deletions source/plg_system_t3/admin/megamenu/js/megamenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,9 @@ var T3AdminMegamenu = window.T3AdminMegamenu || {};
actions.addColumn = function () {
if (!currentSelected) return ;
var $cols = currentSelected.parent().children('[class*="span"]'),
colcount = $cols.length + 1,
colwidths = defaultColumnsWidth (colcount);
colcount = $cols.length + 1,
colwidths = defaultColumnsWidth (colcount);

// add new column
var $col = $('<div><div class="mega-inner"></div></div>');
if (actions.datas.addfirst)
Expand All @@ -296,32 +297,38 @@ var T3AdminMegamenu = window.T3AdminMegamenu || {};
}

actions.removeColumn = function () {
if (!currentSelected) return ;
if (!currentSelected){
return;
}

var $col = currentSelected,
$row = $col.parent(),
$rows = $row.parent().children ('[class*="row"]'),
$allcols = $rows.children('[class*="span"]'),
$allmenucols = $allcols.filter (function(){return !$(this).data('position')}),
$cols = $row.children('[class*="span"]'),
colcount = $cols.length - 1,
colwidths = defaultColumnsWidth (colcount),
type_menu = $col.data ('position') ? false : true;

if ((type_menu && $allmenucols.length == 1) || $allcols.length == 1) {
$row = $col.parent(),
$rows = $row.parent().children ('[class*="row"]'),
$allcols = $rows.children('[class*="span"]'),
$allmenucols = $allcols.filter (function(){return !$(this).data('position')}),
$haspos = $allcols.filter (function(){return $(this).data('position')}).length,
$cols = $row.children('[class*="span"]'),
colcount = $cols.length - 1,
colwidths = defaultColumnsWidth (colcount),
type_menu = $col.data ('position') ? false : true;

if ((type_menu && ((!$haspos && $allmenucols.length == 1) || ($haspos && $allmenucols.length == 0)))
|| $allcols.length == 1) {
// if this is the only one column left
return ;
return;
}

// remove column
// check and move content to other column
if (type_menu) {
var colidx = $allmenucols.index($col),
tocol = colidx == 0 ? $allmenucols[1] : $allmenucols[colidx-1];
tocol = colidx == 0 ? $allmenucols[1] : $allmenucols[colidx-1];

$col.find ('ul:first > li').appendTo ($(tocol).find('ul:first'));
}

var colidx = $allcols.index($col),
nextActiveCol = colidx == 0 ? $allcols[1] : $allcols[colidx-1];

nextActiveCol = colidx == 0 ? $allcols[1] : $allcols[colidx-1];

if (colcount < 1) {
$row.remove();
Expand Down
9 changes: 8 additions & 1 deletion source/tpl_t3_blank/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@

//check if t3 plugin is existed
if(!defined('T3')){
T3::error(JText::_('T3_MISSING_T3_PLUGIN'));
if (JError::$legacy) {
JError::setErrorHandling(E_ERROR, 'die');
JError::raiseError(500, JText::_('T3_MISSING_T3_PLUGIN'));

exit;
} else {
throw new Exception(JText::_('T3_MISSING_T3_PLUGIN'), 500);
}
}

$t3app = T3::getApp($this);
Expand Down

0 comments on commit a2f61fd

Please sign in to comment.