1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-14 01:19:44 +01:00

Merge pull request #1359 from lonalore/master

Issue #369: Plugin Manager: Plugin Description is corrupted if there'…
This commit is contained in:
Cameron 2016-02-15 00:03:39 -08:00
commit af9dfaa90a
3 changed files with 84 additions and 59 deletions

View File

@ -3477,9 +3477,9 @@ class e_form
{
return $this->renderInline($field,$id,$attributes['title'],$value,substr($value,0,50)."...",'textarea'); //FIXME.
}
$expand = '...';
$expand = '<span class="e-expandit-ellipsis">...</span>';
$toexpand = false;
if($attributes['type'] == 'bbarea' && !isset($parms['bb'])) $parms['bb'] = true; //force bb parsing for bbareas
$elid = trim(str_replace('_', '-', $field)).'-'.$id;
@ -3489,17 +3489,11 @@ class e_form
$ttl = vartrue($parms['expand']);
if($ttl == 1)
{
$ttl = $expand."<button class='btn btn-default btn-xs btn-mini pull-right'>More..</button>";
$ttl1 = "<button class='btn btn-default btn-xs btn-mini pull-right'>..Less</button>";
}
else
{
$ttl1 = null;
$dataAttr = "data-text-more='" . LAN_MORE . "' data-text-less='" . LAN_LESS . "'";
$ttl = $expand."<button class='btn btn-default btn-xs btn-mini pull-right' {$dataAttr}>" . LAN_MORE . "</button>";
}
$expands = '<a href="#'.$elid.'-expand" class="e-show-if-js e-expandit">'.defset($ttl, $ttl)."</a>";
$contracts = '<a href="#'.$elid.'-expand" class="e-show-if-js e-expandit">'.defset($ttl1, $ttl1)."</a>";
}
$oldval = $value;
@ -3517,9 +3511,8 @@ class e_form
if($toexpand)
{
// force hide! TODO - core style .expand-c (expand container)
// TODO: Hide 'More..' button when text fully displayed.
$value .= '<span class="expand-c" style="display: none" id="'.$elid.'-expand"><span>'.str_replace($value,'',$oldval).$contracts.'</span></span>';
$value .= $expands; // 'More..' button. Keep it at the bottom so it does't cut the sentence.
$value .= '<span class="expand-c" style="display: none" id="'.$elid.'-expand"><span>'.str_replace($value,'',$oldval).'</span></span>';
$value .= varset($expands); // 'More..' button. Keep it at the bottom so it does't cut the sentence.
}

View File

@ -50,6 +50,7 @@ define("LAN_EDIT","Edit");
define("LAN_DELETE","Delete");
define("LAN_DEFAULT","Default");
define("LAN_MORE", "More..");
define("LAN_LESS", "..Less");
define("LAN_READ_MORE", "Read more..");
define("LAN_GOPAGE", "Go to page");
define("LAN_GOTOPAGEX", "Go to page [x]");

View File

@ -326,6 +326,82 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
}
};
/**
* Behavior to attach a click event to elements with .e-expandit class.
*
* @type {{attach: Function}}
*/
e107.behaviors.eExpandIt = {
attach: function (context, settings)
{
$(context).find('.e-expandit').once('e-expandit').each(function ()
{
// default 'toggle'.
$(this).click(function ()
{
var $this = $(this);
var href = ($this.is("a")) ? $this.attr("href") : '';
var $button = $this.find('button');
if($button.length > 0)
{
var textMore = $button.attr('data-text-more');
var textLess = $button.attr('data-text-less');
if(textLess && textMore)
{
if($button.html() == textMore)
{
$this.find('.e-expandit-ellipsis').hide();
$button.html(textLess);
}
else
{
$this.find('.e-expandit-ellipsis').show();
$button.html(textMore);
}
}
}
if((href === "#" || href == "") && $this.attr("data-target"))
{
var select = $this.attr("data-target").split(','); // support multiple targets (comma separated)
$(select).each(function ()
{
$('#' + this).slideToggle("slow");
});
if($this.attr("data-return") === 'true')
{
return true;
}
return false;
}
if(href === "#" || href == "")
{
var idt = $(this).nextAll("div");
$(idt).slideToggle("slow");
return true;
}
$(href).slideToggle('slow', function ()
{
if($(this).is(':visible'))
{
$(this).css('display', 'initial');
}
});
return false;
});
});
}
};
/**
* Dynamic next/prev.
*
@ -439,52 +515,7 @@ $(document).ready(function()
});
}
});
// default 'toggle'.
$(".e-expandit").click(function () {
var href = ($(this).is("a")) ? $(this).attr("href") : '';
if((href === "#" || href == "") && $(this).attr("data-target"))
{
select = $(this).attr("data-target").split(','); // support multiple targets (comma separated)
$(select).each( function() {
$('#'+ this).slideToggle("slow");
});
if($(this).attr("data-return")==='true')
{
return true;
}
return false;
}
if(href === "#" || href == "")
{
idt = $(this).nextAll("div");
$(idt).slideToggle("slow");
return true;
}
//var id = $(this).attr("href");
$(href).slideToggle("slow");
return false;
});
// On
$(".e-expandit-on").click(function () {