Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
3d27f73
add choice-js
Fedik Sep 17, 2018
9bbd1d1
FieldModuelEditposition custom element
Fedik Sep 18, 2018
3232476
FieldModuelEditposition translation
Fedik Sep 19, 2018
cf59eb5
FieldModuelEditposition extend FormField is enough
Fedik Sep 19, 2018
347beb0
Sync. Merge branch '4.0-dev' into choice-js
Fedik Sep 19, 2018
d563647
field-tags
Fedik Sep 19, 2018
29106a0
field-tags make custom term to work
Fedik Sep 19, 2018
38ad7b8
FieldModuleEditposition: fix typoe and cs
Fedik Sep 20, 2018
7101db5
FieldModuleEditposition: remove unused stuff
Fedik Sep 20, 2018
195f97c
field-tags request for remote tags
Fedik Sep 20, 2018
b187d5c
field-tags deprecate some stuff
Fedik Sep 20, 2018
74e0a49
Merge branch 'choice-js-tags' into choice-js
Fedik Sep 20, 2018
ea011be
choice-js-cat categoriedit field
Fedik Sep 20, 2018
6f4630d
choice-js-cat categoriedit make it work
Fedik Sep 20, 2018
b57715e
merge JS to single field
Fedik Sep 20, 2018
b0ce929
prevent from submit on "enter"
Fedik Sep 20, 2018
8756b4f
add some extar info
Fedik Sep 20, 2018
87e3dd3
add layout to ListField
Fedik Sep 21, 2018
da9e886
joomla.form.field.list-fancy-select layout for list field
Fedik Sep 21, 2018
457bb4d
joomla.form.field.accesslevel for accesslevel field
Fedik Sep 21, 2018
37ec6d1
joomla.form.field.accesslevel-fancy-select for accesslevel field
Fedik Sep 21, 2018
f8c0983
update multiselect fields in Articles filter
Fedik Sep 21, 2018
0a51af8
precache existing options
Fedik Sep 21, 2018
6200b34
update multiselect fields in Featured filter
Fedik Sep 21, 2018
71299b0
fix filters, ignore click inside the filter container
Fedik Sep 22, 2018
6417cc0
phpcs and hound
Fedik Sep 22, 2018
28c833d
revert ModulesPosition and create ModulesPositionedit for edit action
Fedik Sep 22, 2018
993e2b5
Frontend module editing
Fedik Sep 22, 2018
febc3e7
Fix styling
Fedik Sep 22, 2018
b8cdcaf
And forntend, fix styling
Fedik Sep 22, 2018
a5ecdf1
hound
Fedik Sep 22, 2018
a22018d
try to fix build/update.js for Windows
Fedik Sep 22, 2018
77fb52d
remove lasts uses of 'formbehavior.chosen'
Fedik Sep 22, 2018
6999c01
rename choices.js to choicesjs
Fedik Sep 24, 2018
e67c438
Improve Tags ajax search
Fedik Sep 24, 2018
fa0f404
boolean
Fedik Sep 24, 2018
92445a4
Merge branch '4.0-dev' into choice-js
wilsonge Oct 1, 2018
b4003a1
Update deprecated tag
Fedik Oct 6, 2018
5a1c945
Merge branch '4.0-dev' into choice-js
wilsonge Oct 18, 2018
0e641a3
Sync. Merge branch '4.0-dev' into choice-js
Fedik Oct 19, 2018
7fb603c
DOMDocument::loadHTML and CE
Fedik Oct 20, 2018
5f4b99c
choices.js and WebAsset
Fedik Oct 20, 2018
538f7b9
get/set value, and required validation
Fedik Oct 20, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion administrator/components/com_banners/tmpl/banner/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Joomla\CMS\Router\Route;

HTMLHelper::_('behavior.formvalidator');
HTMLHelper::_('formbehavior.chosen', '#jform_catid', null, array('disable_search_threshold' => 0 ));

