Language Change Conflicting Files NPM Resource Changed ? Pending

User tests: Successful: Unsuccessful:

avatar YatharthVyas
YatharthVyas
9 Jul 2021

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


Summary of Changes

Frontend Flow:

This PR re-invents the unconventional method of placing modules from the Backend Dashboard to an easier to visualize series of steps where the users can visit a particular page in the Frontend (while logged in to an admin account) and from there, they can select the menu (automatically determined based on the page) and position of the Module by the means of buttons that reflect the output of where the module will be placed if the user proceeds to create it.

  • New Plugin
    • Introduce a new system plugin plg_system_addmodulebutton for displaying the Add Module Button
    • This button is appended to the end of the <main> tag which is omnipresent on all pages.
    • This button is only displayed when a user logs into the frontend using an account that has Module Add/Edit Permissions
    • Pressing this button adds ?pm=1 as a GET parameter in the URL. This is similar to the ?tp=1 parameter that is used for displaying template positions

addModbtn

  • Place Module (?pm=1) View
    • This view displays the current page will all possible template positions
    • Each position will have a button corresponding to it. This button can be used to select this position for placing the new module.
    • These buttons (to select position) redirect the user to a backend page having a URL like administrator/index.php?option=com_modules&task=module.selectPosition&position=footer&menu=101 . This URL has 3 parts:
      1. task=module.selectPosition is used to call the selectPosition Controller in com_modules/module
      2. &position=footer is used to pass the position as a GET param
      3. &menu=101 is used to pass the menu id of the current page as a GET param

image

  • New Controller: /com_modules/Module/selectPosition
    • Saves the Position and Menu ID which is passed as a GET param in URL by the previous step in the User State,
    • Redirects to Module Select View where user can select the Module Type
    • After the Module Type has been selected, these state items (Position and Menu ID) is used to pre-fill the Position Name and Menu ID

Here is a video demonstration of the overall frontend flow :

Frontend.Flow.mp4

Backend Flow:

Editing Modules in the Backend Admin Panel turned out to be a little tricky for the user if the template positions were not easy to visualize or if the User was unaware of the layout of the template positions. The old way for a user to get around this difficulty was to

  1. Visit the Global Configuration -> Templates -> Enable Template Positions
  2. Visit Frontend
  3. Append ?tp=1 as a param in the Page's URL (Might not be easy for users who do not have a technical background)
  4. Remember the position name (Note: This view only shows active positions so they cannot even know where inactive positions are. Inactive means those positions that do not have a module to show in it)
  5. Go back to the Admin Dashboard and select this position

To simplify all this into an easier and efficient method, a new modal has been added to select the positions via their preview. The video below demonstrates this new modal:

Module.Placement.Backend.flow.mp4

Testing Instructions


Actual result AFTER applying this Pull Request

Refer to the two videos in the Summary of Changes section.


Documentation Changes Required

I'm not sure but I think this should be included in the Joomla Docs as a User Guide for the new feature.


Mentors

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

avatar YatharthVyas YatharthVyas - open - 9 Jul 2021
avatar YatharthVyas YatharthVyas - change - 9 Jul 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 9 Jul 2021
Category SQL Administration com_admin Postgresql com_modules Language & Strings Repository NPM Change JavaScript Installation Layout Libraries Front End Plugins Templates (site)
avatar YatharthVyas YatharthVyas - change - 9 Jul 2021
The description was changed
avatar YatharthVyas YatharthVyas - edited - 9 Jul 2021
avatar richard67
richard67 - comment - 9 Jul 2021
avatar YatharthVyas YatharthVyas - change - 9 Jul 2021
Labels Added: ? NPM Resource Changed ?
avatar micker
micker - comment - 9 Jul 2021

Whooo

avatar brianteeman
brianteeman - comment - 9 Jul 2021

Some initial observations - maybe more for the mentors than you.

