瀏覽代碼

Merge pull request #896 from jitsi/fix-feedback-dialog

Feedback dialog changes
j8
yanas 8 年之前
父節點
當前提交
298338f076

+ 3
- 3
css/_font.scss 查看文件

@@ -69,6 +69,9 @@
69 69
 .icon-exit-full-screen:before {
70 70
   content: "\e90c";
71 71
 }
72
+.icon-star:before {
73
+    content: "\e916";
74
+}
72 75
 .icon-star-full:before {
73 76
   content: "\e90a";
74 77
 }
@@ -105,9 +108,6 @@
105 108
 .icon-settings:before {
106 109
   content: "\e915";
107 110
 }
108
-.icon-star:before {
109
-  content: "\e916";
110
-}
111 111
 .icon-share-desktop:before {
112 112
   content: "\e917";
113 113
 }

+ 13
- 1
css/_variables.scss 查看文件

@@ -61,4 +61,16 @@ $defaultWatermarkLink: '../images/watermark.png';
61 61
  * Z-indexes. TODO: Replace this by a function.
62 62
  */
63 63
 $toolbarZ: 900;
64
-$overlayZ: 800;
64
+$overlayZ: 800;
65
+
66
+/**
67
+ * Font Colors TODO: Change colors when general dialogs are implemented.
68
+ */
69
+$defaultFontColor: #777;
70
+$defaultLightFontColor: #F1F1F1;
71
+$defaultDarkFontColor: #000;
72
+$buttonFontColor: #777;
73
+$buttonHoverFontColor: #287ade;
74
+$linkFontColor: #489afe;
75
+$linkHoverFontColor: #287ade;
76
+

+ 2
- 1
css/main.scss 查看文件

@@ -22,6 +22,8 @@
22 22
 @import 'toastr';
23 23
 @import 'base';
24 24
 @import 'overlay/overlay';
25
+@import 'modals/dialog';
26
+@import 'modals/feedback/feedback';
25 27
 @import 'videolayout_default';
26 28
 @import 'jquery-impromptu';
27 29
 @import 'modaldialog';
@@ -38,7 +40,6 @@
38 40
 @import 'toolbars';
39 41
 @import 'side_toolbar_container';
40 42
 @import 'device_settings_dialog';
41
-@import 'feedback';
42 43
 @import 'jquery.contextMenu';
43 44
 @import 'keyboard-shortcuts';
44 45
 

+ 37
- 0
css/modals/_dialog.scss 查看文件

@@ -0,0 +1,37 @@
1
+.dialog{
2
+    visibility: visible;
3
+    height: auto;
4
+
5
+    p {
6
+        color: $defaultDarkFontColor;
7
+    }
8
+    .aui-dialog2-content:last-child {
9
+        border-bottom-right-radius: 5px;
10
+        border-bottom-left-radius: 5px;
11
+    }
12
+    .aui-dialog2-content:first-child {
13
+        border-top-right-radius: 5px;
14
+        border-top-left-radius: 5px;
15
+    }
16
+    .aui-dialog2-footer{
17
+        padding-top: 0;
18
+    }
19
+    .aui-button {
20
+        height: 36px;
21
+        padding-top: 12px;
22
+        border: none;
23
+        background-color: transparent!important;
24
+        border-left: solid 1px #e4e4e4;
25
+        font-weight: 700;
26
+
27
+        &_close {
28
+            color: $defaultFontColor;
29
+        }
30
+        &_submit {
31
+            color: $linkFontColor;
32
+            &:hover {
33
+                color: $linkHoverFontColor;
34
+            }
35
+        }
36
+    }
37
+}

css/_feedback.scss → css/modals/feedback/_feedback.scss 查看文件

@@ -33,6 +33,8 @@
33 33
 }
34 34
 
35 35
 .shake-rotate {
36
+    display: inline-block;
37
+
36 38
     -webkit-animation-duration: .4s;
37 39
     animation-duration: .4s;
38 40
     -webkit-animation-iteration-count: infinite;
@@ -43,65 +45,65 @@
43 45
     animation-timing-function: ease-in-out
44 46
 }
45 47
 
46
-.text-center {
47
-    text-align: center;
48
-}
49
-
50
-.feedbackDetails textarea {
51
-    resize: vertical;
52
-    min-height: 100px;
53
-}
54
-
55
-.feedback-rating {
56
-    line-height: 1.2;
57
-    padding: 20px 0;
58
-
48
+.feedback {
59 49
     h2 {
60 50
         font-weight: 400;
61 51
         font-size: 24px;
62 52
         line-height: 1.2;
63
-        padding: auto;
64
-        margin: auto;
65
-        border: none;
66 53
     }
67
-
68 54
     p {
69
-        margin-top: 10px;
70
-        margin-left: 0px;
71
-        margin-bottom: 0px;
72
-        margin-right: 0px;
55
+        font-weight: 400;
56
+        font-size: 14px;
73 57
     }
74 58
 
75
-    .star-label {
76
-        font-size: 16px;
77
-        color: $rateStarLabelColor;
59
+    &__content {
60
+        text-align: center;
78 61
     }
62
+    &__footer {
79 63
 
80
-    .star-btn {
81
-        color: $rateStarDefault;
82
-        font-size: 36px;
83
-        position: relative;
84
-        cursor: pointer;
85
-        outline: none;
86
-        text-decoration: none;
87
-        @include transition(all .2s ease);
88
-
89
-        &.starHover,
90
-        &.active,
91 64
         &:hover {
92
-            color: $rateStarActivity;
65
+            color: #287ade;
66
+            outline: 0;
67
+        }
68
+    }
69
+    &__rating {
70
+        line-height: 1.2;
71
+        padding: 20px 0;
93 72
 
94
-            .fa {
95
-                top: -6px;
96
-            }
97
-        };
73
+        p {
74
+            margin: 10px 0 0;
75
+        }
98 76
 
99
-        &.rated:hover .fa {
100
-            top: 0;
77
+        .star-label {
78
+            font-size: 16px;
79
+            color: $rateStarLabelColor;
101 80
         }
102 81
 
103
-        .fa {
82
+        .star-btn {
83
+            color: $rateStarDefault;
84
+            font-size: 36px;
104 85
             position: relative;
86
+            cursor: pointer;
87
+            outline: none;
88
+            text-decoration: none;
89
+            @include transition(all .2s ease);
90
+
91
+            &.starHover,
92
+            &.active,
93
+            &:hover {
94
+                color: $rateStarActivity;
95
+                > i:before {
96
+                    content: "\e90a";
97
+                }
98
+            };
99
+
100
+        }
101
+    }
102
+    &__details {
103
+        text-align: left;
104
+        textarea {
105
+            min-height: 100px;
106
+            width: 100%;
105 107
         }
106 108
     }
107 109
 }

+ 1
- 0
index.html 查看文件

@@ -262,5 +262,6 @@
262 262
             </ul>
263 263
         </div>
264 264
     </div>
265
+    <div id="aui-feedback-dialog" class="dialog feedback aui-layer aui-dialog2 aui-dialog2-medium" style="display: none;"></div>
265 266
   </body>
266 267
 </html>

+ 3
- 1
interface_config.js 查看文件

@@ -38,5 +38,7 @@ var interfaceConfig = {
38 38
     LOCAL_THUMBNAIL_RATIO_WIDTH: 16,
39 39
     LOCAL_THUMBNAIL_RATIO_HEIGHT: 9,
40 40
     REMOTE_THUMBNAIL_RATIO_WIDTH: 1,
41
-    REMOTE_THUMBNAIL_RATIO_HEIGHT: 1
41
+    REMOTE_THUMBNAIL_RATIO_HEIGHT: 1,
42
+    // Enables feedback star animation.
43
+    ENABLE_FEEDBACK_ANIMATION: false
42 44
 };

+ 0
- 326
modules/UI/Feedback.js 查看文件

@@ -1,326 +0,0 @@
1
-/* global $, APP, config, interfaceConfig, JitsiMeetJS */
2
-import UIEvents from "../../service/UI/UIEvents";
3
-import UIUtil from "./util/UIUtil";
4
-
5
-/**
6
- * Constructs the html for the overall feedback window.
7
- *
8
- * @returns {string} the constructed html string
9
- */
10
-var constructOverallFeedbackHtml = function() {
11
-    var feedbackQuestion = (Feedback.feedbackScore < 0)
12
-        ? '<br/><br/>' + APP.translation
13
-        .translateString("dialog.feedbackQuestion")
14
-        : '';
15
-
16
-    var message = '<div class="feedback"><div>' +
17
-        '<div class="feedbackTitle">' +
18
-        APP.translation.translateString("dialog.thankYou",
19
-                                        {appName:interfaceConfig.APP_NAME}) +
20
-        '</div>' +
21
-        feedbackQuestion +
22
-        '</div><br/><br/>' +
23
-        '<div id="stars">' +
24
-        '<a><i class="icon-star icon-star-full"></i></a>' +
25
-        '<a><i class="icon-star icon-star-full"></i></a>' +
26
-        '<a><i class="icon-star icon-star-full"></i></a>' +
27
-        '<a><i class="icon-star icon-star-full"></i></a>' +
28
-        '<a><i class="icon-star icon-star-full"></i></a>' +
29
-        '</div></div>';
30
-
31
-    return message;
32
-};
33
-
34
-/**
35
- * Constructs the html for the detailed feedback window.
36
- *
37
- * @returns {string} the contructed html string
38
- */
39
-var constructDetailedFeedbackHtml = function() {
40
-    // Construct the html, which will be served as a dialog message.
41
-    var message = '<div class="feedback">' +
42
-        '<div class="feedbackTitle">' +
43
-        APP.translation.translateString("dialog.sorryFeedback") +
44
-        '</div><br/><br/>' +
45
-        '<div class="feedbackDetails">' +
46
-        '<textarea id="feedbackTextArea" rows="10" cols="50" autofocus>' +
47
-        '</textarea>' +
48
-        '</div></div>';
49
-
50
-    return message;
51
-};
52
-
53
-var createRateFeedbackHTML = function () {
54
-    var rate = APP.translation.translateString('dialog.rateExperience'),
55
-        help = APP.translation.translateString('dialog.feedbackHelp');
56
-
57
-    return `
58
-        <div class="feedback-rating text-center">
59
-            <h2>${ rate }</h2>
60
-            <p class="star-label">&nbsp;</p>
61
-            <div id="stars" class="feedback-stars">
62
-                <a class="star-btn">
63
-                    <i class="fa fa-star shake-rotate"></i>
64
-                </a>
65
-                <a class="star-btn">
66
-                    <i class="fa fa-star shake-rotate"></i>
67
-                </a>
68
-                <a class="star-btn">
69
-                    <i class="fa fa-star shake-rotate"></i>
70
-                </a>
71
-                <a class="star-btn">
72
-                    <i class="fa fa-star shake-rotate"></i>
73
-                </a>
74
-                <a class="star-btn">
75
-                    <i class="fa fa-star shake-rotate"></i>
76
-                </a>
77
-            </div>
78
-            <p>&nbsp;</p>
79
-            <p>${ help }</p>
80
-        </div>
81
-    `;
82
-};
83
-
84
-/**
85
- * The callback function corresponding to the openFeedbackWindow parameter.
86
- *
87
- * @type {function}
88
- */
89
-var feedbackWindowCallback = null;
90
-
91
-/**
92
- * Shows / hides the feedback button.
93
- * @private
94
- */
95
-function _toggleFeedbackIcon() {
96
-    $('#feedbackButtonDiv').toggleClass("hidden");
97
-}
98
-
99
-/**
100
- * Shows / hides the feedback button.
101
- * @param {show} set to {true} to show the feedback button or to  {false}
102
- * to hide it
103
- * @private
104
- */
105
-function _showFeedbackButton (show) {
106
-    var feedbackButton = $("#feedbackButtonDiv");
107
-
108
-    if (show)
109
-        feedbackButton.css("display", "block");
110
-    else
111
-        feedbackButton.css("display", "none");
112
-}
113
-
114
-/**
115
- * Defines all methods in connection to the Feedback window.
116
- *
117
- * @type {{feedbackScore: number, openFeedbackWindow: Function,
118
- * toggleStars: Function, hoverStars: Function, unhoverStars: Function}}
119
- */
120
-var Feedback = {
121
-    /**
122
-     * The feedback score. -1 indicates no score has been given for now.
123
-     */
124
-    feedbackScore: -1,
125
-
126
-    /**
127
-     * Initialise the Feedback functionality.
128
-     * @param emitter the EventEmitter to associate with the Feedback.
129
-     */
130
-    init: function (emitter) {
131
-        // CallStats is the way we send feedback, so we don't have to initialise
132
-        // if callstats isn't enabled.
133
-        if (!APP.conference.isCallstatsEnabled())
134
-            return;
135
-
136
-        // If enabled property is still undefined, i.e. it hasn't been set from
137
-        // some other module already, we set it to true by default.
138
-        if (typeof this.enabled == "undefined")
139
-            this.enabled = true;
140
-
141
-        _showFeedbackButton(this.enabled);
142
-
143
-        let $feedbackButton = $("#feedbackButton");
144
-
145
-        $feedbackButton.click(function (event) {
146
-            Feedback.openFeedbackWindow();
147
-        });
148
-
149
-        UIUtil.setTooltip($feedbackButton.get(0), 'feedback', 'right');
150
-
151
-        // Show / hide the feedback button whenever the film strip is
152
-        // shown / hidden.
153
-        emitter.addListener(UIEvents.TOGGLE_FILM_STRIP, function () {
154
-            _toggleFeedbackIcon();
155
-        });
156
-    },
157
-    /**
158
-     * Enables/ disabled the feedback feature.
159
-     */
160
-    enableFeedback: function (enable) {
161
-        if (this.enabled !== enable)
162
-            _showFeedbackButton(enable);
163
-        this.enabled = enable;
164
-    },
165
-
166
-    /**
167
-     * Indicates if the feedback functionality is enabled.
168
-     *
169
-     * @return true if the feedback functionality is enabled, false otherwise.
170
-     */
171
-    isEnabled: function() {
172
-        return this.enabled && APP.conference.isCallstatsEnabled();
173
-    },
174
-
175
-    /**
176
-     * Returns true if the feedback window is currently visible and false
177
-     * otherwise.
178
-     * @return {boolean} true if the feedback window is visible, false
179
-     * otherwise
180
-     */
181
-    isVisible: function() {
182
-        return $(".feedback").is(":visible");
183
-    },
184
-
185
-    /**
186
-     * Opens the feedback window.
187
-     */
188
-    openFeedbackWindow: function (callback) {
189
-        feedbackWindowCallback = callback;
190
-        // Add all mouse and click listeners.
191
-        var onLoadFunction = function (event) {
192
-            $('#stars >a').each(function(index) {
193
-                // On star mouse over.
194
-                $(this).get(0).onmouseover = function(){
195
-                    Feedback.hoverStars(index);
196
-                };
197
-                // On star mouse leave.
198
-                $(this).get(0).onmouseleave = function(){
199
-                    Feedback.unhoverStars(index);
200
-                };
201
-                // On star click.
202
-                $(this).get(0).onclick = function(){
203
-                    Feedback.toggleStars(index);
204
-                    Feedback.feedbackScore = index+1;
205
-
206
-                    // If the feedback is less than 3 stars we're going to
207
-                    // ask the user for more information.
208
-                    if (Feedback.feedbackScore > 3) {
209
-                        APP.conference.sendFeedback(Feedback.feedbackScore, "");
210
-                        if (feedbackWindowCallback)
211
-                            feedbackWindowCallback();
212
-                        else
213
-                            APP.UI.messageHandler.closeDialog();
214
-                    }
215
-                    else {
216
-                        feedbackDialog.goToState('detailed_feedback');
217
-                    }
218
-                };
219
-                // Init stars to correspond to previously entered feedback.
220
-                if (Feedback.feedbackScore > 0
221
-                    && index < Feedback.feedbackScore) {
222
-                    Feedback.hoverStars(index);
223
-                    Feedback.toggleStars(index);
224
-                }
225
-            });
226
-        };
227
-
228
-        // Defines the different states of the feedback window.
229
-        var states = {
230
-            overall_feedback: {
231
-                html: createRateFeedbackHTML(),
232
-                persistent: false,
233
-                buttons: {},
234
-                closeText: '',
235
-                focus: "div[id='stars']",
236
-                position: {width: 500}
237
-            },
238
-            detailed_feedback: {
239
-                html: constructDetailedFeedbackHtml(),
240
-                buttons: {"Submit": true, "Cancel": false},
241
-                closeText: '',
242
-                focus: "textarea[id='feedbackTextArea']",
243
-                position: {width: 500},
244
-                submit: function(e,v,m,f) {
245
-                    e.preventDefault();
246
-                    if (v) {
247
-                        var feedbackDetails
248
-                            = document.getElementById("feedbackTextArea").value;
249
-
250
-                        if (feedbackDetails && feedbackDetails.length > 0) {
251
-                            APP.conference.sendFeedback( Feedback.feedbackScore,
252
-                                                    feedbackDetails);
253
-                        }
254
-
255
-                        if (feedbackWindowCallback)
256
-                            feedbackWindowCallback();
257
-                        else
258
-                            APP.UI.messageHandler.closeDialog();
259
-                    } else {
260
-                        // User cancelled
261
-                        if (feedbackWindowCallback)
262
-                            feedbackWindowCallback();
263
-                        else
264
-                            APP.UI.messageHandler.closeDialog();
265
-                    }
266
-                }
267
-            }
268
-        };
269
-
270
-        // Create the feedback dialog.
271
-        var feedbackDialog
272
-            = APP.UI.messageHandler.openDialogWithStates(
273
-                states,
274
-                {   persistent: false,
275
-                    buttons: {},
276
-                    closeText: '',
277
-                    loaded: onLoadFunction,
278
-                    position: {width: 500}}, null);
279
-        JitsiMeetJS.analytics.sendEvent('feedback.open');
280
-    },
281
-    /**
282
-     * Toggles the appropriate css class for the given number of stars, to
283
-     * indicate that those stars have been clicked/selected.
284
-     *
285
-     * @param starCount the number of stars, for which to toggle the css class
286
-     */
287
-    toggleStars: function (starCount)
288
-    {
289
-        $('#stars >a >i').each(function(index) {
290
-            if (index <= starCount) {
291
-                $(this).removeClass("icon-star");
292
-            }
293
-            else
294
-                $(this).addClass("icon-star");
295
-        });
296
-    },
297
-    /**
298
-     * Toggles the appropriate css class for the given number of stars, to
299
-     * indicate that those stars have been hovered.
300
-     *
301
-     * @param starCount the number of stars, for which to toggle the css class
302
-     */
303
-    hoverStars: function (starCount)
304
-    {
305
-        $('#stars >a >i').each(function(index) {
306
-            if (index <= starCount)
307
-                $(this).addClass("starHover");
308
-        });
309
-    },
310
-    /**
311
-     * Toggles the appropriate css class for the given number of stars, to
312
-     * indicate that those stars have been un-hovered.
313
-     *
314
-     * @param starCount the number of stars, for which to toggle the css class
315
-     */
316
-    unhoverStars: function (starCount)
317
-    {
318
-        $('#stars >a >i').each(function(index) {
319
-            if (index <= starCount && $(this).hasClass("icon-star"))
320
-                $(this).removeClass("starHover");
321
-        });
322
-    }
323
-};
324
-
325
-// Exports the Feedback class.
326
-module.exports = Feedback;

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

@@ -29,7 +29,7 @@ var EventEmitter = require("events");
29 29
 UI.messageHandler = require("./util/MessageHandler");
30 30
 var messageHandler = UI.messageHandler;
31 31
 var JitsiPopover = require("./util/JitsiPopover");
32
-var Feedback = require("./Feedback");
32
+var Feedback = require("./feedback/Feedback");
33 33
 
34 34
 import FollowMe from "../FollowMe";
35 35
 
@@ -1126,7 +1126,7 @@ UI.requestFeedback = function () {
1126 1126
             if (Feedback.isEnabled()) {
1127 1127
                 // If the user has already entered feedback, we'll show the
1128 1128
                 // window and immidiately start the conference dispose timeout.
1129
-                if (Feedback.feedbackScore > 0) {
1129
+                if (Feedback.getFeedbackScore() > 0) {
1130 1130
                     Feedback.openFeedbackWindow();
1131 1131
                     resolve();
1132 1132
 

+ 105
- 0
modules/UI/feedback/Feedback.js 查看文件

@@ -0,0 +1,105 @@
1
+/* global $, APP, config, interfaceConfig, JitsiMeetJS */
2
+import UIEvents from "../../../service/UI/UIEvents";
3
+import FeedabckWindow from "./FeedbackWindow";
4
+
5
+/**
6
+ * Shows / hides the feedback button.
7
+ * @private
8
+ */
9
+function _toggleFeedbackIcon() {
10
+    $('#feedbackButtonDiv').toggleClass("hidden");
11
+}
12
+
13
+/**
14
+ * Shows / hides the feedback button.
15
+ * @param {show} set to {true} to show the feedback button or to  {false}
16
+ * to hide it
17
+ * @private
18
+ */
19
+function _showFeedbackButton (show) {
20
+    var feedbackButton = $("#feedbackButtonDiv");
21
+
22
+    if (show)
23
+        feedbackButton.css("display", "block");
24
+    else
25
+        feedbackButton.css("display", "none");
26
+}
27
+
28
+/**
29
+ * Defines all methods in connection to the Feedback window.
30
+ *
31
+ * @type {{openFeedbackWindow: Function}}
32
+ */
33
+var Feedback = {
34
+
35
+    /**
36
+     * Initialise the Feedback functionality.
37
+     * @param emitter the EventEmitter to associate with the Feedback.
38
+     */
39
+    init: function (emitter) {
40
+        // CallStats is the way we send feedback, so we don't have to initialise
41
+        // if callstats isn't enabled.
42
+        if (!APP.conference.isCallstatsEnabled())
43
+            return;
44
+
45
+        // If enabled property is still undefined, i.e. it hasn't been set from
46
+        // some other module already, we set it to true by default.
47
+        if (typeof this.enabled == "undefined")
48
+            this.enabled = true;
49
+
50
+        _showFeedbackButton(this.enabled);
51
+
52
+        this.window = new FeedabckWindow({});
53
+
54
+        $("#feedbackButton").click(Feedback.openFeedbackWindow);
55
+
56
+        // Show / hide the feedback button whenever the film strip is
57
+        // shown / hidden.
58
+        emitter.addListener(UIEvents.TOGGLE_FILM_STRIP, function () {
59
+            _toggleFeedbackIcon();
60
+        });
61
+    },
62
+    /**
63
+     * Enables/ disabled the feedback feature.
64
+     */
65
+    enableFeedback: function (enable) {
66
+        if (this.enabled !== enable)
67
+            _showFeedbackButton(enable);
68
+        this.enabled = enable;
69
+    },
70
+
71
+    /**
72
+     * Indicates if the feedback functionality is enabled.
73
+     *
74
+     * @return true if the feedback functionality is enabled, false otherwise.
75
+     */
76
+    isEnabled: function() {
77
+        return this.enabled && APP.conference.isCallstatsEnabled();
78
+    },
79
+
80
+    /**
81
+     * Returns true if the feedback window is currently visible and false
82
+     * otherwise.
83
+     * @return {boolean} true if the feedback window is visible, false
84
+     * otherwise
85
+     */
86
+    isVisible: function() {
87
+        return $(".feedback").is(":visible");
88
+    },
89
+
90
+    /**
91
+     * Opens the feedback window.
92
+     */
93
+    openFeedbackWindow: function (callback) {
94
+        Feedback.window.show(callback);
95
+
96
+        JitsiMeetJS.analytics.sendEvent('feedback.open');
97
+    },
98
+
99
+    getFeedbackScore: function() {
100
+      return Feedback.window.feedbackScore;
101
+    }
102
+
103
+};
104
+
105
+module.exports = Feedback;

+ 223
- 0
modules/UI/feedback/FeedbackWindow.js 查看文件

@@ -0,0 +1,223 @@
1
+/* global $, APP, interfaceConfig, AJS */
2
+/* jshint -W101 */
3
+
4
+const selector = '#aui-feedback-dialog';
5
+
6
+/**
7
+ * Toggles the appropriate css class for the given number of stars, to
8
+ * indicate that those stars have been clicked/selected.
9
+ *
10
+ * @param starCount the number of stars, for which to toggle the css class
11
+ */
12
+let toggleStars = function(starCount) {
13
+    $('#stars > a').each(function(index, el) {
14
+        if (index <= starCount) {
15
+            el.classList.add("starHover");
16
+        } else
17
+            el.classList.remove("starHover");
18
+    });
19
+};
20
+
21
+/**
22
+ * Constructs the html for the detailed feedback window.
23
+ *
24
+ * @returns {string} the contructed html string
25
+ */
26
+let constructDetailedFeedbackHtml = function() {
27
+
28
+    return `
29
+        <div class="aui-dialog2-content feedback__content">
30
+            <div class="feedback__details">
31
+                <p>${APP.translation.translateString("dialog.sorryFeedback")}</p>
32
+                <br/><br/>
33
+                <textarea id="feedbackTextArea" rows="10" cols="50" autofocus></textarea>
34
+            </div>
35
+        </div>
36
+        <footer class="aui-dialog2-footer feedback__footer">
37
+            <div class="aui-dialog2-footer-actions">
38
+                <button id="dialog-close-button" class="aui-button aui-button_close">Close</button>
39
+                <button id="dialog-submit-button" class="aui-button aui-button_submit">Submit</button>
40
+            </div>
41
+        </footer>
42
+        `;
43
+};
44
+
45
+/**
46
+ * Constructs the html for the rated feedback window.
47
+ *
48
+ * @returns {string} the contructed html string
49
+ */
50
+let createRateFeedbackHTML = function (Feedback) {
51
+    let rateExperience
52
+            = APP.translation.translateString('dialog.rateExperience'),
53
+        feedbackHelp = APP.translation.translateString('dialog.feedbackHelp'),
54
+        feedbackQuestion = (Feedback.feedbackScore < 0)
55
+        ? `<p><br/>${APP.translation.translateString('dialog.feedbackQuestion')}</p>`
56
+        : '';
57
+
58
+    let starClassName = (interfaceConfig.ENABLE_FEEDBACK_ANIMATION)
59
+                            ? "icon-star shake-rotate"
60
+                            : "icon-star";
61
+
62
+    return `
63
+        <div class="aui-dialog2-content feedback__content">
64
+            ${feedbackQuestion}
65
+            <form action="javascript:false;" onsubmit="return false;">
66
+                <div class="feedback__rating">
67
+                    <h2>${ rateExperience }</h2>
68
+                    <p class="star-label">&nbsp;</p>
69
+                    <div id="stars" class="feedback-stars">
70
+                        <a class="star-btn">
71
+                            <i class=${ starClassName }></i>
72
+                        </a>
73
+                        <a class="star-btn">
74
+                            <i class=${ starClassName }></i>
75
+                        </a>
76
+                        <a class="star-btn">
77
+                            <i class=${ starClassName }></i>
78
+                        </a>
79
+                        <a class="star-btn">
80
+                            <i class=${ starClassName }></i>
81
+                        </a>
82
+                        <a class="star-btn">
83
+                            <i class=${ starClassName }></i>
84
+                        </a>
85
+                    </div>
86
+                    <p>&nbsp;</p>
87
+                    <p>${ feedbackHelp }</p>
88
+                </div>
89
+            </form>
90
+        </div>
91
+`;
92
+};
93
+
94
+/**
95
+ * Callback for Rate Feedback
96
+ *
97
+ * @param Feedback
98
+ */
99
+let onLoadRateFunction = function (Feedback) {
100
+    $('#stars > a').each((index, el) => {
101
+        el.onmouseover = function(){
102
+            toggleStars(index);
103
+        };
104
+        el.onmouseleave = function(){
105
+            toggleStars(Feedback.feedbackScore - 1);
106
+        };
107
+        el.onclick = function(){
108
+            Feedback.feedbackScore = index + 1;
109
+
110
+            // If the feedback is less than 3 stars we're going to
111
+            // ask the user for more information.
112
+            if (Feedback.feedbackScore > 3) {
113
+                APP.conference.sendFeedback(Feedback.feedbackScore, "");
114
+                Feedback.hide();
115
+            } else {
116
+                Feedback.setState('detailed_feedback');
117
+            }
118
+        };
119
+    });
120
+
121
+    // Init stars to correspond to previously entered feedback.
122
+    if (Feedback.feedbackScore > 0) {
123
+        toggleStars(Feedback.feedbackScore - 1);
124
+    }
125
+};
126
+
127
+/**
128
+ * Callback for Detailed Feedback
129
+ *
130
+ * @param Feedback
131
+ */
132
+let onLoadDetailedFunction = function(Feedback) {
133
+    let submitBtn = Feedback.$el.find('#dialog-submit-button');
134
+    let closeBtn = Feedback.$el.find('#dialog-close-button');
135
+
136
+    if (submitBtn && submitBtn.length) {
137
+        submitBtn.on('click', (e) => {
138
+            e.preventDefault();
139
+            Feedback.onFeedbackSubmitted();
140
+        });
141
+    }
142
+    if (closeBtn && closeBtn.length) {
143
+        closeBtn.on('click', (e) => {
144
+            e.preventDefault();
145
+            Feedback.hide();
146
+        });
147
+    }
148
+
149
+    $('#feedbackTextArea').focus();
150
+};
151
+
152
+/**
153
+ * @class Dialog
154
+ *
155
+ */
156
+export default class Dialog {
157
+
158
+    constructor(options) {
159
+        this.feedbackScore = -1;
160
+        this.onCloseCallback = null;
161
+
162
+        this.states = {
163
+            rate_feedback: {
164
+                getHtml: createRateFeedbackHTML,
165
+                onLoad: onLoadRateFunction
166
+            },
167
+            detailed_feedback: {
168
+                getHtml: constructDetailedFeedbackHtml,
169
+                onLoad: onLoadDetailedFunction
170
+            }
171
+        };
172
+        this.state = options.state || 'rate_feedback';
173
+
174
+        this.window = AJS.dialog2(selector, {
175
+            closeOnOutsideClick: true
176
+        });
177
+        this.$el = this.window.$el;
178
+
179
+        this.setState();
180
+    }
181
+
182
+    setState(state) {
183
+        let newState = state || this.state;
184
+
185
+        let htmlStr = this.states[newState].getHtml(this);
186
+
187
+        this.$el.html(htmlStr);
188
+
189
+        this.states[newState].onLoad(this);
190
+    }
191
+
192
+    show(cb) {
193
+        this.setState('rate_feedback');
194
+        if (typeof cb == 'function') {
195
+            this.onCloseCallback = cb;
196
+        }
197
+
198
+        this.window.show();
199
+
200
+    }
201
+
202
+    hide() {
203
+        this.window.hide();
204
+
205
+        if (this.onCloseCallback) {
206
+            this.onCloseCallback();
207
+            this.onCloseCallback = null;
208
+        }
209
+    }
210
+
211
+    onFeedbackSubmitted() {
212
+        let message = this.$el.find('textarea').val();
213
+        let self = this;
214
+
215
+        if (message && message.length > 0) {
216
+            APP.conference.sendFeedback(
217
+                self.feedbackScore,
218
+                message);
219
+        }
220
+        this.hide();
221
+    }
222
+
223
+}

+ 1
- 1
modules/UI/recording/Recording.js 查看文件

@@ -17,7 +17,7 @@
17 17
 import UIEvents from "../../../service/UI/UIEvents";
18 18
 import UIUtil from '../util/UIUtil';
19 19
 import VideoLayout from '../videolayout/VideoLayout';
20
-import Feedback from '../Feedback.js';
20
+import Feedback from '../feedback/Feedback.js';
21 21
 import Toolbar from '../toolbars/Toolbar';
22 22
 
23 23
 /**

+ 10
- 10
modules/UI/videolayout/FilmStrip.js 查看文件

@@ -24,7 +24,7 @@ const FilmStrip = {
24 24
      */
25 25
     toggleFilmStrip (visible) {
26 26
         if (typeof visible === 'boolean'
27
-                && this.isFilmStripVisible() == visible) {
27
+            && this.isFilmStripVisible() == visible) {
28 28
             return;
29 29
         }
30 30
 
@@ -34,8 +34,8 @@ const FilmStrip = {
34 34
         var eventEmitter = this.eventEmitter;
35 35
         if (eventEmitter) {
36 36
             eventEmitter.emit(
37
-                    UIEvents.TOGGLED_FILM_STRIP,
38
-                    this.isFilmStripVisible());
37
+                UIEvents.TOGGLED_FILM_STRIP,
38
+                this.isFilmStripVisible());
39 39
         }
40 40
     },
41 41
 
@@ -75,7 +75,7 @@ const FilmStrip = {
75 75
     /**
76 76
      * Normalizes local and remote thumbnail ratios
77 77
      */
78
-     normalizeThumbnailRatio () {
78
+    normalizeThumbnailRatio () {
79 79
         let remoteHeightRatio = interfaceConfig.REMOTE_THUMBNAIL_RATIO_HEIGHT;
80 80
         let remoteWidthRatio = interfaceConfig.REMOTE_THUMBNAIL_RATIO_WIDTH;
81 81
 
@@ -120,11 +120,11 @@ const FilmStrip = {
120 120
          */
121 121
         let videoAreaAvailableWidth
122 122
             = UIUtil.getAvailableVideoWidth()
123
-                - UIUtil.parseCssInt(this.filmStrip.css('right'), 10)
124
-                - UIUtil.parseCssInt(this.filmStrip.css('paddingLeft'), 10)
125
-                - UIUtil.parseCssInt(this.filmStrip.css('paddingRight'), 10)
126
-                - UIUtil.parseCssInt(this.filmStrip.css('borderLeftWidth'), 10)
127
-                - UIUtil.parseCssInt(this.filmStrip.css('borderRightWidth'), 10)
123
+            - UIUtil.parseCssInt(this.filmStrip.css('right'), 10)
124
+            - UIUtil.parseCssInt(this.filmStrip.css('paddingLeft'), 10)
125
+            - UIUtil.parseCssInt(this.filmStrip.css('paddingRight'), 10)
126
+            - UIUtil.parseCssInt(this.filmStrip.css('borderLeftWidth'), 10)
127
+            - UIUtil.parseCssInt(this.filmStrip.css('borderRightWidth'), 10)
128 128
             - 5;
129 129
 
130 130
         let availableWidth = videoAreaAvailableWidth;
@@ -270,4 +270,4 @@ const FilmStrip = {
270 270
 
271 271
 };
272 272
 
273
-export default FilmStrip;
273
+export default FilmStrip;

Loading…
取消
儲存