1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 15:53:28 +00:00

[to-group]modified the popup to be like comment-popup

This commit is contained in:
llj
2012-10-20 21:37:02 +08:00
parent 50947201a1
commit 0d14e4ad29
5 changed files with 32 additions and 14 deletions

View File

@@ -1332,7 +1332,8 @@ ul.with-bg li {
font-size:15px; font-size:15px;
} }
/* File comment */ /* File comment */
#file-comment { #file-comment,
#to-group {
width:400px; width:400px;
position:fixed; position:fixed;
right:10px; right:10px;
@@ -1367,7 +1368,9 @@ ul.with-bg li {
.comment-bd { .comment-bd {
word-wrap:break-word; word-wrap:break-word;
} }
#comment-caret { #comment-caret,
#to-group-caret {
width:28px;
position:fixed; position:fixed;
right:27px; right:27px;
bottom:26px; bottom:26px;
@@ -1389,6 +1392,10 @@ ul.with-bg li {
left:-14px; left:-14px;
} }
.placeholder { color: #aaa; } .placeholder { color: #aaa; }
/*to-group*/
#to-group {
padding:15px;
}
/* text file diff */ /* text file diff */
div.diff-desc { margin: 10px 0; } div.diff-desc { margin: 10px 0; }

View File

@@ -54,7 +54,6 @@
</span> </span>
<span class="time">{{ current_commit.props.ctime|translate_commit_time }}</span> <span class="time">{{ current_commit.props.ctime|translate_commit_time }}</span>
</p> </p>
<div id="ls-ch" class="hide"></div><!--list modification details of a commit-->
</div> </div>
{% endif %} {% endif %}

View File

@@ -191,7 +191,6 @@
</div> </div>
{% endif %} {% endif %}
{% endif %} {% endif %}
<div id="ls-ch" class="hide"></div><!--let user choose which group if there are more than one groups-->
{% endblock %} {% endblock %}
{% block extra_script %} {% block extra_script %}
@@ -344,7 +343,7 @@ $('#comment').click(function() {
}); });
$(document).click(function(e) { $(document).click(function(e) {
var target = e.target || event.srcElement; var target = e.target || event.srcElement;
if (target != $('#comment')[0] && target != $('#file-comment')[0] && target != $('#comment-caret')[0] && !($('#file-comment, #comment-caret').find('*').is(target))) { if (!$('#comment, #file-comment, #comment-caret').is(target) && !($('#file-comment, #comment-caret').find('*').is(target))) {
$('#file-comment, #comment-caret').addClass('hide'); $('#file-comment, #comment-caret').addClass('hide');
} }
}); });

View File

@@ -19,6 +19,8 @@ $('#recommend').click(function() {
$('.ui-autocomplete').css({'max-height': window.innerHeight - $('.ui-autocomplete-input').offset().top - $('.ui-autocomplete-input').height() - 10, 'overflow': 'auto'}); $('.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>');
$('#to-group-caret').css('left', $('#click-into-group').offset().left);
$('#click-into-group').click(function() { $('#click-into-group').click(function() {
{% if groups|length == 1 %} {% if groups|length == 1 %}
// only one group, just turn to group page // only one group, just turn to group page
@@ -28,16 +30,19 @@ $('#click-into-group').click(function() {
{% else %} {% else %}
// more than one group, then let user choose // more than one group, then let user choose
var content = '{{ repo_group_str|escapejs }}'; if ($('#to-group').hasClass('hide')) {
$('#ls-ch').html(content).modal({ $('#to-group, #to-group-caret').removeClass('hide');
appendTo:'#main', } else {
maxHeight: window.innerHeight - 57, $('#to-group, #to-group-caret').addClass('hide');
autoResize:true }
});
{% endif %} {% 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');
}
});
$('#recommend-submit').click(function() { $('#recommend-submit').click(function() {
if (!$.trim($('#recommend-msg').val())) { if (!$.trim($('#recommend-msg').val())) {
apply_form_error('recommend-form', '推荐语不能为空。'); apply_form_error('recommend-form', '推荐语不能为空。');

View File

@@ -1299,6 +1299,13 @@ def repo_view_file(request, repo_id):
contributors, last_modified, last_commit_id = get_file_contributors(repo_id, path.encode('utf-8'), file_path_hash, obj_id) contributors, last_modified, last_commit_id = get_file_contributors(repo_id, path.encode('utf-8'), file_path_hash, obj_id)
latest_contributor = contributors[0] latest_contributor = contributors[0]
if len(groups) > 1:
ctx = {}
ctx['groups'] = groups
repogrp_str = render_to_string("snippets/repo_group_list.html", ctx)
else:
repogrp_str = ''
return render_to_response('repo_view_file.html', { return render_to_response('repo_view_file.html', {
'repo': repo, 'repo': repo,
'obj_id': obj_id, 'obj_id': obj_id,
@@ -1332,6 +1339,7 @@ def repo_view_file(request, repo_id):
'last_commit_id': last_commit_id, 'last_commit_id': last_commit_id,
'read_only': read_only, 'read_only': read_only,
'page_from': page_from, 'page_from': page_from,
'repo_group_str': repogrp_str,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
def file_comment(request): def file_comment(request):