History

Refactor app size/theme methods

Thibaut committed 11 years ago

Commit b3c569b1 parent e2b86744 files · +22 −14Browse files

Showing the changes to lib (1 of 4 files). Show all

Unified · Split

lib/app.rb+12−4
@@ -128,11 +128,11 @@ class App < Sinatra::Application · 127 unmodified lines
128128 end
129129
130130 def main_stylesheet_path
131− stylesheet_paths[cookies[:dark].nil? ? :default : :dark]
131+ stylesheet_paths[dark_theme? ? :dark : :default]
132132 end
133133
134134 def alternate_stylesheet_path
135− stylesheet_paths[cookies[:dark].nil? ? :dark : :default]
135+ stylesheet_paths[dark_theme? ? :default : :dark]
136136 end
137137
138138 def stylesheet_paths
@@ -142,8 +142,16 @@ class App < Sinatra::Application · 3 unmodified lines
142142 }
143143 end
144144
145− def size
146− @size ||= cookies[:size].nil? ? '18rem' : "#{cookies[:size]}px"
145+ def app_size
146+ @app_size ||= cookies[:size].nil? ? '18rem' : "#{cookies[:size]}px"
147+ end
148+
149+ def app_theme
150+ @app_theme ||= cookies[:dark].nil? ? 'default' : 'dark'
151+ end
152+
153+ def dark_theme?
154+ app_theme == 'dark'
147155 end
148156 end
149157