mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-14 06:11:16 +00:00
update
This commit is contained in:
@@ -5,8 +5,8 @@ define([
|
||||
'common',
|
||||
'moment',
|
||||
'app/views/fileupload',
|
||||
'sysadmin-app/views/library-dirent',
|
||||
'sysadmin-app/collection/library-dirents'
|
||||
'sysadmin-app/views/dirent',
|
||||
'sysadmin-app/collection/dirents'
|
||||
], function($, _, Backbone, Common, Moment, FileUploadView,
|
||||
DirentView, DirentCollection) {
|
||||
'use strict';
|
@@ -8,7 +8,7 @@ define([
|
||||
], function($, _, Backbone, Common, Moment, HLItemView) {
|
||||
'use strict';
|
||||
|
||||
var LibraryDirentView = HLItemView.extend({
|
||||
var DirentView = HLItemView.extend({
|
||||
tagName: 'tr',
|
||||
|
||||
template: _.template($('#dirent-item-tmpl').html()),
|
||||
@@ -76,5 +76,5 @@ define([
|
||||
|
||||
});
|
||||
|
||||
return LibraryDirentView;
|
||||
return DirentView;
|
||||
});
|
@@ -11,7 +11,7 @@ define([
|
||||
Select2, HLItemView) {
|
||||
'use strict';
|
||||
|
||||
var LibraryView = HLItemView.extend({
|
||||
var RepoView = HLItemView.extend({
|
||||
tagName: 'tr',
|
||||
|
||||
template: _.template($('#library-item-tmpl').html()),
|
||||
@@ -107,8 +107,12 @@ define([
|
||||
|
||||
render: function() {
|
||||
var data = this.model.toJSON(),
|
||||
icon_size = Common.isHiDPI() ? 96 : 24,
|
||||
icon_url = this.model.getIconUrl(icon_size),
|
||||
last_accessed = Moment(data['last_accessed']);
|
||||
|
||||
data['icon_url'] = icon_url;
|
||||
data['icon_title'] = this.model.getIconTitle();
|
||||
data['enable_sys_admin_view_repo'] = app.pageOptions.enable_sys_admin_view_repo;
|
||||
data['is_pro'] = app.pageOptions.is_pro;
|
||||
data['time'] = last_accessed.format('LLLL');
|
||||
@@ -121,5 +125,5 @@ define([
|
||||
|
||||
});
|
||||
|
||||
return LibraryView;
|
||||
return RepoView;
|
||||
});
|
@@ -4,26 +4,26 @@ define([
|
||||
'backbone',
|
||||
'common',
|
||||
'moment',
|
||||
'sysadmin-app/views/library',
|
||||
'sysadmin-app/collection/libraries'
|
||||
], function($, _, Backbone, Common, Moment, LibraryView, LibraryCollection) {
|
||||
'sysadmin-app/views/repo',
|
||||
'sysadmin-app/collection/repos'
|
||||
], function($, _, Backbone, Common, Moment, RepoView, RepoCollection) {
|
||||
'use strict';
|
||||
|
||||
var LibrariesView = Backbone.View.extend({
|
||||
var ReposView = Backbone.View.extend({
|
||||
|
||||
id: 'admin-libraries',
|
||||
id: 'libraries',
|
||||
|
||||
template: _.template($("#libraries-tmpl").html()),
|
||||
|
||||
initialize: function() {
|
||||
this.libraryCollection = new LibraryCollection();
|
||||
this.listenTo(this.libraryCollection, 'add', this.addOne);
|
||||
this.listenTo(this.libraryCollection, 'reset', this.reset);
|
||||
this.repoCollection = new RepoCollection();
|
||||
this.listenTo(this.repoCollection, 'add', this.addOne);
|
||||
this.listenTo(this.repoCollection, 'reset', this.reset);
|
||||
this.render();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var data = {'cur_tab': 'all',};
|
||||
var data = {'cur_tab': 'all'};
|
||||
this.$el.html(this.template(data));
|
||||
this.$table = this.$('table');
|
||||
this.$tableBody = $('tbody', this.$table);
|
||||
@@ -49,9 +49,9 @@ define([
|
||||
|
||||
getNextPage: function() {
|
||||
this.initPage();
|
||||
var current_page = this.libraryCollection.state.current_page;
|
||||
if (this.libraryCollection.state.hasNextPage) {
|
||||
this.libraryCollection.getPage(current_page + 1, {
|
||||
var current_page = this.repoCollection.state.current_page;
|
||||
if (this.repoCollection.state.hasNextPage) {
|
||||
this.repoCollection.getPage(current_page + 1, {
|
||||
reset: true
|
||||
});
|
||||
}
|
||||
@@ -61,9 +61,9 @@ define([
|
||||
|
||||
getPreviousPage: function() {
|
||||
this.initPage();
|
||||
var current_page = this.libraryCollection.state.current_page;
|
||||
var current_page = this.repoCollection.state.current_page;
|
||||
if ( current_page > 1) {
|
||||
this.libraryCollection.getPage(current_page - 1, {
|
||||
this.repoCollection.getPage(current_page - 1, {
|
||||
reset: true
|
||||
});
|
||||
}
|
||||
@@ -89,7 +89,7 @@ define([
|
||||
var _this = this,
|
||||
current_page = this.option.current_page || 1;
|
||||
|
||||
this.libraryCollection.fetch({
|
||||
this.repoCollection.fetch({
|
||||
data: {'page': current_page},
|
||||
cache: false, // for IE
|
||||
reset: true,
|
||||
@@ -110,13 +110,13 @@ define([
|
||||
},
|
||||
|
||||
reset: function() {
|
||||
var length = this.libraryCollection.length,
|
||||
current_page = this.libraryCollection.state.current_page;
|
||||
var length = this.repoCollection.length,
|
||||
current_page = this.repoCollection.state.current_page;
|
||||
|
||||
this.$loadingTip.hide();
|
||||
|
||||
if (length > 0) {
|
||||
this.libraryCollection.each(this.addOne, this);
|
||||
this.repoCollection.each(this.addOne, this);
|
||||
this.$table.show();
|
||||
this.renderPaginator();
|
||||
} else {
|
||||
@@ -127,13 +127,13 @@ define([
|
||||
},
|
||||
|
||||
renderPaginator: function() {
|
||||
if (this.libraryCollection.state.hasNextPage) {
|
||||
if (this.repoCollection.state.hasNextPage) {
|
||||
this.$jsNext.show();
|
||||
} else {
|
||||
this.$jsNext.hide();
|
||||
}
|
||||
|
||||
var current_page = this.libraryCollection.state.current_page;
|
||||
var current_page = this.repoCollection.state.current_page;
|
||||
if (current_page > 1) {
|
||||
this.$jsPrevious.show();
|
||||
} else {
|
||||
@@ -142,11 +142,11 @@ define([
|
||||
},
|
||||
|
||||
addOne: function(library) {
|
||||
var view = new LibraryView({model: library});
|
||||
var view = new RepoView({model: library});
|
||||
this.$tableBody.append(view.render().el);
|
||||
}
|
||||
});
|
||||
|
||||
return LibrariesView;
|
||||
return ReposView;
|
||||
|
||||
});
|
@@ -3,19 +3,19 @@ define([
|
||||
'underscore',
|
||||
'backbone',
|
||||
'common',
|
||||
'sysadmin-app/models/system-library'
|
||||
], function($, _, Backbone, Common, SystemLibrary) {
|
||||
'sysadmin-app/models/system-repo'
|
||||
], function($, _, Backbone, Common, SystemRepo) {
|
||||
'use strict';
|
||||
|
||||
var SystemLibraryView = Backbone.View.extend({
|
||||
var SystemRepoView = Backbone.View.extend({
|
||||
|
||||
id: "admin-system-library",
|
||||
id: "system-library",
|
||||
|
||||
template: _.template($("#system-library-tmpl").html()),
|
||||
itemTemplate: _.template($("#system-library-item-tmpl").html()),
|
||||
|
||||
initialize: function() {
|
||||
this.systemLibrary = new SystemLibrary();
|
||||
this.systemRepo = new SystemRepo();
|
||||
this.render();
|
||||
},
|
||||
|
||||
@@ -37,7 +37,7 @@ define([
|
||||
this.initPage();
|
||||
var _this = this;
|
||||
|
||||
this.systemLibrary.fetch({
|
||||
this.systemRepo.fetch({
|
||||
url: Common.getUrl({name: 'admin-system-library'}),
|
||||
cache: false, // for IE
|
||||
reset: true,
|
||||
@@ -71,11 +71,11 @@ define([
|
||||
|
||||
reset: function() {
|
||||
this.$loadingTip.hide();
|
||||
this.$tableBody.html(this.itemTemplate(this.systemLibrary.toJSON()));
|
||||
this.$tableBody.html(this.itemTemplate(this.systemRepo.toJSON()));
|
||||
this.$table.show();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return SystemLibraryView;
|
||||
return SystemRepoView;
|
||||
});
|
@@ -8,7 +8,7 @@ define([
|
||||
], function($, _, Backbone, Common, Moment, HLItemView) {
|
||||
'use strict';
|
||||
|
||||
var LibraryView = HLItemView.extend({
|
||||
var TrashRepoView = HLItemView.extend({
|
||||
tagName: 'tr',
|
||||
|
||||
template: _.template($('#trash-library-item-tmpl').html()),
|
||||
@@ -60,8 +60,12 @@ define([
|
||||
|
||||
render: function() {
|
||||
var data = this.model.toJSON(),
|
||||
icon_size = Common.isHiDPI() ? 96 : 24,
|
||||
icon_url = this.model.getIconUrl(icon_size),
|
||||
delete_time = Moment(data['delete_time']);
|
||||
|
||||
data['icon_url'] = icon_url;
|
||||
data['icon_title'] = this.model.getIconTitle();
|
||||
data['time'] = delete_time.format('LLLL');
|
||||
data['time_from_now'] = Common.getRelativeTimeStr(delete_time);
|
||||
|
||||
@@ -72,5 +76,5 @@ define([
|
||||
|
||||
});
|
||||
|
||||
return LibraryView;
|
||||
return TrashRepoView;
|
||||
});
|
@@ -4,22 +4,22 @@ define([
|
||||
'backbone',
|
||||
'common',
|
||||
'moment',
|
||||
'sysadmin-app/views/trash-library',
|
||||
'sysadmin-app/collection/trash-libraries'
|
||||
], function($, _, Backbone, Common, Moment, TrashLibraryView,
|
||||
TrashLibraryCollection) {
|
||||
'sysadmin-app/views/trash-repo',
|
||||
'sysadmin-app/collection/trash-repos'
|
||||
], function($, _, Backbone, Common, Moment, TrashRepoView,
|
||||
TrashRepoCollection) {
|
||||
'use strict';
|
||||
|
||||
var TrashLibrariesView = Backbone.View.extend({
|
||||
var TrashReposView = Backbone.View.extend({
|
||||
|
||||
id: 'admin-trash-libraries',
|
||||
id: 'trash-libraries',
|
||||
|
||||
template: _.template($("#trash-libraries-tmpl").html()),
|
||||
|
||||
initialize: function() {
|
||||
this.trashLibraryCollection = new TrashLibraryCollection();
|
||||
this.listenTo(this.trashLibraryCollection, 'add', this.addOne);
|
||||
this.listenTo(this.trashLibraryCollection, 'reset', this.reset);
|
||||
this.trashRepoCollection = new TrashRepoCollection();
|
||||
this.listenTo(this.trashRepoCollection, 'add', this.addOne);
|
||||
this.listenTo(this.trashRepoCollection, 'reset', this.reset);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@@ -75,7 +75,7 @@ define([
|
||||
this.initPage();
|
||||
var _this = this;
|
||||
|
||||
this.trashLibraryCollection.fetch({
|
||||
this.trashRepoCollection.fetch({
|
||||
data: {},
|
||||
cache: false, // for IE
|
||||
reset: true,
|
||||
@@ -96,12 +96,12 @@ define([
|
||||
},
|
||||
|
||||
reset: function() {
|
||||
var length = this.trashLibraryCollection.length;
|
||||
var length = this.trashRepoCollection.length;
|
||||
|
||||
this.$loadingTip.hide();
|
||||
|
||||
if (length > 0) {
|
||||
this.trashLibraryCollection.each(this.addOne, this);
|
||||
this.trashRepoCollection.each(this.addOne, this);
|
||||
this.$table.show();
|
||||
} else {
|
||||
this.$emptyTip.show();
|
||||
@@ -109,11 +109,11 @@ define([
|
||||
},
|
||||
|
||||
addOne: function(library) {
|
||||
var view = new TrashLibraryView({model: library});
|
||||
var view = new TrashRepoView({model: library});
|
||||
this.$tableBody.append(view.render().el);
|
||||
}
|
||||
});
|
||||
|
||||
return TrashLibrariesView;
|
||||
return TrashReposView;
|
||||
|
||||
});
|
Reference in New Issue
Block a user