HTMLHelper::_('script', 'com_banners/admin-banner-edit.min.js', array('version' => 'auto', 'relative' => true));
?>
Expand Down
105 changes: 19 additions & 86 deletions administrator/components/com_categories/Field/CategoryeditField.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@

defined('JPATH_BASE') or die;

use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\Utilities\ArrayHelper;

FormHelper::loadFieldClass('list');

/**
* Category Edit field..
*
* @since 1.6
*/
class CategoryeditField extends \JFormFieldList
class CategoryeditField extends ListField
{
/**
* To allow creation of new categories.
Expand All @@ -42,6 +40,14 @@ class CategoryeditField extends \JFormFieldList
*/
public $type = 'CategoryEdit';

/**
* Name of the layout being used to render the field
*
* @var string
* @since __DEPLOY_VERSION__
*/
protected $layout = 'joomla.form.field.categoryedit';

/**
* Method to attach a JForm object to the field.
*
Expand Down Expand Up @@ -340,88 +346,15 @@ protected function getOptions()
*/
protected function getInput()
{
$html = array();
$class = array();
$attr = '';

// Initialize some field attributes.
$class[] = !empty($this->class) ? $this->class : '';

if ($this->allowAdd)
{
$customGroupText = Text::_('JGLOBAL_CUSTOM_CATEGORY');

$class[] = 'chosen-custom-value';
$attr .= ' data-custom_group_text="' . $customGroupText . '" '
. 'data-no_results_text="' . Text::_('JGLOBAL_ADD_CUSTOM_CATEGORY') . '" '
. 'data-placeholder="' . Text::_('JGLOBAL_TYPE_OR_SELECT_CATEGORY') . '" ';
}

if ($class)
{
$attr .= 'class="' . implode(' ', $class) . '"';
}

$attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
$attr .= $this->multiple ? ' multiple' : '';
$attr .= $this->required ? ' required' : '';
$attr .= $this->autofocus ? ' autofocus' : '';

// To avoid user's confusion, readonly="true" should imply disabled="true".
if ((string) $this->readonly == '1'
|| (string) $this->readonly == 'true'
|| (string) $this->disabled == '1'
|| (string) $this->disabled == 'true')
{
$attr .= ' disabled="disabled"';
}

// Initialize JavaScript field attributes.
$attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : '';

// Get the field options.
$options = (array) $this->getOptions();
$data = $this->getLayoutData();

// Create a read-only list (no name) with hidden input(s) to store the value(s).
if ((string) $this->readonly == '1' || (string) $this->readonly == 'true')
{
$html[] = HTMLHelper::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id);
$data['options'] = $this->getOptions();
$data['allowCustom'] = $this->allowAdd;

// E.g. form field type tag sends $this->value as array
if ($this->multiple && is_array($this->value))
{
if (!count($this->value))
{
$this->value[] = '';
}

foreach ($this->value as $value)
{
$html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '">';
}
}
else
{
$html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '">';
}
}
else
{
// Create a regular list.
if (count($options) === 0)
{
// All Categories have been deleted, so we need a new category (This will create on save if selected).
$options[0] = new \stdClass;
$options[0]->value = 'Uncategorised';
$options[0]->text = 'Uncategorised';
$options[0]->level = '1';
$options[0]->published = '1';
$options[0]->lft = '1';
}

$html[] = HTMLHelper::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
}
$renderer = $this->getRenderer($this->layout);
$renderer->setComponent('com_categories');
$renderer->setClient(1);

return implode($html);
return $renderer->render($data);
}
}
1 change: 1 addition & 0 deletions administrator/components/com_categories/categories.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<folder>forms</folder>
<folder>Helper</folder>
<folder>helpers</folder>
<folder>layouts</folder>
<folder>Model</folder>
<folder>Table</folder>
<folder>tmpl</folder>
Expand Down
1 change: 0 additions & 1 deletion administrator/components/com_categories/forms/category.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

