Skip to content
Snippets Groups Projects
Unverified Commit 31340b8b authored by Julius Härtl's avatar Julius Härtl
Browse files

Add icon for resource type and icons for folder/file


Signed-off-by: default avatarJulius Härtl <jus@bitgrid.net>
parent d1a4856b
No related branches found
No related tags found
No related merge requests found
......@@ -48,6 +48,13 @@ class ResourceProvider implements IProvider {
$this->urlGenerator = $urlGenerator;
}
private function getNode(IResource $resource): ?Node {
if (isset($this->nodes[(int) $resource->getId()])) {
return $this->nodes[(int) $resource->getId()];
}
return null;
}
/**
* Get the display name of a resource
*
......@@ -94,7 +101,11 @@ class ResourceProvider implements IProvider {
* @since 15.0.0
*/
public function getIconClass(IResource $resource): string {
return 'icon-folder';
$node = $this->getNode($resource);
if ($node && $node->getMimetype() === 'httpd/unix-directory') {
return 'icon-files-dark';
}
return 'icon-filetype-file';
}
/**
......
......@@ -22,7 +22,8 @@ window.OCP.Collaboration.registerType('files', {
});
},
/** used in "Link to a {typeString}" */
typeString: t('files_sharing', 'file')
typeString: t('files_sharing', 'file'),
typeIconClass: 'icon-files-dark'
});
window.OCA.Sharing = OCA.Sharing;
......@@ -384,6 +384,10 @@ img, object, video, button, textarea, input, select, div[contenteditable='true']
@include icon-color('text', 'filetypes', $color-black, 1, true);
}
.icon-filetype-file {
@include icon-color('file', 'filetypes', $color-black, 1, true);
}
@include icon-black-white('folder', 'filetypes', 1, true);
.icon-filetype-folder {
@include icon-color('folder', 'filetypes', $color-black, 1, true);
......
......@@ -49,7 +49,7 @@ export default {
return Object.keys(types);
},
getIcon(type) {
return types[type].icon || '';
return types[type].typeIconClass || '';
},
getLabel(type) {
return t('files_sharing', 'Link to a {label}', { label: types[type].typeString || type }, 1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment