Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bennett <lukeeeebennettplus@gmail.com>2018-09-06 07:13:44 +0300
committerLuke Bennett <lukeeeebennettplus@gmail.com>2018-09-06 07:13:44 +0300
commit693e435f2fb8be8f60f73ee69fcb8f5297522a82 (patch)
tree9c3a5c71115808bf45020109236c2383e0ec41ed /app/assets/javascripts/persistent_user_callout.js
parentab22dae917cc38d6d9573fca472d09950fac8d08 (diff)
port EE
Diffstat (limited to 'app/assets/javascripts/persistent_user_callout.js')
-rw-r--r--app/assets/javascripts/persistent_user_callout.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/assets/javascripts/persistent_user_callout.js b/app/assets/javascripts/persistent_user_callout.js
new file mode 100644
index 00000000000..d136b3bfee9
--- /dev/null
+++ b/app/assets/javascripts/persistent_user_callout.js
@@ -0,0 +1,32 @@
+import axios from './lib/utils/axios_utils';
+import { __ } from './locale';
+import Flash from './flash';
+
+export default class PersistentUserCallout {
+ constructor(container) {
+ const { dismissEndpoint, featureId } = container.dataset;
+ this.container = container;
+ this.dismissEndpoint = dismissEndpoint;
+ this.featureId = featureId;
+ }
+
+ init() {
+ const closeButton = this.container.querySelector('.js-close');
+ closeButton.addEventListener('click', event => this.dismiss(event));
+ }
+
+ dismiss(event) {
+ event.preventDefault();
+
+ axios
+ .post(this.dismissEndpoint, {
+ feature_name: this.featureId,
+ })
+ .then(() => {
+ this.container.remove();
+ })
+ .catch(() => {
+ Flash(__('An error occurred while dismissing the alert. Refresh the page and try again.'));
+ });
+ }
+}