Skip to content

Commit

Permalink
Task techjoomla#208 chore: Changes made for tagInputs
Browse files Browse the repository at this point in the history
  • Loading branch information
pravinTek committed Nov 20, 2019
1 parent fdddad8 commit 9d974cf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
14 changes: 11 additions & 3 deletions administrator/assets/js/tjlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ var tjlist = {

setTimeout(function() {
element.siblings('div.tjfieldTjListOtherText').children('.bootstrap-tagsinput').children().focus();

if (element.attr('multiple') == undefined)
{
element.siblings('div.tjfieldTjListOtherText').children().focus();
}

}, 100);
},
removeOtherOption: function (element) {
Expand All @@ -22,11 +28,13 @@ var tjlist = {
var inputName = element.attr('name'),
inputId = element.attr('id'),
isRequired = (element.attr('required') != undefined) ? 'required="required"' : '',
tagInput = (element.attr('multiple') != undefined) ? 'data-role="tagsinput"' : '',

requiredClass = (isRequired != '') ? 'required' : '';

this.loadTagsinputjs();
if (element.attr('multiple') != undefined)
{
this.loadTagsinputjs();
var tagInput = (element.attr('multiple') != undefined) ? 'data-role="tagsinput"' : '';
}

return '<div class="tjfieldTjListOtherText"><br/><input ' + tagInput + ' placeholder="' + Joomla.JText._('COM_TJFIELDS_OTHER_VALUE') + '" ' + isRequired + ' type="text" name="' + inputName + '" id="' + inputId + '" value="" class=" focus ' + requiredClass + '" aria-invalid="false"></div>';
},
Expand Down
2 changes: 1 addition & 1 deletion administrator/assets/js/tjlist.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions administrator/models/fields/tjlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,14 @@ protected function getInput()
$html = parent::getInput();

$doc = Factory::getDocument();
$doc->addStyleSheet(JUri::root() . 'administrator/components/com_tjfields/assets/css/bootstrap-tagsinput.css');
$doc->addScript(JUri::root() . 'administrator/components/com_tjfields/assets/js/bootstrap-tagsinput.min.js');
$doc->addScript(JUri::root() . 'administrator/components/com_tjfields/assets/js/tjlist.min.js');

if ($this->multiple)
{
$doc->addStyleSheet(JUri::root() . 'administrator/components/com_tjfields/assets/css/bootstrap-tagsinput.css');
$doc->addScript(JUri::root() . 'administrator/components/com_tjfields/assets/js/bootstrap-tagsinput.min.js');
}

$options = $this->getOptions();

if ($this->element['other'])
Expand Down

0 comments on commit 9d974cf

Please sign in to comment.