diff --git a/services/web/app/views/project/editor/file-tree.jade b/services/web/app/views/project/editor/file-tree.jade index 630cd1aa17..77cbd10da9 100644 --- a/services/web/app/views/project/editor/file-tree.jade +++ b/services/web/app/views/project/editor/file-tree.jade @@ -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 }} diff --git a/services/web/public/coffee/ide/file-tree/controllers/FileTreeController.coffee b/services/web/public/coffee/ide/file-tree/controllers/FileTreeController.coffee index cdc261053f..a0dcaa1367 100644 --- a/services/web/public/coffee/ide/file-tree/controllers/FileTreeController.coffee +++ b/services/web/public/coffee/ide/file-tree/controllers/FileTreeController.coffee @@ -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" diff --git a/services/web/public/coffee/ide/file-tree/controllers/FileTreeEntityController.coffee b/services/web/public/coffee/ide/file-tree/controllers/FileTreeEntityController.coffee index b5c96408c7..9190267fad 100644 --- a/services/web/public/coffee/ide/file-tree/controllers/FileTreeEntityController.coffee +++ b/services/web/public/coffee/ide/file-tree/controllers/FileTreeEntityController.coffee @@ -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", [ diff --git a/services/web/public/stylesheets/app/editor/file-tree.less b/services/web/public/stylesheets/app/editor/file-tree.less index 6f70c3299f..55d46c1e5a 100644 --- a/services/web/public/stylesheets/app/editor/file-tree.less +++ b/services/web/public/stylesheets/app/editor/file-tree.less @@ -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; }