User tests: Successful: Unsuccessful:
When an article is successfully saved we expect, especially in frontend, that a success message is displayed.
J!3.7.4 shows a neutral message of type 'message', not of type 'success'.
This becomes evident if you customize the css styles.
The problem cannot be solved with a template override because the message is not emitted in a templatable file; so the problem will remain and can be even worst in custom templates.
The reason is that the code showing the message relies on a default parameter that leads to a message of type 'message'.
Modify a line in libraries/legacy/controller/form.php (now in libraries/src/controller/form.php) adding 'success' parameter.
In J!3.7.4.
Create a menuitem of type "Submit new article".
Set default template to beez3 (protostar has a layout override that assimilates all 'message' type system messages to 'success' type).
Customize beez3 personal.css (templates->templates->beez3->editor->css->personal.css) with something like:
#system-message [class*="success"] { background-color: green; }
#system-message [class*="message"] { background-color: blue; }
When you successfully save an article you'll expect a green background (success).
You'll get a blue background (message).
none
Category | ⇒ | Libraries |
Status | New | ⇒ | Pending |
Really? It seems quite strange to me.
May be that you forgot to customize css styles to give 'message' and 'success' system-message types different looks?
You probably tested with standard Joomla! styles.
In this case you obviously got texts that say success, and you got visual aspects "lookin success", in fact:
Similar is for default admin template.
But these remain two different system message types and a custom styling or a custom template can give them different looks.
If you do that (give to 'message' type system messages a different look from 'success' messages) you'll notice that on save the message emitted is of type 'message' and not 'system'.
In fact setMessage documentation tells that the second parameter default value is 'message' (and not success).
Well, you are using protostar template.
You are not following my testing instructions.
Ok, if you prefer let's use protostar.
The row I PR to modify reads:
$this->setMessage(JText::_($prefix . ($recordId == 0 && $app->isClient('site') ? '_SUBMIT' : '') . '_SAVE_SUCCESS'));
using a defaulted second parameter.
setMessage second parameter defaults to 'message'.
In all your pictures you can read, in the system-message first line, the type of the system-message: its 'Message', not 'success'.
I think this would be enought to accept this PR.
protostar template has a system-message layout override, as you can see in templates\protostar\html\layouts\joomla\system\message.php (https://github.com/joomla/joomla-cms/blob/staging/templates/protostar/html/layouts/joomla/system/message.php).
The template choses to style all system-messages of type 'message' as if they were of type 'success', applying them the 'alert-success' style.
You can read that at line 14: there is a $alert array that contains some associations between message-type and styling classes.
Follow rows that emit the message type (@22) and the message text (@24), applying some stying.
Message types not in the array are directly associated to a class of the same name preceded by 'class-'.
'message' type is associated in the array with 'alert-success' class.
Obviously the class of the divs you hilights, for profile and for article, is 'alert-success'!
isis administrative template does the same as protostar template using a similar layout override (templates\isis\html\layouts\joomla\system\message.php).
So I think that now we agree on this:
Other templates may choose not to style 'message' type messages as 'success' type messages, as many do.
To verify this, PLEASE, make a copy of protostar template and simply replace row 14 (were is the $alert array responsible of the translation) this way:
original @14: $alert = array('error' => 'alert-error', 'warning' => '', 'notice' => 'alert-info', 'message' => 'alert-success');
new @14: $alert = array('error' => 'alert-error', 'warning' => '', 'notice' => 'alert-info');
Now at article submission you'll see this:
That is: a 'message' type system-message styled with an alert-message css class.
The problem of this is in the file I request to fix the way I propose.
Labels |
Added:
?
|
I guess this is what is confusing me then as there is no option for "success" as you have used it
also if this change is going to be made then shouldnt it be made everywhere there is a similar success message?
3.x basically uses the Bootstrap alert class modifiers for the message types, there is no standardization on things.
In 4.0, the goal is to standardize message types based primarily on system logging levels (used by our logging API and the PSR-3 logging interface), see https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/CMS/Application/CMSApplicationInterface.php. It doesn't explicitly cover a "success" case at the moment, but at least it's an effort to make things consistent.
@brianteeman: yes, probably such a changhe should occour in similar situations. I think that we should start here (and we should not wait for J!4.0).
Status | Pending | ⇒ | Needs Review |
Status is set on "Needs Review".
Not sure right now, but I think this happens for other scenarios. In my opinion, this can wait for J4 for the correct handle of messages.
I have tested this item
I have tested this item
Before applying the patch, on saving the article, the class was warning
Once the patch was applied, the class of the message changed to success
yet another one for @HLeithner
can be moved if necessary on J4
closed for a rebase on J4 as stated above.
Status | Needs Review | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-05-11 09:16:58 |
Closed_By | ⇒ | franz-wohlkoenig | |
Labels |
Removed:
J3 Issue
|
Tested in the front end and in the admin and I always get a success message without this PR