Added maxlength attribute to post source
This commit is contained in:
parent
fe451af7be
commit
6cacb90eef
4 changed files with 15 additions and 2 deletions
|
@ -199,7 +199,12 @@ $(function()
|
||||||
{
|
{
|
||||||
postDom.data('url', url);
|
postDom.data('url', url);
|
||||||
postDom.data('file', '');
|
postDom.data('file', '');
|
||||||
postDom.find('[name=source]').val(url);
|
|
||||||
|
var sourceInput = postDom.find('[name=source]');
|
||||||
|
sourceInput.val(url);
|
||||||
|
if (sourceInput.attr('maxlength'))
|
||||||
|
sourceInput.val(sourceInput.val().substring(0, sourceInput.attr('maxlength')));
|
||||||
|
|
||||||
if (matches = url.match(/watch.*?=([a-zA-Z0-9_-]+)/))
|
if (matches = url.match(/watch.*?=([a-zA-Z0-9_-]+)/))
|
||||||
{
|
{
|
||||||
postDom.find('.file-name strong').text(url);
|
postDom.find('.file-name strong').text(url);
|
||||||
|
|
|
@ -8,6 +8,7 @@ $placeholder = isset($this->context->placeholder) ? $this->context->placeholder
|
||||||
$additionalInfo = isset($this->context->additionalInfo) ? $this->context->additionalInfo : '';
|
$additionalInfo = isset($this->context->additionalInfo) ? $this->context->additionalInfo : '';
|
||||||
$inputClass = isset($this->context->inputClass) ? $this->context->inputClass : '';
|
$inputClass = isset($this->context->inputClass) ? $this->context->inputClass : '';
|
||||||
$noAutocomplete = isset($this->context->noAutocomplete) ? true : false;
|
$noAutocomplete = isset($this->context->noAutocomplete) ? true : false;
|
||||||
|
$maxLength = isset($this->context->maxLength) ? intval($this->context->maxLength) : null;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
|
@ -16,6 +17,9 @@ $noAutocomplete = isset($this->context->noAutocomplete) ? true : false;
|
||||||
</label>
|
</label>
|
||||||
<div class="input-wrapper">
|
<div class="input-wrapper">
|
||||||
<input
|
<input
|
||||||
|
<?php if ($maxLength): ?>
|
||||||
|
maxlength="<?= $maxLength ?>"
|
||||||
|
<?php endif ?>
|
||||||
<?php if ($noAutocomplete): ?>
|
<?php if ($noAutocomplete): ?>
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
|
@ -56,6 +56,7 @@ $post = $this->context->transport->post;
|
||||||
$context = new StdClass;
|
$context = new StdClass;
|
||||||
$context->label = 'Source';
|
$context->label = 'Source';
|
||||||
$context->name = 'source';
|
$context->name = 'source';
|
||||||
|
$context->maxLength = Core::getConfig()->posts->maxSourceLength;
|
||||||
$context->value = htmlspecialchars($post->getSource());
|
$context->value = htmlspecialchars($post->getSource());
|
||||||
$this->renderExternal('input-text', $context);
|
$this->renderExternal('input-text', $context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,10 @@ $this->assets->addScript('../lib/tagit/jquery.tagit.js');
|
||||||
<div class="form-row source">
|
<div class="form-row source">
|
||||||
<label>Source:</label>
|
<label>Source:</label>
|
||||||
<div class="input-wrapper">
|
<div class="input-wrapper">
|
||||||
<input type="text" name="source" placeholder="where did you get this from? (optional)"/>
|
<input type="text"
|
||||||
|
maxlength="<?= Core::getConfig()->posts->maxSourceLength ?>"
|
||||||
|
name="source"
|
||||||
|
placeholder="where did you get this from? (optional)"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in a new issue