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

Commit

Permalink
🙀 adapt image property changes
Browse files Browse the repository at this point in the history
refs TryGhost/Ghost#8348

- WIP, no review please
- tests will fail for sure

[ci skip]
  • Loading branch information
kirrg001 committed Apr 20, 2017
1 parent b98a804 commit 5dad032
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/components/gh-post-settings-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export default Component.extend(SettingsMenuMixin, {
},

setCoverImage(image) {
this.set('model.image', image);
this.set('model.feature_image', image);

if (this.get('model.isNew')) {
return;
Expand Down
2 changes: 1 addition & 1 deletion app/components/gh-tag-settings-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default Component.extend({
},

setCoverImage(image) {
this.send('setProperty', 'image', image);
this.send('setProperty', 'feature_image', image);
},

clearCoverImage() {
Expand Down
10 changes: 5 additions & 5 deletions app/controllers/setup/two.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default Controller.extend(ValidationEngine, {
blogTitle: null,
email: '',
flowErrors: '',
image: null,
profile_image: null,
name: null,
password: null,

Expand Down Expand Up @@ -94,14 +94,14 @@ export default Controller.extend(ValidationEngine, {
* @return {Ember.RSVP.Promise} A promise that takes care of both calls
*/
_sendImage(user) {
let image = this.get('image');
let image = this.get('profile_image');

return new Promise((resolve, reject) => {
image.formData = {};
image.submit()
.success((response) => {
let usersUrl = this.get('ghostPaths.url').api('users', user.id.toString());
user.image = response;
user.profile_image = response;

return this.get('ajax').put(usersUrl, {
data: {
Expand Down Expand Up @@ -215,7 +215,7 @@ export default Controller.extend(ValidationEngine, {
},

_afterAuthentication(result) {
if (this.get('image')) {
if (this.get('profile_image')) {
return this._sendImage(result.users[0])
.then(() => {

Expand Down Expand Up @@ -248,7 +248,7 @@ export default Controller.extend(ValidationEngine, {
},

setImage(image) {
this.set('image', image);
this.set('profile_image', image);
}
}
});
2 changes: 1 addition & 1 deletion app/controllers/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default Controller.extend(ValidationEngine, {
},

setImage(image) {
this.set('image', image);
this.set('profile_image', image);
}
}
});
8 changes: 4 additions & 4 deletions app/controllers/team/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export default Controller.extend({
return `${this.get('ghostPaths.assetRoot')}/img/user-image.png`;
}),

userImageBackground: computed('user.image', 'userDefault', function () {
let url = this.get('user.image') || this.get('userDefault');
userImageBackground: computed('user.profile_image', 'userDefault', function () {
let url = this.get('user.profile_image') || this.get('userDefault');
let safeUrl = Handlebars.Utils.escapeExpression(url);

return htmlSafe(`background-image: url(${safeUrl})`);
Expand All @@ -86,8 +86,8 @@ export default Controller.extend({
return `${this.get('ghostPaths.assetRoot')}/img/user-cover.png`;
}),

coverImageBackground: computed('user.cover', 'coverDefault', function () {
let url = this.get('user.cover') || this.get('coverDefault');
coverImageBackground: computed('user.cover_image', 'coverDefault', function () {
let url = this.get('user.cover_image') || this.get('coverDefault');
let safeUrl = Handlebars.Utils.escapeExpression(url);

return htmlSafe(`background-image: url(${safeUrl})`);
Expand Down
2 changes: 1 addition & 1 deletion app/models/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default Model.extend(Comparable, ValidationEngine, {
markdown: attr('string', {defaultValue: ''}),
mobiledoc: attr('json-string', {defaultValue: () => BLANK_DOC}),
html: attr('string'),
image: attr('string'),
feature_image: attr('string'),
featured: attr('boolean', {defaultValue: false}),
page: attr('boolean', {defaultValue: false}),
status: attr('string', {defaultValue: 'draft'}),
Expand Down
2 changes: 1 addition & 1 deletion app/models/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default Model.extend(ValidationEngine, {
parent: attr(),
metaTitle: attr('string'),
metaDescription: attr('string'),
image: attr('string'),
feature_image: attr('string'),
visibility: attr('string', {defaultValue: 'public'}),
createdAtUTC: attr('moment-utc'),
updatedAtUTC: attr('moment-utc'),
Expand Down
4 changes: 2 additions & 2 deletions app/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default Model.extend(ValidationEngine, {
name: attr('string'),
slug: attr('string'),
email: attr('string'),
image: attr('string'),
cover: attr('string'),
profile_image: attr('string'),
cover_image: attr('string'),
bio: attr('string'),
website: attr('string'),
location: attr('string'),
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/gh-post-settings-menu.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>
<div class="settings-menu-content">
{{gh-image-uploader-with-preview
image=model.image
image=model.feature_image
text="Add post image"
update=(action "setCoverImage")
remove=(action "clearCoverImage")
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/gh-tag-settings-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>
<div class="settings-menu-content">
{{gh-image-uploader-with-preview
image=tag.image
image=tag.feature_image
text="Add tag image"
update=(action "setCoverImage")
remove=(action "clearCoverImage")}}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/settings/general.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@

{{#if showUploadCoverModal}}
{{gh-fullscreen-modal "upload-image"
model=(hash model=model imageProperty="cover")
model=(hash model=model imageProperty="cover_image")
close=(action "toggleUploadCoverModal")
modifier="action wide"}}
{{/if}}
Expand Down
4 changes: 2 additions & 2 deletions app/templates/team/user.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<button class="gh-btn gh-btn-default user-cover-edit" {{action "toggleUploadCoverModal"}}><span>Change Cover</span></button>
{{#if showUploadCoverModal}}
{{gh-fullscreen-modal "upload-image"
model=(hash model=user imageProperty="cover")
model=(hash model=user imageProperty="cover_image")
close=(action "toggleUploadCoverModal")
modifier="action wide"}}
{{/if}}
Expand All @@ -109,7 +109,7 @@
<button type="button" {{action "toggleUploadImageModal"}} class="edit-user-image">Edit Picture</button>
{{#if showUploadImageModal}}
{{gh-fullscreen-modal "upload-image"
model=(hash model=user imageProperty="image")
model=(hash model=user imageProperty="profile_image")
close=(action "toggleUploadImageModal")
modifier="action wide"}}
{{/if}}
Expand Down

0 comments on commit 5dad032

Please sign in to comment.