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

Core Enhancement 3 - Merge Featured into Articles #11

Open
wants to merge 16 commits into
base: dev
Choose a base branch
from

Conversation

YatharthVyas
Copy link
Collaborator

@YatharthVyas YatharthVyas commented Aug 5, 2021

The purpose of this PR is to track all the file changes and commits made. Mentors can review the changes and provide feedback.
I will update the description as and when I push more commits.

Plan Document: https://docs.google.com/document/d/1Pl8JGa2hkYkmJzQOn9_mS8a4imDmqc2a/edit#heading=h.t5tri5tytv7q


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

Edit: Merge Table has been removed from the above list because I feel that both the files (in /src/Table/) play an essential role and they must be different

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

@chmst
Copy link
Contributor

chmst commented Aug 8, 2021

About the menuItem "Featured Articles". Could we remove the link to featured articles from the backend? Or is it a b/c break ? Needs to be discussed

@YatharthVyas
Copy link
Collaborator Author

About the menuItem "Featured Articles". Could we remove the link to featured articles from the backend? Or is it a b/c break ? Needs to be discussed

Good Point.
I thought about this aswell and hence I planned to initialize the value of the featured selector drop-down using getUserStateFromRequest() because we can now pass a get Param to the URL as : index.php?option=com_content&view=articles&featured=1 to obtain the page for featured articles. We will simply have to update the URL for that menu item and everything will work normally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants