1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-16 23:29:49 +00:00

[backbone] Several small interface improvements

This commit is contained in:
Daniel Pan
2015-02-11 22:36:35 +08:00
parent 1a47494adb
commit e4036efab2
6 changed files with 79 additions and 26 deletions

View File

@@ -56,6 +56,7 @@ define([
this.$tabs.show(); this.$tabs.show();
this.$table.hide(); this.$table.hide();
this.$loadingTip.show(); this.$loadingTip.show();
$('#mylib-tab', this.$tabs).parent().addClass('ui-state-active');
}, },
show: function() { show: function() {
@@ -65,6 +66,7 @@ define([
hide: function() { hide: function() {
this.$el.hide(); this.$el.hide();
this.$table.hide(); this.$table.hide();
$('#mylib-tab', this.$tabs).parent().removeClass('ui-state-active');
}, },
createRepo: function() { createRepo: function() {

View File

@@ -56,6 +56,7 @@ define([
//this.$table.parent().show(); //this.$table.parent().show();
this.$table.hide(); this.$table.hide();
this.$loadingTip.show(); this.$loadingTip.show();
$('#shared-lib-tab', this.$tabs).parent().addClass('ui-state-active');
}, },
show: function() { show: function() {
@@ -65,6 +66,7 @@ define([
hide: function() { hide: function() {
this.$el.hide(); this.$el.hide();
this.$table.hide(); this.$table.hide();
$('#shared-lib-tab', this.$tabs).parent().removeClass('ui-state-active');
}, },

View File

@@ -28,6 +28,8 @@ define([
this.sharedReposView = new SharedReposView(); this.sharedReposView = new SharedReposView();
this.dirView = new DirView(); this.dirView = new DirView();
this.groupView = new GroupNavView(); this.groupView = new GroupNavView();
Common.initAccountPopup();
}, },

View File

@@ -228,6 +228,53 @@ define([
return result; return result;
}, },
closePopup: function(e, popup, popup_switch) {
var target = e.target || event.srcElement;
if (!popup.hasClass('hide') && !popup.is(target) && !popup.find('*').is(target) && !popup_switch.is(target) && !popup_switch.find('*').is(target) ) {
popup.addClass('hide');
}
},
initAccountPopup: function() {
// TODO: need improving
$('#my-info').click(function() {
var popup = $('#user-info-popup');
popup.toggleClass('hide');
if (!popup.hasClass('hide')) {
var loading_tip = $('.loading-tip', popup),
space_traffic = $('#space-traffic');
loading_tip.show();
space_traffic.addClass('hide');
$('.error', popup).addClass('hide');
$.ajax({
url: space_traffic.data('url'),
dataType: 'json',
cache: false,
success: function(data) {
loading_tip.hide();
space_traffic.html(data['html']).removeClass('hide');
},
error: function (xhr, textStatus, errorThrown) {
if (xhr.responseText) {
var error = $.parseJSON(xhr.responseText).error;
loading_tip.hide();
if ($('.error', popup).length == 0) {
loading_tip.after('<p class="error alc">' + error + '</p>');
} else {
$('.error', popup).removeClass('hide');
}
}
}
});
}
});
_this = this;
$(document).click(function(e) {
_this.closePopup(e, $('#user-info-popup'), $('#my-info'));
});
},
fileSizeFormat: function(bytes, precision) { fileSizeFormat: function(bytes, precision) {
var kilobyte = 1024; var kilobyte = 1024;
var megabyte = kilobyte * 1024; var megabyte = kilobyte * 1024;

View File

@@ -11,7 +11,7 @@ from seaserv import FILE_SERVER_ROOT, FILE_SERVER_PORT
PROJECT_ROOT = os.path.join(os.path.dirname(__file__), os.pardir) PROJECT_ROOT = os.path.join(os.path.dirname(__file__), os.pardir)
DEBUG = True DEBUG = False
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
ADMINS = ( ADMINS = (

View File

@@ -1,5 +1,5 @@
{% load i18n %} {% load i18n %}
{% trans "Libraries" %} / <a href="#" class="path-link normal">{% trans "Libraries" %}</a> /
<a href="#<%= category %>" class="path-link normal"><% if (category == 'my-libs') { %>{% trans "Mine" %}<% } %><% if (category == 'shared-libs') { %>{% trans "Shared" %}<% } %></a> / <a href="#<%= category %>" class="path-link normal"><% if (category == 'my-libs') { %>{% trans "Mine" %}<% } %><% if (category == 'shared-libs') { %>{% trans "Shared" %}<% } %></a> /
<% if (path == '/') { %> <% if (path == '/') { %>
<%= repo_name %> / <%= repo_name %> /