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