<field
name="parent_id"
class="advancedSelect"
type="categoryedit"
label="COM_CATEGORIES_FIELD_PARENT_LABEL"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
type="tag"
label="JOPTION_SELECT_TAG"
mode="nested"
custom="false"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_TAG</option>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('JPATH_BASE') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

extract($displayData);

/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var string $accept File types that are accepted.
*/

$html = array();
$classes = array();
$attr = '';
$attr2 = '';

// Initialize some field attributes.
$attr .= !empty($size) ? ' size="' . $size . '"' : '';
$attr .= $multiple ? ' multiple' : '';
$attr .= $autofocus ? ' autofocus' : '';
$attr .= $onchange ? ' onchange="' . $onchange . '"' : '';

// To avoid user's confusion, readonly="true" should imply disabled="disabled".
if ($readonly || $disabled)
{
$attr .= ' disabled="disabled"';
}

$attr2 .= !empty($class) ? ' class="' . $class . '"' : '';
$attr2 .= ' search-placeholder="' . $this->escape(Text::_('JGLOBAL_TYPE_OR_SELECT_CATEGORY')) . '" ';

if ($allowCustom)
{
$attr2 .= ' allow-custom';
}

if ($required)
{
$attr .= ' required class="required"';
$attr2 .= ' required';
}

// Create a read-only list (no name) with hidden input(s) to store the value(s).
if ($readonly)
{
$html[] = HTMLHelper::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $value, $id);

// E.g. form field type tag sends $this->value as array
if ($multiple && is_array($value))
{
if (!count($value))
{
$value[] = '';
}

foreach ($value as $val)
{
$html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($val, ENT_COMPAT, 'UTF-8') . '">';
}
}
else
{
$html[] = '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '">';
}
}
else
{
// Create a regular list.
if (count($options) === 0)
{
// All Categories have been deleted, so we need a new category (This will create on save if selected).
$options[0] = new \stdClass;
$options[0]->value = 'Uncategorised';
$options[0]->text = 'Uncategorised';
$options[0]->level = '1';
$options[0]->published = '1';
$options[0]->lft = '1';
}

$html[] = HTMLHelper::_('select.genericlist', $options, $name, trim($attr), 'value', 'text', $value, $id);
}

Text::script('JGLOBAL_SELECT_NO_RESULTS_MATCH');
Text::script('JGLOBAL_SELECT_PRESS_TO_SELECT');

Factory::getDocument()->getWebAssetManager()->enableAsset('choicesjs');
HTMLHelper::_('webcomponent', 'system/webcomponents/joomla-field-fancy-select.min.js', ['version' => 'auto', 'relative' => true]);

?>

<joomla-field-fancy-select <?php echo $attr2; ?>><?php echo implode($html); ?></joomla-field-fancy-select>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

HTMLHelper::_('behavior.formvalidator');
HTMLHelper::_('behavior.keepalive');
HTMLHelper::_('formbehavior.chosen', '.advancedSelect');

$app = Factory::getApplication();
$input = $app->input;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
HTMLHelper::_('behavior.formvalidator');
HTMLHelper::_('behavior.keepalive');
HTMLHelper::_('behavior.tabstate');
HTMLHelper::_('formbehavior.chosen', '.chosen-custom-value', null, array('disable_search_threshold' => 0));

// @TODO delete this when custom elements modal is merged
HTMLHelper::_('script', 'com_config/admin-application-default.min.js', ['version' => 'auto', 'relative' => true]);
Expand Down
1 change: 0 additions & 1 deletion administrator/components/com_contact/tmpl/contact/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

HTMLHelper::_('behavior.formvalidator');
HTMLHelper::_('behavior.keepalive');
HTMLHelper::_('formbehavior.chosen', '#jform_catid', null, array('disable_search_threshold' => 0 ));

$app = Factory::getApplication();
$input = $app->input;
Expand Down
Loading