diff --git a/media/css/seahub.css b/media/css/seahub.css
index f3508a12ee..0d3170e84c 100644
--- a/media/css/seahub.css
+++ b/media/css/seahub.css
@@ -1596,7 +1596,10 @@ textarea:-moz-placeholder {/* for FF */
}
#repo-create-form .perm {
width:268px;
- margin-bottom:10px;
+ margin-bottom:5px;
+}
+#repo-create-form .checkbox-label { /* for "Encrypt" */
+ margin:10px 0 0;
}
.event-group-hd {
padding: 8px;
diff --git a/media/scripts/app/models/repo.js b/media/scripts/app/models/repo.js
index 9fff178d76..833fecaf8a 100644
--- a/media/scripts/app/models/repo.js
+++ b/media/scripts/app/models/repo.js
@@ -22,12 +22,12 @@ define([
attrs.id = response.id || response.repo_id;
attrs.name = response.name || response.repo_name;
attrs.desc = response.desc || response.repo_desc;
+ attrs.size_formatted = response.size_formatted || response.repo_size_formatted;
return attrs;
},
validate: function(attrs, options) {
if (!attrs.name) return gettext("Name is required");
- if (!attrs.desc) return gettext("Description is required");
if (attrs.encrypted) {
if (!attrs.passwd1) return gettext("Please enter password");
diff --git a/media/scripts/app/views/add-group-repo.js b/media/scripts/app/views/add-group-repo.js
index 4fa8fd8f6b..577b88a1c8 100644
--- a/media/scripts/app/views/add-group-repo.js
+++ b/media/scripts/app/views/add-group-repo.js
@@ -19,7 +19,7 @@ define([
newAttributes: function() {
var baseAttrs = AddRepoView.prototype.newAttributes.apply(this);
- return _.extend(baseAttrs, $('select[name=permission]', this.$el).val());
+ return _.extend(baseAttrs, {'permission': $('select[name=permission]', this.$el).val()});
},
});
diff --git a/media/scripts/app/views/add-repo.js b/media/scripts/app/views/add-repo.js
index 96489ca3bf..262b531df0 100644
--- a/media/scripts/app/views/add-repo.js
+++ b/media/scripts/app/views/add-repo.js
@@ -39,7 +39,6 @@ define([
newAttributes: function() {
return {
name: $('input[name=repo_name]', this.$el).val().trim(),
- desc: $('textarea[name=repo_desc]', this.$el).val().trim(),
encrypted: $('#encrypt-switch', this.$el).parent().hasClass('checkbox-checked'),
passwd1: $('input[name=passwd]', this.$el).val(),
passwd2: $('input[name=passwd_again]', this.$el).val(),
diff --git a/media/scripts/app/views/group-repos.js b/media/scripts/app/views/group-repos.js
index d59eae7398..8a99656a74 100644
--- a/media/scripts/app/views/group-repos.js
+++ b/media/scripts/app/views/group-repos.js
@@ -60,7 +60,7 @@ define([
Common.showConfirm(
gettext('Unshare Library'),
gettext('Are you sure you want to unshare {placeholder} ?')
- .replace(/\{placeholder\}/g, '' + this.model.get('name') + ''),
+ .replace(/\{placeholder\}/g, '' + Common.HTMLescape(this.model.get('name')) + ''),
yesCallback
);
},
diff --git a/media/scripts/app/views/repo.js b/media/scripts/app/views/repo.js
index 72118fff54..f7cee6994e 100644
--- a/media/scripts/app/views/repo.js
+++ b/media/scripts/app/views/repo.js
@@ -5,13 +5,13 @@ define([
'common',
'app/views/share',
'text!' + app.config._tmplRoot + 'repo.html'
-], function($, _, Backbone, Common, ShareView, reposTemplate) {
+], function($, _, Backbone, Common, ShareView, repoTemplate) {
'use strict';
var RepoView = Backbone.View.extend({
tagName: 'tr',
- template: _.template(reposTemplate),
+ template: _.template(repoTemplate),
repoDelConfirmTemplate: _.template($('#repo-del-confirm-template').html()),
events: {
diff --git a/seahub/api2/views.py b/seahub/api2/views.py
index 431bdca767..e56f5776c1 100644
--- a/seahub/api2/views.py
+++ b/seahub/api2/views.py
@@ -27,6 +27,7 @@ from django.db.models import F
from django.http import HttpResponse, Http404
from django.template import RequestContext
from django.template.loader import render_to_string
+from django.template.defaultfilters import filesizeformat
from django.shortcuts import render_to_response
from django.utils import timezone
@@ -471,6 +472,8 @@ def repo_download_info(request, repo_id, gen_sync_token=True):
token = ''
repo_name = repo.name
repo_desc = repo.desc
+ repo_size = repo.size
+ repo_size_formatted = filesizeformat(repo.size)
enc = 1 if repo.encrypted else ''
magic = repo.magic if repo.encrypted else ''
random_key = repo.random_key if repo.random_key else ''
@@ -488,6 +491,8 @@ def repo_download_info(request, repo_id, gen_sync_token=True):
'repo_id': repo_id,
'repo_name': repo_name,
'repo_desc': repo_desc,
+ 'repo_size': repo_size,
+ 'repo_size_formatted': repo_size_formatted,
'mtime': repo.latest_modify,
'mtime_relative': translate_seahub_time(repo.latest_modify),
'encrypted': enc,
@@ -526,7 +531,7 @@ class Repos(APIView):
repos_json = []
if filter_by['mine']:
owned_repos = get_owned_repo_list(request)
- owned_repos.sort(lambda x, y: cmp(y.latest_modify, x.latest_modify))
+ owned_repos.sort(lambda x, y: cmp(y.last_modify, x.last_modify))
for r in owned_repos:
# do not return virtual repos
if r.is_virtual:
@@ -541,6 +546,7 @@ class Repos(APIView):
"mtime": r.last_modify,
"mtime_relative": translate_seahub_time(r.last_modify),
"size": r.size,
+ "size_formatted": filesizeformat(r.size),
"encrypted": r.encrypted,
"permission": 'rw', # Always have read-write permission to owned repo
"virtual": r.is_virtual,
@@ -567,7 +573,7 @@ class Repos(APIView):
repo.abbrev_origin_path = get_abbrev_origin_path(
repo.origin_repo_name, repo.origin_path)
- sub_repos.sort(lambda x, y: cmp(y.latest_modify, x.latest_modify))
+ sub_repos.sort(lambda x, y: cmp(y.last_modify, x.last_modify))
for r in sub_repos:
# print r._dict
repo = {
@@ -577,8 +583,8 @@ class Repos(APIView):
"origin_repo_id": r.origin_repo_id,
"origin_path": r.origin_path,
"abbrev_origin_path": r.abbrev_origin_path,
- "mtime": r.latest_modify,
- "mtime_relative": translate_seahub_time(r.latest_modify),
+ "mtime": r.last_modify,
+ "mtime_relative": translate_seahub_time(r.last_modify),
"owner": email,
"desc": r.desc,
"size": r.size,
@@ -608,6 +614,7 @@ class Repos(APIView):
"mtime": r.last_modify,
"mtime_relative": translate_seahub_time(r.last_modify),
"size": r.size,
+ "size_formatted": filesizeformat(r.size),
"encrypted": r.encrypted,
"permission": r.user_perm,
"share_type": r.share_type,
@@ -655,6 +662,7 @@ class Repos(APIView):
"mtime": r.last_modified,
"mtime_relative": translate_seahub_time(r.last_modified),
"size": r.size,
+ "size_formatted": filesizeformat(r.size),
"encrypted": r.encrypted,
"permission": r.permission,
"share_from": r.user,
@@ -3029,10 +3037,12 @@ class GroupRepos(APIView):
"id": repo.id,
"name": repo.name,
"desc": repo.desc,
+ "size": repo.size,
+ "size_formatted": filesizeformat(repo.size),
"mtime": repo.latest_modify,
"mtime_relative": translate_seahub_time(repo.latest_modify),
"encrypted": repo.encrypted,
- "permission": 'rw', # Always have read-write permission to owned repo
+ "permission": permission,
"owner": username,
"owner_nickname": email2nickname(username)
}
@@ -3054,6 +3064,8 @@ class GroupRepos(APIView):
"id": r.id,
"name": r.name,
"desc": r.desc,
+ "size": r.size,
+ "size_formatted": filesizeformat(r.size),
"mtime": r.latest_modify,
"mtime_relative": translate_seahub_time(r.latest_modify),
"encrypted": r.encrypted,
diff --git a/seahub/group/templates/group/group_info.html b/seahub/group/templates/group/group_info.html
index d90b588aef..a9c3c01fa2 100644
--- a/seahub/group/templates/group/group_info.html
+++ b/seahub/group/templates/group/group_info.html
@@ -81,11 +81,11 @@
- {% trans "Name" %}
- {% trans "Description" %}
+ {% trans "Name" %}
+
+ {% trans "Size" %}
{% trans "Last Update" %}
{% trans "Shared By" %}
- {% trans "Operations" %}