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

[6.0] Gsoc2021 35228 merge featured #43907

Merged
merged 58 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
0131b8a
Select field featured
chmst Aug 11, 2024
1a110a9
Change links pointing to featured
chmst Aug 11, 2024
71f0e57
Merge model features into articles
chmst Aug 11, 2024
b1c92ce
Merge Views
chmst Aug 11, 2024
6cafabd
Integrate featured into the articles list
chmst Aug 11, 2024
d39cdfe
Remove uused files
chmst Aug 11, 2024
52236fc
sql cupdate space
chmst Aug 11, 2024
1abf31c
child bar buttons featured / unfeatured
chmst Aug 11, 2024
1f1f04a
Merge controller
chmst Aug 11, 2024
f0063ce
deptecate table class
chmst Aug 11, 2024
f648ff9
Featured Quickicon
chmst Aug 11, 2024
e97f37c
cs
chmst Aug 11, 2024
3611375
remove unused imports
chmst Aug 12, 2024
10532bc
cs
chmst Aug 12, 2024
10ff935
cs
chmst Aug 12, 2024
53219f4
quickicon methods cs
chmst Aug 12, 2024
796a00d
cs
chmst Aug 12, 2024
de442db
cs
chmst Aug 13, 2024
2a3a615
cs
chmst Aug 14, 2024
6d578ab
Merge branch '6.0-dev' into gsoc2021-35228-merge-featured
richard67 Aug 20, 2024
326be16
Fix PHPCS (1)
richard67 Aug 20, 2024
d50f2ba
Fix PHPCS (2)
richard67 Aug 20, 2024
6a01522
PHPCS (3)
richard67 Aug 20, 2024
50a9f7f
Revert changes in featured table.
chmst Aug 26, 2024
8483886
Change version "removed in 7.0" to "removed in 8.0"
chmst Aug 26, 2024
42a94a3
Merge branch '6.0-dev' into gsoc2021-35228-merge-featured
chmst Dec 14, 2024
2e9e095
Change filter text
chmst Dec 15, 2024
79537fe
as recommended
chmst Dec 15, 2024
dd99cd8
cs
chmst Dec 16, 2024
fab5f02
Removed conflicting code
obuisard Dec 16, 2024
f2f35de
Removed blank lines
obuisard Dec 16, 2024
57fcf8c
cs
chmst Dec 16, 2024
9aaef98
indent
chmst Dec 17, 2024
1bc3719
Fix quickicons articles / featured articles
chmst Dec 18, 2024
180df89
simplify query, cs
chmst Dec 18, 2024
e2cb935
cs
chmst Jan 13, 2025
2fe0a7c
Update administrator/components/com_content/tmpl/articles/default.php
chmst Jan 13, 2025
e0363f1
Merge branch '6.0-dev' into gsoc2021-35228-merge-featured
chmst Jan 13, 2025
577b942
Update administrator/components/com_content/src/Controller/DisplayCon…
chmst Jan 28, 2025
3a34cb6
Update administrator/components/com_content/src/View/Articles/HtmlVie…
chmst Jan 28, 2025
3a92795
Fix double activated menuitems when featured is active
chmst Jan 31, 2025
cb3a155
updates as requested
chmst Jan 31, 2025
5c040e1
Merge branch '6.0-dev' into gsoc2021-35228-merge-featured
bembelimen Feb 22, 2025
6cacb16
Move featured filter back to filter section
bembelimen Feb 22, 2025
4f7b1bd
Redirect featured option to proper filter
bembelimen Feb 22, 2025
69985cd
Implement proper feature filter in articles model
bembelimen Feb 22, 2025
2555bdc
Use state to check for featured
bembelimen Feb 22, 2025
3138bf2
Fix preset
bembelimen Feb 22, 2025
2eb7215
Fix quickicon
bembelimen Feb 22, 2025
a462eee
Fix SQL files
bembelimen Feb 22, 2025
c0ef187
Fix pagination
bembelimen Feb 22, 2025
d16678e
Fix quickicon count
bembelimen Feb 22, 2025
e3fa82c
Fix featured filter
bembelimen Feb 22, 2025
dc60a07
Fix deletion of featured articles
bembelimen Feb 22, 2025
1f8769b
Fix filter change for featured
bembelimen Feb 22, 2025
c226469
Remove unneeded extra filter output in view
bembelimen Feb 22, 2025
b9953ff
Merge pull request #17 from bembelimen/6.0/chmst/featured-view
chmst Feb 22, 2025
d24908a
Featured filter first
chmst Feb 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Update link to featured

UPDATE `#__menu`
SET `link` = 'index.php?option=com_content&view=articles&filter[featured]=1'
WHERE `link` = 'index.php?option=com_content&view=featured'
AND `client_id` = 1;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Update link to featured

