ui: Render feedback widget client side.

We re-render the feedback widget on every call to
show().  This allows us more flexibility to mess
with the markup for particular use cases.
This commit is contained in:
Steve Howell 2018-12-21 17:21:37 +00:00 committed by Tim Abbott
parent c3a0a22661
commit d844a070fd
4 changed files with 14 additions and 12 deletions

View File

@ -93,11 +93,11 @@ function set_up_handlers() {
meta.hide_me_time = Math.max(meta.hide_me_time, new Date().getTime() + 2000);
});
meta.$container.find('.exit-me').click(function () {
meta.$container.on('click', '.exit-me', function () {
animate.fadeOut();
});
meta.$container.find(".feedback_undo").click(function () {
meta.$container.on('click', '.feedback_undo', function () {
if (meta.undo) {
meta.undo();
}
@ -121,6 +121,9 @@ exports.show = function (opts) {
meta.$container = $('#feedback_container');
var html = templates.render('feedback_container');
meta.$container.html(html);
set_up_handlers();
meta.undo = opts.on_undo;

View File

@ -0,0 +1,7 @@
<div class="float-header">
<h3 class="light no-margin small-line-height float-left feedback_title"></h3>
<div class="exit-me float-right">&#215;</div>
<button class="button small rounded float-right feedback_undo" type="button" name="button"></button>
<div class="float-clear"></div>
</div>
<p class="n-margin feedback_content"></p>

View File

@ -1,9 +0,0 @@
<div id="feedback_container" class="new-style">
<div class="float-header">
<h3 class="light no-margin small-line-height float-left feedback_title"></h3>
<div class="exit-me float-right">&#215;</div>
<button class="button small rounded float-right feedback_undo" type="button" name="button"></button>
<div class="float-clear"></div>
</div>
<p class="n-margin feedback_content"></p>
</div>

View File

@ -35,7 +35,8 @@
{% endblock %}
{% block content %}
{% include "zerver/app/feedback_widget.html" %}
<div id="feedback_container" class="new-style">
</div>
<div id="css-loading">
<h3>{{ _('Loading...') }}</h3>