Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] List Contacts in a Category display #1225

Closed
jgerman-bot opened this issue Sep 18, 2020 · 0 comments
Closed

[4.0] List Contacts in a Category display #1225

jgerman-bot opened this issue Sep 18, 2020 · 0 comments

Comments

@jgerman-bot
Copy link

New language relevant PR in upstream repo: joomla/joomla-cms#30648 Here are the upstream changes:

Click to expand the diff!
diff --git a/components/com_contact/tmpl/category/default_items.php b/components/com_contact/tmpl/category/default_items.php
index 417e99cec7e7..dfa0f80b4e66 100644
--- a/components/com_contact/tmpl/category/default_items.php
+++ b/components/com_contact/tmpl/category/default_items.php
@@ -21,6 +21,9 @@
 $canDo   = ContactHelper::getActions('com_contact', 'category', $this->category->id);
 $canEdit = $canDo->get('core.edit');
 $userId  = Factory::getUser()->id;
+
+$listOrder  = $this->escape($this->state->get('list.ordering'));
+$listDirn   = $this->escape($this->state->get('list.direction'));
 ?>
 <div class="com-contact-category__items">
 	<form action="<?php echo htmlspecialchars(Uri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
@@ -57,105 +60,146 @@ class="inputbox" onchange="document.adminForm.submit();"
 		</fieldset>
 		<?php endif; ?>
 		<?php if (empty($this->items)) : ?>
-			<p>
-				<?php echo Text::_('COM_CONTACT_NO_CONTACTS'); ?>
-			</p>
+			<div class="alert alert-info">
+				<span class="fas fa-info-circle" aria-hidden="true"></span><span class="sr-only"><?php echo Text::_('INFO'); ?></span>
+					<?php echo Text::_('COM_CONTACT_NO_CONTACTS'); ?>
+			</div>
 		<?php else : ?>
-
-			<ul class="com-contact-category__list category row-striped">
-				<?php foreach ($this->items as $i => $item) : ?>
-
-					<?php if (in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
+			<table class="com-content-category__table category table table-striped table-bordered table-hover" id="contactList">
+				<caption id="captionTable" class="sr-only">
+					<?php echo Text::_('COM_CONTACT_TABLE_CAPTION'); ?>,
+				</caption>
+				<?php if ($this->params->get('show_headings')) : ?>
+					<thead>
+						<tr>
+							<th scope="col" id="categorylist_header_title">
+								<?php echo HTMLHelper::_('grid.sort', 'JGLOBAL_TITLE', 'a.name', $listDirn, $listOrder, null, 'asc', '', 'adminForm'); ?>
+							</th>
+							<th scope="col">
+								<?php echo Text::_('COM_CONTACT_CONTACT_DETAILS'); ?>
+							</th>
+							<?php if ($canEdit || ($canDo->get('core.edit.own') && $item->created_by === $userId)) : ?>
+								<th scope="col">
+									<?php echo Text::_('COM_CONTACT_EDIT_CONTACT'); ?>
+								</th>
+							<?php endif; ?>
+						</tr>
+					</thead>
+				<?php endif; ?>
+				<tbody>
+					<?php foreach ($this->items as $i => $item) : ?>
 						<?php if ($this->items[$i]->published == 0) : ?>
-							<li class="row system-unpublished cat-list-row<?php echo $i % 2; ?>">
+							<tr class="system-unpublished cat-list-row<?php echo $i % 2; ?>">
 						<?php else : ?>
-							<li class="row cat-list-row<?php echo $i % 2; ?>" >
+							<tr class="cat-list-row<?php echo $i % 2; ?>" >
 						<?php endif; ?>
-
-						<?php if ($this->params->get('show_image_heading')) : ?>
-							<?php $contact_width = 7; ?>
-							<div class="col-md-2">
-								<?php if ($this->items[$i]->image) : ?>
-									<a href="<?php echo Route::_(RouteHelper::getContactRoute($item->slug, $item->catid, $item->language)); ?>">
-										<?php echo HTMLHelper::_('image', $this->items[$i]->image, Text::_('COM_CONTACT_IMAGE_DETAILS'), array('class' => 'contact-thumbnail img-thumbnail')); ?></a>
-								<?php endif; ?>
-							</div>
-						<?php else : ?>
-							<?php $contact_width = 9; ?>
-						<?php endif; ?>
-
-						<div class="list-title col-md-<?php echo $contact_width; ?>">
+						<th scope="row" class="list-title">
 							<a href="<?php echo Route::_(RouteHelper::getContactRoute($item->slug, $item->catid, $item->language)); ?>">
-								<?php echo $item->name; ?></a>
-							<?php if ($this->items[$i]->published == 0) : ?>
-								<span class="badge badge-warning"><?php echo Text::_('JUNPUBLISHED'); ?></span>
-							<?php endif; ?>
-							<?php echo $item->event->afterDisplayTitle; ?>
-
-							<?php echo $item->event->beforeDisplayContent; ?>
-
-							<?php if ($this->params->get('show_position_headings')) : ?>
-									<?php echo $item->con_position; ?><br>
-							<?php endif; ?>
-							<?php if ($this->params->get('show_email_headings')) : ?>
-									<?php echo $item->email_to; ?><br>
+								<?php if ($this->params->get('show_image_heading')) : ?>
+									<?php if ($item->image) : ?>
+										<?php echo HTMLHelper::_('image', $item->image, '', array('class' => 'contact-thumbnail img-thumbnail')); ?>
+									<?php endif; ?>
+								<?php endif; ?>
+								<?php echo $this->escape($item->name); ?>
+							</a>
+							<?php if ($item->published == 0) : ?>
+								<div>
+									<span class="list-published badge badge-warning">
+										<?php echo Text::_('JUNPUBLISHED'); ?>
+									</span>
+								</div>
 							<?php endif; ?>
-							<?php $location = array(); ?>
-							<?php if ($this->params->get('show_suburb_headings') && !empty($item->suburb)) : ?>
-								<?php $location[] = $item->suburb; ?>
+							<?php if (strtotime($item->publish_up) > strtotime(Factory::getDate())) : ?>
+								<div>
+									<span class="list-published badge badge-warning">
+										<?php echo Text::_('JNOTPUBLISHEDYET'); ?>
+									</span>
+								</div>
 							<?php endif; ?>
-							<?php if ($this->params->get('show_state_headings') && !empty($item->state)) : ?>
-								<?php $location[] = $item->state; ?>
+							<?php if (!is_null($item->publish_down) && strtotime($item->publish_down) < strtotime(Factory::getDate())) : ?>
+								<div>
+									<span class="list-published badge badge-warning">
+										<?php echo Text::_('JEXPIRED'); ?>
+									</span>
+								</div
 							<?php endif; ?>
-							<?php if ($this->params->get('show_country_headings') && !empty($item->country)) : ?>
-								<?php $location[] = $item->country; ?>
+							<?php if ($item->published == -2) : ?>
+								<div>
+									<span class="badge badge-warning">
+										<?php echo Text::_('JTRASHED'); ?>
+									</span>
+								</div>
 							<?php endif; ?>
-							<?php echo implode(', ', $location); ?>
-						</div>
 
-						<div class="col-md-3">
-							<?php if ($canEdit || ($canDo->get('core.edit.own') && $item->created_by === $userId)) : ?>
-								<div class="float-right"><?php echo HTMLHelper::_('contacticon.edit', $item, $this->params); ?></div>
-							<?php endif; ?>
+							<?php echo $item->event->afterDisplayTitle; ?>
+						</th>
+						<td>
+							<?php echo $item->event->beforeDisplayContent; ?>
 
 							<?php if ($this->params->get('show_telephone_headings') && !empty($item->telephone)) : ?>
 								<?php echo Text::sprintf('COM_CONTACT_TELEPHONE_NUMBER', $item->telephone); ?><br>
 							<?php endif; ?>
 
 							<?php if ($this->params->get('show_mobile_headings') && !empty ($item->mobile)) : ?>
-									<?php echo Text::sprintf('COM_CONTACT_MOBILE_NUMBER', $item->mobile); ?><br>
+								<?php echo Text::sprintf('COM_CONTACT_MOBILE_NUMBER', $item->mobile); ?><br>
 							<?php endif; ?>
 
 							<?php if ($this->params->get('show_fax_headings') && !empty($item->fax) ) : ?>
 								<?php echo Text::sprintf('COM_CONTACT_FAX_NUMBER', $item->fax); ?><br>
 							<?php endif; ?>
-						</div>
 
-						<?php echo $item->event->afterDisplayContent; ?>
-					</li>
-					<?php endif; ?>
-				<?php endforeach; ?>
-			</ul>
-			<?php endif; ?>
+							<?php if ($this->params->get('show_position_headings')) : ?>
+								<?php echo $item->con_position; ?><br>
+							<?php endif; ?>
 
-			<?php if ($canDo->get('core.create')) : ?>
-				<?php echo HTMLHelper::_('contacticon.create', $this->category, $this->category->params); ?>
-			<?php endif; ?>
+							<?php if ($this->params->get('show_email_headings')) : ?>
+								<?php echo $item->email_to; ?><br>
+							<?php endif; ?>
 
-			<?php if ($this->params->get('show_pagination', 2)) : ?>
+							<?php $location = array(); ?>
+							<?php if ($this->params->get('show_suburb_headings') && !empty($item->suburb)) : ?>
+								<?php $location[] = $item->suburb; ?><br>
+							<?php endif; ?>
+
+							<?php if ($this->params->get('show_state_headings') && !empty($item->state)) : ?>
+								<?php $location[] = $item->state; ?><br>
+							<?php endif; ?>
+
+							<?php if ($this->params->get('show_country_headings') && !empty($item->country)) : ?>
+								<?php $location[] = $item->country; ?><br>
+							<?php endif; ?>
+							<?php echo implode(', ', $location); ?>
+
+							<?php echo $item->event->afterDisplayContent; ?>
+						</td>
+						<?php if ($canEdit || ($canDo->get('core.edit.own') && $item->created_by === $userId)) : ?>
+							<td>
+								<?php echo HTMLHelper::_('contacticon.edit', $item, $this->params); ?>
+							</td>
+						<?php endif; ?>
+					<?php endforeach; ?>
+				</tbody>
+			</table>
+		<?php endif; ?>
+
+		<?php if ($canDo->get('core.create')) : ?>
+			<?php echo HTMLHelper::_('contacticon.create', $this->category, $this->category->params); ?>
+		<?php endif; ?>
+
+		<?php if ($this->params->get('show_pagination', 2)) : ?>
 			<div class="com-contact-category__counter w-100">
 				<?php if ($this->params->def('show_pagination_results', 1)) : ?>
-					<p class="counter float-right pt-3 pr-2">
+					<p class="com-contact-category__counter counter float-right pt-3 pr-2">
 						<?php echo $this->pagination->getPagesCounter(); ?>
 					</p>
 				<?php endif; ?>
 
 				<?php echo $this->pagination->getPagesLinks(); ?>
 			</div>
-			<?php endif; ?>
-			<div>
-				<input type="hidden" name="filter_order" value="<?php echo $this->escape($this->state->get('list.ordering')); ?>">
-				<input type="hidden" name="filter_order_Dir" value="<?php echo $this->escape($this->state->get('list.direction')); ?>">
-			</div>
+		<?php endif; ?>
+		<div>
+			<input type="hidden" name="filter_order" value="<?php echo $this->escape($this->state->get('list.ordering')); ?>">
+			<input type="hidden" name="filter_order_Dir" value="<?php echo $this->escape($this->state->get('list.direction')); ?>">
+		</div>
 	</form>
 </div>
diff --git a/language/en-GB/com_contact.ini b/language/en-GB/com_contact.ini
index 1fe2e0d6ab72..92a1e931ae06 100644
--- a/language/en-GB/com_contact.ini
+++ b/language/en-GB/com_contact.ini
@@ -8,6 +8,7 @@ COM_CONTACT_CAPTCHA_LABEL="Captcha"
 COM_CONTACT_CAT_NUM="# of Contacts :"
 COM_CONTACT_CHECKED_OUT_BY="Checked out by %s"
 COM_CONTACT_CONTACT_DEFAULT_LABEL="Send an Email"
+COM_CONTACT_CONTACT_DETAILS="Details"
 COM_CONTACT_CONTACT_EMAIL_A_COPY_LABEL="Send a copy to yourself"
 COM_CONTACT_CONTACT_EMAIL_NAME_LABEL="Name"
 COM_CONTACT_CONTACT_ENTER_MESSAGE_LABEL="Message"
@@ -77,8 +78,8 @@ COM_CONTACT_SELECT_CONTACT="Select a contact:"
 COM_CONTACT_SESSION_INVALID="Invalid session cookie. Please check that you have cookies enabled in your web browser."
 COM_CONTACT_STATE="State"
 COM_CONTACT_SUBURB="Suburb"
+COM_CONTACT_TABLE_CAPTION="Table of Contacts"
 COM_CONTACT_TELEPHONE="Phone"
 COM_CONTACT_TELEPHONE_NUMBER="Phone: %s"
 COM_CONTACT_USER_FIELDS="Fields"
 COM_CONTACT_VCARD="vCard"
-COM_CONTACT_WRITTEN_BY="Written by %s"
diff --git a/templates/cassiopeia/scss/blocks/_global.scss b/templates/cassiopeia/scss/blocks/_global.scss
index c383e483fe1e..b6059b58856c 100644
--- a/templates/cassiopeia/scss/blocks/_global.scss
+++ b/templates/cassiopeia/scss/blocks/_global.scss
@@ -41,6 +41,10 @@ dd {
   margin-bottom: 0;
 }
 
+th dd {
+  font-weight: normal;
+}
+
 .mod-menu {
   flex-direction: column;
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants