mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-23 01:23:59 +00:00
Cherry-pick 0e70320 (Select icon based on file extension) from datajoy
This commit is contained in:
parent
8621d497b4
commit
d813f45d28
4 changed files with 17 additions and 7 deletions
|
@ -107,8 +107,7 @@ script(type='text/ng-template', id='entityListItemTemplate')
|
|||
//- Just a spacer to align with folders
|
||||
i.fa.fa-fw.toggle(ng-if="entity.type != 'folder'")
|
||||
|
||||
i.fa.fa-fw.fa-file(ng-if="entity.type == 'doc'")
|
||||
i.fa.fa-fw.fa-image(ng-if="entity.type == 'file'")
|
||||
i.fa.fa-fw(ng-if="entity.type != 'folder'", ng-class="'fa-' + iconTypeFromName(entity.name)")
|
||||
span(
|
||||
ng-hide="entity.renaming"
|
||||
) {{ entity.name }}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
define [
|
||||
"base"
|
||||
], (App) ->
|
||||
App.controller "FileTreeController", ["$scope", "$modal", "ide", ($scope, $modal, ide) ->
|
||||
App.controller "FileTreeController", ["$scope", "$modal", "ide", "$rootScope", ($scope, $modal, ide, $rootScope) ->
|
||||
$scope.openNewDocModal = () ->
|
||||
$modal.open(
|
||||
templateUrl: "newDocModalTemplate"
|
||||
|
|
|
@ -51,6 +51,17 @@ define [
|
|||
|
||||
$scope.$on "delete:selected", () ->
|
||||
$scope.openDeleteModal() if $scope.entity.selected
|
||||
|
||||
$scope.iconTypeFromName = (name) ->
|
||||
ext = name.split(".").pop()?.toLowerCase()
|
||||
if ext in ["png", "pdf", "jpg", "jpeg", "gif"]
|
||||
return "image"
|
||||
else if ext in ["csv", "xls", "xlsx"]
|
||||
return "table"
|
||||
else if ext in ["py", "r"]
|
||||
return "file-text"
|
||||
else
|
||||
return "file"
|
||||
]
|
||||
|
||||
App.controller "DeleteEntityModalController", [
|
||||
|
|
|
@ -52,13 +52,13 @@ aside#file-tree {
|
|||
}
|
||||
}
|
||||
|
||||
i.fa-folder-open, i.fa-folder {
|
||||
color: lighten(desaturate(@link-color, 10%), 5%);
|
||||
i.fa {
|
||||
color: @gray-light;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
i.fa-file, i.fa-image, i.fa-file-pdf-o {
|
||||
color: @gray-light;
|
||||
i.fa-folder-open, i.fa-folder {
|
||||
color: lighten(desaturate(@link-color, 10%), 5%);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue