浏览代码

fix(Toolbar): move login buttons to Profile

Authentication buttons no longer belong to the Toolbar.
j8
paweldomas 8 年前
父节点
当前提交
09406bfbfc
共有 3 个文件被更改,包括 78 次插入72 次删除
  1. 4
    4
      modules/UI/UI.js
  2. 74
    5
      modules/UI/side_pannels/profile/Profile.js
  3. 0
    63
      modules/UI/toolbars/Toolbar.js

+ 4
- 4
modules/UI/UI.js 查看文件

1105
     let showAuth = isAuthEnabled && UIUtil.isAuthenticationEnabled();
1105
     let showAuth = isAuthEnabled && UIUtil.isAuthenticationEnabled();
1106
     let loggedIn = !!login;
1106
     let loggedIn = !!login;
1107
 
1107
 
1108
-    Toolbar.showAuthenticateButton(showAuth);
1108
+    Profile.showAuthenticationButtons(showAuth);
1109
 
1109
 
1110
     if (showAuth) {
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
-/* global $ */
1
+/* global $, APP, JitsiMeetJS */
2
 import UIUtil from "../../util/UIUtil";
2
 import UIUtil from "../../util/UIUtil";
3
 import UIEvents from "../../../../service/UI/UIEvents";
3
 import UIEvents from "../../../../service/UI/UIEvents";
4
 import Settings from '../../../settings/Settings';
4
 import Settings from '../../../settings/Settings';
18
             <input id="setEmail" type="text" class="input-control" 
18
             <input id="setEmail" type="text" class="input-control" 
19
                 data-i18n="[placeholder]profile.setEmailInput">
19
                 data-i18n="[placeholder]profile.setEmailInput">
20
         </div>
20
         </div>
21
-        <div id="authenticationContainer" 
21
+        <div id="profile_auth_container" 
22
              class="sideToolbarBlock auth_container">
22
              class="sideToolbarBlock auth_container">
23
             <p data-i18n="toolbar.authenticate"></p>
23
             <p data-i18n="toolbar.authenticate"></p>
24
             <ul>
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
                     <a class="authButton" data-i18n="toolbar.login"></a>
27
                     <a class="authButton" data-i18n="toolbar.login"></a>
28
                 </li>
28
                 </li>
29
-                <li id="toolbar_button_logout">
29
+                <li id="profile_button_logout">
30
                     <a class="authButton" data-i18n="toolbar.logout"></a>
30
                     <a class="authButton" data-i18n="toolbar.logout"></a>
31
                 </li>
31
                 </li>
32
             </ul>
32
             </ul>
68
                     updateEmail();
68
                     updateEmail();
69
                 }
69
                 }
70
             }).focusout(updateEmail);
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
      */
120
      */
93
     changeAvatar (avatarUrl) {
121
     changeAvatar (avatarUrl) {
94
         $('#avatar').attr('src', avatarUrl);
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
         JitsiMeetJS.analytics.sendEvent('toolbar.hangup');
97
         JitsiMeetJS.analytics.sendEvent('toolbar.hangup');
98
         emitter.emit(UIEvents.HANGUP);
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
     "toolbar_button_raisehand": function () {
100
     "toolbar_button_raisehand": function () {
121
         JitsiMeetJS.analytics.sendEvent('toolbar.raiseHand.clicked');
101
         JitsiMeetJS.analytics.sendEvent('toolbar.raiseHand.clicked');
122
         APP.conference.maybeToggleRaisedHand();
102
         APP.conference.maybeToggleRaisedHand();
397
     isEnabled() {
377
     isEnabled() {
398
         return this.enabled;
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
     showEtherpadButton () {
381
     showEtherpadButton () {
410
         if (!$('#toolbar_button_etherpad').is(":visible")) {
382
         if (!$('#toolbar_button_etherpad').is(":visible")) {
451
         UIUtil.showOrHideElement(id, shouldShow);
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
      * Update the state of the button. The button has blue glow if desktop
427
      * Update the state of the button. The button has blue glow if desktop
491
      * streaming is active.
428
      * streaming is active.

正在加载...
取消
保存