As I stated before I do not like that this is dependent on the template being used. Surely if we can have a preview of template positions and a module edit button without requiring a change to the template it can be done here as well.

Why do I have to go to the very bottom of the page to "turn this on" - imagine navigating there without using a mouse. My first impression was that this was the only area I could insert a module. Do we even need this step? We don't need an additional step for editing modules.

When I select a "place module here" the site changes to the admin (without any notice), I have to log in and there is no method to return to the site once the module has been inserted. Why not use the existing frontend module editing form and existing authorisation - you just need to add a "select module" to that.

Why is this controlled and managed indpendently to the edit module options?

Final observation is regarding the confusion for users when adding a module who dont understand the difference between a menu and a page. For example if you have a blog category and then select an article and you see the add module button they will think they are adding it to the page with the article and will be surprised to see it has been added to every article in the blog

image

avatar YatharthVyas
YatharthVyas - comment - 9 Jul 2021

Thank you for this detailed and constructive feedback! I'm happy to learn where I can improve.
There are some points that I wish to address before my mentors comment on it

As I stated before I do not like that this is dependent on the template being used. Surely if we can have a preview of template positions and a module edit button without requiring a change to the template it can be done here as well.

I was unable to figure out a workaround to this. I will need some guidance from my mentors here. Thanks!

Why do I have to go to the very bottom of the page to "turn this on" - imagine navigating there without using a mouse. My first impression was that this was the only area I could insert a module. Do we even need this step? We don't need an additional step for editing modules.

Excellent Idea. I will try to re-position the button to be similar to the screenshot

When I select a "place module here" the site changes to the admin (without any notice), I have to log in and there is no method to return to the site once the module has been inserted. Why not use the existing frontend module editing form and existing authorisation - you just need to add a "select module" to that.

I thought about this, but the frontend edit module view doesn't have all the fields. To be specific, the Menu Assignment Tab wasn't present in the frontend edit view. I thought that this has been deliberately not included and hence I decided to proceed with redirection to the admin panel. Transferring this to the frontend can be done but it will definitely require some extra efforts and careful inspection of what is being copy-pasted from the administrator files which might get a little complicated. I would want to hear my mentor's opinion on this too.

avatar YatharthVyas
YatharthVyas - comment - 10 Jul 2021

image

Updated the Position and Style of the Add Module Button

avatar richard67
richard67 - comment - 10 Jul 2021

image

Updated the Position and Style of the Add Module Button

The "Add Module" label and "Add a new module here" description being shown below each other for that button now seem to be redundant to me.

Why not just use label "Add New Module Here" or "Create Module Here"?

@brianteeman What do you suggest as native speaker?

avatar chmst
chmst - comment - 10 Jul 2021

I am not native speaker, but just wanted to say the same.
"Create a module" is better.

avatar YatharthVyas YatharthVyas - change - 10 Jul 2021
The description was changed
avatar YatharthVyas YatharthVyas - edited - 10 Jul 2021
avatar brianteeman
brianteeman - comment - 10 Jul 2021

the l;anguage string is the least important thing to resolve on this pr and can be looked at later

avatar YatharthVyas YatharthVyas - change - 12 Jul 2021
The description was changed
avatar YatharthVyas YatharthVyas - edited - 12 Jul 2021
avatar chmst
chmst - comment - 3 Aug 2021

I thought about this, but the frontend edit module view doesn't have all the fields. To be specific, the Menu Assignment Tab wasn't present in the frontend edit view. I thought that this has been deliberately not included and hence I decided to proceed with redirection to the admin panel. Transferring this to the frontend can be done but it will definitely require some extra efforts and careful inspection of what is being copy-pasted from the administrator files which might get a little complicated. I would want to hear my mentor's opinion on this too.

I think, we should keep this out from this PR

avatar YatharthVyas YatharthVyas - change - 3 Aug 2021
Labels Added: ?
Removed: ?
avatar YatharthVyas
YatharthVyas - comment - 3 Aug 2021

