Skip to content

[4.0] Frontend: Fix List Contacts Category List Limit#30904

Merged
rdeutz merged 2 commits intojoomla:4.0-devfrom
infograf768:4.0_contact_cat_list_limit
Oct 8, 2020
Merged

[4.0] Frontend: Fix List Contacts Category List Limit#30904
rdeutz merged 2 commits intojoomla:4.0-devfrom
infograf768:4.0_contact_cat_list_limit

Conversation

@infograf768
Copy link
Copy Markdown
Member

@infograf768 infograf768 commented Oct 3, 2020

Pull Request for Issue #30813 (comment)

Summary of Changes

The existing code prevents modifying the list limit as it is forced or by the Global Contacts List Layout Options, or the List Contacts in a Category menu item params.

This normalizes the use of list limit, as done for other lists displaying in frontend, by deleting both fields and modifying the model code. Default is set to 20.

Testing Instructions

Create some contacts in a category.
Create a List Contacts in a Category menu item.
Display the menu item in frontend.

Try to modify the list limit
Patch and test again.

Actual result BEFORE applying this Pull Request

limitbox_contacts-list-before

Expected result AFTER applying this Pull Request

limitbox_contacts-list-after

@ghost
Copy link
Copy Markdown

ghost commented Oct 3, 2020

I have tested this item ✅ successfully on 5d62196


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

1 similar comment
@richard67
Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on 5d62196


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

@richard67
Copy link
Copy Markdown
Member

RTC


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

@richard67 richard67 removed Language Change This is for Translators PR-4.0-dev labels Oct 3, 2020
@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Oct 3, 2020
@richard67 richard67 added Language Change This is for Translators PR-4.0-dev labels Oct 3, 2020
@HLeithner
Copy link
Copy Markdown
Member

Sorry why should we hard code the default to 20? and what's the problem with our configuration option? don*t we use the same functionality in com_content?

@HLeithner HLeithner removed the RTC This Pull Request is Ready To Commit label Oct 3, 2020
@brianteeman
Copy link
Copy Markdown
Contributor

brianteeman commented Oct 3, 2020

It is not hard coded to 20. It uses the list_limit defined in global configuration. But as also shown below I dont get the same layout - and shouldnt the button be called search not filter?

image

image

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Oct 3, 2020
@HLeithner
Copy link
Copy Markdown
Member

HLeithner commented Oct 3, 2020

I only looked at the code

-			$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'), 'uint');
+			$limit = $app->input->get('limit', $app->get('list_limit', 20), 'uint');

and getuserstatefromrequest should do the same as input->get but also set the user preference in the session.

Edit: I miss read this as remove of the default, but it removes the com_contact .xml options if i'm not wrong?

@infograf768
Copy link
Copy Markdown
Member Author

infograf768 commented Oct 4, 2020

don*t we use the same functionality in com_content?

Nope. We do not have a articles__num as Options in the xmls for articles List Layouts

The contact specific field option in the xmls (contacts_display_num) are unecessary as it is only used to force a specific limit which is ALWAYS set, which created the original issue

before the patch we had in Contacts CategoryModel:

		$numberOfContactsToDisplay = $mergedParams->get('contacts_display_num');

		if ($format === 'feed')
		{
			$limit = $app->get('feed_limit');
		}
		elseif (isset($numberOfContactsToDisplay))
		{
			$limit = $numberOfContactsToDisplay; // As this is always set, it forces that limit...
		}
		else
		{
			$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'), 'uint');
		}

20 is indeed basically a default.
Same code is used for frontend Articles Model concerning the category list.

$value = $app->input->get('limit', $app->get('list_limit', 0), 'uint');
$this->setState('list.limit', $value);

and shouldnt the button be called search not filter?

That's what it is called for articles list.

<button type="submit" name="filter_submit" class="btn btn-primary"><?php echo Text::_('COM_CONTENT_FORM_FILTER_SUBMIT'); ?></button>

COM_CONTENT_FORM_FILTER_SUBMIT="Filter"
I have not changed this. Just mimicked it for contacts by using a Global string JGLOBAL_FILTER_BUTTON. It can be modified globally for all similar lists in frontend by using JSEARCH_FILTER_SUBMIT if desired.
I remind you that you tested that PR OK and the layout does not change with this patch. It should be tested with a 4.0-dev test site where npm ci has been run.
#30813 (comment)

Folks, I basically have done all these contacts related frontend list refactoring PRs based on what we already have for articles.
For example, there is a debate here about the use of a fieldset or not.
#30868
Taking out the fieldset element would also change the display, pushing the list limit to the right for the contacts lists. Articles may need more refactoring.

@infograf768
Copy link
Copy Markdown
Member Author

As requested modified to use back getUserStateFromRequest
No change in behavior.

@chmst
Copy link
Copy Markdown
Contributor

chmst commented Oct 6, 2020

I have tested this item ✅ successfully on daf7d61


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

1 similar comment
@ghost
Copy link
Copy Markdown

ghost commented Oct 6, 2020

I have tested this item ✅ successfully on daf7d61


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

@infograf768
Copy link
Copy Markdown
Member Author

@HLeithner
Good to go.

@rdeutz rdeutz added this to the Joomla 4.0 milestone Oct 8, 2020
@rdeutz rdeutz merged commit 091fcfd into joomla:4.0-dev Oct 8, 2020
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Oct 8, 2020
@infograf768 infograf768 deleted the 4.0_contact_cat_list_limit branch October 8, 2020 08:25
richard67 pushed a commit that referenced this pull request Apr 9, 2021
PR for #33021

Hopefully this resolves the bug reported with #30813.
#30904 tried to fix it by removing the feature introduced with #23710 completely which was wrong

Co-authored-by: Tuan Pham Ngoc <github@joomdonation.com>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants