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
128 end128 end
129 129
130 def main_stylesheet_path130 def main_stylesheet_path
131 stylesheet_paths[cookies[:dark].nil? ? :default : :dark]131 stylesheet_paths[dark_theme? ? :dark : :default]
132 end132 end
133 133
134 def alternate_stylesheet_path134 def alternate_stylesheet_path
135 stylesheet_paths[cookies[:dark].nil? ? :dark : :default]135 stylesheet_paths[dark_theme? ? :default : :dark]
136 end136 end
137 137
138 def stylesheet_paths138 def stylesheet_paths
@@ -142,8 +142,16 @@ class App < Sinatra::Application · 3 unmodified lines
142 }142 }
143 end143 end
144 144
145 def size145 def app_size
146 @size ||= cookies[:size].nil? ? '18rem' : "#{cookies[:size]}px"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'
147 end155 end
148 end156 end
149 157