mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Expose blog URL to client app
fixes #3724 - provide config.url to the ember client app via a data attribute - create server and client side helpers to output the URL - wire up the client side helper - add a class for testing, and add tests for both the server and client side
This commit is contained in:
parent
3c8a6a5464
commit
8ae5e65462
4 changed files with 13 additions and 4 deletions
6
ghost/admin/helpers/gh-blog-url.js
Normal file
6
ghost/admin/helpers/gh-blog-url.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
var blogUrl = Ember.Handlebars.makeBoundHelper(function () {
|
||||
|
||||
return new Ember.Handlebars.SafeString(this.get('config.blogUrl'));
|
||||
});
|
||||
|
||||
export default blogUrl;
|
|
@ -3,9 +3,12 @@ var ConfigInitializer = {
|
|||
|
||||
initialize: function (container, application) {
|
||||
var apps = $('body').data('apps'),
|
||||
fileStorage = $('body').data('filestorage');
|
||||
fileStorage = $('body').data('filestorage'),
|
||||
blogUrl = $('body').data('blogurl');
|
||||
|
||||
application.register('ghost:config', {apps: apps, fileStorage: fileStorage}, {instantiate: false});
|
||||
application.register(
|
||||
'ghost:config', {apps: apps, fileStorage: fileStorage, blogUrl: blogUrl}, {instantiate: false}
|
||||
);
|
||||
|
||||
application.inject('route', 'config', 'ghost:config');
|
||||
application.inject('controller', 'config', 'ghost:config');
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
{{/if}}
|
||||
|
||||
<section class="object-list">
|
||||
<section class="object-list active-users">
|
||||
|
||||
<h4 class="object-list-title">Active users</h4>
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<label for="user-slug">Slug</label>
|
||||
{{!-- {{input value=user.slug id="user-slug" placeholder="Slug" autocorrect="off"}} --}}
|
||||
{{gh-blur-input class="user-name" id="user-slug" value=slugValue name="user" action="updateSlug" placeholder="Slug" selectOnClick="true" autocorrect="off"}}
|
||||
<p>http://blog-url.com/author/{{slugValue}}</p>
|
||||
<p>{{gh-blog-url}}/author/{{slugValue}}</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
Loading…
Add table
Reference in a new issue