mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Tweak file and folder styles
This commit is contained in:
@@ -37,7 +37,6 @@ class ArchiveView extends ScrollView
|
||||
else
|
||||
@tree.append(new FileView(@path, entry))
|
||||
|
||||
@tree.find('.entry.file:first').addClass('selected')
|
||||
@tree.show()
|
||||
|
||||
setModel: (editSession) ->
|
||||
|
||||
@@ -4,7 +4,8 @@ FileView = require './file-view'
|
||||
module.exports =
|
||||
class DirectoryView extends View
|
||||
@content: (archivePath, entry) ->
|
||||
@div entry.getName(), class: 'entry directory'
|
||||
@div class: 'entry', =>
|
||||
@span entry.getName(), class: 'directory'
|
||||
|
||||
initialize: (archivePath, entry) ->
|
||||
for child in entry.children
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{View} = require 'space-pen'
|
||||
fs = require 'fs'
|
||||
fsUtils = require 'fs-utils'
|
||||
path = require 'path'
|
||||
temp = require 'temp'
|
||||
archive = require 'ls-archive'
|
||||
@@ -7,24 +7,26 @@ archive = require 'ls-archive'
|
||||
module.exports =
|
||||
class FileView extends View
|
||||
@content: (archivePath, entry) ->
|
||||
@div =>
|
||||
@span entry.getName(), class: 'entry file'
|
||||
@div class: 'entry', =>
|
||||
@span entry.getName(), class: 'file', outlet: 'name'
|
||||
|
||||
initialize: (archivePath, entry) ->
|
||||
@name.addClass('symlink') if entry.isSymbolicLink()
|
||||
|
||||
@on 'click', =>
|
||||
@closest('.archive-view').find('.entry').removeClass('selected')
|
||||
@addClass('selected')
|
||||
@closest('.archive-view').find('.selected').removeClass('selected')
|
||||
@name.addClass('selected')
|
||||
archive.readFile archivePath, entry.getPath(), (error, contents) ->
|
||||
if error?
|
||||
console.error("Error reading: #{entry.getPath()} from #{archivePath}", error.stack ? error)
|
||||
else
|
||||
temp.mkdir path.basename(archivePath), (error, tempDirPath) ->
|
||||
temp.mkdir 'atom-', (error, tempDirPath) ->
|
||||
if error?
|
||||
console.error("Error creating temp directory: #{tempDirPath}")
|
||||
else
|
||||
tempFilePath = path.join(tempDirPath, entry.getName())
|
||||
fs.writeFile tempFilePath, contents, (error) ->
|
||||
if error?
|
||||
console.error("Error writing to #{tempFilePath}")
|
||||
else
|
||||
rootView.open(tempFilePath)
|
||||
tempFilePath = path.join(tempDirPath, path.basename(archivePath), entry.getName())
|
||||
fsUtils.writeAsync tempFilePath, contents, (error) ->
|
||||
if error?
|
||||
console.error("Error writing to #{tempFilePath}")
|
||||
else
|
||||
rootView.open(tempFilePath)
|
||||
|
||||
@@ -26,27 +26,37 @@
|
||||
}
|
||||
|
||||
.entry {
|
||||
padding: 5px;
|
||||
margin: 5px;
|
||||
|
||||
> .entry {
|
||||
margin-left: 5px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
&:before {
|
||||
margin-right: @icon-margin;
|
||||
}
|
||||
span.file {
|
||||
display: inline-block;
|
||||
padding: 5px;
|
||||
|
||||
&:before {
|
||||
padding-right: @icon-margin;
|
||||
}
|
||||
|
||||
&.file {
|
||||
.mini-icon(text-file);
|
||||
|
||||
&.symlink {
|
||||
.mini-icon(symlink);
|
||||
}
|
||||
}
|
||||
|
||||
&.directory {
|
||||
span.directory {
|
||||
display: inline-block;
|
||||
padding-left: 5px;
|
||||
|
||||
&:before {
|
||||
margin-right: @icon-margin;
|
||||
}
|
||||
|
||||
.mini-icon(directory);
|
||||
}
|
||||
|
||||
&.symlink {
|
||||
.mini-icon(symlink);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user