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 <lbennett@gitlab.com>2018-12-06 16:41:20 +0300
committerMichael Kozono <mkozono@gmail.com>2019-01-03 21:39:36 +0300
commit5f110a6acff7571126c22013923d3f5d2aab770d (patch)
treea60fdc9812d72f942ca85698517c0b967f1c09fa /app/assets/javascripts/persistent_user_callout.js
parent24665ccbe13134bf8379dc68ddfbe80f6c035808 (diff)
Port GitLab.com gold trial callout changes to CE
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/8731
Diffstat (limited to 'app/assets/javascripts/persistent_user_callout.js')
-rw-r--r--app/assets/javascripts/persistent_user_callout.js34
1 files changed, 34 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..1e34e74a152
--- /dev/null
+++ b/app/assets/javascripts/persistent_user_callout.js
@@ -0,0 +1,34 @@
+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;
+
+ this.init();
+ }
+
+ 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.'));
+ });
+ }
+}