1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 10:26:17 +00:00

[libs] modified ui of 'lib list' & 'lib create'

* removed 'description', added 'size'
This commit is contained in:
llj
2015-04-02 18:51:48 +08:00
committed by Daniel Pan
parent f30cb39ef5
commit 62fe930d3a
16 changed files with 70 additions and 58 deletions

View File

@@ -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;

View File

@@ -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");

View File

@@ -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()});
},
});

View File

@@ -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(),

View File

@@ -60,7 +60,7 @@ define([
Common.showConfirm(
gettext('Unshare Library'),
gettext('Are you sure you want to unshare {placeholder} ?')
.replace(/\{placeholder\}/g, '<span class="op-target">' + this.model.get('name') + '</span>'),
.replace(/\{placeholder\}/g, '<span class="op-target">' + Common.HTMLescape(this.model.get('name')) + '</span>'),
yesCallback
);
},

View File

@@ -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: {

View File

@@ -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,

View File

@@ -81,11 +81,11 @@
<thead>
<tr>
<th width="4%"><!--icon--></th>
<th width="20%">{% trans "Name" %} <span class="by-name icon-caret-up cspt"></span></th>
<th width="33%">{% trans "Description" %}</th>
<th width="44%">{% trans "Name" %} <span class="by-name icon-caret-up cspt"></span></th>
<th width="6%"><!--op--></th>
<th width="16%">{% trans "Size" %}</th>
<th width="16%">{% trans "Last Update" %} <span class="by-time icon-caret-down cspt"></span></th>
<th width="14%">{% trans "Shared By" %}</th>
<th width="13%">{% trans "Operations" %}</th>
</tr>
</thead>
<tbody></tbody>

View File

@@ -3,8 +3,6 @@
<h3>{% trans "New Library"%}</h3>
<label>{% trans "Name"%}</label><br/>
<input type="text" name="repo_name" value="" maxlength="{{max_file_name}}" class="input" /><br />
<label>{% trans "Description"%}</label><br/>
<textarea name="repo_desc" class="textarea"></textarea><br />
<% if (showSharePerm) { %>
<label>{% trans "Share Permission"%}</label><br />
<select name="permission" class="perm">

View File

@@ -11,11 +11,12 @@
<% } %>
</td>
<td><a href="#/lib/<%= id %>"><%- name %></a></td>
<td><%- desc %></td>
<td><%= mtime_relative %></td>
<td><%- owner_nickname %></td>
<td>
<td class="alc">
<% if (app.pageOptions.isGroupStaff) { %>
<img src="<%= app.config.mediaUrl%>img/rm.png" alt="" class="cancel-share op-icon vh" title="{% trans "Unshare" %}" />
<% } %>
</td>
<td><%= size_formatted %></td>
<td><%= mtime_relative %></td>
<td><%- owner_nickname %></td>

View File

@@ -11,11 +11,11 @@
<% } %>
</td>
<td><a href="#/lib/<%= id %>"><%- name %></a></td>
<td><%- desc %></td>
<td><%- mtime_relative %></td>
<td><%- share_from %></td>
<td>
<% if (show_unshare_btn == true) { %>
<td class="alc">
<% if (show_unshare_btn) { %>
<img src="<%= app.config.mediaUrl%>img/rm.png" alt="" class="cancel-share op-icon vh" title="{% trans "Unshare" %}" />
<% } %>
</td>
<td><%- size_formatted %></td>
<td><%= mtime_relative %></td>
<td><%- share_from %></td>

View File

@@ -7,11 +7,12 @@
<% } %>
</td>
<td><a href="#my-libs/lib/<%= id %>"><%- name %></a></td>
<td><%- desc %></td>
<td><%= mtime_relative %></td>
<td>
<div class="op-container">
<img src="{{ MEDIA_URL }}img/share_20.png" alt="" class="repo-share-btn op-icon vh" title="{% trans "Share" %}" />
<img src="{{ MEDIA_URL }}img/rm.png" class="repo-delete-btn op-icon vh" title="{% trans "Delete" %}" />
</div>
</td>
<td><%= size_formatted %></td>
<td><%= mtime_relative %></td>

View File

@@ -11,9 +11,9 @@
<% } %>
</td>
<td><a href="#shared-libs/lib/<%= id %>"><%- name %></a></td>
<td><%- desc %></td>
<td><%= mtime_relative %></td>
<td><span title="<%- owner %>"><%- owner_nickname %></span></td>
<td>
<td class="alc">
<span class="icon-trash unshare-btn op-icon vh" title="{% trans "Leave Share" %}"></span>
</td>
<td><%= size_formatted %></td>
<td><%= mtime_relative %></td>
<td><span title="<%- owner %>"><%- owner_nickname %></span></td>

