Переглянути джерело

fix(Toolbar): move login buttons to Profile

Authentication buttons no longer belong to the Toolbar.
j8
paweldomas 8 роки тому
джерело
коміт
09406bfbfc

+ 4
- 4
modules/UI/UI.js Переглянути файл

@@ -1105,13 +1105,13 @@ UI.updateAuthInfo = function (isAuthEnabled, login) {
1105 1105
     let showAuth = isAuthEnabled && UIUtil.isAuthenticationEnabled();
1106 1106
     let loggedIn = !!login;
1107 1107
 
1108
-    Toolbar.showAuthenticateButton(showAuth);
1108
+    Profile.showAuthenticationButtons(showAuth);
1109 1109
 
1110 1110
     if (showAuth) {
1111
-        Toolbar.setAuthenticatedIdentity(login);
1111
+        Profile.setAuthenticatedIdentity(login);
1112 1112
 
1113
-        Toolbar.showLoginButton(!loggedIn);
1114
-        Toolbar.showLogoutButton(loggedIn);
1113
+        Profile.showLoginButton(!loggedIn);
1114
+        Profile.showLogoutButton(loggedIn);
1115 1115
     }
1116 1116
 };
1117 1117
 

+ 74
- 5
modules/UI/side_pannels/profile/Profile.js Переглянути файл

@@ -1,4 +1,4 @@
1
-/* global $ */
1
+/* global $, APP, JitsiMeetJS */
2 2
 import UIUtil from "../../util/UIUtil";
3 3
 import UIEvents from "../../../../service/UI/UIEvents";
4 4
 import Settings from '../../../settings/Settings';
@@ -18,15 +18,15 @@ const htmlStr = `
18 18
             <input id="setEmail" type="text" class="input-control" 
19 19
                 data-i18n="[placeholder]profile.setEmailInput">
20 20
         </div>
21
-        <div id="authenticationContainer" 
21
+        <div id="profile_auth_container" 
22 22
              class="sideToolbarBlock auth_container">
23 23
             <p data-i18n="toolbar.authenticate"></p>
24 24
             <ul>
25
-                <li id="toolbar_auth_identity"></li>
26
-                <li id="toolbar_button_login">
25
+                <li id="profile_auth_identity"></li>
26
+                <li id="profile_button_login">
27 27
                     <a class="authButton" data-i18n="toolbar.login"></a>
28 28
                 </li>
29
-                <li id="toolbar_button_logout">
29
+                <li id="profile_button_logout">
30 30
                     <a class="authButton" data-i18n="toolbar.logout"></a>
31 31
                 </li>
32 32
             </ul>
@@ -68,6 +68,34 @@ export default {
68 68
                     updateEmail();
69 69
                 }
70 70
             }).focusout(updateEmail);
71
+
72
+        // LOGIN
73
+        function loginClicked () {
74
+            JitsiMeetJS.analytics.sendEvent('authenticate.login.clicked');
75
+            emitter.emit(UIEvents.AUTH_CLICKED);
76
+        }
77
+
78
+        $('#profile_button_login').click(loginClicked);
79
+
80
+        // LOGOUT
81
+        function logoutClicked () {
82
+            let titleKey = "dialog.logoutTitle";
83
+            let msgKey = "dialog.logoutQuestion";
84
+            JitsiMeetJS.analytics.sendEvent('authenticate.logout.clicked');
85
+            // Ask for confirmation
86
+            APP.UI.messageHandler.openTwoButtonDialog({
87
+                titleKey: titleKey,
88
+                msgKey: msgKey,
89
+                leftButtonKey: "dialog.Yes",
90
+                submitFunction: function (evt, yes) {
91
+                    if (yes) {
92
+                        emitter.emit(UIEvents.LOGOUT);
93
+                    }
94
+                }
95
+            });
96
+        }
97
+
98
+        $('#profile_button_logout').click(logoutClicked);
71 99
     },
72 100
 
73 101
     /**
@@ -92,5 +120,46 @@ export default {
92 120
      */
93 121
     changeAvatar (avatarUrl) {
94 122
         $('#avatar').attr('src', avatarUrl);
123
+    },
124
+
125
+    /**
126
+     * Shows or hides authentication related buttons
127
+     * @param {boolean} show <tt>true</tt> to show or <tt>false</tt> to hide
128
+     */
129
+    showAuthenticationButtons (show) {
130
+        let id = 'profile_auth_container';
131
+        UIUtil.showOrHideElement(id, show);
132
+    },
133
+
134
+    /**
135
+     * Shows/hides login button.
136
+     * @param {boolean} show <tt>true</tt> to show or <tt>false</tt> to hide
137
+     */
138
+    showLoginButton (show) {
139
+        let id = 'profile_button_login';
140
+
141
+        UIUtil.showOrHideElement(id, show);
142
+    },
143
+
144
+    /**
145
+     * Shows/hides logout button.
146
+     * @param {boolean} show <tt>true</tt> to show or <tt>false</tt> to hide
147
+     */
148
+    showLogoutButton (show) {
149
+        let id = 'profile_button_logout';
150
+
151
+        UIUtil.showOrHideElement(id, show);
152
+    },
153
+
154
+    /**
155
+     * Displays user's authenticated identity name (login).
156
+     * @param {string} authIdentity identity name to be displayed.
157
+     */
158
+    setAuthenticatedIdentity (authIdentity) {
159
+        let id = 'profile_auth_identity';
160
+
161
+        UIUtil.showOrHideElement(id, !!authIdentity);
162
+
163
+        $(`#${id}`).text(authIdentity ? authIdentity : '');
95 164
     }