UPDATE "#__menu"
SET "link" = 'index.php?option=com_content&view=articles&filter[featured]=1'
WHERE "link" = 'index.php?option=com_content&view=featured'
AND "client_id" = 1;
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
name="featured"
type="list"
label="JFEATURED"
filtermode="selector"
class="js-select-submit-on-change"
default=""
validate="options"
>
<option value="">COM_CONTENT_SELECT_FEATURED</option>
Expand Down
152 changes: 0 additions & 152 deletions administrator/components/com_content/forms/filter_featured.xml

This file was deleted.

2 changes: 1 addition & 1 deletion administrator/components/com_content/presets/content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
title="COM_CONTENT_MENUS_FEATURED"
type="component"
element="com_content"
link="index.php?option=com_content&amp;view=featured"
link="index.php?option=com_content&amp;view=articles&amp;filter[featured]=1"
class="class:featured"
/>
</menuitem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\Router\Route;
use Joomla\Component\Content\Administrator\Model\ArticlesModel;
use Joomla\Input\Input;
use Joomla\Utilities\ArrayHelper;

Expand Down Expand Up @@ -145,9 +146,7 @@ public function getQuickiconContent()
{
$model = $this->getModel('articles');

$model->setState('filter.published', 1);

$amount = (int) $model->getTotal();
$amount = (int) $model->getTotal($featured = '');

$result = [];

Expand All @@ -157,4 +156,31 @@ public function getQuickiconContent()

echo new JsonResponse($result);
}

/**
* Method to get the number of published featured articles for quickicons
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function getQuickiconFeatured()
{
/**
* @var ArticlesModel $model
*/
$model = $this->getModel('articles');

$model->setState('filter.featured', '1');

$amount = (int) $model->getTotal();

$result = [];

$result['amount'] = $amount;
$result['sronly'] = Text::plural('COM_CONTENT_FEATURED_N_QUICKICON_SRONLY', $amount);
$result['name'] = Text::plural('COM_CONTENT_FEATURED_N_QUICKICON', $amount);

echo new JsonResponse($result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public function display($cachable = false, $urlparams = [])
return false;
}

if ($view === 'featured' || $this->input->getInt('featured')) {
$this->setRedirect(Route::_('index.php?option=com_content&view=articles&filter[featured]=1', false));
return false;
}

return parent::display();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @deprecated 6.0 will be removed in 8.0
*/

namespace Joomla\Component\Content\Administrator\Controller;

use Joomla\CMS\Language\Text;
use Joomla\CMS\Response\JsonResponse;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
Expand All @@ -21,107 +20,11 @@
* Featured content controller class.
*
* @since 1.6
*
* @deprecated 6.0 will be removed in 8.0
* Use \Joomla\Component\Content\Administrator\Controller\ArticlesController instead
* For Quickicons use articles.getQuickiconFeatured()
*/
class FeaturedController extends ArticlesController
{
/**
* Removes an item.
*
* @return void
*
* @since 1.6
*/
public function delete()
{
// Check for request forgeries
$this->checkToken();

$user = $this->app->getIdentity();
$ids = (array) $this->input->get('cid', [], 'int');

// Access checks.
foreach ($ids as $i => $id) {
// Remove zero value resulting from input filter
if ($id === 0) {
unset($ids[$i]);

continue;
}

if (!$user->authorise('core.delete', 'com_content.article.' . (int) $id)) {
// Prune items that you can't delete.
unset($ids[$i]);
$this->app->enqueueMessage(Text::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'notice');
}
}

if (empty($ids)) {
$this->app->enqueueMessage(Text::_('JERROR_NO_ITEMS_SELECTED'), 'error');
} else {
/** @var \Joomla\Component\Content\Administrator\Model\FeatureModel $model */
$model = $this->getModel();

// Remove the items.
if (!$model->featured($ids, 0)) {
$this->app->enqueueMessage($model->getError(), 'error');
}
}

$this->setRedirect('index.php?option=com_content&view=featured');
}

/**
* Method to publish a list of articles.
*
* @return void
*
* @since 1.0
*/
public function publish()
{
parent::publish();

$this->setRedirect('index.php?option=com_content&view=featured');
}

/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return \Joomla\CMS\MVC\Model\BaseDatabaseModel The model.
*
* @since 1.6
*/
public function getModel($name = 'Feature', $prefix = 'Administrator', $config = ['ignore_request' => true])
{
return parent::getModel($name, $prefix, $config);
}

/**
* Method to get the number of published featured articles for quickicons
*
* @return void
*
* @since 4.3.0
*/
public function getQuickiconContent()
{
$model = $this->getModel('articles');

$model->setState('filter.published', 1);
$model->setState('filter.featured', 1);

$amount = (int) $model->getTotal();

$result = [];

$result['amount'] = $amount;
$result['sronly'] = Text::plural('COM_CONTENT_FEATURED_N_QUICKICON_SRONLY', $amount);
$result['name'] = Text::plural('COM_CONTENT_FEATURED_N_QUICKICON', $amount);

echo new JsonResponse($result);
}
}
Loading