View File

@@ -7,10 +7,10 @@
<% } %>
</td>
<td><a href="#my-sub-libs/lib/<%= id %>"><%- name %></a></td>
<td><a href="#my-libs/lib/<%= origin_repo_id %><%- origin_path %>"><%- abbrev_origin_path %></a></td>
<td><%- mtime_relative %></td>
<td>
<div class="op-container">
<div class="op-container alc">
<img src="{{MEDIA_URL}}img/rm.png" class="repo-delete-btn op-icon vh" title="{% trans "Delete" %}" />
</div>
</td>
<td><a href="#my-libs/lib/<%= origin_repo_id %><%- origin_path %>"><%- abbrev_origin_path %></a></td>
<td><%= mtime_relative %></td>

View File

@@ -89,10 +89,10 @@
<thead>
<tr>
<th width="4%"><!--icon--></th>
<th width="30%">{% trans "Name" %} <span class="by-name icon-caret-up cspt"></span></th>
<th width="36%">{% trans "Description" %}</th>
<th width="46%">{% trans "Name" %} <span class="by-name icon-caret-up cspt"></span></th>
<th width="10%"><!--op--></th>
<th width="20%">{% trans "Size" %}</th>
<th width="20%">{% trans "Last Update" %} <span class="by-time icon-caret-down cspt"></span></th>
<th width="10%"></th>
</tr>
</thead>
<tbody></tbody>
@@ -108,10 +108,10 @@
<thead>
<tr>
<th width="4%"><!--icon--></th>
<th width="24%">{% trans "Name" %}</th>
<th width="38%">{% trans "Origin" %}</th>
<th width="38%">{% trans "Name" %}</th>
<th width="6%"><!--op--></th>
<th width="30%">{% trans "Origin" %}</th>
<th width="22%">{% trans "Last Update" %}</th>
<th width="12%">{% trans "Operations" %}</th>
</tr>
</thead>
<tbody></tbody>
@@ -127,11 +127,11 @@
<thead>
<tr>
<th width="4%"><!--icon--></th>
<th width="28%">{% trans "Name" %} <span class="by-name icon-caret-up cspt"></span></th>
<th width="28%">{% trans "Description" %}</th>
<th width="38%">{% trans "Name" %} <span class="by-name icon-caret-up cspt"></span></th>
<th width="6%"><!--op--></th>
<th width="18%">{% trans "Size" %}</th>
<th width="18%">{% trans "Last Update" %} <span class="by-time icon-caret-down cspt"></span></th>
<th width="16%">{% trans "Shared By" %}</th>
<th width="6%"></th>
</tr>
</thead>
<tbody></tbody>
@@ -164,8 +164,6 @@
</tr>
</table>
{% include "snippets/repo_create_form.html" %}
{% if need_guide %}
<div id="guide-for-new" class="hide">
<span class="icon-lightbulb fleft"></span>

View File

@@ -28,18 +28,18 @@
</div>
<table class="repo-list hide">
<thead>
<tr>
<th width="4%"></th>
<th width="20%">{% trans "Name"%} <span class="by-name icon-caret-up cspt"></span></th>
<th width="20%">{% trans "Description"%}</th>
<th width="20%">{% trans "Last Update"%} <span class="by-time icon-caret-down cspt"></span></th>
<th width="20%">{% trans "Share From"%}</th>
<th width="16%">{% trans "Operations"%}</th>
</tr>
</thead>
<tbody>
</tbody>
<thead>
<tr>
<th width="4%"></th>
<th width="30%">{% trans "Name"%} <span class="by-name icon-caret-up cspt"></span></th>
<th width="6%"><!--op--></th>
<th width="20%">{% trans "Size"%}</th>
<th width="20%">{% trans "Last Update"%} <span class="by-time icon-caret-down cspt"></span></th>
<th width="20%">{% trans "Share From"%}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<img src="{{MEDIA_URL}}img/loading-icon.gif" alt="" class="loading-tip" />
<div class="empty-tips hide">