96 165
 };

+ 0
- 63
modules/UI/toolbars/Toolbar.js Переглянути файл

@@ -97,26 +97,6 @@ const buttonHandlers = {
97 97
         JitsiMeetJS.analytics.sendEvent('toolbar.hangup');
98 98
         emitter.emit(UIEvents.HANGUP);
99 99
     },
100
-    "toolbar_button_login": function () {
101
-        JitsiMeetJS.analytics.sendEvent('toolbar.authenticate.login.clicked');
102
-        emitter.emit(UIEvents.AUTH_CLICKED);
103
-    },
104
-    "toolbar_button_logout": function () {
105
-        let titleKey = "dialog.logoutTitle";
106
-        let msgKey = "dialog.logoutQuestion";
107
-        JitsiMeetJS.analytics.sendEvent('toolbar.authenticate.logout.clicked');
108
-        // Ask for confirmation
109
-        APP.UI.messageHandler.openTwoButtonDialog({
110
-            titleKey,
111
-            msgKey,
112
-            leftButtonKey: "dialog.Yes",
113
-            submitFunction: function (evt, yes) {
114
-                if (yes) {
115
-                    emitter.emit(UIEvents.LOGOUT);
116
-                }
117
-            }
118
-        });
119
-    },
120 100
     "toolbar_button_raisehand": function () {
121 101
         JitsiMeetJS.analytics.sendEvent('toolbar.raiseHand.clicked');
122 102
         APP.conference.maybeToggleRaisedHand();
@@ -397,14 +377,6 @@ Toolbar = {
397 377
     isEnabled() {
398 378
         return this.enabled;
399 379
     },
400
-    /**
401
-     * Shows or hides authentication button
402
-     * @param show <tt>true</tt> to show or <tt>false</tt> to hide
403
-     */
404
-    showAuthenticateButton (show) {
405
-        let id = 'authenticationContainer';
406
-        UIUtil.showOrHideElement(id, show);
407
-    },
408 380
 
409 381
     showEtherpadButton () {
410 382
         if (!$('#toolbar_button_etherpad').is(":visible")) {
@@ -451,41 +423,6 @@ Toolbar = {
451 423
         UIUtil.showOrHideElement(id, shouldShow);
452 424
     },
453 425
 
454
-    /**
455
-     * Displays user authenticated identity name(login).
456
-     * @param authIdentity identity name to be displayed.
457
-     */
458
-    setAuthenticatedIdentity (authIdentity) {
459
-        let id = 'toolbar_auth_identity';
460
-
461
-        if(authIdentity) {
462
-            $(`#${id}`).text(authIdentity);
463
-        } else {
464
-            $(`#${id}`).text('');
465
-        }
466
-        UIUtil.showOrHideElement(id, !!authIdentity);
467
-    },
468
-
469
-    /**
470
-     * Shows/hides login button.
471
-     * @param show <tt>true</tt> to show
472
-     */
473
-    showLoginButton (show) {
474
-        let id = 'toolbar_button_login';
475
-
476
-        UIUtil.showOrHideElement(id, show);
477
-    },
478
-
479
-    /**
480
-     * Shows/hides logout button.
481
-     * @param show <tt>true</tt> to show
482
-     */
483
-    showLogoutButton (show) {
484
-        let id = 'toolbar_button_logout';
485
-
486
-        UIUtil.showOrHideElement(id, show);
487
-    },
488
-
489 426
     /**
490 427
      * Update the state of the button. The button has blue glow if desktop
491 428
      * streaming is active.

Завантаження…
Відмінити
Зберегти