After discussing @brianteeman's suggestions (Thank you for the same) with my Mentors, here's where we stand:

1. Changes in Template File

We discussed that the changes made in Cassiopeia's template files are fine since the feature doesn't depend upon it, ie. The code will still work for external templates that do not use it, just that the select-able positions would be limited to active positions only. Moreover, the Joomla Docs mention that:

Note that in some circumstances there may be module positions available that are not outlined in red. This can happen when a template defines those module positions as conditional on there being modules enabled in that position. If there are no modules enabled in that position, the template may adapt and the position will not be visible.

so each template can customize this and we're doing the same.

Before After
image image
Shows Only Active Positions Shows All Positions

2. Redirection to the admin panel issue

Quoting what I wrote earlier:

I thought about this, but the frontend edit module view doesn't have all the fields. To be specific, the Menu Assignment Tab wasn't present in the frontend edit view. I thought that this has been deliberately not included and hence I decided to proceed with redirection to the admin panel. Transferring this to the frontend can be done but it will definitely require some extra efforts and careful inspection of what is being copy-pasted from the administrator files which might get a little complicated.

While the suggestion is very much apt and valid, Mentors agree that the missing extra tab is out of this PR's scope and it might be better to leave this as is in its current state.


3. Confusion regarding Menu and Page

This sure needs to be worked upon. I believe some rephrasing will be required in the button's tooltip description to clear this confusion. I believe that the feedback from the community would be the best source of inspiration for this.


Fixed

  • Position of the Module Button and it's label text was not very user friendly and that has been updated.

I would like to discuss the future scope of this PR by requesting the maintainers to give their feedback on any other possible improvements that I might've missed out. Thank you

avatar Dako390 Dako390 - test_item - 16 Aug 2021 - Tested successfully
avatar Dako390
Dako390 - comment - 16 Aug 2021

I have tested this item successfully on 0f735db

Works as intended.

One possible addition to it: I would love to be able to have the option "Place Module here" while adding a module to the dashboard.


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

avatar YatharthVyas
YatharthVyas - comment - 16 Aug 2021

Thank you for testing!

One possible addition to it: I would love to be able to have the option "Place Module here" while adding a module to the dashboard.

That sounds like a good idea. I will probably open up a new PR in the future to extend this feature to the Dashboard.

avatar YatharthVyas YatharthVyas - change - 17 Aug 2021
Labels Added: Language Change
Removed: ?
avatar scout507 scout507 - test_item - 17 Aug 2021 - Tested successfully
avatar scout507
scout507 - comment - 17 Aug 2021

Everything seems to work as intended. It's a nice feature and easy to use.

Some suggestions:

  • The 'Add Module' button would be a perfect fit for a floating button. Something like this accessability button:

Screenshot 2021-08-17 111903

  • I haven't found a way to cancel the 'place module' mode. There should probably be a cancel button to improve usability.

  • The 'place module here' button should probably be tied to the positions, rather than individual modules, since it doesn't seem to actually place it in the order you'd expect (above or below the selected module).

  • Also, when you are not loged in as Admin in the Front-End but trying to use the 'Select From Template View' in the Back-End, you get an error stating that you need to be loged in first, so you have to login in the Template View in order to use this feature:

Screenshot 2021-08-17 101713

That beeing said, all these things are just suggestions to improve the useability of this feature, which is otherwise working just fine.

avatar scout507 scout507 - test_item - 17 Aug 2021 - Not tested
avatar YatharthVyas
YatharthVyas - comment - 17 Aug 2021

Thank you soo much for such a comprehensive feedback! ?

  • The 'Add Module' button would be a perfect fit for a floating button. Something like this accessability button:

Nice Idea. I will discuss this with my mentors. I think we had decided to place the button in its current position because it resonated with the position fo the frontend editing button

  • I haven't found a way to cancel the 'place module' mode. There should probably be a cancel button to improve usability.

