Skip to content

[ticket/16237] Overhaul icons to use Twig function#5753

Merged
marc1706 merged 37 commits intophpbb:masterfrom
hanakin:ticket/16237
Aug 21, 2020
Merged

[ticket/16237] Overhaul icons to use Twig function#5753
marc1706 merged 37 commits intophpbb:masterfrom
hanakin:ticket/16237

Conversation

@hanakin
Copy link
Copy Markdown
Member

@hanakin hanakin commented Nov 30, 2019

Checklist:

  • Correct branch: master for new features; 3.3.x & 3.2.x for fixes
  • Tests pass
  • Code follows coding guidelines: master, 3.3.x and 3.2.x
  • Commit follows commit message format

PHPBB3-16237

Depends on: #5545

https://tracker.phpbb.com/browse/PHPBB3-16237

TODO:

  • Rework ajax icon swaps for subscriptions
  • Fix blockquote icon
  • Rework new svg logo inclusion
  • Fix return arrow icons

Screenshot examples:
Screenshot 2019-11-30 02 35 15
Screenshot 2019-11-29 23 33 45
Screenshot 2019-11-29 23 34 09
Screenshot 2019-11-29 23 34 20
Screenshot 2019-11-29 23 34 36
Screenshot 2019-11-29 23 34 48
Screenshot 2019-11-29 23 35 15
Screenshot 2019-11-29 23 37 29
Screenshot 2019-11-29 23 38 08
Screenshot 2019-11-29 23 38 25
Screenshot 2019-11-29 23 39 11
Screenshot 2019-11-30 02 36 34
Screenshot 2019-11-30 10 18 28
Screenshot 2019-12-29 12 37 14

@hanakin hanakin added this to the 4.0.0-a1 milestone Nov 30, 2019
@hanakin hanakin removed the WIP 🚧 label Dec 29, 2019
@hanakin hanakin requested a review from a user April 11, 2020 05:08
@hanakin hanakin added the dependencies Pull requests that update a dependency file label Apr 11, 2020
@hanakin hanakin removed the dependencies Pull requests that update a dependency file label Apr 15, 2020
@hanakin hanakin closed this Apr 15, 2020
@hanakin hanakin reopened this Apr 15, 2020
@hanakin hanakin self-assigned this Apr 16, 2020
ghost
ghost previously requested changes May 3, 2020
Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was able to do 42/94 files for now, will continue when I have some more time.
Reference to self: viewtopic_body.html

<li data-last-responsive="true">
<a href="{U_ACP}" title="{L_ACP}" role="menuitem">
<i class="icon fa-cogs fa-fw" aria-hidden="true"></i><span>{L_ACP_SHORT}</span>
{{ Icon('iconify', 'fa:cogs', '', false) }}<span>{{ lang('ACP_SHORT') }}</span>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you tried this before or after you removed the lang() from macros/icon/iconify.twig, but it should work correctly after that. The problem was that ACP_SHORT returns ACP, which was than translated again by the macro, into the long version.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after

<li>
<a href="{U_LOGIN_LOGOUT}" title="{L_LOGIN_LOGOUT}" accesskey="x" role="menuitem">
<i class="icon fa-power-off fa-fw" aria-hidden="true"></i><span>{L_LOGIN_LOGOUT}</span>
{{ Icon('iconify', 'fa:power-off', lang('LOGIN_LOGOUT'), false) }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need the L_ prefix again, as it's created PHP side. Alternatively you can just check if the current user is a guest and display the correct language string depending on that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here and below.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes the L is not possible

'mdi:file-document-outline' : true,
}, '', true, 'c-forum-row-icon') }}
</a>
{% if lang(searchresults.TOPIC_AUTHOR) == S_USERNAME %}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance we could move this to a PHP check instead?
So we can perform a proper one instead: S_THIS_USER => $user->data['user_id'] == $row['topic_poster'], or some other variable name, rather than comparing usernames. Or alternatively assign the poster_id/topic_poster to the template and compare that: {% if searchresults.POSTER_ID == user.data.id %}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i open to whatever is best. but it php is not my game!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just let me know where best to put it and can do

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it's easier for now to tag it with a @todo mrgoldy and I'll add a PR afterwards, cause the check is in various places / files.

