Просмотр исходного кода

Merge pull request #945 from jitsi/feedback-improvements

Feedback window improvements.
master
Emil Ivov 8 лет назад
Родитель
Сommit
6ccc58a060

+ 1
- 12
css/_variables.scss Просмотреть файл

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

+ 27
- 11
css/modals/_dialog.scss Просмотреть файл

@@ -3,7 +3,11 @@
3 3
     height: auto;
4 4
 
5 5
     p {
6
-        color: $defaultDarkFontColor;
6
+        color: $defaultDarkColor;
7
+    }
8
+    textarea {
9
+        background: none;
10
+        border: 1px solid $inputBorderColor;
7 11
     }
8 12
     .aui-dialog2-content:last-child {
9 13
         border-bottom-right-radius: 5px;
@@ -14,24 +18,36 @@
14 18
         border-top-left-radius: 5px;
15 19
     }
16 20
     .aui-dialog2-footer{
21
+        border-top: 0;
22
+        border-radius: 0;
17 23
         padding-top: 0;
24
+        background: none;
25
+        border: none;
26
+        height: auto;
27
+        margin-top: 10px;
18 28
     }
19 29
     .aui-button {
20
-        height: 36px;
21
-        padding-top: 12px;
30
+        height: 28px;
31
+        font-size: 12px;
32
+        padding: 3px 6px 3px 6px;
22 33
         border: none;
23
-        background-color: transparent!important;
24
-        border-left: solid 1px #e4e4e4;
25
-        font-weight: 700;
34
+        box-shadow: none;
35
+        outline: none;
26 36
 
27 37
         &_close {
28
-            color: $defaultFontColor;
38
+            font-weight: 400 !important;
39
+            color: $buttonBackground;
40
+            background: none !important;
41
+
42
+            :hover {
43
+                text-decoration: underline;
44
+            }
29 45
         }
30 46
         &_submit {
31
-            color: $linkFontColor;
32
-            &:hover {
33
-                color: $linkHoverFontColor;
34
-            }
47
+            font-weight: 700 !important;
48
+            color: $defaultColor;
49
+            background: $buttonBackground;
50
+            border-radius: 3px;
35 51
         }
36 52
     }
37 53
 }

+ 6
- 7
css/modals/feedback/_feedback.scss Просмотреть файл

@@ -58,6 +58,12 @@
58 58
 
59 59
     &__content {
60 60
         text-align: center;
61
+
62
+        textarea {
63
+            text-align: left;
64
+            min-height: 80px;
65
+            width: 100%;
66
+        }
61 67
     }
62 68
     &__footer {
63 69
 
@@ -99,11 +105,4 @@
99 105
 
100 106
         }
101 107
     }
102
-    &__details {
103
-        text-align: left;
104
-        textarea {
105
-            min-height: 100px;
106
-            width: 100%;
107
-        }
108
-    }
109 108
 }

+ 3
- 0
modules/UI/UI.js Просмотреть файл

