Browse Source

Feedback window improvements.

master
yanas 9 years ago
parent
commit
6249ff89ff

+ 1
- 12
css/_variables.scss View File

@@ -61,15 +61,4 @@ $defaultWatermarkLink: '../images/watermark.png';
61 61
  */
62 62
 $tooltipsZ: 901;
63 63
 $toolbarZ: 900;
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;
64
+$overlayZ: 800;

+ 25
- 11
css/modals/_dialog.scss View File

@@ -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,34 @@
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;
26 34
 
27 35
         &_close {
28
-            color: $defaultFontColor;
36
+            font-weight: 400 !important;
37
+            color: $buttonBackground;
38
+            background: none !important;
39
+
40
+            :hover {
41
+                text-decoration: underline;
42
+            }
29 43
         }
30 44
         &_submit {
31
-            color: $linkFontColor;
32
-            &:hover {
33
-                color: $linkHoverFontColor;
34
-            }
45
+            font-weight: 700 !important;
46
+            color: $defaultColor;
47
+            background: $buttonBackground;
48
+            border-radius: 3px;
35 49
         }
36 50
     }
37 51
 }

+ 6
- 7
css/modals/feedback/_feedback.scss View File

@@ -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 View File

@@ -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 View File

@@ -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;

+ 20
- 48
modules/UI/feedback/FeedbackWindow.js View File

@@ -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
  *
@@ -86,7 +62,14 @@ let createRateFeedbackHTML = function (Feedback) {
86 62
                     <p>&nbsp;</p>
87 63
                     <p>${ feedbackHelp }</p>
88 64
                 </div>
65
+                <textarea id="feedbackTextArea" rows="10" cols="40" autofocus></textarea>
89 66
             </form>
67
+            <footer class="aui-dialog2-footer feedback__footer">
68
+                <div class="aui-dialog2-footer-actions">
69
+                    <button id="dialog-close-button" class="aui-button aui-button_close">Close</button>
70
+                    <button id="dialog-submit-button" class="aui-button aui-button_submit">Submit</button>
71
+                </div>
72
+            </footer>
90 73
         </div>
91 74
 `;
92 75
 };
@@ -106,15 +89,6 @@ let onLoadRateFunction = function (Feedback) {
106 89
         };
107 90
         el.onclick = function(){
108 91
             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 92
         };
119 93
     });
120 94
 
@@ -122,14 +96,10 @@ let onLoadRateFunction = function (Feedback) {
122 96
     if (Feedback.feedbackScore > 0) {
123 97
         toggleStars(Feedback.feedbackScore - 1);
124 98
     }
125
-};
126 99
 
127
-/**
128
- * Callback for Detailed Feedback
129
- *
130
- * @param Feedback
131
- */
132
-let onLoadDetailedFunction = function(Feedback) {
100
+    if (Feedback.feedbackText && Feedback.feedbackText.length > 0)
101
+        $('#feedbackTextArea').text(Feedback.feedbackText);
102
+
133 103
     let submitBtn = Feedback.$el.find('#dialog-submit-button');
134 104
     let closeBtn = Feedback.$el.find('#dialog-close-button');
135 105
 
@@ -157,16 +127,14 @@ export default class Dialog {
157 127
 
158 128
     constructor(options) {
159 129
         this.feedbackScore = -1;
130
+        this.feedbackText = null;
131
+        this.submitted = false;
160 132
         this.onCloseCallback = null;
161 133
 
162 134
         this.states = {
163 135
             rate_feedback: {
164 136
                 getHtml: createRateFeedbackHTML,
165 137
                 onLoad: onLoadRateFunction
166
-            },
167
-            detailed_feedback: {
168
-                getHtml: constructDetailedFeedbackHtml,
169
-                onLoad: onLoadDetailedFunction
170 138
             }
171 139
         };
172 140
         this.state = options.state || 'rate_feedback';
@@ -215,11 +183,15 @@ export default class Dialog {
215 183
         let self = this;
216 184
 
217 185
         if (message && message.length > 0) {
218
-            APP.conference.sendFeedback(
219
-                self.feedbackScore,
220
-                message);
186
+            self.feedbackText = message;
221 187
         }
188
+
189
+        APP.conference.sendFeedback(self.feedbackScore,
190
+                                    self.feedbackText);
191
+
192
+        // TO DO: make sendFeedback return true or false.
193
+        self.submitted = true;
194
+
222 195
         this.hide();
223 196
     }
224
-
225 197
 }

Loading…
Cancel
Save