Feature Language Change NPM Resource Changed PR-5.3-dev Pending

User tests: Successful: Unsuccessful:

avatar YatharthVyas
YatharthVyas
12 Jul 2021

Project Repo PR: joomla-projects/gsoc21_core-enhancements#8
Plan Document: https://docs.google.com/document/d/1Pl8JGa2hkYkmJzQOn9_mS8a4imDmqc2a/edit#heading=h.xzcjfqetxfhr


Summary of Changes

  1. Create Module in Article Edit Screen

    Users can add Modules in Articles in Joomla. This is done with the help of the Module xtd-editor Plugin. However, this Plugin opens a Modal that only allows the user to select a pre-existing module, ie. there is no option to add a new module directly in the Article Edit View.
    To enhance that, this PR introduces a button to Create Modules directly in the Article Edit View:

    add module

  1. Imported Modules Tab

    Note: To test this feature, you must enable "Show Imported Modules" in the com_content Global Configuration OR in the Configure Edit Screen Tab. Also, remember that the tab is only visible when you Import a Module and Save it.

    configure

    • Users have no option to ascertain information about the Modules imported in an article (they can only see the module id)

      image

    • Additionally, these modules cannot be directly edited in the Article Edit View.

      edit

    • There is no user-friendly way to removing these modules. It requires a person to backspace the {loadmoduleid id} string from the article text which may not seem very intuitive to someone that is not tech-savvy. So to make this process more smooth, the users can now remove the tab with the click of a button in this tab

      remove

Testing Instructions

  1. Run npm ci to rebuild the assets
  2. Enable the Imported Modules Tab (Global Configuration -> Articles -> Editing Layout -> Show Imported Modules Switcher)
  3. Follow the GIFs above

Documentation Changes Required

I'm not sure

Mentors

@chmst @nibra @bembelimen
(and thanks @richard67)

avatar YatharthVyas YatharthVyas - open - 12 Jul 2021
avatar YatharthVyas YatharthVyas - change - 12 Jul 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 12 Jul 2021
Category Administration com_content com_modules Language & Strings Repository NPM Change JavaScript
avatar YatharthVyas YatharthVyas - change - 12 Jul 2021
The description was changed
avatar YatharthVyas YatharthVyas - edited - 12 Jul 2021
avatar YatharthVyas YatharthVyas - change - 12 Jul 2021
The description was changed
avatar YatharthVyas YatharthVyas - edited - 12 Jul 2021
avatar brianteeman
brianteeman - comment - 12 Jul 2021

When you use the NEW button why do you have to repeat everything in order to select and insert the module. This should be a single step.

avatar brianteeman
brianteeman - comment - 12 Jul 2021

Something for you to review with your mentors.

Everything in this code is dependent on adding modules to the content using the syntax {loadmoduleid 1}

However modules can also be added to content using alternative syntax

  • {loadposition position_name}
  • {loadposition module_name}

Any modules present in the content using either of these alternatives will not be included in the tab containing "imported modules"

avatar chmst
chmst - comment - 12 Jul 2021

However modules can also be added to content using alternative syntax

When modules are added, is does not matter. The id is unique, the name was a small help for users - but the name is not always unique.

avatar brianteeman
brianteeman - comment - 12 Jul 2021

@chmst you miss the point.

Because a module can be added to an article with three different syntax (and if I remember correctly the id method was not the original) a user will expect all the modules in an article to be displayed in the imported modules tab. With the way the current code is here that will not be the case.

avatar YatharthVyas YatharthVyas - change - 14 Jul 2021
Labels Added: ? NPM Resource Changed ?
avatar YatharthVyas
YatharthVyas - comment - 14 Jul 2021

The new commits address 2 of the improvements suggested by @brianteeman

1. Importing a newly created module is now a single-step process. No need to re-open the Modal.

loadmodule.mp4

I've used a cookie here as I need to access its contents using both PHP (to not display the Save and Close button in Toolbar for unsaved modules) and JavaScript (to clear this flag when we close the modal). Hiding Save and Close button is necessary here because we need to make sure that the module is saved (in our database) before we close the modal so we can grab the module's ID.

2. Modules positions also shown in the imported modules tab (for loadposition):

image

Only the positions are shown and not the modules under these positions because that requires us to know the menu id for the article's page (can be in multiple pages) and then mapping the menu ID to position to modules which will be a costly performance impacting query.

Scope for Improvement

  • Modules imported using {loadmodule mod_type} are not displayed in the new tab. This should be implemented.
avatar YatharthVyas
YatharthVyas - comment - 17 Jul 2021

All 3 Types of module import syntax are considered in the imported modules tab

