diff --git a/apps/qubit/modules/default/actions/bs2DeprecationMessageComponent.class.php b/apps/qubit/modules/default/actions/bs2DeprecationMessageComponent.class.php new file mode 100644 index 0000000000..39335f80d0 --- /dev/null +++ b/apps/qubit/modules/default/actions/bs2DeprecationMessageComponent.class.php @@ -0,0 +1,41 @@ +. + */ + +/** + * Display bootstrap 2 theme deprecation message component. + * + * @author Anvit Srivastav + */ +class DefaultBS2DeprecationMessageComponent extends sfComponent +{ + public function execute($request) + { + $hasTranslateOrEditAccess = $this->context->user->isAdministrator() + || $this->getUser()->hasGroup(QubitAclGroup::TRANSLATOR_ID) + || $this->getUser()->hasGroup(QubitAclGroup::EDITOR_ID); + + // Only display this banner to editors, translators, and admins and + // do not display if the theme uses BS5 if it has previously been dismissed + if (!$hasTranslateOrEditAccess || sfConfig::get('app_b5_theme', false) + || null !== $this->context->user->getAttribute('bs2_deprecation_message_dismissed') + ) { + return sfView::NONE; + } + } +} diff --git a/apps/qubit/modules/default/actions/bs2DeprecationMessageDismissAction.class.php b/apps/qubit/modules/default/actions/bs2DeprecationMessageDismissAction.class.php new file mode 100644 index 0000000000..f83afbc66d --- /dev/null +++ b/apps/qubit/modules/default/actions/bs2DeprecationMessageDismissAction.class.php @@ -0,0 +1,28 @@ +. + */ + +class DefaultBS2DeprecationMessageDismissAction extends sfAction +{ + public function execute($request) + { + $this->context->user->setAttribute('bs2_deprecation_message_dismissed', true); + + return sfView::NONE; + } +} diff --git a/apps/qubit/modules/default/templates/_bs2DeprecationMessage.php b/apps/qubit/modules/default/templates/_bs2DeprecationMessage.php new file mode 100644 index 0000000000..fd367e66ae --- /dev/null +++ b/apps/qubit/modules/default/templates/_bs2DeprecationMessage.php @@ -0,0 +1,10 @@ + + +
+
+
+ '', '%2%' => '']); ?> +
+ +
+
diff --git a/apps/qubit/templates/_header.php b/apps/qubit/templates/_header.php index c7b31ecbf6..7bfbc59afa 100644 --- a/apps/qubit/templates/_header.php +++ b/apps/qubit/templates/_header.php @@ -1,3 +1,5 @@ + + diff --git a/js/bs2DeprecationMessage.js b/js/bs2DeprecationMessage.js new file mode 100644 index 0000000000..5b7f3d9f52 --- /dev/null +++ b/js/bs2DeprecationMessage.js @@ -0,0 +1,31 @@ +(function ($) { + + "use strict"; + + class Bs2DeprecationMessage { + constructor(element) { + this.$block = $(element); + this.$button = this.$block.find('button'); + this.listen(); + } + + listen() { + this.$button.on('click', $.proxy(this.onBs2DeprecationMessageButton, this)); + } + + onBs2DeprecationMessageButton() { + this.$block.slideUp(100); + $.get('/default/bs2DeprecationMessageDismiss'); + } + } + + $(function () + { + let $node = $('#bs2-deprecation-message'); + if (0 < $node.length) + { + new Bs2DeprecationMessage($node.get(0)); + } + }); + +})(window.jQuery); diff --git a/plugins/arArchivesCanadaPlugin/templates/_header.php b/plugins/arArchivesCanadaPlugin/templates/_header.php index 554634fa91..a15c56b82d 100644 --- a/plugins/arArchivesCanadaPlugin/templates/_header.php +++ b/plugins/arArchivesCanadaPlugin/templates/_header.php @@ -1,5 +1,7 @@ + + diff --git a/plugins/arDominionPlugin/css/less/scaffolding.less b/plugins/arDominionPlugin/css/less/scaffolding.less index 6e4d66f1b0..85f855a755 100644 --- a/plugins/arDominionPlugin/css/less/scaffolding.less +++ b/plugins/arDominionPlugin/css/less/scaffolding.less @@ -1668,6 +1668,51 @@ body.login #content { } } +// Bootstrap 2 theme deprecation notice +@media (max-width: 767px) { + #bs2-deprecation-message { + margin-left: -20px; + margin-right: -20px; + } +} + +#bs2-deprecation-message { + text-align: center; + position: sticky; + top: 0; + z-index: 1; + + .alert-banner { + margin: 0 auto; + display: flex; + justify-content: space-between; + border: 0; + border-radius: 0; + } + + button { + font-size: 1.75rem; + right: 0; + top: 0; + transform: translateX(-100%); + } + + #bs2-deprecation-message-content { + padding: 8px 0; + color: @red; + position: relative; + left: 50%; + transform: translateX(-50%); + margin-right: 65px; + font-size: 0.85rem; + + a:not(.btn) { + text-shadow: none; + text-decoration: underline; + } + } +} + // GDPR Privacy Message banner @media (max-width: 767px) { #privacy-message {