Skip to content

Commit

Permalink
Merge pull request #22 from vamcart/master
Browse files Browse the repository at this point in the history
Fix logo, slider upload and display problems
  • Loading branch information
vamcart authored Apr 14, 2019
2 parents fd71cc5 + 91561f5 commit fed44bc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 39 deletions.
1 change: 1 addition & 0 deletions config/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module.exports = {
// dashboard UI language
language: process.env.LANGUAGE || 'en',
apiBaseUrl: process.env.API_BASE_URL || 'http://localhost:3001/api/v1',
assetsBaseURL: process.env.ASSETS_BASE_URL || 'http://localhost:3001',
apiWebSocketUrl: process.env.API_WEB_SOCKET_URL || 'ws://localhost:3001',
developerMode: process.env.DEVELOPER_MODE || true
};
79 changes: 40 additions & 39 deletions src/modules/settings/themeSettings/components/imageEditor.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
import React from 'react';
import api from 'lib/api';
import ImageUpload from 'modules/shared/imageUpload';

export default class ThemeImageUpload extends React.Component {
onDelete = () => {
const fileName = this.props.input.value;
api.theme.assets.deleteFile(fileName).then(() => {
this.props.input.onChange('');
});
};

onUpload = formData => {
api.theme.assets.uploadFile(formData).then(({ status, json }) => {
const fileName = json.file;
this.props.input.onChange(fileName);
});
};

render() {
let { input, label } = this.props;
const imageUrl =
input.value && input.value.length > 0
? '/assets/images/' + input.value
: null;

return (
<div>
<p>{label}</p>
<ImageUpload
uploading={false}
imageUrl={imageUrl}
onDelete={this.onDelete}
onUpload={this.onUpload}
/>
</div>
);
}
}
import React from 'react';
import api from 'lib/api';
import ImageUpload from 'modules/shared/imageUpload';
import settings from 'lib/settings';

export default class ThemeImageUpload extends React.Component {
onDelete = () => {
const fileName = this.props.input.value;
api.theme.assets.deleteFile(fileName).then(() => {
this.props.input.onChange('');
});
};

onUpload = formData => {
api.theme.assets.uploadFile(formData).then(({ status, json }) => {
const fileName = json.file;
this.props.input.onChange(fileName);
});
};

render() {
let { input, label } = this.props;
const imageUrl =
input.value && input.value.length > 0
? settings.assetsBaseURL + '/assets/images/' + input.value
: null;

return (
<div>
<p>{label}</p>
<ImageUpload
uploading={false}
imageUrl={imageUrl}
onDelete={this.onDelete}
onUpload={this.onUpload}
/>
</div>
);
}
}

0 comments on commit fed44bc

Please sign in to comment.