image

The new addition here is the Modules Imported by Type Section. Here's how it works:

  • It is similar to the flow of the loadmodules plugin
  • We first check if the ModuleHelper:getModule returns a valid module
  • If not, we add mod_ as a prefix to the name and call the ModuleHelper:getModule function
  • When the moduleHelper function returns a value, we append it to the array (sometimes a ID of 0 is return even though the module exists which is why there are some modules having ID 0 and no edit button)
avatar YatharthVyas YatharthVyas - change - 6 Aug 2021
Labels Added: ? ?
Removed: ? ?
avatar YatharthVyas YatharthVyas - change - 20 Aug 2021
Labels Added: Language Change ?
Removed: ? ?
avatar YatharthVyas YatharthVyas - change - 8 Jan 2022
Labels Added: ?
Removed: ?
avatar HLeithner
HLeithner - comment - 27 Jun 2022

This pull request has automatically rebased to 4.2-dev.

avatar joomla-bot
joomla-bot - comment - 27 Jun 2022

This pull requests has been automatically converted to the PSR-12 coding standard.

avatar chmst chmst - change - 23 Oct 2022
Labels Added: ? ?
Removed: ?
avatar HLeithner
HLeithner - comment - 2 May 2023

This pull request has been automatically rebased to 5.0-dev.

avatar ceford ceford - test_item - 9 Sep 2023 - Tested unsuccessfully
avatar ceford
ceford - comment - 9 Sep 2023

I have tested this item ? unsuccessfully on dcad97f

If I apply the patch and start a new article I get this above the edit form:

Deprecated: preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in /Users/ceford/Sites/joomla-cms/administrator/components/com_content/src/Model/ArticleModel.php on line 462

Deprecated: preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in /Users/ceford/Sites/joomla-cms/administrator/components/com_content/src/Model/ArticleModel.php on line 478

Deprecated: preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in /Users/ceford/Sites/joomla-cms/administrator/components/com_content/src/Model/ArticleModel.php on line 506

Deprecated: preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in /Users/ceford/Sites/joomla-cms/administrator/components/com_content/src/Model/ArticleModel.php on line 462

Deprecated: preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in /Users/ceford/Sites/joomla-cms/administrator/components/com_content/src/Model/ArticleModel.php on line 478

Deprecated: preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated in /Users/ceford/Sites/joomla-cms/administrator/components/com_content/src/Model/ArticleModel.php on line 506

I can create a new module but it is not inserted in the edit form - so this feature seems pointless.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/34764.

avatar HLeithner
HLeithner - comment - 30 Sep 2023

This pull request has been automatically rebased to 5.1-dev.

avatar Razzo1987 Razzo1987 - change - 3 Nov 2023
Title
[4.1] [GSoC 21] Core Enhancement 2 - Incorporation of Modules in Articles-Edit-View
[5.1] [GSoC 21] Core Enhancement 2 - Incorporation of Modules in Articles-Edit-View
avatar Razzo1987 Razzo1987 - edited - 3 Nov 2023
avatar wilsonge wilsonge - change - 22 Nov 2023
Labels Added: Feature PR-5.1-dev
Removed: ? ?
avatar HLeithner
HLeithner - comment - 24 Apr 2024

This pull request has been automatically rebased to 5.2-dev.

avatar HLeithner HLeithner - change - 24 Apr 2024
Title
[5.1] [GSoC 21] Core Enhancement 2 - Incorporation of Modules in Articles-Edit-View
[5.2] [GSoC 21] Core Enhancement 2 - Incorporation of Modules in Articles-Edit-View
avatar HLeithner HLeithner - edited - 24 Apr 2024
avatar obuisard obuisard - change - 27 Jul 2024
Labels Added: PR-5.2-dev
Removed: PR-5.1-dev
avatar bascherz bascherz - test_item - 24 Aug 2024 - Tested unsuccessfully
avatar bascherz
bascherz - comment - 24 Aug 2024

I have tested this item ? unsuccessfully on dcad97f

I do not know what "npm" is or how to execute it. So that aside, after installing the patch I get the following error when either editing an existing article or creating a new one. I have seen this during testing of other patches during PBF.

An error has occurred.
0 There is no "com_content.admin-article-edit" asset of a "script" type in the registry.
Call Stack

Function Location

