{% load i18n %} {% load url from future %} var Bottom_bar = '
{% if groups %}{% endif %}
'; $('#wrapper').append(Bottom_bar); $('#main-panel').css('margin-bottom', $('#bottom-bar').outerHeight() + 2); $('#footer').addClass('hide'); {% if groups %} $('#discuss').click(function() { var form = $('#discuss-to-group-form'); var caret = $('#discuss-to-group-caret'); if (form.hasClass('hide')) { form.removeClass('hide'); caret.removeClass('hide'); caret.css({'left': $(this).offset().left}); } else { form.addClass('hide'); caret.addClass('hide'); } }); $(document).click(function(e) { var target = e.target || event.srcElement; if (!$('#discuss, #discuss-to-group-form, #discuss-to-group-caret').is(target) && !($('#discuss-to-group-form, #discuss-to-group-caret').find('*').is(target))) { $('#discuss-to-group-form, #discuss-to-group-caret').addClass('hide'); } }); $('#discuss-submit').click(function() { if (!$.trim($('#discuss-to-group-form .input').val())) { apply_form_error('discuss-to-group-form', '{% trans "Please input a discussion." %}'); return false; } }); $('#main').append('
{{ repo_group_str|escapejs }}
'); $('#click-into-group').click(function() { {% if groups|length == 1 %} // only one group, just turn to group page {% for group in groups %} location.href= "{% url 'group_info' group.id %}"; {% endfor %} {% else %} // more than one group, then let user choose if ($('#to-group').hasClass('hide')) { $('#to-group, #to-group-caret').removeClass('hide'); $('#to-group-caret').css('left', $('#click-into-group').offset().left + $('#click-into-group').width()/3); if ($('#to-group').offset().left > $('#click-into-group').offset().left) { $('#to-group').css('left', $('#click-into-group').offset().left); } } else { $('#to-group, #to-group-caret').addClass('hide'); } {% endif %} }); $(document).click(function(e) { var target = e.target || event.srcElement; if (!$('#click-into-group, #to-group, #to-group-caret').is(target) && !($('#to-group, #to-group-caret').find('*').is(target))) { $('#to-group, #to-group-caret').addClass('hide'); } }); {% endif %} $(function() { var btn_height = $('#bottom-bar button').outerHeight(); $('#discuss-to-group-caret, #to-group-caret, #comment-caret').css({'bottom': btn_height + 1}); $('#file-comment, #to-group, #discuss-to-group-form').css({'bottom': btn_height + 1 + $('.outer-caret').outerHeight()}); });