Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 module import syntax. Fixes #347 #351

Merged
merged 2 commits into from
Feb 9, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix apiRequest function.
coreygrunewald committed Feb 9, 2017
commit 07e417d0a5e4c5d471120e82ffe9ff0be50dbfb1
2 changes: 1 addition & 1 deletion lektor/admin/static/js/components/Sidebar.jsx
Original file line number Diff line number Diff line change
@@ -151,7 +151,7 @@ class Sidebar extends RecordComponent {
utils.apiRequest('/browsefs', {data: {
path: this.getRecordPath(),
alt: this.getRecordAlt()
}, method: 'POST'})
}, method: 'POST'}, makeRichPromise)
.then((resp) => {
if (!resp.okay) {
alert(i18n.trans('ERROR_CANNOT_BROWSE_FS'));
3 changes: 2 additions & 1 deletion lektor/admin/static/js/dialogs/Refresh.jsx
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ import SlideDialog from '../components/SlideDialog'
import utils from '../utils'
import i18n from '../i18n'
import dialogSystem from '../dialogSystem'
import makeRichPromise from '../richPromise';


class Refresh extends Component {
@@ -37,7 +38,7 @@ class Refresh extends Component {
});
utils.apiRequest('/clean', {
method: 'POST'
}).then((resp) => {
}, makeRichPromise).then((resp) => {
this.setState({
currentState: 'DONE'
})
3 changes: 2 additions & 1 deletion lektor/admin/static/js/dialogs/findFiles.jsx
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ import SlideDialog from '../components/SlideDialog';
import utils from '../utils';
import i18n from '../i18n';
import dialogSystem from '../dialogSystem';
import makeRichPromise from '../richPromise';

class FindFiles extends RecordComponent {

@@ -46,7 +47,7 @@ class FindFiles extends RecordComponent {
lang: i18n.currentLanguage
},
method: 'POST'
}).then((resp) => {
}, makeRichPromise).then((resp) => {
this.setState({
results: resp.results,
currentSelection: Math.min(this.state.currentSelection,
2 changes: 1 addition & 1 deletion lektor/admin/static/js/dialogs/publish.jsx
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ class Publish extends Component {
});
utils.apiRequest('/build', {
method: 'POST'
}).then((resp) => {
}, makeRichPromise).then((resp) => {
this._beginPublish();
});
}
4 changes: 2 additions & 2 deletions lektor/admin/static/js/utils.jsx
Original file line number Diff line number Diff line change
@@ -230,7 +230,7 @@ const utils = {
});
},

apiRequest(url, options) {
apiRequest(url, options, createPromise) {
options = options || {};
options.url = utils.getApiUrl(url);
if (options.json !== undefined) {
@@ -242,7 +242,7 @@ const utils = {
options.method = 'GET';
}

return makeRichPromise((resolve, reject) => {
return createPromise((resolve, reject) => {
jQuery.ajax(options)
.done((data) => {
resolve(data);
2 changes: 1 addition & 1 deletion lektor/admin/static/js/views/AddChildPage.jsx
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ class AddChildPage extends RecordComponent {
data[primaryField.name] = this.state.primary;
}

utils.apiRequest('/newrecord', {json: params, method: 'POST'})
utils.apiRequest('/newrecord', {json: params, method: 'POST'}, makeRichPromise)
.then((resp) => {
if (resp.exists) {
errMsg(i18n.trans('ERROR_PAGE_ID_DUPLICATE').replace('%s', id));
2 changes: 1 addition & 1 deletion lektor/admin/static/js/views/DeletePage.jsx
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ class DeletePage extends RecordComponent {
path: path,
alt: this.getRecordAlt(),
delete_master: this.state.deleteMasterRecord ? '1' : '0'
}, method: 'POST'})
}, method: 'POST'}, makeRichPromise)
.then((resp) => {
if (this.state.recordInfo.is_attachment) {
hub.emit(new AttachmentsChangedEvent({
2 changes: 1 addition & 1 deletion lektor/admin/static/js/views/EditPage.jsx
Original file line number Diff line number Diff line change
@@ -135,7 +135,7 @@ class EditPage extends RecordEditComponent {
var alt = this.getRecordAlt();
var newData = this.getValues();
utils.apiRequest('/rawrecord', {json: {
data: newData, path: path, alt: alt}, method: 'PUT'})
data: newData, path: path, alt: alt}, method: 'PUT'}, makeRichPromise)
.then((resp) => {
this.setState({
hasPendingChanges: false