Revision 54417a11 ui/templates/home.html

b/ui/templates/home.html
72 72
        var TIMEOUT = {{timeout}};
73 73
        var UPDATE_INTERVAL = {{update_interval}};
74 74
        var LOGOUT_REDIRECT = undefined;
75
        var INVITATIONS_URL = "{% url invitations %}"
76
        var INVITATIONS_TITLE = "{% trans "Invitations" %}"
75
        var INVITATIONS_URL = "{% url invitations %}";
76
        var INVITATIONS_TITLE = "{% trans "Invitations" %}";
77 77
        var APP_DEBUG = {% if DEBUG %}true{% else %}false{% endif %};
78
        var FEEDBACK_URL = "{% url feedback %}";
79
        var FEEDBACK_TITLE = "{% trans "Feedback" %}";
78 80

  
79 81
        // server statuses and transitions
80 82
        var STATUSES = {
......
271 273
                }
272 274
            }
273 275

  
276
            
277
            // prepare ajax call to get called when user clicks on 
278
            // send error report button
279
            function initialize_error_report(cont, extra_data) {
280
                var cont = $(cont);
281
                var sel = function(sel) {return $(sel, cont)};
282
                var btn = sel(".send-btn");
283
                var extra_data = extra_data;
284

  
285
                // clear previous callbacks
286
                btn.unbind('click');
287
                btn.click(function(){
288

  
289
                    // wrap in its own try catch to avoid retriggering ajax_error
290

  
291
                    try {
292
                        var data = $.extend({'error_info': $.extend({}, extra_data)}, get_user_data());
293
                        var payload = {'feedback-msg': "Automated error report", 'feedback-data': JSON.stringify(data)};
294
                        
295
                        $.ajax({
296
                            url: FEEDBACK_URL,
297
                            type: "POST",
298
                            data: $.param(payload),
299
                            beforeSend: function() {
300
                                sel(".send-btn").hide();
301
                                sel(".sending").fadeIn();
302
                            },
303
                            error: function() {
304
                                sel(".sending").hide();
305
                                sel(".errormsg").fadeIn();
306
                            },
307
                            success: function() {
308
                                sel(".sending").hide();
309
                                sel(".success").fadeIn();
310
                            }
311
                        });
312

  
313
                    } catch (err) {
314
                        console.error(err);
315
                    }
316
                });
317
            }
318

  
274 319
            // bring up error notification
275 320
            var triggers = $("a#notification").overlay({
276 321
                // some mask tweaks suitable for modal dialogs
277 322
                mask: '#666',
278 323
                top: 'center',
279 324
                closeOnClick: false,
325
                fixed: false,
280 326
                oneInstance: false,
281 327
                load: false,
282 328
                onClose: function () {
283
                    // refresh the whole page
284
                    location.reload();
329
                   // refresh the whole page
330
                   location.reload();
331
                },
332
                onLoad: function() {
333
                    initialize_error_report($(this.getOverlay()), [status, serverID, action, responseText]);
285 334
                }
335

  
286 336
            });
287 337

  
288 338
            // we need to give the browser some time to close the old overlays before opening the new one
......
351 401
                <div class="usermenu">
352 402
                    <div class="username">{{ request.user.uniq }}</div>
353 403
                    <ul class="useractions">
354
                        <li class="invitations"><a class="action" href="#">{% trans "Invitations" %}</a></li>
404
                        <li class="invitations"><a class="action" href="#">{% trans "invitations" %}</a></li>
405
                        <li class="feedback"><a class="action" href="#">{% trans "feedback" %}</a></li>
355 406
                        <li class="logout last"><a class="action" href="#">{% trans "logout" %}</a></li>
356 407
                    </ul>
357 408
                </div>
......
445 496
        }
446 497

  
447 498
        $(document).ready(function(){
499
            
500
            $(".close-msg-box").live('click', close_all_overlays);
448 501

  
449 502
            {% if current_lang == "el" and not DEBUG %}
450 503
                window.location = "/lang/?l=en";
......
472 525
            });
473 526

  
474 527
            $(".usermenu .invitations").click(show_invitations);
475
            
528
            $(".usermenu .feedback").click(show_feedback_form);
529

  
476 530
        });
477 531
    </script>
478 532
    <!-- base notification for error/success reporting -->
479 533
    <a id="notification" rel="#error-success" href="#"></a>
480 534
    <a id="msgbox" rel="#notification-box" href="#"></a>
535
    <a id="feedbackbox" rel="#feedback-form" href="#"></a>
481 536

  
482 537
    <div class="modal" id="error-success">
483 538
        <h3 class="popup-header">
484
            <span class="header-box"></span>
539
            <span class="header-box">{% trans "Feedback form" %}</span>
485 540
        </h3>
486 541
        <div class="popup-body">
487 542
            <div class="popup-body-inner">
543
                <div class="error-report">
544
                    <div class="send-btn">{% trans "send error report" %}</div>
545
                    <div class="sending">{% trans "sending...." %}</div>
546
                    <div class="errormsg">{% trans "cannot send error report" %}</div>
547
                    <div class="success">{% trans "report send successfully" %}</div>
548
                </div>
488 549
                <div class="machine-now-building"></div>
489 550
                <div class="popup-separator"></div>
490 551
                <div class="password-container">
......
499 560
        </div>
500 561
    </div>
501 562

  
502
    <div class="modal" id="notification-box">
563
    <div class="modal" id="feedback-form" class="feedback notification-box">
564
        <h3 class="popup-header">
565
            <span class="header-box">{% trans "Feedback form" %}</span>
566
        </h3>
567
        <div class="popup-body">
568
            <div class="popup-body-inner">
569
                <div class="form-container">
570
                <p class="feedback-intro">
571
                {% blocktrans %}
572
                Feedback form intro text ..... .. ... .. ..... .. .. . .. . .. .. .. ...... .. .
573
                Feedback form intro text ..... .. ... .. ..... .. .. . .. . .. .. .. ...... .. .
574
                Feedback form intro text ..... .. ... .. ..... .. .. . .. . .. .. .. ...... .. .
575
                {% endblocktrans %}</p>
576
                <form id="feedback-form">
577
                    <label for="feedback-msg">{% trans "Feedback or question" %}</label>
578
                    <div class="description">{% trans "please describe here .... blah blah blah" %}</div>
579
                    <div class="empty-error-msg">{% trans "Please fill out the feedback form" %}</div>
580
                    <textarea name="feedback-msg" class="feedback-text"></textarea>
581
                    <input type="checkbox" name="submit-submit-data"/><label class="inline" for="submit-submit-data">{% trans "submit application data" %}</label>
582
                    <div class="description">{% trans "describe what application data checkbox does" %}</div>
583
                    <input type="submit" value="{% trans "submit feedback" %}" class="submit" />
584
                    <textarea name="feedback-data" class="data-text"></textarea>
585
                </form>
586
            </div>
587

  
588
            <div class="message sending">{% trans "submiting your data....." %}</div>
589
            <div class="message success">
590
                {% trans "thank you for submiting your feedback" %}
591
                <span class="close-msg-box"> {% trans "close feedback" %}</span></div>
592
            <div class="message errormsg">
593
                {% trans "some error occured submiting submiting your feedback, please try again later" %}
594
                <span class="close-msg-box"> {% trans "close feedback" %}</span></div>
595
            </div>
596
            </div>
597
        </div>
598
    </div>
599

  
600
    <div class="modal" id="notification-box" class="notification-box">
503 601
        <h3 class="popup-header">
504 602
            <span class="header-box"></span>
505 603
        </h3>

Also available in: Unified diff