<li>
<a href="{U_EMAIL_TOPIC}" title="{L_EMAIL_TOPIC}">
<i class="icon fa-envelope-o fa-fw" aria-hidden="true"></i><span>{L_EMAIL_TOPIC}</span>
{{ Icon('iconify', 'mdi:send-circle-outline', '', true) }}<span>{L_EMAIL_TOPIC}</span>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this can be added to the title parameter.

</a>
</li>
<!-- ENDIF -->
<!-- INCLUDE posting_buttons.html -->
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you include here, are the posting buttons, which are the BBCodes shown above the textarea when creating a post.
You include them again, in the dropdown version.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm looks like all the changes I made to factor out all the JS responsive menu bulllshit got stripped out so ill have to fix all of this also.

<span class="crumb">
<a href="{U_INDEX}" data-navbar-reference="index">
<!-- IF not U_SITE_HOME --><i class="icon fa-home fa-fw" aria-hidden="true"></i><!-- ENDIF --><span>{L_INDEX}</span>
<!-- IF not U_SITE_HOME -->{{ Icon('iconify', 'fa:home', lang(L_INDEX), false) }}<!-- ENDIF -->
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now you remove the text aswell when there is a 'Main website'. The check is only if an icon should be displayed.

Suggested change
<!-- IF not U_SITE_HOME -->{{ Icon('iconify', 'fa:home', lang(L_INDEX), false) }}<!-- ENDIF -->
{% if U_SITE_HOME %}<span>{{ lang('INDEX') }}</span>{% else %}{{ Icon('iconify', 'fa:home', lang('INDEX'), false) }}{% endif %}

@hanakin hanakin dismissed ghost ’s stale review May 8, 2020 00:56

fixed

<li>
<a href="{U_PRINT_PM}" title="{L_PRINT_PM}" accesskey="p">
<i class="icon fa-print fa-fw" aria-hidden="true"></i><span>{L_PRINT_PM}</span>
{{ Icon('iconify', 'fa:print', lang('PRINT_PM'), false) }}<span>{L_}</span>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left over L_.


<p class="author">
<span><i class="icon fa-file fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{history_row.MINI_POST}</span></span> {L_SENT_AT}{L_COLON} <strong>{history_row.SENT_DATE}</strong>
<span title="{history_row.MINI_POST}">{{ Icon('iconify', 'fa:file', history_row.MINI_POST, true, 'c-topic-icon') }}</span> {L_SENT_AT}{L_COLON} <strong>{history_row.SENT_DATE}</strong>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title attribute here is rather redundant on the icon here, as it's exactly the same as the parent <span> that only has one child.

<script src="{T_ASSETS_PATH}/javascript/core.js?assets_version={T_ASSETS_VERSION}"></script>
<!-- INCLUDEJS forum_fn.js -->
<!-- INCLUDEJS ajax.js -->
<script src="https://code.iconify.design/1/1.0.0-rc7/iconify.min.js"></script>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, is this still the correct version? Can we not use 1.0.6?
https://code.iconify.design/1/1.0.6/iconify.min.js

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be updated but also we need to serve one version of this from assets and only serve from CDN if this is enabled in the ACP.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also create a new ticket + PR for that part though to not needlessly increase the size of this PR.

<li>
<a href="{searchresults.U_VIEW_POST}" class="arrow-{S_CONTENT_FLOW_END}">
<i class="icon fa-angle-{S_CONTENT_FLOW_END} fa-fw icon-black" aria-hidden="true"></i><span>{L_JUMP_TO_POST}</span>
{{ Icon('iconify', 'fa:angle'-S_CONTENT_FLOW_END, lang('JUMP_TO_POST'), false, 'c-return-arrow-icon') }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrongly concatenated

Suggested change
{{ Icon('iconify', 'fa:angle'-S_CONTENT_FLOW_END, lang('JUMP_TO_POST'), false, 'c-return-arrow-icon') }}
{{ Icon('iconify', 'fa:angle-' ~ S_CONTENT_FLOW_END, lang('JUMP_TO_POST'), false, 'c-return-arrow-icon') }}

<!-- IF searchresults.ATTACH_ICON_IMG -->{{ Icon('iconify', 'fa:paperclip', '', true) }}<!-- ENDIF -->
{% EVENT topiclist_row_topic_by_author_before %}
{L_POST_BY_AUTHOR} <!-- EVENT search_results_topic_author_username_prepend -->{searchresults.TOPIC_AUTHOR_FULL}<!-- EVENT search_results_topic_author_username_append --> &raquo; <time datetime="{searchresults.FIRST_POST_TIME_RFC3339}">{searchresults.FIRST_POST_TIME}</time> &raquo; {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a>
{L_POST_BY_AUTHOR} <!-- EVENT search_results_topic_author_username_prepend -->{searchresults.TOPIC_AUTHOR_FULL}<!-- EVENT search_results_topic_author_username_append --> &raquo; {searchresults.FIRST_POST_TIME} &raquo; {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the <time> element removed here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge error?

<i class="icon fa-link fa-fw" aria-hidden="true"></i>
</button>
<!-- ENDIF -->
<!-- IF S_BBCODE_FLASH -->
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the Flash BBCode removed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could have sworn we dropped support for it

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dropped it for Flash attachments, if I recall correctly. Not the BBCode.

</p>
<!-- ELSE -->
<p class="author"><span><i class="icon fa-file fa-fw icon-lightgray icon-md" aria-hidden="true"></i><span class="sr-only">{MINI_POST_IMG}</span></span> {L_POSTED} {L_POST_BY_AUTHOR} {POST_AUTHOR_FULL} &raquo; {POST_DATE}</p>
<p class="author"><span>{{ Icon('iconify', 'fa:file', MINI_POST_IMG, true, 'c-topic-icon') }}</span> {L_POSTED} {L_POST_BY_AUTHOR} {POST_AUTHOR_FULL} &raquo; {POST_DATE}</p>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MINI_POST_IMG can not be the title, as that is not actually a language string but a <span> HTML element with specific classes.
image

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems this needs a new template variable

<p class="post-notice reported">
<i class="icon fa-exclamation fa-fw icon-red" aria-hidden="true"></i><span class="sr-only">{{ lang('TOPIC_REPORTED') }}</span> <a href="{{ U_MCP_REPORT }}"><strong>{{ lang('POST_REPORTED') }}</strong></a>
{{ Icon('iconify', 'fa:exclamation', lang('TOPIC_REPORTED'), true, 'c-topic-reported-icon') }}
<a href="{U_MCP_REPORT}"><strong>{L_MESSAGE_REPORTED}</strong></a>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You changed the used language string here, which is not available.

Suggested change
<a href="{U_MCP_REPORT}"><strong>{L_MESSAGE_REPORTED}</strong></a>
<a href="{{ U_MCP_REPORT }}"><strong>{{ lang('POST_REPORTED') }}</strong></a>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm 😕

<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="row-item-link"></a><!-- ENDIF -->
<dl class="row-item">
<dt>
<a class="row-item-link{% if topicrow.S_UNREAD_TOPIC %} unread{% else %} read{% endif %}" href="{topicrow.U_NEWEST_POST}" title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed this and I am not sure if this applies to all other cases where you create Topic icons.
But there are a couple of issues here.
topicrow.TOPIC_FOLDER_IMG_ALT is not defined, which results in an empty title attribute, which isn't that bad.
topicrow.U_NEWEST_POST is not defined, so making the icon a link with an empty href attribute. topicrow.U_VIEW_TOPIC should be used instead.

Copy link
Copy Markdown
Member Author

@hanakin hanakin May 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i just used the same code as viewforum everywhere seems we need to add that template variable there as it works everywhere else

<a href="{forumrow.subforum.U_SUBFORUM}" class="subforum<!-- IF forumrow.subforum.S_UNREAD --> unread<!-- ELSE --> read<!-- ENDIF -->" title="<!-- IF forumrow.subforum.S_UNREAD -->{L_UNREAD_POSTS}<!-- ELSE -->{L_NO_UNREAD_POSTS}<!-- ENDIF -->">
<i class="icon <!-- IF forumrow.subforum.IS_LINK -->fa-external-link<!-- ELSE -->fa-file-o<!-- ENDIF --> fa-fw <!-- IF forumrow.subforum.S_UNREAD --> icon-red<!-- ELSE --> icon-blue<!-- ENDIF --> icon-md" aria-hidden="true"></i>{forumrow.subforum.SUBFORUM_NAME}</a><!-- IF not forumrow.subforum.S_LAST_ROW -->{L_COMMA_SEPARATOR}<!-- ENDIF -->
{{ Icon('iconify', {
'fa:external-link' : forumrow.subforum.IS_LINK ,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a excessive space between IS_LINK and ,.

Suggested change
'fa:external-link' : forumrow.subforum.IS_LINK ,
'fa:external-link' : forumrow.subforum.IS_LINK,

Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small change and then I think it's done.

<!-- IF searchresults.ATTACH_ICON_IMG -->{{ Icon('iconify', 'fa:paperclip', '', true) }}<!-- ENDIF -->
{% EVENT topiclist_row_topic_by_author_before %}
{L_POST_BY_AUTHOR} <!-- EVENT search_results_topic_author_username_prepend -->{searchresults.TOPIC_AUTHOR_FULL}<!-- EVENT search_results_topic_author_username_append --> &raquo; <time datetime="{searchresults.FIRST_POST_TIME_RFC3339}">{searchresults.FIRST_POST_TIME}</time> &raquo; {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a>
{L_POST_BY_AUTHOR} <!-- EVENT search_results_topic_author_username_prepend -->{searchresults.TOPIC_AUTHOR_FULL}<!-- EVENT search_results_topic_author_username_append --> <time datetime="{searchresults.FIRST_POST_TIME_RFC3339}">{searchresults.FIRST_POST_TIME}</time> &raquo; {searchresults.FIRST_POST_TIME} &raquo; {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a>
Copy link
Copy Markdown

@ghost ghost May 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You now have the time duplicated here.
<time> still shows the text as normal, but allows defining the datetime="" attribute, which is helpful for screenreaders.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird i literally copy and pasted that whole line

@hanakin
Copy link
Copy Markdown
Member Author

hanakin commented Aug 20, 2020

@marc1706 seems icons.css was included twice leading to the logo hiccup, also noticed blockquote icon got foobared as well during the rebase so I fixed that as well. Everything should be good now I think

@marc1706
Copy link
Copy Markdown
Member

Will have another look today

@marc1706
Copy link
Copy Markdown
Member

Looks good now. Do you want to fix the invalid commit message that travis complains about yourself or should I do that for you?

@hanakin
Copy link
Copy Markdown
Member Author

hanakin commented Aug 21, 2020

might be easier for you to fix if you know whats wrong as i can not see whats wrong with it?

@marc1706
Copy link
Copy Markdown
Member

marc1706 commented Aug 21, 2020

Issue was that commit message has an invalid ticket id: PHPBB-16237
Should be: PHPBB3-16237

@marc1706 marc1706 merged commit 49dd279 into phpbb:master Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants