Skip to content

Commit

Permalink
added configurable temporary banner
Browse files Browse the repository at this point in the history
  • Loading branch information
murtaza-swati authored and DominikAlberski committed Mar 11, 2024
1 parent 3c89501 commit 4b8c333
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
13 changes: 13 additions & 0 deletions app/components/temporary-announcement-banner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Component from '@ember/component';
import config from 'travis/config/environment';

export default Component.extend({
message: '',
enabled: false,

init() {
this._super(...arguments);
this.set('enabled', config.tempBanner.tempBannerEnabled === 'true');
this.set('message', config.tempBanner.tempBannerMessage || '');
}
});
5 changes: 5 additions & 0 deletions app/templates/components/temporary-announcement-banner.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{#if this.enabled}}
<div class="notice-banner--yellow align-center">
{{this.message}}
</div>
{{/if}}
1 change: 1 addition & 0 deletions app/templates/components/top-bar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
{{#if this.features.enterpriseVersion}}
<EnterpriseBanner />
{{/if}}
<TemporaryAnnouncementBanner />
{{#if this.user}}
<RepositorySecurityBanner />
{{/if}}
Expand Down
8 changes: 7 additions & 1 deletion config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ const {
DISABLE_SENTRY,
TRAVIS_COMMIT,
SOURCE_VERSION,
DEPLOY_TARGET
DEPLOY_TARGET,
TEMPORARY_ANNOUNCEMENT_BANNER_ENABLED,
TEMPORARY_ANNOUNCEMENT_MESSAGE
} = process.env;

module.exports = function (environment) {
Expand Down Expand Up @@ -171,6 +173,10 @@ module.exports = function (environment) {
gReCaptcha: {
siteKey: GOOGLE_RECAPTCHA_SITE_KEY
},
tempBanner: {
tempBannerEnabled: TEMPORARY_ANNOUNCEMENT_BANNER_ENABLED || false,
tempBannerMessage: TEMPORARY_ANNOUNCEMENT_MESSAGE || ''
}
};

ENV.metricsAdapters = [];
Expand Down

0 comments on commit 4b8c333

Please sign in to comment.