@@ -1072,6 +1072,9 @@ UI.updateDTMFSupport = function (isDTMFSupported) {
1072 1072
 UI.requestFeedback = function () {
1073 1073
     if (Feedback.isVisible())
1074 1074
         return Promise.reject(UIErrors.FEEDBACK_REQUEST_IN_PROGRESS);
1075
+    // Feedback has been submitted already.
1076
+    else if (Feedback.isSubmitted())
1077
+        return Promise.resolve();
1075 1078
     else
1076 1079
         return new Promise(function (resolve, reject) {
1077 1080
             if (Feedback.isEnabled()) {

+ 25
- 2
modules/UI/feedback/Feedback.js Просмотреть файл

@@ -87,6 +87,16 @@ var Feedback = {
87 87
         return $(".feedback").is(":visible");
88 88
     },
89 89
 
90
+    /**
91
+     * Indicates if the feedback is submitted.
92
+     *
93
+     * @return {boolean} {true} to indicate if the feedback is submitted,
94
+     * {false} - otherwise
95
+     */
96
+    isSubmitted: function() {
97
+        return Feedback.window.submitted;
98
+    },
99
+
90 100
     /**
91 101
      * Opens the feedback window.
92 102
      */
@@ -96,10 +106,23 @@ var Feedback = {
96 106
         JitsiMeetJS.analytics.sendEvent('feedback.open');
97 107
     },
98 108
 
109
+    /**
110
+     * Returns the feedback score.
111
+     *
112
+     * @returns {*}
113
+     */
99 114
     getFeedbackScore: function() {
100
-      return Feedback.window.feedbackScore;
101
-    }
115
+        return Feedback.window.feedbackScore;
116
+    },
102 117
 
118
+    /**
119
+     * Returns the feedback free text.
120
+     *
121
+     * @returns {null|*|message}
122
+     */
123
+    getFeedbackText: function() {
124
+        return Feedback.window.feedbackText;
125
+    }
103 126
 };
104 127
 
105 128
 module.exports = Feedback;

+ 21
- 53
modules/UI/feedback/FeedbackWindow.js Просмотреть файл

@@ -18,30 +18,6 @@ let toggleStars = function(starCount) {
18 18
     });
19 19
 };
20 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 21
 /**
46 22
  * Constructs the html for the rated feedback window.
47 23
  *
@@ -50,10 +26,7 @@ let constructDetailedFeedbackHtml = function() {
50 26
 let createRateFeedbackHTML = function (Feedback) {
51 27
     let rateExperience
52 28
             = 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
-        : '';
29
+        feedbackHelp = APP.translation.translateString('dialog.feedbackHelp');
57 30
 
58 31
     let starClassName = (interfaceConfig.ENABLE_FEEDBACK_ANIMATION)
59 32
                             ? "icon-star shake-rotate"
@@ -61,7 +34,6 @@ let createRateFeedbackHTML = function (Feedback) {
61 34
 
62 35
     return `
63 36
         <div class="aui-dialog2-content feedback__content">
64
-            ${feedbackQuestion}
65 37
             <form action="javascript:false;" onsubmit="return false;">
66 38
                 <div class="feedback__rating">
67 39
                     <h2>${ rateExperience }</h2>
@@ -86,7 +58,14 @@ let createRateFeedbackHTML = function (Feedback) {
86 58
                     <p>&nbsp;</p>
87 59
                     <p>${ feedbackHelp }</p>
88 60
                 </div>
61
+                <textarea id="feedbackTextArea" rows="10" cols="40" autofocus></textarea>
89 62
             </form>
63
+            <footer class="aui-dialog2-footer feedback__footer">
64
+                <div class="aui-dialog2-footer-actions">
65
+                    <button id="dialog-close-button" class="aui-button aui-button_close">Close</button>
66
+                    <button id="dialog-submit-button" class="aui-button aui-button_submit">Submit</button>
67
+                </div>
68
+            </footer>
90 69
         </div>
91 70
 `;
92 71
 };
@@ -106,15 +85,6 @@ let onLoadRateFunction = function (Feedback) {
106 85
         };
107 86
         el.onclick = function(){
108 87
             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 88
         };
119 89
     });
120 90
 
@@ -122,14 +92,10 @@ let onLoadRateFunction = function (Feedback) {
122 92
     if (Feedback.feedbackScore > 0) {
123 93
         toggleStars(Feedback.feedbackScore - 1);
124 94
     }
125
-};
126 95
 
127
-/**
128
- * Callback for Detailed Feedback
129
- *
130
- * @param Feedback
131
- */
132
-let onLoadDetailedFunction = function(Feedback) {
96
+    if (Feedback.feedbackText && Feedback.feedbackText.length > 0)
97
+        $('#feedbackTextArea').text(Feedback.feedbackText);
98
+
133 99
     let submitBtn = Feedback.$el.find('#dialog-submit-button');
134 100
     let closeBtn = Feedback.$el.find('#dialog-close-button');
135 101
 
@@ -157,16 +123,14 @@ export default class Dialog {
157 123
 
158 124
     constructor(options) {
159 125
         this.feedbackScore = -1;
126
+        this.feedbackText = null;
127
+        this.submitted = false;
160 128
         this.onCloseCallback = null;
161 129
 
162 130
         this.states = {
163 131
             rate_feedback: {
164 132
                 getHtml: createRateFeedbackHTML,
165 133
                 onLoad: onLoadRateFunction
166
-            },
167
-            detailed_feedback: {
168
-                getHtml: constructDetailedFeedbackHtml,
169
-                onLoad: onLoadDetailedFunction
170 134
             }
171 135
         };
172 136
         this.state = options.state || 'rate_feedback';
@@ -215,11 +179,15 @@ export default class Dialog {
215 179
         let self = this;
216 180
 
217 181
         if (message && message.length > 0) {
218
-            APP.conference.sendFeedback(
219
-                self.feedbackScore,
220
-                message);
182
+            self.feedbackText = message;
221 183
         }
184
+
185
+        APP.conference.sendFeedback(self.feedbackScore,
186
+                                    self.feedbackText);
187
+
188
+        // TO DO: make sendFeedback return true or false.
189
+        self.submitted = true;
190
+
222 191
         this.hide();
223 192
     }
224
-
225 193
 }

Загрузка…
Отмена
Сохранить