mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-18 15:08:22 +00:00
69 lines
2.8 KiB
HTML
69 lines
2.8 KiB
HTML
{% load i18n %}
|
|
{% load url from future %}
|
|
var Bottom_bar = '<div id="bottom-bar">{% if groups %}<button id="discuss">{% trans "Discuss" %}</button><button id="click-into-group">{% trans "To group" %}</button>{% endif %}</div>';
|
|
$('#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('<div id="to-group" class="hide">{{ repo_group_str|escapejs }}</div><div id="to-group-caret" class="hide"><div class="outer-caret"><div class="inner-caret"></div></div></div>');
|
|
$('#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()});
|
|
});
|