?
avatar shoulders
shoulders
17 Feb 2021

Steps to reproduce the issue

In the admin area, go to any components default view by clicking on it's primary link:

image

When you load the components default view the following classes are incomplete in the <body> tag declaration, you get instead:

  • view-
  • layout-

and as you can see the names of the view and layout are missing part of the class declaration which means you cannot do 'page / view / layout' specific CSS styling when it is loaded as a default view.

If you load https://localhost/platforms/joomla3/administrator/index.php?option=com_contact&view=contacts then the view class is correctly formed as view-contacts. However the layout is still incomplete probably because the layout is default.

Expected result

<body class=" jsn-master tmpl-isis admin com_contact view-contacts layout-default task- itemid-0" data-basepath="/platforms/joomla3">

Actual result

<body class=" jsn-master tmpl-isis admin com_contact view- layout- task- itemid-0" data-basepath="/platforms/joomla3">

System information (as much as possible)

Setting Value
 
PHP Built On Windows NT E6540 10.0 build 19042 (Windows 10) AMD64
Database Type mysql
Database Version 5.5.5-10.4.10-MariaDB
Database Collation utf8mb4_unicode_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 7.3.12
Web Server Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.3.12
WebServer to PHP Interface apache2handler
Joomla! Version Joomla! 3.9.24 Stable [ Amani ] 12-January-2021 15:00 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36

Additional comments

This is an issue in Joomla 3 but I have checked in joomla 4 and get the following notes. I also again used com_contacts and the example

  • When you click on the primary link nothing happens so to load up the default view I used the following direct link instead
    joomla4/administrator/index.php?option=com_contact
  • on the default page i got the following body tag i intiall got the following <body> tag but with view-sysinfo which is new over Joomla 3 and again layout- + there is now task-
    <body class=" jsn-master tmpl-isis admin com_admin view-sysinfo layout- task- itemid-0" data-basepath="/platforms/joomla3">
  • after the intial load of joomla4/administrator/index.php?option=com_contact I now get a different <body> tag
    <body class="admin com_contact view- layout-default task-display">
    this now has the layout show correctly with default but the view is now missing part of the class name
  • i load contacts up through the menu Sidemenu --> Components -->Contacts --> Contacts I get the following <body> tag
    <body class="admin com_contact view-contacts layout-default task-display">

Conclusion

What this means is there is some inconsistencies with how these class names are created but has been partially fixed in Joomla 4.

This is not a show stopper but definately should be one of those things fixed in Joomla 4 if not in Joomla 3.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
3.00

avatar shoulders shoulders - open - 17 Feb 2021
avatar joomla-cms-bot joomla-cms-bot - change - 17 Feb 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 17 Feb 2021
avatar brianteeman
brianteeman - comment - 17 Feb 2021

Please test and confirm that you have he same issue when using the joomla admin template and not the one from joomlashine

avatar richard67
richard67 - comment - 17 Feb 2021

I can reproduce it on current staging with the Isis template:

2021-02-17_01

avatar richard67 richard67 - change - 17 Feb 2021
Status New Confirmed
avatar shoulders
shoulders - comment - 17 Feb 2021

I have just double checked the Joomlashine template issue. It was their system plugin adding jsn-master and I have reported this to them. Here is me checking my results with the ISIS template but without the JSN system plugin running.

image

Alsojust notices that there is task- showing incomplete like in Joomla 4.

avatar joomdonation
joomdonation - comment - 17 Feb 2021

Easy to handle if it is really needed. With com_contact for example, just add two lines of code below before this line https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_contact/controller.php#L42 and it should work as expected:

$this->input->set('view', $view);
$this->input->set('layout', $layout);
avatar shoulders
shoulders - comment - 17 Feb 2021

this issue is with all components, not just com_contacts so it is an issue with the Joomla core and possibly how it handles default routes and that it does not add these variables into the request before Joomla builds the <body> tag . i.e.

  • the default views can be set in the controller protected $default_view = 'contacts';
  • if no layout is present in the request then default is assumed.
  • if there is no task it is assumed that the task is display
avatar joomdonation
joomdonation - comment - 17 Feb 2021

We can handle it in display method of BaseController class. Adding these lines of code below after this line https://github.com/joomla/joomla-cms/blob/staging/libraries/src/MVC/Controller/BaseController.php#L619

$this->input->set('view', $viewName);
$this->input->set('layout', $viewLayout);

And that should work for all components. But I'm unsure if it is safe to do that.

avatar brianteeman
brianteeman - comment - 17 Feb 2021

What is the problem you are trying to solve

avatar shoulders
shoulders - comment - 17 Feb 2021

thats an easy one.

  • I am writing my own component which has a dashboard, and this dashboard is the default view.
  • I want to style the background of the dashboard view (only) to grey so it makes the buttons stand out better but i do not want to make the backgrounds of all my other views grey.
  • i am using 1 stylesheet in the admin for all of my component

this changes the background globaly in the admin for my component

body.com_qwupdateserver {    
    background: #f9f9f9;
}

the next logical step is to use a page specific CSS

body.view-dashboard {    
    background: #f9f9f9;
}

Solutions

  • implement the issue related to in this thread. (prefered)
  • i could add a specific CSS or ID into the dashboard html (seems wrong way when i should be able to use the auto generate css from Joomla)
  • i could use double css identifiers: .view-dashboard and view- (messy)

On a personal note i want all of my CSS and code to be neat and tidy and I dont like broken code. ?

avatar rdeutz rdeutz - change - 9 Mar 2021
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2021-03-09 20:55:30
Closed_By rdeutz
avatar rdeutz rdeutz - close - 9 Mar 2021

Add a Comment

Login with GitHub to post a comment