mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-31 22:54:11 +00:00
new share admin page (#1233)
This commit is contained in:
45
static/scripts/app/models/share-admin-share-link.js
Normal file
45
static/scripts/app/models/share-admin-share-link.js
Normal file
@@ -0,0 +1,45 @@
|
||||
define([
|
||||
'underscore',
|
||||
'backbone',
|
||||
'common',
|
||||
'moment'
|
||||
], function(_, Backbone, Common, Moment) {
|
||||
'use strict';
|
||||
|
||||
var ShareAdminShareLink = Backbone.Model.extend({
|
||||
parse: function(response) {
|
||||
var attrs = _.clone(response),
|
||||
expire_date = response.expire_date;
|
||||
|
||||
if (expire_date) {
|
||||
attrs.expire_date_timestamp = Moment(expire_date).format('X');
|
||||
} else {
|
||||
attrs.expire_date_timestamp = 0;
|
||||
}
|
||||
|
||||
return attrs;
|
||||
},
|
||||
|
||||
getIconUrl: function(size) {
|
||||
if (this.get('is_dir')) {
|
||||
return Common.getDirIconUrl(false, size);
|
||||
} else {
|
||||
return Common.getFileIconUrl(this.get('obj_name'), size);
|
||||
}
|
||||
},
|
||||
|
||||
getWebUrl: function() {
|
||||
var repo_id = this.get('repo_id');
|
||||
var dirent_path = this.get('path');
|
||||
|
||||
if (this.get('is_dir')) {
|
||||
return "#common/lib/" + repo_id + Common.encodePath(dirent_path);
|
||||
} else {
|
||||
return app.config.siteRoot + "lib/" + repo_id + "/file" + Common.encodePath(dirent_path);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return ShareAdminShareLink;
|
||||
});
|
Reference in New Issue
Block a user