From f11f85e87b18e9e05ede67f798724347cfcf7c9b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Sat, 5 Jan 2013 19:24:53 -0800 Subject: [PATCH] Show octicon for project's that are repos --- src/app/git.coffee | 8 +++----- src/packages/tree-view/src/directory-view.coffee | 13 ++++++++++++- src/packages/tree-view/stylesheets/tree-view.css | 8 +++++++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/app/git.coffee b/src/app/git.coffee index c8369a53c..17e07fffa 100644 --- a/src/app/git.coffee +++ b/src/app/git.coffee @@ -20,8 +20,7 @@ class Git getWorkingDirectory: -> repoPath = @getPath() - if repoPath - repoPath.substring(0, repoPath.length - 5) + repoPath?.substring(0, repoPath.length - 6) getHead: -> @repo.getHead() or '' @@ -48,7 +47,7 @@ class Git relativize: (path) -> workingDirectory = @getWorkingDirectory() - if workingDirectory and path.indexOf(workingDirectory) is 0 + if workingDirectory and path.indexOf("#{workingDirectory}/") is 0 path.substring(workingDirectory.length) else path @@ -65,5 +64,4 @@ class Git @repo.checkoutHead(@relativize(path)) getDiffStats: (path) -> - stats = @repo.getDiffStats(@relativize(path)) - stats or {'added': 0, 'deleted': 0} + @repo.getDiffStats(@relativize(path)) or added: 0, deleted: 0 diff --git a/src/packages/tree-view/src/directory-view.coffee b/src/packages/tree-view/src/directory-view.coffee index 5aa796190..986b17dd0 100644 --- a/src/packages/tree-view/src/directory-view.coffee +++ b/src/packages/tree-view/src/directory-view.coffee @@ -21,7 +21,18 @@ class DirectoryView extends View initialize: ({@directory, isExpanded, @project, parent} = {}) -> @expand() if isExpanded @disclosureArrow.on 'click', => @toggleExpansion() - @directoryName.addClass('ignored') if @project.repo.isPathIgnored(@directory.getPath()) + + repo = @project.repo + if repo? + path = @directory.getPath() + @directoryName.addClass('ignored') if repo.isPathIgnored(path) + console.log path, repo.getWorkingDirectory() + if path is repo.getWorkingDirectory() + @directoryName.addClass('repository-icon') + else + @directoryName.addClass('directory-icon') + else + @directoryName.addClass('directory-icon') getPath: -> @directory.path diff --git a/src/packages/tree-view/stylesheets/tree-view.css b/src/packages/tree-view/stylesheets/tree-view.css index 50f6ac361..6e59d1211 100644 --- a/src/packages/tree-view/stylesheets/tree-view.css +++ b/src/packages/tree-view/stylesheets/tree-view.css @@ -128,11 +128,17 @@ -webkit-font-smoothing: antialiased; } -.tree-view .directory .header .name:before { +.tree-view .directory .header .directory-icon:before { content: "\f016"; top: -5px; } +.tree-view .directory .header .repository-icon:before { + content: "\f001"; + top: -4px; +} + + .tree-view .file .text-name:before { content: "\f011"; top: -2px;