? Success

User tests: Successful: Unsuccessful:

avatar LivioCavallo
LivioCavallo
12 Aug 2017

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'.

Summary of Changes

Modify a line in libraries/legacy/controller/form.php (now in libraries/src/controller/form.php) adding 'success' parameter.

Testing Instructions

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; }

Expected result

When you successfully save an article you'll expect a green background (success).

Actual result

You'll get a blue background (message).

Documentation Changes Required

none

avatar joomla-cms-bot joomla-cms-bot - change - 12 Aug 2017
Category Libraries
avatar LivioCavallo LivioCavallo - open - 12 Aug 2017
avatar LivioCavallo LivioCavallo - change - 12 Aug 2017
Status New Pending
avatar brianteeman
brianteeman - comment - 12 Aug 2017

Tested in the front end and in the admin and I always get a success message without this PR

avatar LivioCavallo
LivioCavallo - comment - 12 Aug 2017

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:

  • protostar template assimilates 'message' to 'success';
  • beez3 gives the same look to both system message types.

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).

avatar brianteeman
brianteeman - comment - 13 Aug 2017

Maybe I am misunderstanding you so here are some screenshots

screenshotr11-39-38

screenshotr11-40-08

screenshotr11-40-30

screenshotr11-40-46

screenshotr11-41-09

screenshotr11-41-23

avatar LivioCavallo
LivioCavallo - comment - 13 Aug 2017

Well, you are using protostar template.
You are not following my testing instructions.
Ok, if you prefer let's use protostar.

  1. 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'.
    setmessage

  2. 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.

  3. 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'!

  4. 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:

  • as your picture shows, the messages are of type 'message' (and not 'success')
  • although protostar template is styling it as a success message.

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:
message
divs

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.

avatar LivioCavallo LivioCavallo - change - 14 Aug 2017
Labels Added: ?
avatar brianteeman
brianteeman - comment - 14 Aug 2017

I guess this is what is confusing me then as there is no option for "success" as you have used it

https://docs.joomla.org/Display_error_messages_and_notices

avatar brianteeman
brianteeman - comment - 14 Aug 2017

also if this change is going to be made then shouldnt it be made everywhere there is a similar success message?

avatar mbabker
mbabker - comment - 14 Aug 2017

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.

avatar LivioCavallo
LivioCavallo - comment - 14 Aug 2017

@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).

avatar LivioCavallo
LivioCavallo - comment - 14 Aug 2017

@mbabker: Yes, in fact I see there is no complete uniformity in message types and styling.
I do not know 4.0 and I read your link to CMSApplicationInterface; I hope that J!4.0 will uniform messages and I think that a 'success' message type is needed.

avatar franz-wohlkoenig franz-wohlkoenig - change - 1 Nov 2017
Status Pending Needs Review
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 1 Nov 2017

Status is set on "Needs Review".

avatar carlitorweb
carlitorweb - comment - 8 May 2018

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.

avatar ivankomlev
ivankomlev - comment - 16 Nov 2018

I have tested this item successfully on 0828dd6


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

avatar ivankomlev ivankomlev - test_item - 16 Nov 2018 - Tested successfully
avatar BertaOctech
BertaOctech - comment - 16 Nov 2018

I have tested this item successfully on 0828dd6

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


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

avatar BertaOctech BertaOctech - test_item - 16 Nov 2018 - Tested successfully
avatar alikon
alikon - comment - 10 May 2019

yet another one for @HLeithner

avatar alikon
alikon - comment - 11 May 2019

can be moved if necessary on J4

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 11 May 2019

closed for a rebase on J4 as stated above.

avatar franz-wohlkoenig franz-wohlkoenig - change - 11 May 2019
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
avatar franz-wohlkoenig franz-wohlkoenig - close - 11 May 2019

Add a Comment

Login with GitHub to post a comment