Currently, pressing the back button on your browser would do the job of cancelling it but your feedback has helped me understand that the back button way isn't the best and it needs some sort of a cancel button. I appreciate this idea and I will think about the best way to implement this!

  • The 'place module here' button should probably be tied to the positions, rather than individual modules, since it doesn't seem to actually place it in the order you'd expect (above or below the selected module).

I 100% agree with your point here, but there's just one tiny reason why I didn't decide to go forward with this. And that's because we would need to edit the template file in order to add this functionality and modifying the template file would be an issue for 3PD (third-party developers) as they would have to adapt to it accordingly. In the current iteration, everything would work without the need for 3PD having to modify their templates.

  • Also, when you are not loged in as Admin in the Front-End but trying to use the 'Select From Template View' in the Back-End, you get an error stating that you need to be loged in first, so you have to login in the Template View in order to use this feature:

I had deliberately kept this check as I intended it to be more like an informatory warning which would prevent any person without permissions from being able to modify module positions while guiding the users with the access in modifying it.


I want to thank you again for taking time to review this PR and provide such a helpful and detailed feedback. I'm really grateful!

avatar YatharthVyas YatharthVyas - change - 20 Aug 2021
Labels Added: ?
Removed: ?
avatar YatharthVyas YatharthVyas - change - 20 Aug 2021
Labels Added: ?
Removed: ?
avatar brianteeman
brianteeman - comment - 20 Nov 2021

Trying to edit a module in the front endyou are presented with the module edit form. If you then click on the "select from template" button a modal is opened - it should NOT have the admin interface elements highlighted in the screenshot below

image

avatar brianteeman
brianteeman - comment - 20 Nov 2021

deleted this as its not related to this pr

avatar brianteeman
brianteeman - comment - 20 Nov 2021

Please change this button text to "Select Position From Template Preview" or even "Select Position From Template"

image

avatar brianteeman
brianteeman - comment - 20 Nov 2021

Disable Frontend Editing in global configuration

image

Expected behaviour is for the add module functionality not to be active. It is :(

image

avatar brianteeman
brianteeman - comment - 20 Nov 2021

I was really confused about this button. I thought when it said "add a new module here" the here meant something connected to the area on the screen that the button is located. I finally understand that there is just one button on the page.

This button is appended to the end of the

tag which is omnipresent on all pages.

  1. The text should be "Add a new module" - the "here" is wrong and confusing
  2. You cannot guarantee that main is present in every template.
  3. The button should be placed in a corner just as debug, accessibility buttons are. it refers to the entire page not the part of the page inside main. Look at the cassiopeia screenshot below of the sample data homepage. The button location makes no sense at all.
  4. The button should be consistently placed on the screen no matter what page you are on - clearly it isnt

Inked2021-11-20_20-38-39

avatar brianteeman
brianteeman - comment - 20 Nov 2021

Final comment on the frontend creation of modules.

Click on the button
-> select the position
-> log in to the admin
-> select the module
-> complete the module details and save

You are now stuck in the admin interface.
To return to the site you have to press back 4 times

Expected behaviour would be to return to the site and now you can see what you have done

avatar YatharthVyas
YatharthVyas - comment - 21 Nov 2021

Thank you soo much @brianteeman for such a thorough feedback! I agree with all the points that you stated. I will start working on these improvements.

avatar brianteeman
brianteeman - comment - 14 Jun 2022

Could someone add the "conflicting files" label please

avatar HLeithner
HLeithner - comment - 27 Jun 2022

This pull request has automatically rebased to 4.2-dev.

avatar chmst
chmst - comment - 23 Oct 2022

Unfortunately there are too many open questtions with 3rd party templates and template frameworks, no chance to make it compatible with all possible constellations.

avatar chmst chmst - close - 23 Oct 2022
avatar chmst chmst - change - 23 Oct 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-10-23 08:50:50
Closed_By chmst
Labels Added: Conflicting Files ?
Removed: ?

Add a Comment

Login with GitHub to post a comment