mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
Merge pull request #5119 from novaugust/preview_link_subdir
Use absolute url for post preview link
This commit is contained in:
commit
e0369d207f
@ -8,6 +8,7 @@ var ConfigInitializer = {
|
||||
application.register('ghost:config', config, {instantiate: false});
|
||||
|
||||
application.inject('route', 'config', 'ghost:config');
|
||||
application.inject('model:post', 'config', 'ghost:config');
|
||||
application.inject('controller', 'config', 'ghost:config');
|
||||
application.inject('component', 'config', 'ghost:config');
|
||||
}
|
||||
|
@ -222,10 +222,11 @@ EditorControllerMixin = Ember.Mixin.create({
|
||||
|
||||
showSaveNotification: function (prevStatus, status, delay) {
|
||||
var message = this.messageMap.success.post[prevStatus][status],
|
||||
path = this.get('ghostPaths.url').join(this.get('config.blogUrl'), this.get('model.url'));
|
||||
path = this.get('model.absoluteUrl'),
|
||||
type = this.get('postOrPage');
|
||||
|
||||
if (status === 'published') {
|
||||
message += ' <a href="' + path + '">View ' + this.get('postOrPage') + '</a>';
|
||||
message += ` <a href="${path}">View ${type}</a>`;
|
||||
}
|
||||
this.notifications.showSuccess(message.htmlSafe(), {delayed: delay});
|
||||
},
|
||||
|
@ -29,6 +29,12 @@ var Post = DS.Model.extend(NProgressSaveMixin, ValidationEngine, {
|
||||
tags: DS.hasMany('tag', {embedded: 'always'}),
|
||||
url: DS.attr('string'),
|
||||
|
||||
absoluteUrl: Ember.computed('url', 'ghostPaths.url', 'config.blogUrl', function () {
|
||||
var blogUrl = this.get('config.blogUrl'),
|
||||
postUrl = this.get('url');
|
||||
return this.get('ghostPaths.url').join(blogUrl, postUrl);
|
||||
}),
|
||||
|
||||
scratch: null,
|
||||
titleScratch: null,
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<small class="post-published-by">
|
||||
<span class="status">
|
||||
{{#if isPublished}}
|
||||
<a title="{{model.title}}" href="{{model.url}}">Published</a>
|
||||
<a title="{{model.title}}" href="{{model.absoluteUrl}}">Published</a>
|
||||
{{else}}
|
||||
Written
|
||||
{{/if}}
|
||||
|
Loading…
Reference in New Issue
Block a user