1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 06:33:48 +00:00

Rewrite home and myhome page

This commit is contained in:
plt
2011-10-13 00:17:48 +08:00
parent 29b7e1d334
commit 3c9b48fea7
10 changed files with 113 additions and 47 deletions

View File

View File

@@ -0,0 +1,9 @@
from datetime import datetime
from django import template
register = template.Library()
@register.filter(name='tsstr_sec')
def tsstr_sec(value):
"""Turn a timestamp to string"""
return datetime.utcfromtimestamp(value).strftime("%Y-%m-%d %H:%M:%S")

View File

@@ -21,13 +21,19 @@ table.default tr.even { background-color: #FAFAFA; }
table.default tr.odd { background-color: #E0E0E0; }
table.default tr.first { background-color: #00FF00; }
/* container */
#wrapper { margin:0 auto; width:950px;
font-family: , Arial, Helvetica, sans-serif; font-size:13px; }
#header { font-size: 14px;font-weight: bold;min-height: 60px;}
#main { padding-top:10px; }
#wrapper { font: 13px/1.5 , Arial, Helvetica, sans-serif; }
#header, #main, #footer { width:950px; }
#header, #main { margin:0 auto; }
#header { font-size: 14px; font-weight: bold; }
#left-panel { float:left; width:120px; }
#right-panel { float:right; width:800px; }
#footer { color:#999; padding-top:2px; margin:25px 0; border-top:1px solid #DDD; }
#footer { color:#999; padding-top:2px; margin:25px auto; border-top:1px solid #DDD; }
/* top-bar */
#top-bar { height:20px; padding-bottom:21px; background:#fff url('../img/dropshadow.png') repeat-x center bottom; }
.top-bar { height:20px; color:#fff; text-align:right; font-weight:bold; background:#606; }
.top-bar-in { width:950px; margin:0 auto; }
.top-bar a { color:#ddd; font-weight:normal; }
.top-bar a:hover { background:#A0A; }
/* #header */
#header .top_operation { float:right; margin:2px 10px 0 0; color:#ddd; font-size:13px; }
#header .top_operation a { font-weight:normal; font-size:13px; margin-left:2px; text-decoration: none; }
@@ -45,8 +51,8 @@ div.nav-separator { clear: both; border-top: #FF8C00 1px solid; border-bottom: n
/* footer */
#footer a { color:#333; text-decoration:none; }
/* main */
h2 { font-size:16px; color:#292; padding:4px 0 2px 0px; margin:10px 0; }
h3 { font-size: 14px; color: #808; margin: 10px 0px 4px 0; }
h2 { font-size:18px; color:#808; padding:4px 0 2px 0px; margin: 0; }
h3 { font-size:14px; color:#808; margin-top:10px; font-weight:normal; }
p { line-height: 22px; }
ol { margin:0; padding:0px 0 0 2em; list-style-position:inside; }
ul { padding:4px 0 0 0; }

BIN
media/img/dropshadow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

View File

@@ -14,12 +14,13 @@
<body>
<div id="wrapper">
<div id="header">
<div class="top_operation">
<div id="top-bar">
<div class="top-bar">
<div class="top-bar-in">
{% if request.user.is_authenticated %}
欢迎, {{ request.user }}.
<a href="{{ SITE_ROOT }}home/my/">我的页面</a>
<a href="{{ SITE_ROOT }}home/">社区</a>
<a href="{{ SITE_ROOT }}home/">主页</a>
<a href="{{ SITE_ROOT }}profile/">设置</a>
{% if request.user.is_staff %}
<a href="{{ SITE_ROOT }}admin/">管理</a>
@@ -30,19 +31,28 @@
<a href="{{ SITE_ROOT }}accounts/register/">注册</a>
{% endif %}
</div>
<img id="logo" src="{{ MEDIA_URL }}img/logo.png" title="Seafile" />
</div>
</div>
<div id="header">
<div class="logo">
<a href="/home/" id="logo"><img src="{{ MEDIA_URL }}img/logo.png" title="Seafile" alt="Seafile logo" /></a>
</div>
<div class="navs">
{% block nav %}
<ul class="nav">
<li>
<a href="{{ SITE_ROOT }}home/">Home</a>
<a href="{{ SITE_ROOT }}home/">主页</a>
</li>
<!--
<li>
<a href="{{ SITE_ROOT }}peers/">Peers</a>
</li>
-->
<!--
<li>
<a href="{{ SITE_ROOT }}groups/">Groups</a>
</li>
-->
</ul>
{% endblock %}
</div>

View File

@@ -6,18 +6,19 @@ Welcome.
{% block right_panel %}
<h2>What's Ccnet</h2>
<p>Ccnet is a group oriented communication and file sharing tool. </p>
<h2>什么是 Seafile</h2>
<p>
Seafile 是一个海量文件同步和共享软件。 它非常适合于一个小组来同步和共享大量的文件,比如建立一个电子书的仓库。 它也适合于个人在多台电脑间同步数据。
</p>
<p>It provide two basic functions:<p>
<ul>
<li>Versioned data sharing and synchronization.</li>
<li>Group oriented message communication.</li>
</ul>
<p>
使用上, seafile 允许用户创建多个文件盒, 每个文件盒可以单独的设置权限、加密、共享和同步。
</p>
<h2>用户控制数据</h2>
<p>
与其他的文件同步软件不同, seafile 强调用户对自身数据的控制。 用户的数据和数据的操作历史完整的保存在用户的电脑上, 服务器只是作为数据的中转站。 如果用户选择对数据加密, 加密的过程完全在用户的电脑上进行, 服务器上不知道文件是否加密。
</p>
<p>Features:</p>
<ul>
<li>data is at users' control</li>
</ul>
{% endblock %}

View File

@@ -1,5 +1,32 @@
{% extends "myhome_base.html" %}
{% block right_panel %}
Ccnet ID: {{ ccnet_user_id }}
<h3>基本信息</h3>
<table class="default">
<tr>
<td>Seafile ID</td>
<td>{{ ccnet_user_id }}</td>
</tr>
<tr>
</tr>
</table>
<h3>我的文件盒</h3>
<table class="repo-list default">
<tr>
<th>名字</th>
<th>ID</th>
<th>描述</th>
</tr>
{% for repo in owned_repos %}
<tr>
<td><a href="/repo/{{ repo.props.id }}">{{ repo.props.name }}</a></td>
<td>{{ repo.props.id }}</td>
<td>{{ repo.props.desc }}</td>
</tr>
{% endfor %}
</table>
{% endblock %}

View File

@@ -2,8 +2,9 @@
{% block nav %}
<ul class="nav">
<li>
<a href="{{ SITE_ROOT }}home/my/">Home</a>
<a href="{{ SITE_ROOT }}home/my/">我的页面</a>
</li>
<!--
<li>
<a href="{{ SITE_ROOT }}repos/my/">Files</a>
</li>
@@ -13,5 +14,6 @@
<li>
<a href="{{ SITE_ROOT }}groups/">Groups</a>
</li>
-->
</ul>
{% endblock %}

View File

@@ -1,19 +1,25 @@
{% extends "myhome_base.html" %}
{% load seahub_tags %}
{% block right_panel %}
<h3>Basic Info</h3>
<p><i>Name:</i> {{repo.props.name}}</p>
<p><i>ID:</i> {{repo.props.id}}</p>
<p><i>Description:</i> {{repo.props.desc}}</p>
<h2>{{repo.props.name}}</h2>
<table class="default">
<tr>
<td>ID</td>
<td>{{repo.props.id}}</td>
</tr>
<tr>
<td>描述</td>
<td>{{repo.props.desc}}</td>
</tr>
</table>
<h3>Branches</h3>
Current branch: {{repo.props.head_branch}}
<h3>分支</h3>
<table class="branch-list default">
<tr>
<th>Name</th>
<th>分支名</th>
<th>Head Commit</th>
</tr>
{% for branch in branches %}
@@ -34,7 +40,7 @@ Current branch: {{repo.props.head_branch}}
{% for commit in commits %}
<tr>
<td>{{ commit.props.id }}</td>
<td>{{ commit.props.ctime }}</td>
<td>{{ commit.props.ctime|tsstr_sec }}</td>
<td>{{ commit.props.desc }}</td>
</tr>
{% endfor %}

View File

@@ -132,8 +132,13 @@ def myhome(request):
except UserProfile.DoesNotExist:
pass
owned_repos = []
if ccnet_user_id:
owned_repos = seafile_rpc.list_owned_repos(ccnet_user_id)
return render_to_response('myhome.html', {
"ccnet_user_id": ccnet_user_id,
"owned_repos": owned_repos,
}, context_instance=RequestContext(request))