소스 검색

Merge pull request #945 from jitsi/feedback-improvements

Feedback window improvements.
master
Emil Ivov 8 년 전
부모
커밋
6ccc58a060
6개의 변경된 파일83개의 추가작업 그리고 85개의 파일을 삭제
  1. 1
    12
      css/_variables.scss
  2. 27
    11
      css/modals/_dialog.scss
  3. 6
    7
      css/modals/feedback/_feedback.scss
  4. 3
    0
      modules/UI/UI.js
  5. 25
    2
      modules/UI/feedback/Feedback.js
  6. 21
    53
      modules/UI/feedback/FeedbackWindow.js

+ 1
- 12
css/_variables.scss 파일 보기

62
  */
62
  */
63
 $tooltipsZ: 901;
63
 $tooltipsZ: 901;
64
 $toolbarZ: 900;
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
     height: auto;
3
     height: auto;
4
 
4
 
5
     p {
5
     p {
6
-        color: $defaultDarkFontColor;
6
+        color: $defaultDarkColor;
7
+    }
8
+    textarea {
9
+        background: none;
10
+        border: 1px solid $inputBorderColor;
7
     }
11
     }
8
     .aui-dialog2-content:last-child {
12
     .aui-dialog2-content:last-child {
9
         border-bottom-right-radius: 5px;
13
         border-bottom-right-radius: 5px;
14
         border-top-left-radius: 5px;
18
         border-top-left-radius: 5px;
15
     }
19
     }
16
     .aui-dialog2-footer{
20
     .aui-dialog2-footer{
21
+        border-top: 0;
22
+        border-radius: 0;
17
         padding-top: 0;
23
         padding-top: 0;
24
+        background: none;
25
+        border: none;
26
+        height: auto;
27
+        margin-top: 10px;
18
     }
28
     }
19
     .aui-button {
29
     .aui-button {
20
-        height: 36px;
21
-        padding-top: 12px;
30
+        height: 28px;
31
+        font-size: 12px;
32
+        padding: 3px 6px 3px 6px;
22
         border: none;
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
         &_close {
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
         &_submit {
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
 
58
 
59
     &__content {
59
     &__content {
60
         text-align: center;
60
         text-align: center;
61
+
62
+        textarea {
63
+            text-align: left;
64
+            min-height: 80px;
65
+            width: 100%;
66
+        }
61
     }
67
     }
62
     &__footer {
68
     &__footer {
63
 
69
 
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
 UI.requestFeedback = function () {
1072
 UI.requestFeedback = function () {
1073
     if (Feedback.isVisible())
1073
     if (Feedback.isVisible())
1074
         return Promise.reject(UIErrors.FEEDBACK_REQUEST_IN_PROGRESS);
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
     else
1078
     else
1076
         return new Promise(function (resolve, reject) {
1079
         return new Promise(function (resolve, reject) {
1077
             if (Feedback.isEnabled()) {
1080
             if (Feedback.isEnabled()) {

+ 25
- 2
modules/UI/feedback/Feedback.js 파일 보기

87
         return $(".feedback").is(":visible");
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
      * Opens the feedback window.
101
      * Opens the feedback window.
92
      */
102
      */
96
         JitsiMeetJS.analytics.sendEvent('feedback.open');
106
         JitsiMeetJS.analytics.sendEvent('feedback.open');
97
     },
107
     },
98
 
108
 
109
+    /**
110
+     * Returns the feedback score.
111
+     *
112
+     * @returns {*}
113
+     */
99
     getFeedbackScore: function() {
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
 module.exports = Feedback;
128
 module.exports = Feedback;

+ 21
- 53
modules/UI/feedback/FeedbackWindow.js 파일 보기

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
  * Constructs the html for the rated feedback window.
22
  * Constructs the html for the rated feedback window.
47
  *
23
  *
50
 let createRateFeedbackHTML = function (Feedback) {
26
 let createRateFeedbackHTML = function (Feedback) {
51
     let rateExperience
27
     let rateExperience
52
             = APP.translation.translateString('dialog.rateExperience'),
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
     let starClassName = (interfaceConfig.ENABLE_FEEDBACK_ANIMATION)
31
     let starClassName = (interfaceConfig.ENABLE_FEEDBACK_ANIMATION)
59
                             ? "icon-star shake-rotate"
32
                             ? "icon-star shake-rotate"
61
 
34
 
62
     return `
35
     return `
63
         <div class="aui-dialog2-content feedback__content">
36
         <div class="aui-dialog2-content feedback__content">
64
-            ${feedbackQuestion}
65
             <form action="javascript:false;" onsubmit="return false;">
37
             <form action="javascript:false;" onsubmit="return false;">
66
                 <div class="feedback__rating">
38
                 <div class="feedback__rating">
67
                     <h2>${ rateExperience }</h2>
39
                     <h2>${ rateExperience }</h2>
86
                     <p>&nbsp;</p>
58
                     <p>&nbsp;</p>
87
                     <p>${ feedbackHelp }</p>
59
                     <p>${ feedbackHelp }</p>
88
                 </div>
60
                 </div>
61
+                <textarea id="feedbackTextArea" rows="10" cols="40" autofocus></textarea>
89
             </form>
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
         </div>
69
         </div>
91
 `;
70
 `;
92
 };
71
 };
106
         };
85
         };
107
         el.onclick = function(){
86
         el.onclick = function(){
108
             Feedback.feedbackScore = index + 1;
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
     if (Feedback.feedbackScore > 0) {
92
     if (Feedback.feedbackScore > 0) {
123
         toggleStars(Feedback.feedbackScore - 1);
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
     let submitBtn = Feedback.$el.find('#dialog-submit-button');
99
     let submitBtn = Feedback.$el.find('#dialog-submit-button');
134
     let closeBtn = Feedback.$el.find('#dialog-close-button');
100
     let closeBtn = Feedback.$el.find('#dialog-close-button');
135
 
101
 
157
 
123
 
158
     constructor(options) {
124
     constructor(options) {
159
         this.feedbackScore = -1;
125
         this.feedbackScore = -1;
126
+        this.feedbackText = null;
127
+        this.submitted = false;
160
         this.onCloseCallback = null;
128
         this.onCloseCallback = null;
161
 
129
 
162
         this.states = {
130
         this.states = {
163
             rate_feedback: {
131
             rate_feedback: {
164
                 getHtml: createRateFeedbackHTML,
132
                 getHtml: createRateFeedbackHTML,
165
                 onLoad: onLoadRateFunction
133
                 onLoad: onLoadRateFunction
166
-            },
167
-            detailed_feedback: {
168
-                getHtml: constructDetailedFeedbackHtml,
169
-                onLoad: onLoadDetailedFunction
170
             }
134
             }
171
         };
135
         };
172
         this.state = options.state || 'rate_feedback';
136
         this.state = options.state || 'rate_feedback';
215
         let self = this;
179
         let self = this;
216
 
180
 
217
         if (message && message.length > 0) {
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
         this.hide();
191
         this.hide();
223
     }
192
     }
224
-
225
 }
193
 }

Loading…
취소
저장