Hide profiles beginning with underscores.

This commit is contained in:
FelisCatus 2014-10-03 14:33:42 +08:00
parent 4ca4b93822
commit 8a777054d1

View File

@ -1,5 +1,6 @@
angular.module('omega').filter 'profiles', (builtinProfiles, profileOrder) ->
charCodePlus = '+'.charCodeAt(0)
charCodeUnderscore = '_'.charCodeAt(0)
builtinProfileList = (profile for _, profile of builtinProfiles)
(options, filter) ->
result = []
@ -11,7 +12,15 @@ angular.module('omega').filter 'profiles', (builtinProfiles, profileOrder) ->
filter = filter.substr(1)
result = OmegaPac.Profiles.validResultProfilesFor(filter, options)
if filter == 'all'
result = result.filter (profile) ->
# Hide profiles beginning with underscore.
profile.name.charCodeAt(0) != charCodeUnderscore
result = result.concat builtinProfileList
else
result = result.filter (profile) ->
# Hide profiles beginning with double underscore in options.
(profile.name.charCodeAt(0) != charCodeUnderscore or
profile.name.charCodeAt(1) != charCodeUnderscore)
if filter == 'sorted'
result.sort profileOrder
result