User tests: Successful: Unsuccessful:
Pull Request for Issue # .
addToolbar updated.
initializeToolbar and appendMoreButton functions added.
developers can override functions or just extend this class.
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');
}
}
Toolbar show buttons side by side
Toolbar show dropdown button
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
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Labels |
Added:
PR-5.2-dev
|
@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.
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
@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.
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.
I am not the best person to ask regarding these changes - please stop asking me directly here and at mattermost
@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.
@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.
/me confused. developers already make extensions with toolbars matching joomla core
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-03-22 10:23:22 |
Closed_By | ⇒ | chmst |
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...
before telling people that somethign is not good please answer the questions you have been asked.
@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"
@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.
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