2012-09-03 12:54:07 +00:00
{% load url from future %}
2012-10-20 12:18:08 +00:00
var Bottom_bar = '< div id = "bottom-bar" > {% if groups %}< button id = "recommend" > 推荐到群组< / button > < button id = "click-into-group" > 到所在群组< / button > {% endif %}< / div > ';
2012-08-08 09:14:04 +00:00
$('#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');
2012-10-20 12:18:08 +00:00
{% 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]);
}
2012-08-08 09:14:04 +00:00
$('#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'});
2012-08-08 09:14:04 +00:00
});
2012-09-03 12:54:07 +00:00
$('#click-into-group').click(function() {
2012-10-19 06:25:23 +00:00
{% if groups|length == 1 %}
// only one group, just turn to group page
2012-09-03 12:54:07 +00:00
{% for group in groups %}
location.href= "{% url 'group_info' group.id %}";
{% endfor %}
2012-10-19 06:25:23 +00:00
{% else %}
// more than one group, then let user choose
var content = '{{ repo_group_str|escapejs }}';
$('#ls-ch').html(content).modal({
appendTo:'#main',
maxHeight: window.innerHeight - 57,
autoResize:true
});
{% endif %}
2012-09-03 12:54:07 +00:00
});
2012-08-15 06:16:15 +00:00
$('#recommend-submit').click(function() {
if (!$.trim($('#recommend-msg').val())) {
apply_form_error('recommend-form', '推荐语不能为空。');
return false;
}
});
2012-10-20 12:18:08 +00:00
{% endif %}