diff options
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/themes.rb | 25 | ||||
-rw-r--r-- | app/lib/user_settings_decorator.rb | 7 |
2 files changed, 31 insertions, 1 deletions
diff --git a/app/lib/themes.rb b/app/lib/themes.rb index 7ced9f945..0819e2c90 100644 --- a/app/lib/themes.rb +++ b/app/lib/themes.rb @@ -17,10 +17,31 @@ class Themes name = File.basename(File.dirname(path)) if data['pack'] data['name'] = name + data['skin'] = { 'default' => [] } result[name] = data end end + Dir.glob(Rails.root.join('app', 'javascript', 'skins', '*', '*')) do |path| + ext = File.extname(path) + skin = File.basename(path) + name = File.basename(File.dirname(path)) + if result[name] + if File.directory?(path) + pack = [] + Dir.glob(File.join(path, '*.{css,scss}')) do |sheet| + pack.push(File.basename(sheet, File.extname(sheet))) + end + elsif ext.match?(/^\.s?css$/i) + skin = File.basename(path, ext) + pack = ['common'] + end + if skin != 'default' + result[name]['skin'][skin] = pack + end + end + end + @core = core @conf = result @@ -37,4 +58,8 @@ class Themes def names @conf.keys end + + def skins_for(name) + @conf[name]['skin'].keys + end end diff --git a/app/lib/user_settings_decorator.rb b/app/lib/user_settings_decorator.rb index d86959c0b..730c70177 100644 --- a/app/lib/user_settings_decorator.rb +++ b/app/lib/user_settings_decorator.rb @@ -27,6 +27,7 @@ class UserSettingsDecorator user.settings['system_font_ui'] = system_font_ui_preference if change?('setting_system_font_ui') user.settings['noindex'] = noindex_preference if change?('setting_noindex') user.settings['theme'] = theme_preference if change?('setting_theme') + user.settings['skin'] = skin_preference if change?('setting_skin') end def merged_notification_emails @@ -76,7 +77,11 @@ class UserSettingsDecorator def theme_preference settings['setting_theme'] end - + + def skin_preference + settings['setting_skin'] + end + def boolean_cast_setting(key) settings[key] == '1' end |