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

Show 24px file icon for low DPI screen

This commit is contained in:
Daniel Pan
2016-03-04 16:40:45 +08:00
parent f04e152e41
commit 24e2870831
3 changed files with 22 additions and 4 deletions

BIN
media/img/folder-192.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -35,12 +35,13 @@ define([
var dirent_path = Common.pathJoin([dir.path, this.model.get('obj_name')]); var dirent_path = Common.pathJoin([dir.path, this.model.get('obj_name')]);
var is_pro = app.pageOptions.is_pro; var is_pro = app.pageOptions.is_pro;
var file_audit_enabled = app.pageOptions.file_audit_enabled; var file_audit_enabled = app.pageOptions.file_audit_enabled;
var file_icon_size = Common.isHiDPI() ? 48 : 24;
this.$el.html(this.template({ this.$el.html(this.template({
dirent: this.model.attributes, dirent: this.model.attributes,
dirent_path: dirent_path, dirent_path: dirent_path,
encoded_path: Common.encodePath(dirent_path), encoded_path: Common.encodePath(dirent_path),
icon_url: this.model.getIconUrl(48), icon_url: this.model.getIconUrl(file_icon_size),
url: this.model.getWebUrl(), url: this.model.getWebUrl(),
download_url: this.model.getDownloadUrl(), download_url: this.model.getDownloadUrl(),
category: dir.category, category: dir.category,

View File

@@ -212,10 +212,27 @@ define([
}, },
getDirIconUrl: function(is_readonly, size) { getDirIconUrl: function(is_readonly, size) {
if (is_readonly) { if (size > 24) {
return app.config.mediaUrl + "img/folder-read-only-192.png"; if (is_readonly) {
return app.config.mediaUrl + "img/folder-read-only-192.png";
} else {
return app.config.mediaUrl + "img/folder-192.png";
}
} else { } else {
return app.config.mediaUrl + "img/folder-beige-192.png"; if (is_readonly) {
return app.config.mediaUrl + "img/folder-read-only-24.png";
} else {
return app.config.mediaUrl + "img/folder-24.png";
}
}
},
isHiDPI: function() {
var pixelRatio = window.devicePixelRatio ? window.devicePixelRatio : 1;
if (pixelRatio > 1) {
return true;
} else {
return false;
} }
}, },