1 () JROOT/libraries/src/WebAsset/WebAssetRegistry.php:135
2 Joomla\CMS\WebAsset\WebAssetRegistry->get() JROOT/libraries/src/WebAsset/WebAssetManager.php:274
3 Joomla\CMS\WebAsset\WebAssetManager->useAsset() JROOT/libraries/src/WebAsset/WebAssetManager.php:208
4 Joomla\CMS\WebAsset\WebAssetManager->__call() JROOT/administrator/components/com_content/tmpl/article/edit.php:26
5 include() JROOT/libraries/src/MVC/View/HtmlView.php:416
6 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/libraries/src/MVC/View/HtmlView.php:204
7 Joomla\CMS\MVC\View\HtmlView->display() JROOT/administrator/components/com_content/src/View/Article/HtmlView.php:135
8 Joomla\Component\Content\Administrator\View\Article\HtmlView->display() JROOT/libraries/src/MVC/Controller/BaseController.php:697
9 Joomla\CMS\MVC\Controller\BaseController->display() JROOT/administrator/components/com_content/src/Controller/DisplayController.php:65
10 Joomla\Component\Content\Administrator\Controller\DisplayController->display() JROOT/libraries/src/MVC/Controller/BaseController.php:730
11 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:143
12 Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:361
13 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/AdministratorApplication.php:150
14 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT/libraries/src/Application/AdministratorApplication.php:195
15 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:306
16 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/includes/app.php:58
17 require_once() JROOT/administrator/index.php:32


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/34764.

avatar richard67
richard67 - comment - 24 Aug 2024

I have tested this item ? unsuccessfully on dcad97fI do not know what "npm" is or how to execute it. So that aside, after installing the patch I get the following error when either editing an existing article or creating a new one. I have seen this during testing of other patches during PBF.

@bascherz NPM is the Node Package Manager which we use to maintain our javascript dependencies and to generate the js and css from the sources. If you haven't used it and haven't used a prebuild package for testing this PR, then your test is not valid as it is not sufficient just to apply the changes e.g. with the patchtester.

Please change back your test result to "Not tested".

avatar bascherz
bascherz - comment - 24 Aug 2024

@richard67 I do not know how to do that. I don't see a way to edit a previous post. Should I just repost?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/34764.

avatar bascherz bascherz - test_item - 24 Aug 2024 - Not tested
avatar bascherz
bascherz - comment - 24 Aug 2024

I have not tested this item.

I do not know what "npm" is or how to execute it. So that aside, after installing the patch I get the following error when either editing an existing article or creating a new one. I have seen this during testing of other patches during PBF.

An error has occurred.
0 There is no "com_content.admin-article-edit" asset of a "script" type in the registry.
Call Stack

Function Location

1 () JROOT/libraries/src/WebAsset/WebAssetRegistry.php:135
2 Joomla\CMS\WebAsset\WebAssetRegistry->get() JROOT/libraries/src/WebAsset/WebAssetManager.php:274
3 Joomla\CMS\WebAsset\WebAssetManager->useAsset() JROOT/libraries/src/WebAsset/WebAssetManager.php:208
4 Joomla\CMS\WebAsset\WebAssetManager->__call() JROOT/administrator/components/com_content/tmpl/article/edit.php:26
5 include() JROOT/libraries/src/MVC/View/HtmlView.php:416
6 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/libraries/src/MVC/View/HtmlView.php:204
7 Joomla\CMS\MVC\View\HtmlView->display() JROOT/administrator/components/com_content/src/View/Article/HtmlView.php:135
8 Joomla\Component\Content\Administrator\View\Article\HtmlView->display() JROOT/libraries/src/MVC/Controller/BaseController.php:697
9 Joomla\CMS\MVC\Controller\BaseController->display() JROOT/administrator/components/com_content/src/Controller/DisplayController.php:65
10 Joomla\Component\Content\Administrator\Controller\DisplayController->display() JROOT/libraries/src/MVC/Controller/BaseController.php:730
11 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:143
12 Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:361
13 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/AdministratorApplication.php:150
14 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT/libraries/src/Application/AdministratorApplication.php:195
15 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:306
16 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/includes/app.php:58
17 require_once() JROOT/administrator/index.php:32


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/34764.

avatar HLeithner
HLeithner - comment - 2 Sep 2024

This pull request has been automatically rebased to 5.3-dev.

avatar HLeithner HLeithner - change - 2 Sep 2024
Title
[5.2] [GSoC 21] Core Enhancement 2 - Incorporation of Modules in Articles-Edit-View
[5.3] [GSoC 21] Core Enhancement 2 - Incorporation of Modules in Articles-Edit-View
avatar HLeithner HLeithner - edited - 2 Sep 2024
avatar LadySolveig LadySolveig - change - 7 Oct 2024
Labels Added: PR-5.3-dev
Removed: PR-5.2-dev

Add a Comment

Login with GitHub to post a comment