User tests: Successful: Unsuccessful:
Sometimes Joomla's workflow can be a bit confusing for new users:
Usually you have to create a category "X", create some articles that you assign to that category "X", create a menu item of type Category Blog to display the articles from category "X".
This PR adds a new functionality to the Article edit form that makes it possible to create & assign a new Category on the fly.
Huge thanks to @roland-d who helped me with developing this functionality at the Joomla Code Sprint at Roompot in Weert(NL).
Go to Content > Article
Create a new article (Title) and select an existing Category.
Go to Content > Article
Create a new article (Title) and click on the Category dropdown.
The Category dropdown now has an option to add a new Category name.
Don't forget to click on to select your newly created Category.
The new Category will be on the bottom of the list, but only saved when the article is saved.
Status | New | ⇒ | Pending |
Labels |
Added:
?
?
|
Yes, that's right.
If you want to change the Categories (which you'll probably will later on), you can do that later in the Category Manager.
OK Several "smaller" comments and a "larger" comment (the plugin thing) but overall nice work. This is a really positive feature :)
What about having a field "parent category" and a second field "child category"
This would improve 2 things:
1) On pages with complex structure it´s easier to find the categories inside the list
2) This great new feature would be able to add categories to existing parent categories
thanks for this great feature!
Without commenting on the code aspects that @wilsonge mentioned
Also what about the acl.
If the user doesnt have access to create a root level category what happens. (Sorry I havent tested this as I am useless setting up the ACL)
Sorry me again
Front end editing
While you can create a new tag on the frontend you cant create a new category
Thanks for your constructive feedback @wilsonge !
I've made some changes, e.g. moved the code to category helper file so that it can be reused with other extensions that use com_categories categories. IMHO it's better to use the helper file and not a plugin.
Roland (thanks @roland-d !) helped me with refactoring the allowAdd to the field.php library.
Thanks for your feedback @designbengel !
I've tried to keep it as simple as possible.
IMHO people can use the Category Manager to further (re)organize their category structure.
The categories created from articles are all assigned to parent level & easy to find.
Maybe we could add a message about that after creating a new category?
For example: "You've created a new category. To organize your categories go to the [Category Manager]" with [Category Manager] linked to the category manager?
Simple is always best
Thanks for your feedback @brianteeman
I'll indeed add this functionality to other components that make use of Categories. Now that the Category Creation method is in the helper file, it's easier to reuse by other components.
Thanks for your tooltip suggestion, I've added it to this PR.
I've reproduced the front-end problem with this PR that @brianteeman reported.
I'll try to fix that...
Please alpha order
+JGLOBAL_ADD_CUSTOM_CATEGORY="Add new Category"
I will do so. Thanks @infograf768
Something else: I've run into an issue with creating a new Category Name with numbers only.
I'll fix that too...
Solved the issue with using a Category name that's only a number. Thanks @roland-d
Alpha ordered new language strings. Thanks @infograf768
Changed tooltip. Thanks @brianteeman
its realy goooooodddd
same think for link menu ?
in article editing view and category editing view => select an existing link or create a new one
SeemsGood
Tested OK here in monolanguage and multilanguage where the new category picks the article language ( ).
The tip displayed in back-end could also be displayed in front-end I guess.
Labels |
Added:
?
|
Milestone |
Added: |
Labels |
Added:
?
|
Thanks for testing @infograf768 & @alikon and everybody else for improving this PR!
Labels |
Removed:
?
|
Thought:
after looking more into this, I became conscious of an aspect we may have overseen: ACL.
By default, an Author and up can create articles —normal—, but also categories as the permissions for the component are not separated in Joomla.
As long as this was in back-end, that was not a problem as Authors, Editors, Publishers are not allowed to log in back-end by default, but now that this feature let's create also categories in frontend, it shows the limitations of our ACL. Basically, an Author could create as many new categories as desired...
Is it a real issue? What do you think?
I have tested this item successfully on cf87097
Thanks for testing @Gerlof
Thanks @infograf768 for your comment about this PR & ACL.
This can be a problem indeed, will check it...
This PR has received new commits.
CC: @Gerlof
I've tested the issue with front-end ACL that @infograf768 described:
It was possible for an author to create (unlimited) new categories, however their articles were all created with publish state "unpublished".
IMHO that's unwanted behavior, so I removed the possibility on the front-end to add new categories.
I have tested this item successfully on c055379
Very usable to end-users AND administrators. Tested multi-lingual. Worked fine!
I have tested this item successfully on c055379
Tested successfully.
Verry Nice feature.
I have tested this item successfully on c055379
@test tested succesfully, nice feature!
Milestone |
Removed: |
Milestone |
Added: |
I have tested this item successfully on c055379
Test OK
Category | ⇒ | Components |
Status | Pending | ⇒ | Ready to Commit |
Labels |
RTC - thanks
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-04-09 14:18:36 |
Closed_By | ⇒ | wilsonge |
With a quick look at the code
so i decided to test this feature in 3.6.x
Indeed the categoryedit form element does not check it
How to test
The problem is that after checking the allowAdd attibute,
we need to go further and also make an core.create ACL check on
the extension (since we are creating a category at root level right ?)
$this->allowAdd = isset($this->element['allowAdd']) ? $this->element['allowAdd'] : '';
if ($this->allowAdd)
{
$jinput = JFactory::getApplication()->input;
$user = JFactory::getUser();
$extension = $this->element['extension'] ? (string) $this->element['extension'] : (string) $jinput->get('extension', 'com_content');
$this->allowAdd = $user->authorise('core.create', $extension);
}
Labels |
Removed:
?
|
Now if only this option was available on the frontend, communities could create all sorts of structures with this!
@JoshuaLewis What could possibly go wrong!? ;-)
If it was permission based (whether ACL or through a menu item) it could be managed through a select group of people via Joomla's user groups. If the easy creation of categories could be assigned to a parent category, someone attempting to wreck havoc wouldn't be hard to spot and wouldn't really mess up the site structure.
Is it always a root level category?