1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-30 22:34:53 +00:00
seahub/templates/snippets/bottom_bar.html

54 lines
2.3 KiB
HTML
Raw Normal View History

{% load url from future %}
var Bottom_bar = '<div id="bottom-bar">{% if groups %}<button id="recommend">推荐到群组</button> <button id="click-into-group">到所在群组</button>{% endif %}</div>';
$('#wrapper').append(Bottom_bar);
2012-08-15 06:16:15 +00:00
$('#bottom-bar').css({'position':'fixed', 'bottom':0, 'right':'10px'});
$('#main-panel').css('margin-bottom', '28px');
$('#footer').addClass('hide');
{% if groups %}
2012-08-15 06:16:15 +00:00
var group_list = []
{% for group in groups %}
group_list.push('{{ group.props.group_name }} <{{ group.props.creator_name }}>');
{% endfor %}
if (group_list.length == 1) {
$('#recommend-groups').val(group_list[0]);
}
$('#recommend').click(function() {
$('#recommend-form').modal({appendTo: '#main'});
2012-08-15 06:16:15 +00:00
addAutocomplete('#recommend-groups', '#recommend-form', group_list);
$('.ui-autocomplete').css({'max-height': window.innerHeight - $('.ui-autocomplete-input').offset().top - $('.ui-autocomplete-input').height() - 10, 'overflow': 'auto'});
});
$('#main').append('<div id="to-group" class="hide">{{ repo_group_str|escapejs }}</div><div id="to-group-caret" class="hide"><div id="comment-outer-caret"><div id="comment-inner-caret"></div></div></div>');
2012-10-22 05:19:12 +00:00
$('#to-group').css({'width':$('#to-group').width(), 'left':$('#click-into-group').offset().left - $('#to-group').width()/3});
$('#to-group-caret').css('left', $('#click-into-group').offset().left);
$('#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');
} 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');
}
});
2012-08-15 06:16:15 +00:00
$('#recommend-submit').click(function() {
if (!$.trim($('#recommend-msg').val())) {
apply_form_error('recommend-form', '推荐语不能为空。');
return false;
}
});
{% endif %}