Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Messages/Alerts: using icons instead of text as heading #30516

Merged
merged 16 commits into from
Sep 1, 2020

Conversation

infograf768
Copy link
Member

Pull Request for Issue #30404

Summary of Changes

As title says, replacing text by icons in Alerts

Testing Instructions

Add to Atum and Cassiopea index.php

Factory::getApplication()->enqueueMessage('error message','error');
Factory::getApplication()->enqueueMessage('another long error message','error');
Factory::getApplication()->enqueueMessage('a danger message','danger');
Factory::getApplication()->enqueueMessage('warning message','warning');;
Factory::getApplication()->enqueueMessage('notice message','notice');
Factory::getApplication()->enqueueMessage('info message','info');
Factory::getApplication()->enqueueMessage('success message','success');
Factory::getApplication()->enqueueMessage('message no type');

in order to test all kinds of messages

Patch, Run NPM CI

Actual result BEFORE applying this Pull Request

Screen Shot 2020-08-30 at 09 38 28

Expected result AFTER applying this Pull Request

Cassiopea

Screen Shot 2020-08-30 at 09 23 41

Atum

Screen Shot 2020-08-30 at 09 23 22

Documentation Changes Required

@joomla-cms-bot joomla-cms-bot added NPM Resource Changed This Pull Request can't be tested by Patchtester PR-4.0-dev labels Aug 30, 2020
@brianteeman
Copy link
Contributor

Not got time to check properly but this looks ok for accessibility at first glance. Needs to be reviewed by the accessibility team though.

@brianteeman
Copy link
Contributor

I have tested this item 🔴 unsuccessfully on dce6e70


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

@brianteeman
Copy link
Contributor

After applying the patch and rebuilding npm the pr itself works great but it has a knock on impact elsewhere

before

image

after

image

@infograf768
Copy link
Member Author

After applying the patch and rebuilding npm the pr itself works great but it has a knock on impact elsewhere

Yep, we saw that a bit ago.
Changing to draft.

@infograf768 infograf768 marked this pull request as draft August 30, 2020 09:38
@infograf768
Copy link
Member Author

icomoon stuff was loaded, creating the issue with the featured columns icon.
It is now solved, but we have another issue:
The icons are very slow to load, including for all the other icons than the alerts ones.

Maybe this is due to the use of @extend in, for example

    .error,
    .danger {
      @extend .fas;
      @extend .fa-times-circle;
    }

and the fact that it is necessary if we use @extend to import fontawesome in joomla-alert.scss

We may have use a simpler

.error,
.danger {
      &::before {
        font-family: "Font Awesome 5 Free";
        font-weight: 900;
        content: "\f057";
      }

etc.

@ReLater
Copy link
Contributor

ReLater commented Aug 30, 2020

Before this PR I had the possibility to use custom language strings for custom message types
Factory::getApplication()->enqueueMessage('message my type', 'blah');

After this PR not.


both template.scss are importing already fontawesome. Why twice with this pr?

https://github.com/joomla/joomla-cms/blob/4.0-dev/templates/cassiopeia/scss/template.scss#L15-L18

@infograf768
Copy link
Member Author

@ReLater

both template.scss are importing already fontawesome. Why twice with this pr?

My test with @extend created errors when compiling as @extend can only work with selectors.
To solve this I had to load again fontawesome in the file where @extend is used.
This is why I need help from a scss expert. Will test without @extend to see how it behaves.

Before this PR I had the possibility to use custom language strings for custom message types

I guess you were always getting an info type message (blue background), with blah translated in the heading.

Here we use icons related to core types.
As blah is not a specific type, it will show without a specific icon, unless you define a css for an icon in your template css.
But the text will be correctly translated.

Example:
Factory::getApplication()->enqueueMessage('message with blah as type', 'blah');

BLAH="My custom heading text"

Screen Shot 2020-08-30 at 16 55 20

@N6REJ
Copy link
Contributor

N6REJ commented Aug 30, 2020

This brings up an important issue I have had with the way icons are currently handled. Which me'n hans are working on. Give me 24hrs to sort this out for the best solution. One thing we don't need/want is to load fa set twice.

@dgrammatiko
Copy link
Contributor

@infograf768 for the love of god please don't mix Fontawesome with the alerts. They are and supposed to be universal (eg no dependencies and work well with any front end stack). Just copy paste these few lines of CSS from this comment: joomla-projects/custom-elements#99 (comment)

@infograf768
Copy link
Member Author

infograf768 commented Aug 31, 2020

@dgrammatiko
I understand it should not be done this way as anyway the icons loading time is a no no.
But I am not sure how to apply your suggestion here.

Note: let's not forget that we have 2 ways to trigger the alerts:

  1. the layout
  2. the js

Therefore we do need a common resulting css for both.

@infograf768
Copy link
Member Author

Obvioulsy, it is possible to solve the issue for the layout, using a simple code similar to the one used in brianteeman@8f6c3f9
This because we do not use the h4 anymore.

i.e. adding

$icon = [
		CMSApplication::MSG_EMERGENCY => 'fas fa-times-circle',
		CMSApplication::MSG_ALERT     => 'fas fa-times-circle',
		CMSApplication::MSG_CRITICAL  => 'fas fa-times-circle',
		CMSApplication::MSG_ERROR     => 'fas fa-times-circle',
		CMSApplication::MSG_WARNING   => 'fas fa-exclamation-triangle',
		CMSApplication::MSG_NOTICE    => 'fas fa-info-circle',
		CMSApplication::MSG_INFO      => 'fas fa-info-circle',
		CMSApplication::MSG_DEBUG     => 'fas fa-info-circle',
		'message'                     => 'fas fa-check-circle',
		'success'                     => 'fas fa-check-circle',
		'danger'                      => 'fas fa-times-circle',
];

and then

<span class="<?php echo $icon[$type]; ?>" aria-hidden="true"></span>

But the problem remains for the js as I guess it is not a good idea to hardcode there these classes.

@brianteeman
Copy link
Contributor

That is not correct for the reasons stated in that pr when it was closed

@infograf768
Copy link
Member Author

I think I understood Dimitris proposal. On it now.

@dgrammatiko
Copy link
Contributor

I think I understood Dimitris proposal. On it now.

The same approach SHOULD be applied also to all the fields. Fields should be coded in such a way that Bootstrap/jQuery or Font Awesome is not a dependency... (eg icons should be a css baground-image property if you want the CMS to remain relative in terms of performance)

@infograf768
Copy link
Member Author

@dgrammatiko @brianteeman
Modified to use svg. No more issue loading time.

We now get

Screen Shot 2020-08-31 at 13 36 35

@infograf768 infograf768 marked this pull request as ready for review August 31, 2020 11:39
@infograf768
Copy link
Member Author

Have to correct a lot of scss cs, does not prevent from testing ;)

@N6REJ
Copy link
Contributor

N6REJ commented Aug 31, 2020

why is the background size so big?

background-image:url('data:image/svg+xml;utf8,<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path fill="rgba(255, 255, 255, .95)" d="M1299 813l-422 422q-19 19-45 19t-45-19l-294-294q-19-19-19-45t19-45l102-102q19-19 45-19t45 19l147 147 275-275q19-19 45-19t45 19l102 102q19 19 19 45t-19 45zm141 83q0-148-73-273t-198-198-273-73-273 73-198 198-73 273 73 273 198 198 273 73 273-73 198-198 73-273zm224 0q0 209-103 385.5t-279.5 279.5-385.5 103-385.5-103-279.5-279.5-103-385.5 103-385.5 279.5-279.5 385.5-103 385.5 103 279.5 279.5 103 385.5z"/></svg>');

@Quy
Copy link
Contributor

Quy commented Aug 31, 2020

30516

@infograf768
Copy link
Member Author

@Quy
On it.

@infograf768
Copy link
Member Author

@Quy
Should be OK now.

@N6REJ

why is the background size so big?

I picked 2 of these at joomla-projects/custom-elements#99 (comment)
Then I got the others from fontawesome svg and a bit mimicked code.

@chmst
Copy link
Contributor

chmst commented Sep 1, 2020

I have tested this item ✅ successfully on c39992e

Tested on win10 with FF and Edged. Just a hint for other testers: my cache was stubborn for these changes, so using a new instance of browsers is agood idea.


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

@dgrammatiko
Copy link
Contributor

I have tested this item ✅ successfully on c39992e


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

@Quy
Copy link
Contributor

Quy commented Sep 1, 2020

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Sep 1, 2020
@HLeithner HLeithner merged commit 6dd00a1 into joomla:4.0-dev Sep 1, 2020
@HLeithner
Copy link
Member

Thanks

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Sep 1, 2020
@HLeithner HLeithner added this to the Joomla 4.0 milestone Sep 1, 2020
@infograf768 infograf768 deleted the 4.0_alerts_use_icons branch September 2, 2020 05:10
dgrammatiko added a commit to dgrammatiko/joomla-cms that referenced this pull request Sep 29, 2020
…om_templates

* '4.0-dev' of github.com:joomla/joomla-cms: (70 commits)
  [4.0] Child templates consistency (joomla#30387)
  [4.0] favicon changes to support child templates (joomla#30388)
  [4.0] Update Readme for Api tests (joomla#30539)
  [4.0] [Multilingual Status module] Adding displaying a possible error if URL Language Code is empty (joomla#30537)
  [4.0] Display of horizontal mod_articles_news module (joomla#30527)
  [4.0] Useless installation lang strings (joomla#30568)
  [4.0] Numbers not digits (joomla#30559)
  [4.0] Accessibility plugin position (joomla#30552)
  [4.0] fix for inherit fields (joomla#30557)
  [4.0] Redundant words (joomla#30555)
  add missing legend to fieldset (joomla#30528)
  [4.0] [a11y] add statement on found results (joomla#30535)
  [4.0] com_finder ul instead of dl for easier styling (joomla#30534)
  [4.0] Messages/Alerts: using icons instead of text as heading (joomla#30516)
  [4.0] Increase API Test Coverage (joomla#26722)
  [4.0] Implementing display of password requirements for frontend (joomla#30473)
  [4.0] FieldsHelper: Choose a first available category  correctly (joomla#30268)
  Sort options (joomla#30531)
  Clear checkboxes on back button (joomla#30498)
  Update _icomoon.scss (joomla#30436)
  ...
sakiss pushed a commit to sakiss/joomla-cms that referenced this pull request Oct 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NPM Resource Changed This Pull Request can't be tested by Patchtester
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants