mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 15:38:15 +00:00
improved recommend-to-group & clean up code
This commit is contained in:
@@ -168,6 +168,10 @@ p {
|
|||||||
.op {
|
.op {
|
||||||
font-size:13px;
|
font-size:13px;
|
||||||
}
|
}
|
||||||
|
.op-target {
|
||||||
|
color:#c39;
|
||||||
|
word-wrap:break-word;
|
||||||
|
}
|
||||||
.no-deco,
|
.no-deco,
|
||||||
.no-deco:hover {
|
.no-deco:hover {
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
@@ -204,6 +208,25 @@ ul.with-bg li {
|
|||||||
border-style: dashed dashed dashed solid;
|
border-style: dashed dashed dashed solid;
|
||||||
border-left-color: #bbb;
|
border-left-color: #bbb;
|
||||||
}
|
}
|
||||||
|
.outer-caret,
|
||||||
|
.inner-caret {
|
||||||
|
height:0;
|
||||||
|
width:1px;
|
||||||
|
border:14px solid;
|
||||||
|
border-color:#CBCBCB transparent;
|
||||||
|
border-bottom-width:0;
|
||||||
|
z-index:100;
|
||||||
|
margin:0 auto;
|
||||||
|
}
|
||||||
|
.inner-caret {
|
||||||
|
border-top-color:#fff;
|
||||||
|
position:relative;
|
||||||
|
top:-15px;
|
||||||
|
left:-14px;
|
||||||
|
}
|
||||||
|
.placeholder {
|
||||||
|
color: #aaa;
|
||||||
|
}
|
||||||
.avatar {
|
.avatar {
|
||||||
border-radius:3px;
|
border-radius:3px;
|
||||||
}
|
}
|
||||||
@@ -839,9 +862,6 @@ ul.with-bg li {
|
|||||||
display:block;
|
display:block;
|
||||||
padding:0 12px;
|
padding:0 12px;
|
||||||
}
|
}
|
||||||
.op-target {
|
|
||||||
color:#c39;
|
|
||||||
}
|
|
||||||
#mv-form {
|
#mv-form {
|
||||||
width:500px;
|
width:500px;
|
||||||
padding:10px 20px;
|
padding:10px 20px;
|
||||||
@@ -1007,17 +1027,6 @@ ul.with-bg li {
|
|||||||
width:260px;
|
width:260px;
|
||||||
height:80px;
|
height:80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#recommend-msg,
|
|
||||||
#recommend-groups {
|
|
||||||
width:450px;
|
|
||||||
}
|
|
||||||
#recommend-groups {
|
|
||||||
margin-bottom:5px;
|
|
||||||
}
|
|
||||||
#recommend-msg {
|
|
||||||
height:55px;
|
|
||||||
}
|
|
||||||
/* group, org */
|
/* group, org */
|
||||||
.group-list {
|
.group-list {
|
||||||
margin-top:20px;
|
margin-top:20px;
|
||||||
@@ -1335,7 +1344,8 @@ ul.with-bg li {
|
|||||||
}
|
}
|
||||||
/* File comment */
|
/* File comment */
|
||||||
#file-comment,
|
#file-comment,
|
||||||
#to-group {
|
#to-group,
|
||||||
|
#recommend-to-group-form {
|
||||||
width:400px;
|
width:400px;
|
||||||
position:fixed;
|
position:fixed;
|
||||||
right:10px;
|
right:10px;
|
||||||
@@ -1371,29 +1381,13 @@ ul.with-bg li {
|
|||||||
word-wrap:break-word;
|
word-wrap:break-word;
|
||||||
}
|
}
|
||||||
#comment-caret,
|
#comment-caret,
|
||||||
#to-group-caret {
|
#to-group-caret,
|
||||||
|
#recommend-to-group-caret {
|
||||||
width:28px;
|
width:28px;
|
||||||
position:fixed;
|
position:fixed;
|
||||||
right:27px;
|
right:27px;
|
||||||
bottom:26px;
|
bottom:26px;
|
||||||
}
|
}
|
||||||
#comment-outer-caret,
|
|
||||||
#comment-inner-caret {
|
|
||||||
height:0;
|
|
||||||
width:1px;
|
|
||||||
border:14px solid;
|
|
||||||
border-color:#CBCBCB transparent;
|
|
||||||
border-bottom-width:0;
|
|
||||||
z-index:100;
|
|
||||||
margin:0 auto;
|
|
||||||
}
|
|
||||||
#comment-inner-caret {
|
|
||||||
border-top-color:#fff;
|
|
||||||
position:relative;
|
|
||||||
top:-15px;
|
|
||||||
left:-14px;
|
|
||||||
}
|
|
||||||
.placeholder { color: #aaa; }
|
|
||||||
/*to-group*/
|
/*to-group*/
|
||||||
#to-group {
|
#to-group {
|
||||||
min-width:100px;
|
min-width:100px;
|
||||||
@@ -1407,7 +1401,24 @@ ul.with-bg li {
|
|||||||
#to-group a:hover {
|
#to-group a:hover {
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
|
/*recommend to group*/
|
||||||
|
#recommend-to-group-form {
|
||||||
|
padding-bottom:10px;
|
||||||
|
}
|
||||||
|
#recommend-to-group-form .groups {
|
||||||
|
margin-bottom:6px;
|
||||||
|
}
|
||||||
|
#recommend-to-group-form .group-checkbox,
|
||||||
|
#recommend-to-group-form .group-name {
|
||||||
|
vertical-align:middle;
|
||||||
|
}
|
||||||
|
#recommend-to-group-form .group-name {
|
||||||
|
margin:0 10px 0 3px;
|
||||||
|
}
|
||||||
|
#recommend-to-group-form textarea {
|
||||||
|
width:100%;
|
||||||
|
height:5em;
|
||||||
|
}
|
||||||
/* text file diff */
|
/* text file diff */
|
||||||
div.diff-desc { margin: 10px 0; }
|
div.diff-desc { margin: 10px 0; }
|
||||||
div.diff-desc p { margin: 10px 0; }
|
div.diff-desc p { margin: 10px 0; }
|
||||||
|
@@ -54,6 +54,7 @@
|
|||||||
</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 %}
|
||||||
|
|
||||||
@@ -203,12 +204,10 @@
|
|||||||
<input type="submit" value="提交" class="submit" />
|
<input type="submit" value="提交" class="submit" />
|
||||||
<button class="simplemodal-close">取消</button>
|
<button class="simplemodal-close">取消</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% with attach_type='dir' %}
|
{% with attach_type='dir' %}
|
||||||
{% include "snippets/group_recommend_form.html" %}
|
{% include "snippets/group_recommend_form.html" %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
||||||
<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 %}
|
||||||
|
@@ -185,8 +185,8 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div id="comment-caret" class="hide">
|
<div id="comment-caret" class="hide">
|
||||||
<div id="comment-outer-caret">
|
<div class="outer-caret">
|
||||||
<div id="comment-inner-caret"></div>
|
<div class="inner-caret"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@@ -10,16 +10,29 @@ var group_list = []
|
|||||||
{% for group in groups %}
|
{% for group in groups %}
|
||||||
group_list.push('{{ group.props.group_name }} <{{ group.props.creator_name }}>');
|
group_list.push('{{ group.props.group_name }} <{{ group.props.creator_name }}>');
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
if (group_list.length == 1) {
|
$('#recommend-to-group-caret').css('left', $('#recommend').offset().left);
|
||||||
$('#recommend-groups').val(group_list[0]);
|
|
||||||
}
|
|
||||||
$('#recommend').click(function() {
|
$('#recommend').click(function() {
|
||||||
$('#recommend-form').modal({appendTo: '#main'});
|
if ($('#recommend-to-group-form').hasClass('hide')) {
|
||||||
addAutocomplete('#recommend-groups', '#recommend-form', group_list);
|
$('#recommend-to-group-form, #recommend-to-group-caret').removeClass('hide');
|
||||||
$('.ui-autocomplete').css({'max-height': window.innerHeight - $('.ui-autocomplete-input').offset().top - $('.ui-autocomplete-input').height() - 10, 'overflow': 'auto'});
|
} else {
|
||||||
|
$('#recommend-to-group-form, #recommend-to-group-caret').addClass('hide');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(document).click(function(e) {
|
||||||
|
var target = e.target || event.srcElement;
|
||||||
|
if (!$('#recommend, #recommend-to-group-form, #recommend-to-group-caret').is(target) && !($('#recommend-to-group-form, #recommend-to-group-caret').find('*').is(target))) {
|
||||||
|
$('#recommend-to-group-form, #recommend-to-group-caret').addClass('hide');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#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>');
|
$('#recommend-submit').click(function() {
|
||||||
|
if (!$.trim($('#recommend-to-group-form [name="message"]').val())) {
|
||||||
|
apply_form_error('recommend-form', '推荐语不能为空。');
|
||||||
|
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>');
|
||||||
$('#to-group').css({'width':$('#to-group').width(), 'left':$('#click-into-group').offset().left - $('#to-group').width()/3});
|
$('#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);
|
$('#to-group-caret').css('left', $('#click-into-group').offset().left);
|
||||||
$('#click-into-group').click(function() {
|
$('#click-into-group').click(function() {
|
||||||
@@ -44,10 +57,4 @@ $(document).click(function(e) {
|
|||||||
$('#to-group, #to-group-caret').addClass('hide');
|
$('#to-group, #to-group-caret').addClass('hide');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#recommend-submit').click(function() {
|
|
||||||
if (!$.trim($('#recommend-msg').val())) {
|
|
||||||
apply_form_error('recommend-form', '推荐语不能为空。');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@@ -1,25 +1,28 @@
|
|||||||
{% load url from future %}
|
{% load url from future %}
|
||||||
<form action="{% url 'group_recommend' %}" method="post" id="recommend-form" class="hide">{% csrf_token %}
|
<form action="{% url 'group_recommend' %}" method="post" id="recommend-to-group-form" class="hide">{% csrf_token %}
|
||||||
<h3>推荐
|
<h3>推荐
|
||||||
{% for name, link in zipped %}
|
{% for name, link in zipped %}
|
||||||
{% if forloop.last %}
|
{% if forloop.last %}
|
||||||
{{ name }}
|
<span class="op-target">{{ name }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
到群组:
|
到群组:
|
||||||
</h3>
|
</h3>
|
||||||
<div>
|
<div class="groups">
|
||||||
{% for group in groups %}
|
{% for group in groups %}
|
||||||
<input type="checkbox" name="groups" value="{{ group.id }}" {% if forloop.first and forloop.last %} checked {% endif %}>{{ group.group_name }}<br>
|
<input type="checkbox" name="groups" value="{{ group.id }}" id="{{ group.id }}" {% if forloop.first and forloop.last %}checked="checked"{% endif %} class="group-checkbox"><label for="{{ group.id }}" class="group-name">{{ group.group_name }}</label>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
<label>推荐语:</label>
|
||||||
<label>推荐语:</label><br />
|
<textarea name="message"></textarea>
|
||||||
<textarea name="message" id="recommend-msg"></textarea><br />
|
|
||||||
<input type="hidden" name="repo_id" value="{{ repo.id }}" />
|
<input type="hidden" name="repo_id" value="{{ repo.id }}" />
|
||||||
<input type="hidden" name="path" value="{{ path }}" />
|
<input type="hidden" name="path" value="{{ path }}" />
|
||||||
<input type="hidden" name="attach_type" value="{{ attach_type }}" />
|
<input type="hidden" name="attach_type" value="{{ attach_type }}" />
|
||||||
<p class="error hide"></p>
|
<p class="error hide"></p>
|
||||||
<input type="submit" id="recommend-submit" class="submit" value="提交" />
|
<input type="submit" id="recommend-submit" class="submit" value="提交" />
|
||||||
<button class="simplemodal-close">取消</button>
|
|
||||||
</form>
|
</form>
|
||||||
|
<div id="recommend-to-group-caret" class="hide">
|
||||||
|
<div class="outer-caret">
|
||||||
|
<div class="inner-caret"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
Reference in New Issue
Block a user