-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
(accessibility/misc-core-fixes/issues/3) Remove CMS specific print header templates that share same code #11944
Conversation
templates/CRM/common/CMSPrint.tpl
Outdated
@@ -35,14 +35,14 @@ | |||
{if isset($browserPrint) and $browserPrint} | |||
{* Javascript window.print link. Used for public pages where we can't do printer-friendly view. *} | |||
<div id="printer-friendly"> | |||
<a href="#" onclick="window.print(); return false;" title="{ts}Print this page.{/ts}"> | |||
<a href="#" onclick="window.print(); return false;" title="{ts}Print this page.{/ts}" aria-label="{ts}Print this page.{/ts}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@monishdeb this has other changes in it as well though? I was hoping just to merge the file duplication clean up since I haven't formed an opinion on the other changes as yet
I worked through this myself doing the following
So, I feel confident this is a clean amalgamation of duplicate code, merge on pass |
@monishdeb @eileenmcnaughton the only code i don't think has been brought across is
|
how odd - how did I mess that? Perhaps we had better keep the files & put in {include "CRM/common/CMSPrint.tpl"} |
7d23d48
to
80a3926
Compare
Thanks @seamuslee001 for pointing that out and made the changes in CMSPrint.tpl itself https://github.com/civicrm/civicrm-core/pull/11944/files#diff-262551485634c80891f7f7ae1e804c30R32 or should I still keep the files? @eileenmcnaughton |
@monishdeb yeah - I think I would keep all files (but replace the contents with an include) rather than have references to a specific cms in a generic file |
@eileenmcnaughton done, please have a look! |
I think we still need to move the joomla specific parts back to the joomla tpl. We wouldn't need the joomla if them either {if $config->userFramework|lower eq 'joomla'} Not sure if we should move the outer div back to the cms specific ones so joomla can share the inner part - perhaps |
@eileenmcnaughton I believe @monishdeb has updated the PR for you to review. |
</div> | ||
{/if} | ||
|
||
{*{include file="CRM/common/langSwitch.tpl"}*} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this line is removed from the final tpl - but as it is commented out that seems fine
|
||
{crmNavigationMenu is_default=1} | ||
|
||
{if $breadcrumb} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This chunk here is missing from the final tpl - was that deliberate?
templates/CRM/common/CMSPrint.tpl
Outdated
@@ -0,0 +1,82 @@ | |||
{* | |||
+--------------------------------------------------------------------+ | |||
| CiviCRM version 4.7 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opps - we are on 5.x now
Thanks @JoeMurray. @monishdeb there is one piece of code in the Wordpress.tpl that is omitted relating to the breadcrumb. Can you comment on that. Also, either this PR or a follow up PR needs to fix the version in the new tpl |
…ader templates that share same code
{$crumb} | ||
{/foreach} | ||
</div> | ||
{/if} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eileenmcnaughton thanks for notifying it, restored the breadcrumb block and ensure that this variable is exclusively available for wordpress as per
$ grep -irn "('breadcrumb'" CRM
CRM/Utils/System/Joomla.php:187: $bc = $template->get_template_vars('breadcrumb');
CRM/Utils/System/Joomla.php:205: $template->assign_by_ref('breadcrumb', $bc);
CRM/Utils/System/WordPress.php:147: $template->assign_by_ref('breadcrumb', $breadCrumb);
@eileenmcnaughton fixed both the issues, please have a look. I was earlier thinking of including this chunk of code https://github.com/civicrm/civicrm-core/blob/master/templates/CRM/common/joomla.tpl#L56L98 in CMSprint.tpl as shared by all CMS tpl which allow us to keep the CMS specific code in respective tpl and include the shared code via CMSprint.tpl |
@monishdeb I added merge on pass as I'm happy this makes sense now - I think extracting that block to a tpl which both Joomla.tpl & CMSPrint.tpl include makes sense - is that what you mean? We can cover in a follow up PR |
Yes not only Joomla but all other CMSs tpl can share too, say for drupal.tpl it would be like
but then it will still have few duplicate code which is the outer div structure and |
@monishdeb that doesn't seem too bad in terms of duplication |
Merging as per tag. |
Overview
While working for https://lab.civicrm.org/accessibility/misc-core-fixes/issues/3 about making labels accessible I noticed that the files under
templates/CRM/common/{UserFramework}.tpl
share the same code and thus this patch replaces all those with a new fileCMSPrint.tpl
and contain other changes at the server end to accept the new file.