Commit bf9032a1f573a24418b34b85a716c5f0369c1bff
1 parent
3cc6faaa
Exists in
master
and in
29 other branches
ActionItem1049: random theme
Showing
1 changed file
with
9 additions
and
0 deletions
Show diff stats
app/helpers/application_helper.rb
... | ... | @@ -312,6 +312,15 @@ module ApplicationHelper |
312 | 312 | |
313 | 313 | def current_theme |
314 | 314 | return session[:theme] if (session[:theme]) |
315 | + | |
316 | + # utility for developers: set the theme to 'random' in development mode and | |
317 | + # you will get a different theme every request. This is interesting for | |
318 | + # testing | |
319 | + if ENV['RAILS_ENV'] == 'development' && @environment.theme == 'random' | |
320 | + @theme ||= Dir.glob('public/designs/themes/*').map { |f| File.basename(f) }.rand | |
321 | + return @theme | |
322 | + end | |
323 | + | |
315 | 324 | p = profile |
316 | 325 | if p |
317 | 326 | p.theme | ... | ... |