PR-5.2-dev Pending

User tests: Successful: Unsuccessful:

avatar sinahaghparast
sinahaghparast
17 Mar 2024

Pull Request for Issue # .

Summary of Changes

addToolbar updated.

initializeToolbar and appendMoreButton functions added.

developers can override functions or just extend this class.

Testing Instructions

When show list of items, HtmlView extends ListView instead of BaseHtmlView...

class HtmlView extends ListView
{
	public function __construct($config = [])
    {
		$config['toolbar_title'] = Text::_('COM_XYZ');
		$config['option'] = ApplicationHelper::getComponentName();
		$config['toolbar_icon'] = 'signup';
		$config['help_link'] = '#';
                parent::__construct($config);
		$this->canDo = ContentHelper::getActions('com_xyz');
	}
}

Actual result BEFORE applying this Pull Request

Toolbar show buttons side by side

Expected result AFTER applying this Pull Request

Toolbar show dropdown button

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

avatar sinahaghparast sinahaghparast - open - 17 Mar 2024
avatar sinahaghparast sinahaghparast - change - 17 Mar 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 17 Mar 2024
Category Libraries
avatar sinahaghparast sinahaghparast - change - 17 Mar 2024
The description was changed
avatar sinahaghparast sinahaghparast - edited - 17 Mar 2024
avatar sinahaghparast sinahaghparast - change - 17 Mar 2024
The description was changed
avatar sinahaghparast sinahaghparast - edited - 17 Mar 2024
avatar sinahaghparast sinahaghparast - change - 17 Mar 2024
Labels Added: PR-5.2-dev
avatar brianteeman
brianteeman - comment - 17 Mar 2024

Please look at the code you are changing - there is testing code and other changes that are not related to the description of the issue.

https://github.com/joomla/joomla-cms/pull/43070/files#diff-2d333764d3b745e8d516fc4bffc5967a4c28d23157e00b9464e239d28f1c0c69

avatar sinahaghparast
sinahaghparast - comment - 17 Mar 2024

@brianteeman
For the first time, I made changes to the library codes. Please check, what is my mistake?
If you use this code, the toolbar will look like the picture.
Please advise how I should register the changes. How should I implement new ideas for Joomla?
Also, please reply to messages on Mattermost.

Screenshot 2024-03-17 at 15-50-34 COM_MRJOOMLACART COM_MRJOOMLACART_STATUS - Joomla! 5 - Administration

avatar brianteeman
brianteeman - comment - 17 Mar 2024

I have no idea what you are trying to do or why so I am sorry I am not the best person to help you

avatar sinahaghparast
sinahaghparast - comment - 17 Mar 2024

@brianteeman
When a developer wants to create a component, it can extend from this class for list views. This class exists in the Joomla project, but so far the main components of Joomla have not used it. I used it for a component I created. I noticed that its output is not the same as the output of content components, banner, audience, field, category, etc. The changes made will cause the output of views that are extended from this class to be similar to the main components of Joomla. With such a class that causes the output of other components to be similar to the main components of Joomla, several advantages are obtained.

  • The user experience is similar throughout the admin.
  • Visual beauty is achieved.
  • Main components can also be extended from this class.
  • Developers can still have their own customization.
    I decided to change the addToolbar function. In order to make the appearance similar to the main components of Joomla and developers can add the buttons they need to the toolbar if they need other buttons. Two functions named initia and moreBu have been added to this class. There were also some properties in the content view class that I added to this class as well.
    Please check the code and add it to Joomla if there is no error.
avatar brianteeman
brianteeman - comment - 17 Mar 2024

Please look at the code you are changing - there is testing code and other changes that are not related to the description of the issue.

https://github.com/joomla/joomla-cms/pull/43070/files#diff-2d333764d3b745e8d516fc4bffc5967a4c28d23157e00b9464e239d28f1c0c69

I am not the best person to ask regarding these changes - please stop asking me directly here and at mattermost

avatar Fedik
Fedik - comment - 22 Mar 2024

@chmst the PR contain many unrelated changes, no point do do full review ?

@sinahaghparast the idea with appendMoreButton() is not bad, but a better approach would be to improve our Toolbar class to allow to append the button at specific position. Example:

$doc->getToolbar()->addButtonAfter('cancel', $button1);
$doc->getToolbar()->addButtonbefore('cancel', $button2);

I suggest to close this PR.

avatar sinahaghparast
sinahaghparast - comment - 22 Mar 2024

@chmst
Thanks for your time. You have made some good points.

@Fedik
The purpose of making these changes was not to optimize the toolbar library. The goal was to simulate the toolbar in list views. with existing facilities. Its purpose has been to make the components, whether they are specific to Joomla or produced by developers, have a uniform form in the admin panel. Of course, your suggestion about the toolbar is very good and practical.

avatar brianteeman
brianteeman - comment - 22 Mar 2024

/me confused. developers already make extensions with toolbars matching joomla core

avatar chmst
chmst - comment - 22 Mar 2024

Agree with @Fedik and close this for now.
We appreciate your contribution but I suggest that you first study the Joomla core and documentation and coding conventions.

avatar chmst chmst - change - 22 Mar 2024
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2024-03-22 10:23:22
Closed_By chmst
avatar chmst chmst - close - 22 Mar 2024
avatar sinahaghparast
sinahaghparast - comment - 26 Mar 2024

Hello,
@brianteeman , @chmst , @Fedik

Here we are trying to make Joomla stronger than before. Please ask me for more clarification if something is confusing you.
There is a ListView in the Joomla library files. While this file exists, no core component has been expanded from it so far. In fact, there is a file without consumption in the library, which was not even used for core components! This is not good.
Well, if the core components find the current form attractive, I decided to update the library file as needed now (Joomla 5). After checking several components, I realized that if this file is going to make toolbars of several core components, then we need two more functions. I think you have not paid attention to correcting the file with due care.
I even have a part of the code that I need other developers to brainstorm, which I have marked as a TODO.
Take this file seriously... because it has been unused until today. The proof of my point is a simple search in the editor.

"extends ListView"
===OR===
"use Joomla\CMS\MVC\View\ListView"
===NOTHING===

Please accept that if this file was useful, Joomla itself should have used it first. and other developers to model how to use it. And developers are encouraged to extend this file in their components so that the visual effect of Joomla is the same throughout the admin pages.

core components can extends ListView
com_content
com_categories
com_workflow
com_fields
com_modules
com_menus
com_contact
com_finder
com_users
and ...

When you find in /administrator folder these phrases:
$this->get('Items')
$this->get('Pagination')

result is
45
43

It means result files are list view and better is extends ListView...

avatar brianteeman
brianteeman - comment - 26 Mar 2024

before telling people that somethign is not good please answer the questions you have been asked.

avatar sinahaghparast
sinahaghparast - comment - 26 Mar 2024

@brianteeman , I really don't know which question you mean? I have tried to answer all the answers so far.

Some things were also modified, but the changes are not displayed here. Maybe I haven't learned GitHub well...! I edit the codes with GitHub web panel...

https://github.com/sinahaghparast/joomla-cms/blob/staging/libraries/src/MVC/View/ListView.php

Just don't say "I am not the best person to help you"

avatar wojsmol
wojsmol - comment - 26 Mar 2024

@sinahaghparast This PR shows changes from sinahaghparast-clean-code in your fork of this repository - link in your previous message points to old staging branch in you fork.

Add a Comment

Login with GitHub to post a comment