[ticket/16237] Overhaul icons to use Twig function#5753
[ticket/16237] Overhaul icons to use Twig function#5753marc1706 merged 37 commits intophpbb:masterfrom hanakin:ticket/16237
Conversation
ghost
left a comment
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
| <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) }} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
yes the L is not possible
| 'mdi:file-document-outline' : true, | ||
| }, '', true, 'c-forum-row-icon') }} | ||
| </a> | ||
| {% if lang(searchresults.TOPIC_AUTHOR) == S_USERNAME %} |
There was a problem hiding this comment.
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 %}
There was a problem hiding this comment.
i open to whatever is best. but it php is not my game!
There was a problem hiding this comment.
just let me know where best to put it and can do
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
Looks like this can be added to the title parameter.
| </a> | ||
| </li> | ||
| <!-- ENDIF --> | ||
| <!-- INCLUDE posting_buttons.html --> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 --> |
There was a problem hiding this comment.
Now you remove the text aswell when there is a 'Main website'. The check is only if an icon should be displayed.
| <!-- 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 %} |
| <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> |
|
|
||
| <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> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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') }} |
There was a problem hiding this comment.
This is wrongly concatenated
| {{ 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 --> » <time datetime="{searchresults.FIRST_POST_TIME_RFC3339}">{searchresults.FIRST_POST_TIME}</time> » {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 --> » {searchresults.FIRST_POST_TIME} » {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> |
| <i class="icon fa-link fa-fw" aria-hidden="true"></i> | ||
| </button> | ||
| <!-- ENDIF --> | ||
| <!-- IF S_BBCODE_FLASH --> |
There was a problem hiding this comment.
I could have sworn we dropped support for it
There was a problem hiding this comment.
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} » {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} » {POST_DATE}</p> |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
You changed the used language string here, which is not available.
| <a href="{U_MCP_REPORT}"><strong>{L_MESSAGE_REPORTED}</strong></a> | |
| <a href="{{ U_MCP_REPORT }}"><strong>{{ lang('POST_REPORTED') }}</strong></a> |
| <!-- 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}"> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 , |
There was a problem hiding this comment.
There's a excessive space between IS_LINK and ,.
| 'fa:external-link' : forumrow.subforum.IS_LINK , | |
| 'fa:external-link' : forumrow.subforum.IS_LINK, |
ghost
left a comment
There was a problem hiding this comment.
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 --> » <time datetime="{searchresults.FIRST_POST_TIME_RFC3339}">{searchresults.FIRST_POST_TIME}</time> » {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> » {searchresults.FIRST_POST_TIME} » {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
weird i literally copy and pasted that whole line
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
|
@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 |
|
Will have another look today |
|
Looks good now. Do you want to fix the invalid commit message that travis complains about yourself or should I do that for you? |
|
might be easier for you to fix if you know whats wrong as i can not see whats wrong with it? |
PHPBB3-16237
PHPBB3-16237
PHPBB3-16237
|
Issue was that commit message has an invalid ticket id: |

Checklist:
PHPBB3-16237
Depends on: #5545
https://tracker.phpbb.com/browse/PHPBB3-16237
TODO:
Screenshot examples:













