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:
authorJose Ivan Vargas <jvargas@gitlab.com>2017-02-17 20:28:52 +0300
committerJose Ivan Vargas <jvargas@gitlab.com>2017-02-24 00:47:23 +0300
commitbcab4bb5efd1cc499dc7d753115fe91b98f27bda (patch)
tree712923e168785037162b4c96fe6c9705db84fa4c /app/assets/javascripts/user_callout.js
parent19a21107d7f4a256271306ae10bb376dfbc8bbad (diff)
Changed the javascript class from using the global scope to exporting it via webpack
Also improved accesibility and change the id from user_callouts to a class
Diffstat (limited to 'app/assets/javascripts/user_callout.js')
-rw-r--r--app/assets/javascripts/user_callout.js50
1 files changed, 24 insertions, 26 deletions
diff --git a/app/assets/javascripts/user_callout.js b/app/assets/javascripts/user_callout.js
index 5d10bfc8290..85f85674e59 100644
--- a/app/assets/javascripts/user_callout.js
+++ b/app/assets/javascripts/user_callout.js
@@ -1,37 +1,35 @@
/* eslint-disable arrow-parens, class-methods-use-this, no-param-reassign */
/* global Cookies */
-((global) => {
- const userCalloutElementName = '#user-callout';
- const dismissIcon = '.dismiss-icon';
- const userCalloutBtn = '.user-callout-btn';
+const userCalloutElementName = '.user-callout';
+const dismissIcon = '.dismiss-icon';
+const userCalloutBtn = '.user-callout-btn';
- const USER_CALLOUT_COOKIE = 'user_callout_dismissed';
+const USER_CALLOUT_COOKIE = 'user_callout_dismissed';
- class UserCallout {
- constructor() {
- this.isCalloutDismissed = Cookies.get(USER_CALLOUT_COOKIE);
- this.init();
- }
+class UserCallout {
+ constructor() {
+ this.isCalloutDismissed = Cookies.get(USER_CALLOUT_COOKIE);
+ this.init();
+ this.isUserCalloutDismissed();
+ }
- init() {
- $(document)
- .on('click', dismissIcon, () => this.closeAndDismissCallout())
- .on('click', userCalloutBtn, () => this.closeAndDismissCallout())
- .on('DOMContentLoaded', () => this.isUserCalloutDismissed());
- }
+ init() {
+ $(document)
+ .on('click', dismissIcon, () => this.closeAndDismissCallout())
+ .on('click', userCalloutBtn, () => this.closeAndDismissCallout());
+ }
- closeAndDismissCallout() {
- $(userCalloutElementName).hide();
- Cookies.set(USER_CALLOUT_COOKIE, '1');
- }
+ closeAndDismissCallout() {
+ $(userCalloutElementName).hide();
+ Cookies.set(USER_CALLOUT_COOKIE, '1');
+ }
- isUserCalloutDismissed() {
- if (!this.isCalloutDismissed) {
- $(userCalloutElementName).show();
- }
+ isUserCalloutDismissed() {
+ if (!this.isCalloutDismissed) {
+ $(userCalloutElementName).show();
}
}
+}
- global.UserCallout = UserCallout;
-})(window.gl || (window.gl = {}));
+module.exports = UserCallout;