mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
List available themes in general config panel
This commit is contained in:
committed by
Corey Johnson & Kevin Sawicki
parent
495230435f
commit
d857cc7d77
@@ -116,6 +116,18 @@ _.extend atom,
|
||||
@loadTheme(themeName) for themeName in themeNames
|
||||
@loadUserStylesheet()
|
||||
|
||||
getAvailableThemePaths: ->
|
||||
themePaths = []
|
||||
for themeDirPath in config.themeDirPaths
|
||||
|
||||
console.log fsUtils.list(themeDirPath)
|
||||
|
||||
themePaths.push(fsUtils.list(themeDirPath, ['', '.tmTheme', '.css', 'less'])...)
|
||||
_.uniq(themePaths)
|
||||
|
||||
getAvailableThemeNames: ->
|
||||
fsUtils.base(path).split('.')[0] for path in @getAvailableThemePaths()
|
||||
|
||||
loadTheme: (name) ->
|
||||
@loadedThemes.push Theme.load(name)
|
||||
|
||||
|
||||
@@ -19,8 +19,13 @@ class GeneralConfigPanel extends ConfigPanel
|
||||
@div "Packages"
|
||||
@ol id: 'package-list', outlet: 'packageList'
|
||||
|
||||
@div class: 'row', =>
|
||||
@div "Themes"
|
||||
@ol id: 'available-theme-list', outlet: 'availableThemeList'
|
||||
|
||||
initialize: ->
|
||||
@populatePackageList()
|
||||
@populateThemeLists()
|
||||
@packageList.on 'change', 'input[type=checkbox]', (e) ->
|
||||
checkbox = $(e.target)
|
||||
name = checkbox.closest('li').attr('name')
|
||||
@@ -44,3 +49,8 @@ class GeneralConfigPanel extends ConfigPanel
|
||||
@packageList.find("input[type='checkbox']").attr('checked', true)
|
||||
for name in disabledPackages
|
||||
@packageList.find("li[name='#{name}'] input[type='checkbox']").attr('checked', false)
|
||||
|
||||
populateThemeLists: ->
|
||||
for name in atom.getAvailableThemeNames()
|
||||
@availableThemeList.append $$ ->
|
||||
@li name: name, name
|
||||
|
||||
@@ -106,8 +106,13 @@ module.exports =
|
||||
done(null, paths)
|
||||
|
||||
filterExtensions: (paths, extensions) ->
|
||||
extensions = extensions.map (ext) -> '.' + ext.replace(/^\./, '')
|
||||
paths.filter (path) => _.include(extensions, @extension(path))
|
||||
extensions = extensions.map (ext) ->
|
||||
if ext is ''
|
||||
ext
|
||||
else
|
||||
'.' + ext.replace(/^\./, '')
|
||||
paths.filter (path) =>
|
||||
_.include(extensions, @extension(path))
|
||||
|
||||
listTree: (rootPath) ->
|
||||
paths = []
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.row {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: inline-block;
|
||||
width: 180px;
|
||||
|
||||
Reference in New Issue
Block a user