Skip to content

Commit

Permalink
HTML class naming standard [frontend][com-tags]
Browse files Browse the repository at this point in the history
  • Loading branch information
ciar4n committed Jun 20, 2018
1 parent 46c4cf1 commit 97ed8a9
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 113 deletions.
6 changes: 3 additions & 3 deletions components/com_tags/tmpl/tag/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

?>

<div class="tag-category">
<div class="com-tags-tag tag-category">

<?php if ($this->params->get('show_page_heading')) : ?>
<h1>
Expand All @@ -31,7 +31,7 @@

<?php // We only show a tag description if there is a single tag. ?>
<?php if (count($this->item) === 1 && ($this->params->get('tag_list_show_tag_image', 1) || $this->params->get('tag_list_show_tag_description', 1))) : ?>
<div class="category-desc">
<div class="com-tags-tag__description category-desc">
<?php $images = json_decode($this->item[0]->images); ?>
<?php if ($this->params->get('tag_list_show_tag_image', 1) == 1 && !empty($images->image_fulltext)) : ?>
<img src="<?php echo htmlspecialchars($images->image_fulltext, ENT_COMPAT, 'UTF-8'); ?>"
Expand All @@ -55,7 +55,7 @@
<?php echo $this->loadTemplate('items'); ?>

<?php if (($this->params->def('show_pagination', 1) == 1 || ($this->params->get('show_pagination') == 2)) && ($this->pagination->pagesTotal > 1)) : ?>
<div class="w-100">
<div class="com-tags-tag__pagination w-100">
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter float-right pt-3 pr-2">
<?php echo $this->pagination->getPagesCounter(); ?>
Expand Down
6 changes: 3 additions & 3 deletions components/com_tags/tmpl/tag/default_items.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
$items = $this->items;
$n = count($this->items);
?>
<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm" class="com-tags-tag__items">
<?php if ($this->params->get('show_headings') || $this->params->get('filter_field') || $this->params->get('show_pagination_limit')) : ?>
<fieldset class="filters d-flex justify-content-between mb-3">
<fieldset class="com-tags-tag__filters filters d-flex justify-content-between mb-3">
<?php if ($this->params->get('filter_field')) : ?>
<div class="input-group">
<label class="filter-search-lbl sr-only" for="filter-search">
Expand Down Expand Up @@ -66,7 +66,7 @@
<?php if ($this->items === false || $n === 0) : ?>
<p><?php echo JText::_('COM_TAGS_NO_ITEMS'); ?></p>
<?php else : ?>
<ul class="category list-group">
<ul class="com-tags-tag__category category list-group">
<?php foreach ($items as $i => $item) : ?>
<?php if ($item->core_state == 0) : ?>
<li class="list-group-item-danger">
Expand Down
4 changes: 2 additions & 2 deletions components/com_tags/tmpl/tag/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

?>

<div class="tag-category">
<div class="com-tags-tag-list tag-category">

<?php if ($this->params->get('show_page_heading')) : ?>
<h1>
Expand All @@ -32,7 +32,7 @@

<?php // We only show a tag description if there is a single tag. ?>
<?php if (count($this->item) === 1 && ($this->params->get('tag_list_show_tag_image', 1) || $this->params->get('tag_list_show_tag_description', 1))) : ?>
<div class="category-desc">
<div class="com-tags-tag-list__description category-desc">
<?php $images = json_decode($this->item[0]->images); ?>
<?php if ($this->params->get('tag_list_show_tag_image', 1) == 1 && !empty($images->image_fulltext)) : ?>
<img src="<?php echo htmlspecialchars($images->image_fulltext, ENT_COMPAT, 'UTF-8'); ?>">
Expand Down
8 changes: 4 additions & 4 deletions components/com_tags/tmpl/tag/list_items.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
?>
<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm" class="com-tags-tag-list__items">
<?php if ($this->params->get('filter_field') || $this->params->get('show_pagination_limit')) : ?>
<fieldset class="filters d-flex justify-content-between mb-3">
<fieldset class="com-tags-tag-list__filters filters d-flex justify-content-between mb-3">
<?php if ($this->params->get('filter_field')) : ?>
<div class="input-group">
<label class="filter-search-lbl sr-only" for="filter-search">
Expand Down Expand Up @@ -57,7 +57,7 @@
<?php if ($this->items === false || $n === 0) : ?>
<p><?php echo JText::_('COM_TAGS_NO_ITEMS'); ?></p>
<?php else : ?>
<table class="category table table-striped table-bordered table-hover">
<table class="com-tags-tag-list__category category table table-striped table-bordered table-hover">
<?php if ($this->params->get('show_headings')) : ?>
<thead>
<tr>
Expand Down Expand Up @@ -115,7 +115,7 @@
<?php // Add pagination links ?>
<?php if (!empty($this->items)) : ?>
<?php if (($this->params->def('show_pagination', 2) == 1 || ($this->params->get('show_pagination') == 2)) && ($this->pagination->pagesTotal > 1)) : ?>
<div class="w-100">
<div class="com-tags-tag-list__pagination w-100">
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter float-right pt-3 pr-2">
<?php echo $this->pagination->getPagesCounter(); ?>
Expand Down
6 changes: 3 additions & 3 deletions components/com_tags/tmpl/tags/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
$descriptionImage = $this->params->get('all_tags_description_image');

?>
<div class="tag-category">
<div class="com-tags tag-category">
<?php if ($this->params->get('show_page_heading')) : ?>
<h1>
<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if ($this->params->get('all_tags_show_description_image') && !empty($descriptionImage)) : ?>
<div>
<div class="com-tags__image">
<img src="<?php echo $descriptionImage; ?>" />
</div>
<?php endif; ?>
<?php if (!empty($description)) : ?>
<div>
<div class="com-tags__description">
<?php echo $description; ?>
</div>
<?php endif; ?>
Expand Down
198 changes: 100 additions & 98 deletions components/com_tags/tmpl/tags/default_items.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,110 +45,112 @@

?>

<?php if ($this->params->get('filter_field') || $this->params->get('show_pagination_limit')) : ?>
<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
<fieldset class="filters d-flex justify-content-between mb-3">
<?php if ($this->params->get('filter_field')) : ?>
<div class="input-group">
<label class="filter-search-lbl sr-only" for="filter-search">
<?php echo JText::_('COM_TAGS_TITLE_FILTER_LABEL') . '&#160;'; ?>
</label>
<input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->state->get('list.filter')); ?>" class="form-control" title="<?php echo JText::_('COM_TAGS_FILTER_SEARCH_DESC'); ?>" placeholder="<?php echo JText::_('COM_TAGS_TITLE_FILTER_LABEL'); ?>">
<span class="input-group-append">
<button type="submit" name="filter-search-button" title="<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>" class="btn btn-secondary">
<span class="fa fa-search" aria-hidden="true"></span>
</button>
<button type="reset" name="filter-clear-button" title="<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>" class="btn btn-secondary">
<span class="fa fa-times" aria-hidden="true"></span>
</button>
</span>
</div>
<?php endif; ?>
<?php if ($this->params->get('show_pagination_limit')) : ?>
<div class="btn-group float-right">
<label for="limit" class="sr-only">
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<?php endif; ?>
<div class="com-tags__items">
<?php if ($this->params->get('filter_field') || $this->params->get('show_pagination_limit')) : ?>
<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm" class="com-tags__items">
<fieldset class="com-tags__filters filters d-flex justify-content-between mb-3">
<?php if ($this->params->get('filter_field')) : ?>
<div class="input-group">
<label class="filter-search-lbl sr-only" for="filter-search">
<?php echo JText::_('COM_TAGS_TITLE_FILTER_LABEL') . '&#160;'; ?>
</label>
<input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->state->get('list.filter')); ?>" class="form-control" title="<?php echo JText::_('COM_TAGS_FILTER_SEARCH_DESC'); ?>" placeholder="<?php echo JText::_('COM_TAGS_TITLE_FILTER_LABEL'); ?>">
<span class="input-group-append">
<button type="submit" name="filter-search-button" title="<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>" class="btn btn-secondary">
<span class="fa fa-search" aria-hidden="true"></span>
</button>
<button type="reset" name="filter-clear-button" title="<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>" class="btn btn-secondary">
<span class="fa fa-times" aria-hidden="true"></span>
</button>
</span>
</div>
<?php endif; ?>
<?php if ($this->params->get('show_pagination_limit')) : ?>
<div class="btn-group float-right">
<label for="limit" class="sr-only">
<?php echo JText::_('JGLOBAL_DISPLAY_NUM'); ?>
</label>
<?php echo $this->pagination->getLimitBox(); ?>
</div>
<?php endif; ?>

<input type="hidden" name="filter_order" value="">
<input type="hidden" name="filter_order_Dir" value="">
<input type="hidden" name="limitstart" value="">
<input type="hidden" name="task" value="">
</fieldset>
</form>
<?php endif; ?>

<input type="hidden" name="filter_order" value="">
<input type="hidden" name="filter_order_Dir" value="">
<input type="hidden" name="limitstart" value="">
<input type="hidden" name="task" value="">
</fieldset>
</form>
<?php endif; ?>

<?php if ($this->items == false || $n === 0) : ?>
<p><?php echo JText::_('COM_TAGS_NO_TAGS'); ?></p>
<?php else : ?>
<?php foreach ($this->items as $i => $item) : ?>

<?php if ($n === 1 || $i === 0 || $bscolumns === 1 || $i % $bscolumns === 0) : ?>
<ul class="category list-group">
<?php endif; ?>
<?php if ($this->items == false || $n === 0) : ?>
<p class="com-tags__no-tags"><?php echo JText::_('COM_TAGS_NO_TAGS'); ?></p>
<?php else : ?>
<?php foreach ($this->items as $i => $item) : ?>

<li class="list-group-item list-group-item-action">
<?php if ((!empty($item->access)) && in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
<h3 class="mb-0">
<a href="<?php echo JRoute::_(TagsHelperRoute::getTagRoute($item->id . ':' . $item->alias)); ?>">
<?php echo $this->escape($item->title); ?>
</a>
</h3>
<?php if ($n === 1 || $i === 0 || $bscolumns === 1 || $i % $bscolumns === 0) : ?>
<ul class="com-tags__category category list-group">
<?php endif; ?>

<?php if ($this->params->get('all_tags_show_tag_image') && !empty($item->images)) : ?>
<?php $images = json_decode($item->images); ?>
<span class="tag-body">
<?php if (!empty($images->image_intro)) : ?>
<?php $imgfloat = empty($images->float_intro) ? $this->params->get('float_intro') : $images->float_intro; ?>
<div class="float-<?php echo htmlspecialchars($imgfloat); ?> item-image">
<img
<?php if ($images->image_intro_caption) : ?>
<?php echo 'class="caption"' . ' title="' . htmlspecialchars($images->image_intro_caption) . '"'; ?>
<?php endif; ?>
src="<?php echo $images->image_intro; ?>"
alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>">
</div>
<?php endif; ?>
</span>
<li class="list-group-item list-group-item-action">
<?php if ((!empty($item->access)) && in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
<h3 class="mb-0">
<a href="<?php echo JRoute::_(TagsHelperRoute::getTagRoute($item->id . ':' . $item->alias)); ?>">
<?php echo $this->escape($item->title); ?>
</a>
</h3>
<?php endif; ?>

<?php if ($this->params->get('all_tags_show_tag_image') && !empty($item->images)) : ?>
<?php $images = json_decode($item->images); ?>
<span class="tag-body">
<?php if (!empty($images->image_intro)) : ?>
<?php $imgfloat = empty($images->float_intro) ? $this->params->get('float_intro') : $images->float_intro; ?>
<div class="float-<?php echo htmlspecialchars($imgfloat); ?> item-image">
<img
<?php if ($images->image_intro_caption) : ?>
<?php echo 'class="caption"' . ' title="' . htmlspecialchars($images->image_intro_caption) . '"'; ?>
<?php endif; ?>
src="<?php echo $images->image_intro; ?>"
alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>">
</div>
<?php endif; ?>
</span>
<?php endif; ?>

<?php if ($this->params->get('all_tags_show_tag_description') || $this->params->get('all_tags_show_tag_hits')) : ?>
<div class="caption">
<?php if ($this->params->get('all_tags_show_tag_description')) : ?>
<span class="tag-body">
<?php echo JHtml::_('string.truncate', $item->description, $this->params->get('all_tags_tag_maximum_characters')); ?>
</span>
<?php endif; ?>
<?php if ($this->params->get('all_tags_show_tag_hits')) : ?>
<span class="list-hits badge badge-info">
<?php echo JText::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
</li>

<?php if (($i === 0 && $n === 1) || $i === $n - 1 || $bscolumns === 1 || (($i + 1) % $bscolumns === 0)) : ?>
</ul>
<?php endif; ?>

<?php if ($this->params->get('all_tags_show_tag_description') || $this->params->get('all_tags_show_tag_hits')) : ?>
<div class="caption">
<?php if ($this->params->get('all_tags_show_tag_description')) : ?>
<span class="tag-body">
<?php echo JHtml::_('string.truncate', $item->description, $this->params->get('all_tags_tag_maximum_characters')); ?>
</span>
<?php endif; ?>
<?php if ($this->params->get('all_tags_show_tag_hits')) : ?>
<span class="list-hits badge badge-info">
<?php echo JText::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
</li>
<?php endforeach; ?>
<?php endif; ?>

<?php if (($i === 0 && $n === 1) || $i === $n - 1 || $bscolumns === 1 || (($i + 1) % $bscolumns === 0)) : ?>
</ul>
<?php // Add pagination links ?>
<?php if (!empty($this->items)) : ?>
<?php if (($this->params->def('show_pagination', 2) == 1 || ($this->params->get('show_pagination') == 2)) && ($this->pagination->pagesTotal > 1)) : ?>
<div class="com-tags__pagination w-100">
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter float-right pt-3 pr-2">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>

<?php endforeach; ?>
<?php endif; ?>

<?php // Add pagination links ?>
<?php if (!empty($this->items)) : ?>
<?php if (($this->params->def('show_pagination', 2) == 1 || ($this->params->get('show_pagination') == 2)) && ($this->pagination->pagesTotal > 1)) : ?>
<div class="w-100">
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter float-right pt-3 pr-2">
<?php echo $this->pagination->getPagesCounter(); ?>
</p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>

0 comments on commit 97ed8a9

Please sign in to comment.