FIX: site customization preview links when deployed in a subfolder

This commit is contained in:
Neil Lalonde 2015-07-24 11:19:53 -04:00
parent b2fcc17ca2
commit c78dbb7fa5
3 changed files with 11 additions and 3 deletions

View File

@ -10,6 +10,14 @@ import showModal from 'discourse/lib/show-modal';
**/
export default Ember.ArrayController.extend({
undoPreviewUrl: function() {
return Discourse.getURL("/?preview-style=");
}.property(),
defaultStyleUrl: function() {
return Discourse.getURL("/?preview-style=default");
}.property(),
actions: {
/**

View File

@ -44,7 +44,7 @@ Discourse.SiteCustomization = Discourse.Model.extend({
this.set('originals', originals);
}.on('init'),
previewUrl: function() { return "/?preview-style=" + this.get('key'); }.property('key'),
previewUrl: function() { return Discourse.getURL("/?preview-style=" + this.get('key')); }.property('key'),
disableSave: function() { return !this.get('changed') || this.get('saving'); }.property('changed'),
save: function() {

View File

@ -65,9 +65,9 @@
{{#unless selectedItem.changed}}
<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' title="{{i18n 'admin.customize.explain_undo_preview'}}">{{i18n 'admin.customize.undo_preview'}}</a>
<a href="{{undoPreviewUrl}}" 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>
<a href="{{defaultStyleUrl}}" target='_blank' title="{{i18n 'admin.customize.explain_rescue_preview'}}">{{i18n 'admin.customize.rescue_preview'}}</a><br>
{{/unless}}
</div>