Make ?preview-style make sense

New behavior:
?preview-style=(sha) -- see that stylesheet
?preview-style= -- see the currently selected stylesheet
?preview-style=default -- see the default stylesheet ("rescue mode")
This commit is contained in:
riking 2014-06-20 09:06:36 -07:00
parent d704991609
commit 2d5f667160
3 changed files with 16 additions and 4 deletions

View file

@ -51,9 +51,11 @@
<span>{{i18n admin.customize.override_default}} {{view Ember.Checkbox checkedBinding="selectedItem.override_default_style"}}</span>
<span>{{i18n admin.customize.enabled}} {{view Ember.Checkbox checkedBinding="selectedItem.enabled"}}</span>
{{#unless selectedItem.changed}}
<a class='preview-link' {{bind-attr href="selectedItem.previewUrl"}} target='_blank'>{{i18n admin.customize.preview}}</a>
<a class='preview-link' {{bind-attr href="selectedItem.previewUrl"}} target='_blank' title="{{i18n admin.customize.explain_preview}}">{{i18n admin.customize.preview}}</a>
|
<a href="/?preview-style=" target='_blank'>{{i18n admin.customize.undo_preview}}</a><br>
<a href="/?preview-style=" target='_blank' title="{{i18n admin.customize.explain_undo_preview}}">{{i18n admin.customize.undo_preview}}</a>
|
<a href="/?preview-style=default" target='_blank' title="{{i18n admin.customize.explain_rescue_preview}}">{{i18n admin.customize.rescue_preview}}</a><br>
{{/unless}}
</div>

View file

@ -163,7 +163,13 @@ class ApplicationController < ActionController::Base
def inject_preview_style
style = request['preview-style']
session[:preview_style] = style if style
if style.blank?
session[:preview_style] = nil
elsif style == "default"
session[:preview_style] = ""
else
session[:preview_style] = style
end
end
def disable_customization

View file

@ -1505,7 +1505,11 @@ en:
override_default: "Do not include standard style sheet"
enabled: "Enabled?"
preview: "preview"
undo_preview: "undo preview"
undo_preview: "remove preview"
rescue_preview: "default style"
explain_preview: "See the site with this custom stylesheet"
explain_undo_preview: "Go back to the currently enabled custom stylesheet"
explain_rescue_preview: "See the site with the default stylesheet"
save: "Save"
new: "New"
new_style: "New Style"