|
@@ -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> </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
|
}
|