Put status indicator on right side of fuzzy finder

Closes #313
This commit is contained in:
Kevin Sawicki
2013-02-28 12:16:19 -08:00
parent 3852b7212b
commit 77bc42bd45
5 changed files with 50 additions and 25 deletions

View File

@@ -39,28 +39,26 @@ class FuzzyFinderView extends SelectList
itemForElement: (path) ->
$$ ->
@li =>
typeClass = null
if git?
status = git.statuses[project.resolve(path)]
if git.isStatusNew(status)
typeClass = 'new'
@div class: 'status new'
else if git.isStatusModified(status)
typeClass = 'modified'
@div class: 'status modified'
unless typeClass
ext = fs.extension(path)
if fs.isReadmePath(path)
typeClass = 'readme-name'
else if fs.isCompressedExtension(ext)
typeClass = 'compressed-name'
else if fs.isImageExtension(ext)
typeClass = 'image-name'
else if fs.isPdfExtension(ext)
typeClass = 'pdf-name'
else if fs.isBinaryExtension(ext)
typeClass = 'binary-name'
else
typeClass = 'text-name'
ext = fs.extension(path)
if fs.isReadmePath(path)
typeClass = 'readme-name'
else if fs.isCompressedExtension(ext)
typeClass = 'compressed-name'
else if fs.isImageExtension(ext)
typeClass = 'image-name'
else if fs.isPdfExtension(ext)
typeClass = 'pdf-name'
else if fs.isBinaryExtension(ext)
typeClass = 'binary-name'
else
typeClass = 'text-name'
@span fs.base(path), class: "file label #{typeClass}"
if folder = fs.directory(path)

View File

@@ -446,8 +446,8 @@ describe 'FuzzyFinder', ->
git.getPathStatus(editor.getPath())
rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
expect(finderView.find('.file.modified').length).toBe 1
expect(finderView.find('.file.modified').text()).toBe 'sample.js'
expect(finderView.find('.status.modified').length).toBe 1
expect(finderView.find('.status.modified').closest('li').find('.file').text()).toBe 'sample.js'
describe "when a new file is shown in the list", ->
@@ -456,5 +456,5 @@ describe 'FuzzyFinder', ->
git.getPathStatus(editor.getPath())
rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
expect(finderView.find('.file.new').length).toBe 1
expect(finderView.find('.file.new').text()).toBe 'newsample.js'
expect(finderView.find('.status.new').length).toBe 1
expect(finderView.find('.status.new').closest('li').find('.file').text()).toBe 'newsample.js'