Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
🎨 settings model inconsistency (#669)
Browse files Browse the repository at this point in the history
requires TryGhost/Ghost#8381
- all camelCase settings model attribute names received from the API are now underscore_case
- discussed here #661 (comment)
  • Loading branch information
kirrg001 authored and kevinansfield committed Apr 24, 2017
1 parent 7169a14 commit 3768905
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
6 changes: 3 additions & 3 deletions app/models/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ export default Model.extend(ValidationEngine, {
title: attr('string'),
description: attr('string'),
logo: attr('string'),
cover_image: attr('string'),
coverImage: attr('string'),
icon: attr('string'),
defaultLang: attr('string'),
forceI18n: attr('boolean'),
permalinks: attr('string'),
activeTimezone: attr('string', {defaultValue: 'Etc/UTC'}),
ghost_head: attr('string'),
ghost_foot: attr('string'),
ghostHead: attr('string'),
ghostFoot: attr('string'),
facebook: attr('facebook-url-user'),
twitter: attr('twitter-url-user'),
labs: attr('string'),
Expand Down
4 changes: 0 additions & 4 deletions app/serializers/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ export default ApplicationSerializer.extend({
return this._super(store, primaryModelClass, payload, id, requestType);
},

keyForAttribute(attr) {
return attr;
},

_extractObjectFromArrayPayload(_payload) {
let payload = {id: '0'};

Expand Down
4 changes: 2 additions & 2 deletions app/templates/settings/code-injection.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
<div class="form-group settings-code">
<label for="ghost-head">Blog Header</label>
<p>Code here will be injected into the <code>\{{ghost_head}}</code> tag on every page of your blog</p>
{{gh-cm-editor model.ghost_head id="ghost-head" class="gh-input settings-code-editor" name="codeInjection[ghost_head]" type="text" update=(action (mut model.ghost_head))}}
{{gh-cm-editor model.ghostHead id="ghost-head" class="gh-input settings-code-editor" name="codeInjection[ghost_head]" type="text" update=(action (mut model.ghostHead))}}
</div>

<div class="form-group settings-code">
<label for="ghost-foot">Blog Footer</label>
<p>Code here will be injected into the <code>\{{ghost_foot}}</code> tag on every page of your blog</p>
{{gh-cm-editor model.ghost_foot id="ghost-foot" class="gh-input settings-code-editor" name="codeInjection[ghost_foot]" type="text" update=(action (mut model.ghost_foot))}}
{{gh-cm-editor model.ghostFoot id="ghost-foot" class="gh-input settings-code-editor" name="codeInjection[ghost_foot]" type="text" update=(action (mut model.ghostFoot))}}
</div>
</fieldset>
</form>
Expand Down
6 changes: 3 additions & 3 deletions app/templates/settings/general.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@
<div class="gh-setting-desc">An optional large background image for your site</div>
</div>
<div class="gh-setting-action gh-setting-action-largeimg">
{{#if model.cover_image}}
<img class="blog-cover" src="{{model.cover_image}}" alt="cover photo" role="button" {{action "toggleUploadCoverModal"}}>
{{#if model.coverImage}}
<img class="blog-cover" src="{{model.coverImage}}" alt="cover photo" role="button" {{action "toggleUploadCoverModal"}}>
{{else}}
<button type="button" class="gh-btn" {{action "toggleUploadCoverModal"}}><span>Upload Image</span></button>
{{/if}}

{{#if showUploadCoverModal}}
{{gh-fullscreen-modal "upload-image"
model=(hash model=model imageProperty="cover_image")
model=(hash model=model imageProperty="coverImage")
close=(action "toggleUploadCoverModal")
modifier="action wide"}}
{{/if}}
Expand Down
8 changes: 4 additions & 4 deletions mirage/fixtures/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default [
},
{
id: 5,
key: 'defaultLang',
key: 'default_lang',
value: 'en_US',
type: 'blog',
created_at: '2013-11-25T14:48:11.000Z',
Expand All @@ -52,7 +52,7 @@ export default [
},
{
id: 7,
key: 'forceI18n',
key: 'force_i18n',
value: 'true',
type: 'blog',
created_at: '2013-11-25T14:48:11.000Z',
Expand Down Expand Up @@ -117,7 +117,7 @@ export default [
id: 14,
created_at: '2015-09-11T09:44:30.810Z',
created_by: 1,
key: 'isPrivate',
key: 'is_private',
type: 'blog',
updated_at: '2015-09-23T13:32:49.868Z',
updated_by: 1,
Expand Down Expand Up @@ -167,7 +167,7 @@ export default [
id: 19,
created_at: '2015-09-11T09:44:30.810Z',
created_by: 1,
key: 'activeTimezone',
key: 'active_timezone',
type: 'blog',
updated_at: '2015-09-23T13:32:49.868Z',
updated_by: 1,
Expand Down

0 comments on commit 3768905

Please sign in to comment.