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

Make open-via-client in community edition and clean code for file/dir icons

This commit is contained in:
Daniel Pan
2016-02-29 15:29:29 +08:00
parent 003838b8f1
commit 463b48c788
23 changed files with 119 additions and 33 deletions

View File

@@ -13,6 +13,15 @@ define([
return Common.pathJoin([this.collection.path, this.get('obj_name')]);
},
getIconUrl: function(size) {
if (this.get('is_dir')) {
var is_readonly = this.get('perm') == 'r';
return Common.getDirIconUrl(is_readonly, size);
} else {
return Common.getFileIconUrl(this.get('obj_name'), size);
}
},
// return the URL to visit the folder or file
getWebUrl: function() {
var dir = this.collection;

View File

@@ -50,6 +50,7 @@ define([
this.$el.html(template({
dirent: this.model.attributes,
dirent_path: this.model.getPath(),
icon_url: this.model.getIconUrl(192),
url: this.model.getWebUrl(),
category: dir.category,
repo_id: dir.repo_id,
@@ -132,6 +133,7 @@ define([
this.$el.on('click', '.mv', _.bind(this.mvcp, this));
this.$el.on('click', '.cp', _.bind(this.mvcp, this));
this.$el.on('click', '.rename', _.bind(this.rename, this));
this.$el.on('click', '.open-via-client', _.bind(this.open_via_client, this));
return false;
},
@@ -196,6 +198,11 @@ define([
};
new DirentRenameDialog(options);
return false;
},
open_via_client: function() {
this._closeMenu();
return true;
}
});

View File

@@ -38,6 +38,9 @@ define([
dirent: this.model.attributes,
dirent_path: dirent_path,
encoded_path: Common.encodePath(dirent_path),
icon_url: this.model.getIconUrl(48),
url: this.model.getWebUrl(),
download_url: this.model.getDownloadUrl(),
category: dir.category,
repo_id: dir.repo_id,
is_repo_owner: dir.is_repo_owner,
@@ -65,7 +68,14 @@ define([
'click .cp': 'mvcp',
'click .set-folder-permission': 'setFolderPerm',
'click .lock-file': 'lockFile',
'click .unlock-file': 'unlockFile'
'click .unlock-file': 'unlockFile',
'click .open-via-client': 'open_via_client'
},
_hideMenu: function() {
//this.$('.hidden-op').addClass('hide');
this.$el.removeClass('hl').find('.repo-file-op').addClass('vh');
this.$('.hidden-op').addClass('hide');
},
highlight: function() {
@@ -498,7 +508,13 @@ define([
}
});
return false;
},
open_via_client: function() {
this._hideMenu();
return true;
}
});
return DirentView;

View File

@@ -274,7 +274,7 @@ define([
.bind('fileuploadprogressall', function (e, data) {
$total_progress.html(parseInt(data.loaded / data.total * 100, 10) + '% ' +
'<span style="font-size:14px;color:#555;">(' +
$(this).data('blueimp-fileupload')._formatBitrate(data.bitrate) +
$(this).data('blueimp-fileupload')._formatBitrate(data.bitrate) +
')</span>').removeClass('hide');
if (data.loaded > 0 && data.loaded == data.total) {
saving_tip.show();