joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[4.2] [GSoC 21] Core Enhancement 3 - Merge Featured into Articles

Open YatharthVyas opened this issue 4 years ago • 22 comments

Project Repo PR: https://github.com/joomla-projects/gsoc21_core-enhancements/pull/11 Plan Document: https://docs.google.com/document/d/1Pl8JGa2hkYkmJzQOn9_mS8a4imDmqc2a/edit#heading=h.t5tri5tytv7q


  • [x] Drop-down selector in Articles view
  • [x] Merge Model
  • [x] Merge tmpl files
  • [x] Merge View
  • [x] Merge Controller
  • [x] Update all links pointing to view=featured
  • [x] Update Link of Featured Articles Menu Item
  • [x] Remove Featured files

Summary of Changes

[A] New Selector Dropdown

A searchtools selector is added that can be used to toggle between:

Option Value
All ""
Unfeatured 0
Featured 1

dropdown


[B] Model Merged

  • A new method to return the featured selector filter parameter using the getUserState from request
$featured = $this->getUserStateFromRequest($this->context . '.featured', 'featured', '');
  • The advantage of the above is that we can also pass the value as a GET param to the URL which helps us to make redirect URLs that can initialize the value of this dropdown
  • $featured variable is used as a condition to manipulate the query to adjust to Featured

[C] Templates Merged

  • We use state->get('featured') to conditonally render the template code as per featured or not.

[D] Views Merged

  • We use state->get('featured') to conditonally render the toolbar options

[E] Controller Merged

  • Merged the delete function from FeaturedController

Testing Instructions

  • Visit the Articles View and ensure that everything works as it did before.
  • Test workflows and filters too
  • Ensure that the tmpl and view (and all other MVC files) are common for both featured and articles

Expected result AFTER applying this Pull Request

Everything works normally


Mentors

@chmst @nibra @bembelimen (and thanks @richard67)

YatharthVyas avatar Aug 19 '21 15:08 YatharthVyas

Does this fix https://github.com/joomla/joomla-cms/issues/29942 ?

PhilETaylor avatar Aug 19 '21 15:08 PhilETaylor

Does this fix #29942 ?

Sadly, No. I haven't made any change that affects this.

YatharthVyas avatar Aug 19 '21 15:08 YatharthVyas

If you only moved the "Featured" filter to set it using GET, that works as well with: /administrator/index.php?option=com_content&view=articles&filter[featured]=1.

Bakual avatar Aug 20 '21 14:08 Bakual

Sorting by Featured does not update the icon-sort to caret up/caret down.

Quy avatar Aug 20 '21 23:08 Quy

Updates:

  1. This has been fixed:

Sorting by Featured does not update the icon-sort to caret up/caret down.

  1. All old files related to featured articles have been deleted

YatharthVyas avatar Oct 30 '21 17:10 YatharthVyas

Will Featured Articles in the sidebar be removed?

Quy avatar Nov 21 '21 19:11 Quy

Will Featured Articles in the sidebar be removed?

No, it will stay but it's navigation url will be different. This new url will point to the articles (instead of featured) view and it will pass the filter of featured=1 that will be applied in the search tools to only show featured articles

YatharthVyas avatar Nov 21 '21 20:11 YatharthVyas

Two menu items are highlighted. Also, see #28003 for request to remove it.

featured-articles

Quy avatar Nov 21 '21 21:11 Quy

The double highlighting is because of an unrelated bug in menu highlighting

brianteeman avatar Nov 21 '21 22:11 brianteeman

#19886 could be obsolete for 4.x with this PR


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

chmst avatar Jan 22 '22 09:01 chmst

Apologies for the review request, I rebased my branch to fix the merge conflicts and it automatically requested for review when I pushed it

YatharthVyas avatar Mar 23 '22 11:03 YatharthVyas

Review request can be removed by using the cog icon beside the reviewers list on the top ~~left~~ right corner, and then choosing the reviewer which has a check mark in the drop down.

richard67 avatar Mar 23 '22 11:03 richard67

Thank you!

YatharthVyas avatar Mar 23 '22 11:03 YatharthVyas

Thinking loud, because there was a question in a forum aboout a template override for the featured layout. Can this remain unchanged?

chmst avatar Mar 23 '22 20:03 chmst

@YatharthVyas We have a conflict :fearful: Can you check it please?

roland-d avatar Mar 27 '22 08:03 roland-d

@YatharthVyas We have a conflict 😨 Can you check it please?

Thanks, I have rebased it now

Thinking loud, because there was a question in a forum aboout a template override for the featured layout. Can this remain unchanged?

Sorry, I am unware about this.I would like to read more information about the forum question

YatharthVyas avatar Mar 27 '22 08:03 YatharthVyas

Now I am sorry, I cannot find the post.

The user had an own template override for the featured articles (tmpl/featured/default.php). This remembered me that featured articles can have a very different layout than other articles or blog layouts.

chmst avatar Mar 27 '22 09:03 chmst

Install Blog Sample Data. Go to the front page. Error: The requested page can't be found.

Quy avatar Mar 27 '22 10:03 Quy

Install Blog Sample Data.

obviously as the plugin is not updated in this pr

brianteeman avatar Mar 27 '22 10:03 brianteeman

Enable Workflows. Go to Actions dropdown. Missing Run Transitions and Unfeature should not be listed.

actions

Quy avatar Mar 27 '22 10:03 Quy

obviously as the plugin is not updated in this pr

The issue is that the update sql should update the backend only and not the frontend too.

Quy avatar Mar 27 '22 10:03 Quy

obviously as the plugin is not updated in this pr

The issue is that the update sql should update the backend only and not the frontend too.

@Quy Yes, the update SQL statement is missing a condition for client_id = 1 in the WHERE clause.

@YatharthVyas Could you change that, and change the name of the update SQL scripts from "4.1.0-2021-08-09.sql" to the right version 4.2.0 and a more current date, e.g. "4.2.0-2022-03-27.sql"? If you can, remember to do the file rename and the file content change with separate commits so GitHub history shows the file has been renamed and changed and not shows a deleted and a created file.

richard67 avatar Mar 27 '22 10:03 richard67

@obuisard this wasn't accepted for 4.2 - no idea why - will it be accepted for 4.3 (if updated). If not then the creator should be informed and this closed. (which will be a shame) but there is no point in leaving it open otherwise

brianteeman avatar Sep 04 '22 16:09 brianteeman

Thank you @brianteeman for pointing this out. We are going to contact student and mentor about this enhancement as it was a GSoC project. We will also double-check with the UX team on this one.

obuisard avatar Sep 04 '22 17:09 obuisard

This pull request has been automatically rebased to 5.0-dev. No new features will be merged into Joomla! 4.3 series. Joomla! 4.4 series is a bridge release to make migration from Joomla! 4 to 5 as smooth as possible.

HLeithner avatar May 08 '23 15:05 HLeithner

This pull request has been automatically rebased to 5.1-dev.

HLeithner avatar Sep 30 '23 22:09 HLeithner

This pull request has been automatically rebased to 5.2-dev.

HLeithner avatar Apr 24 '24 09:04 HLeithner