-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deprecation notice for BS2 theme (#1642)
Add a notice informing users about BS2 themes being deprecated and pointing them to a docs page that tells them how to switch themes.
- Loading branch information
Showing
7 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
apps/qubit/modules/default/actions/bs2DeprecationMessageComponent.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Access to Memory (AtoM) software. | ||
* | ||
* Access to Memory (AtoM) is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Access to Memory (AtoM) is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Access to Memory (AtoM). If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/** | ||
* Display bootstrap 2 theme deprecation message component. | ||
* | ||
* @author Anvit Srivastav <[email protected]> | ||
*/ | ||
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; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
apps/qubit/modules/default/actions/bs2DeprecationMessageDismissAction.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Access to Memory (AtoM) software. | ||
* | ||
* Access to Memory (AtoM) is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Access to Memory (AtoM) is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Access to Memory (AtoM). If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
class DefaultBS2DeprecationMessageDismissAction extends sfAction | ||
{ | ||
public function execute($request) | ||
{ | ||
$this->context->user->setAttribute('bs2_deprecation_message_dismissed', true); | ||
|
||
return sfView::NONE; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
apps/qubit/modules/default/templates/_bs2DeprecationMessage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php echo javascript_include_tag('bs2DeprecationMessage'); ?> | ||
|
||
<div class="animateNicely" id="bs2-deprecation-message"> | ||
<div class="alert alert-danger alert-banner"> | ||
<div id="bs2-deprecation-message-content"> | ||
<?php echo __('Bootstrap 2 themes have been deprecated and will be removed in a future release. Please consider switching to a Bootstrap 5 theme. %1%More info.%2%', ['%1%' => '<a href="https://www.accesstomemory.org/en/docs/latest/admin-manual/customization/theming/#bs2-update" target="_blank">', '%2%' => '</a>']); ?> | ||
</div> | ||
<button type="button" class="close">×</button> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters