FEATURE: allow users to persist customization with &sticky=true

This commit is contained in:
Sam 2015-01-06 17:39:08 +11:00
parent e6dba8adc2
commit a99c3c3df9

View file

@ -171,13 +171,22 @@ class ApplicationController < ActionController::Base
def inject_preview_style def inject_preview_style
style = request['preview-style'] style = request['preview-style']
if style.blank?
session[:preview_style] = nil if style.nil?
elsif style == "default" session[:preview_style] = cookies[:preview_style]
session[:preview_style] = ""
else else
session[:preview_style] = style cookies.delete(:preview_style)
if style.blank? || style == 'default'
session[:preview_style] = nil
else
session[:preview_style] = style
if request['sticky']
cookies[:preview_style] = style
end
end
end end
end end
def disable_customization def disable_customization