1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-29 12:04:02 +00:00
seahub/templates/myhome.html

144 lines
4.2 KiB
HTML
Raw Normal View History

{% extends "myhome_base.html" %}
2011-05-08 07:19:58 +00:00
2012-03-22 12:33:27 +00:00
{% block nav_home_class %}class="cur"{% endblock %}
{% block left_panel %}
<h3>已用空间</h3>
<p>{{ quota_usage|filesizeformat }} / 2 GB</p>
{% endblock %}
2011-05-08 07:19:58 +00:00
{% block right_panel %}
{% if output_msg %}
{% for key, value in output_msg.items %}
{% if key == 'info_msg' %}
<p class="notification">{{ value }} 请前往<a href="{{ SITE_ROOT }}shareadmin/">共享管理</a>查看。</p>
{% endif %}
{% if key == 'err_msg' %}
<p class="error">{{ value }}</p>
{% endif %}
{% endfor %}
{% endif %}
2011-10-12 16:17:48 +00:00
<h3>我拥有的同步目录</h3>
2012-03-22 12:33:27 +00:00
{% if owned_repos %}
<table class="repo-list">
2011-10-12 16:17:48 +00:00
<tr>
2012-04-24 14:31:24 +00:00
<th width="30%">名字</th>
<th width="50%">描述</th>
<th width="20%">操作</th>
2011-10-12 16:17:48 +00:00
</tr>
{% for repo in owned_repos %}
<tr>
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">{{ repo.props.name }}</a></td>
2011-10-12 16:17:48 +00:00
<td>{{ repo.props.desc }}</td>
2012-03-29 07:36:15 +00:00
<td>
<button data="{{ SITE_ROOT }}download/repo/?repo_id={{ repo.props.id }}" class="download-btn">下载</button>
2012-04-24 06:21:52 +00:00
<button data="{{ repo.props.id }}" class="repo-share-btn">共享</button>
2012-04-17 03:41:38 +00:00
<button data="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/" class="repo-delete-btn">删除</button>
2012-03-29 07:36:15 +00:00
</td>
2011-10-12 16:17:48 +00:00
</tr>
{% endfor %}
</table>
2012-03-22 12:33:27 +00:00
{% else %}
<p>暂无</p>
{% endif %}
2011-10-12 16:17:48 +00:00
2012-04-26 14:15:07 +00:00
<h3>共享给我的同步目录</h3>
{% if in_repos %}
<table class="repo-list">
2012-03-11 13:35:44 +00:00
<tr>
2012-04-24 14:31:24 +00:00
<th width="30%">名字</th>
2012-04-26 14:15:07 +00:00
<th width="20%">共享来源</th>
<th width="35%">描述</th>
<th width="15%">操作</th>
2012-03-11 13:35:44 +00:00
</tr>
2012-04-26 14:15:07 +00:00
{% for repo in in_repos %}
2012-03-11 13:35:44 +00:00
<tr>
2012-04-26 14:15:07 +00:00
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}">{{ repo.props.name }}</a></td>
<td>{{ repo.props.shared_email }}</td>
2012-03-11 13:35:44 +00:00
<td>{{ repo.props.desc }}</td>
2012-03-29 07:36:15 +00:00
<td>
2012-04-26 14:15:07 +00:00
<button data="{{ SITE_ROOT }}download/repo/?repo_id={{ repo.props.id }}" class="download-btn">下载</button>
2012-03-29 07:36:15 +00:00
</td>
2012-03-11 13:35:44 +00:00
</tr>
{% endfor %}
</table>
2012-03-22 12:33:27 +00:00
{% else %}
<p>暂无</p>
{% endif %}
2012-04-24 06:21:52 +00:00
<form id="repo-share-form" action="{{ SITE_ROOT }}home/my/" method="post" name="repo-share-form" class="hide">
<label>邮箱:</label><br />
<textarea id="to_email" name="to_email"></textarea><br />
2012-04-24 06:21:52 +00:00
<input id="share_repo_id" type="hidden" name="share_repo_id" value="" />
<p class="error hide">输入不能为空。</p>
<input type="submit" value="提交" id="share-submit-btn" />
2012-04-24 06:21:52 +00:00
</form>
{% endblock %}
{% block extra_script %}
<script type="text/javascript">
$(function() {
//repo-share-form email autocomplete
var contact_list = [];
{% for contact in contacts %}
contact_list.push('{{ contact.contact_email }}');
{% endfor %}
2012-05-07 08:33:36 +00:00
function split(val) {
return val.split(/,\s*/);
}
function extractLast(term) {
return split(term).pop();
2012-05-07 08:33:36 +00:00
}
$("#to_email")
.bind("keydown", function(event) {
if (event.keyCode === $.ui.keyCode.TAB &&
$(this).data("autocomplete").menu.active) {
event.preventDefault();
}
})
.autocomplete({
appendTo: '#repo-share-form',
autoFocus: true,
delay: 100,
minLength: 0,
source: function(request, response) {
response($.ui.autocomplete.filter(contact_list, extractLast(request.term)));
},
focus: function() {
return false;
},
select: function(event, ui) {
var terms = split(this.value);
terms.pop();
terms.push(ui.item.value);
terms.push("");
this.value = terms.join(", ");
return false;
}
});
$(".repo-share-btn").click(function() {
$("#share_repo_id").val($(this).attr("data"));
$("#repo-share-form").modal({appendTo: "#main", containerCss:{padding:18}});
});
//check before post
$('#share-submit-btn').click(function() {
if (!$.trim($('#to_email').attr('value'))) {
$('#repo-share-form .error').removeClass('hide');
return false;
}
return true;
});
2012-05-07 08:33:36 +00:00
addConfirmTo($('.repo-delete-btn'));
2012-05-07 08:33:36 +00:00
});
</script>
2011-05-08 07:19:58 +00:00
{% endblock %}