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

[5.2] Articles module: Truncate text (introtext and read more title) #44189

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

drmenzelit
Copy link
Contributor

This Pull Request tries to solve several issues #44183, #44185, corrects wrong introduced parameters for the read more button #44136 and replaces other PRs #44179, #44175

Summary of Changes

Replaced the truncate method with string.truncateComplex . The intro text preserves now html tags (e.g. formatting like strong or links) and the number of characters is almost correct (the truncate method doesn't cut words, so the number of characters can be more or less depending on the length of the words and the position of a space). The ellipsis are on a new line, I don't like it, but that is the way the method is defined and it is not in the scope of this PR to change the truncate method.
The PR #44136 introduced some additional parameters on the read more button. These are not necessary and interferes with the parameter of the module (e.g. don't displaying the read more button although the parameter is set to show).

Testing Instructions

Create several articles with and without formatting (e.g. strong) and / or links in the intro text. Create a module to display the articles and play with the parameters Introtext, Introtext Limit, "Read More" Link, Read More with Title, Read More Limit

Actual result BEFORE applying this Pull Request

Please look at all linked issues and pull requests.

Expected result AFTER applying this Pull Request

grafik
grafik

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@chmst
Copy link
Contributor

chmst commented Oct 4, 2024

The PR is successful for html code.
But there is no change in the original problem. If the limit is smaller than the length of the first word, no text is displayed.
grafik
grafik

When the limit is set to for example 15, the result is
grafik
#44183 (comment)
It is a result of the stringhelper truncate method:
grafik

$offset is empty if the string does not contain a space.

@drmenzelit
Copy link
Contributor Author

@chmst yes, that is what I wrote in the description of the PR too. But it is not in the scope of this PR to change how the truncate method works. The only option is to add some help text for the field(s)...

@chmst
Copy link
Contributor

chmst commented Oct 4, 2024

@drmenzelit agreed

@Hackwar
Copy link
Member

Hackwar commented Oct 4, 2024

We can add that help text in 5.2.1, among other things because we are in language freeze. Waiting for people to test this, so that I can merge it.

@coolcat-creations
Copy link
Contributor

coolcat-creations commented Oct 4, 2024

I set the introtext limit to 10 but its cut after 4. For Example "Your home page" is cut after Your

grafik grafik

@dautrich
Copy link

dautrich commented Oct 4, 2024

I have tested this item ✅ successfully on 66725d3


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

@coolcat-creations
Copy link
Contributor

Read more limit is set to 15 but cut after 10

grafik

@coolcat-creations
Copy link
Contributor

Read more is only read more without title but the 3 dots appear

grafik grafik

@coolcat-creations
Copy link
Contributor

If I delete the 100 character limit of the introtext it comes back again instead of unlimited.

@coolcat-creations
Copy link
Contributor

When I manually add a 0 into the truncation of introtext field an image field magically appears, don't know if that is intended?

@dautrich
Copy link

dautrich commented Oct 4, 2024

When I manually add a 0 into the truncation of introtext field an image field magically appears, don't know if that is intended?

This is what it says in the tooltip.

@coolcat-creations
Copy link
Contributor

When I manually add a 0 into the truncation of introtext field an image field magically appears, don't know if that is intended?

This is what it says in the tooltip.

Thats not obvious that someone needs to toggle inline help to find something like this. If I delete the number it should be deleted or set to 0 but not make 100 reapear

@coolcat-creations
Copy link
Contributor

Also the 3 dots still appear on a new line instead of after the truncated text (it was mentioned in another issue)

@dautrich
Copy link

dautrich commented Oct 4, 2024

Currently, the module has some small information buttons that show a tooltip on hover. I don't think that this is sufficient for a standard user. I believe that we need comprehensive inline help for the module.

@coolcat-creations
Copy link
Contributor

Currently, the module has some small information buttons that show a tooltip on hover. I don't think that this is sufficient for a standard user. I believe that we need comprehensive inline help for the module.

I dont see any tooltips? just the inline help. But the inline help is not really good for explaining unexpected behaviour :)

@RickR2H
Copy link
Member

RickR2H commented Oct 4, 2024

I have tested this item ✅ successfully on 66725d3


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

@RickR2H
Copy link
Member

RickR2H commented Oct 4, 2024

RTC


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

@Hackwar Hackwar enabled auto-merge (squash) October 4, 2024 19:28
@Hackwar Hackwar merged commit 4b41186 into joomla:5.2-dev Oct 4, 2024
3 checks passed
@Quy Quy added this to the Joomla! 5.2.0 milestone Oct 5, 2024
richard67 added a commit that referenced this pull request Oct 6, 2024
[5.2] Add active class to active item in mod_ articles #44153 
[5.2] Articles module: Truncate text (introtext and read more title) #44189
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants