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 #30648

Merged
merged 4 commits into from
Sep 18, 2020

Conversation

infograf768
Copy link
Member

Summary of Changes

Displaying the list of contacts in a table, using a similar default display as List Articles in a Category menu item

Testing Instructions

Create a Contact Category.
Create contacts, some with parameters, some without.
Also test Unpublishing a contact, Setting published up the future, Settings publish down to a date in the past, Trash contact
Create a List Contacts in a Category menu item.
Display this menu item in frontend.

Actual result BEFORE applying this Pull Request

listcontacts_before

Expected result AFTER applying this Pull Request

listcontacts

When using custom field after title
Screen Shot 2020-09-15 at 17 47 17

Documentation Changes Required

Maybe, because of the new placing of the events.

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-4.0-dev labels Sep 15, 2020
@@ -81,4 +82,3 @@ 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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean to remove this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep. After some discussion we found it was useless to display the author of the contact in frontend.

@brianteeman
Copy link
Contributor

Could you please look at how the tables in the admin list view are created so that this new table is also accessible

@infograf768
Copy link
Member Author

Could you please look at how the tables in the admin list view are created so that this new table is also accessible

I am not a specialist of accessibility.
This PR is based on the List Articles in a Category display, thus why it may miss that aspect.

Do you mean adding scope="row", scope="col"? What else?

also a caption like ?

						<caption id="captionTable" class="sr-only">
							<?php echo Text::_('COM_CONTACT_TABLE_CAPTION'); ?>,
							<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
							<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
						</caption>

@brianteeman
Copy link
Contributor

Its not about being a specialist its just about following the good examples and ignoring the bad example ;)

adding scope and caption
reviewing useless headers and if necessary removing id

@infograf768
Copy link
Member Author

I welcome a PR to my branch as It would be easier this way.

@ghost
Copy link

ghost commented Sep 16, 2020

I have tested this item ✅ successfully on 4192e52


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30648.

@infograf768
Copy link
Member Author

Corrections done for a11y (as much as I did know).
Left some ids as I have no idea if they are or not useful.
Did not add under caption

<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>

Because we do not use searchtools.sort here but grid.sort.

Corrected also alpha sorting for Title as it was a bad copy paste.

@ghost
Copy link

ghost commented Sep 16, 2020

I have tested this item 🔴 unsuccessfully on 595f907

com_field-Label and Value have same style.

Screenshot_2020-09-16 Category


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30648.

@infograf768
Copy link
Member Author

@Formatio-hippocampi
This is due to the change from td to th to mimic admin table in:
<th scope="row" class="list-title">

I am not sure this should have been done. If it should we can solve by a css modification. If not I can modify back.
@brianteeman
@zwiastunsw

@joomla-cms-bot joomla-cms-bot added the NPM Resource Changed This Pull Request can't be tested by Patchtester label Sep 16, 2020
@infograf768
Copy link
Member Author

@Formatio-hippocampi
I added a css for <dd>

can you test again? Needs npm to test.

@ghost
Copy link

ghost commented Sep 16, 2020

test only by Patchtester.

@hans2103
Copy link
Contributor

Tested, didn't run npm run build:css.
On my screenshot there is no need to add the css change for <dd>.
Schermafbeelding 2020-09-17 om 09 54 30

Schermafbeelding 2020-09-17 om 09 54 09

To prevent the first column to stretch you might consider the following css:

.list-title {
    white-space: nowrap;
    width: 1%;

    vertical-align: top;
}

Schermafbeelding 2020-09-17 om 10 00 49

I see that the Details are just rendered with a <br/>
Is it an idea toe render them in a list <dl> or <ul>?

@infograf768
Copy link
Member Author

infograf768 commented Sep 17, 2020

@hans2103
Indeed no need for dd new css for Details because Details are displayed via <td> and not <th>
<th> is only used for the title and there one needs the new css. The custom field is rendered after title.

The main question here is
Do we need a <th> or not for title?
Is the Caption enough

				<caption id="captionTable" class="sr-only">
					<?php echo Text::_('COM_CONTACT_TABLE_CAPTION'); ?>,
				</caption>

as we can't use

<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>

using br or ul/li is not the main matter. We can do both.
Will test

.list-title {
    white-space: nowrap;
    width: 1%;

    vertical-align: top;
}

@hans2103
Copy link
Contributor

We do need the th element in the rows.
The name of each contact can be seen as a header.
see: https://www.w3.org/WAI/tutorials/tables/two-headers/

@hans2103
Copy link
Contributor

The caption element indicates the title of the table. That one is needed too.
(actually for all tables in Joomla)

@hans2103
Copy link
Contributor

hans2103 commented Sep 17, 2020

It would be great if <span id="orderedBy and <span id="filteredBy could be added to the <caption> too. But that is out of scope for this PR. Frontend is using grid.sort while backend uses searchtools.sort. A new PR should be added to find a way to change the innerHTML using grid.sort.

@hans2103
Copy link
Contributor

The PR is a11y fine if we assume backend similar tables are fine.

@infograf768
Copy link
Member Author

as .list-title is also used for newsfeeds and tags, in a weird way, I prefer not touch at that now. It would be for another PR where all occurences are taken care of.

@infograf768
Copy link
Member Author

OK, after this small change for the dd css, it looks that this PR is OK to go.
remains, for future PRs, to deal with

  1. grid.sort
  2. .list-title or other depending on future modifications for articles, newsfeeds, tags category display in frontend.

@hans2103
Copy link
Contributor

I have tested this item ✅ successfully on 7214004


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30648.

@BertaOctech
Copy link

I have tested this item ✅ successfully on 7214004

For me it worked as described.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30648.

@infograf768
Copy link
Member Author

RTC. Thanks for testing.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30648.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Sep 18, 2020
@rdeutz rdeutz merged commit 18ecaa7 into joomla:4.0-dev Sep 18, 2020
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Sep 18, 2020
@zero-24 zero-24 added this to the Joomla 4.0 milestone Sep 19, 2020
@infograf768 infograf768 deleted the 4.0_list_contacts_frontend branch September 19, 2020 05:57
heelc29 added a commit to heelc29/joomla that referenced this pull request Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Language Change This is for Translators NPM Resource Changed This Pull Request can't be tested by Patchtester
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants