Skip to content

Commit

Permalink
Merge branch 'develop' into issue/1758
Browse files Browse the repository at this point in the history
* develop:
  article view now generated after article model saved
  Amend check to allow undefined data
  Switch to local log func
  Stop throwing error if repo update check failed
  Fix version check
  Add override for removal of list items
  Handle response errors better
  Fix bug with recursive function call
  Remove testing header
  Update CHANGELOG for release 0.4.0 (#1739)
  Enchancements to install/update (#1726)
  Amend contentModel._children to allow for arrays
  fixes 1474
  updated from feedback changed icon to paintbrush

# Conflicts:
#	frontend/src/modules/editor/contentObject/views/editorPageView.js
  • Loading branch information
taylortom committed Nov 27, 2017
2 parents a6e4cb3 + 56a748c commit ed3e92c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 14 deletions.
27 changes: 27 additions & 0 deletions frontend/src/modules/scaffold/backboneFormsOverrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,33 @@ define(function(require) {
return parts.join('<br />');
};

Backbone.Form.editors.List.prototype.removeItem = function(item) {
//Confirm delete
var confirmMsg = this.schema.confirmDelete;

var remove = _.bind(function(isConfirmed) {
if (isConfirmed === false) return;

var index = _.indexOf(this.items, item);

this.items[index].remove();
this.items.splice(index, 1);

if (item.addEventTriggered) {
this.trigger('remove', this, item.editor);
this.trigger('change', this);
}

if (!this.items.length && !this.Editor.isAsync) this.addItem();
}, this);

if (confirmMsg) {
window.confirm({ title: confirmMsg, type: 'warning', callback: remove });
} else {
remove();
}
};

// Used to setValue with defaults

Backbone.Form.editors.Base.prototype.setValue = function(value) {
Expand Down
2 changes: 1 addition & 1 deletion lib/bowermanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ BowerManager.prototype.installPlugin = function(pluginName, pluginVersion, callb
if (err) {
return callback(err);
}
installHelpers.getLatestFrameworkVersion(function(error, frameworkVersion) {
installHelpers.getInstalledFrameworkVersion(function(error, frameworkVersion) {
if (error) {
return callback(error);
}
Expand Down
29 changes: 16 additions & 13 deletions lib/installHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ function getUpdateData(callback) {
return callback(error);
}
var updateData = {};
if(semver.lt(results[0].adapt_authoring, results[1].adapt_authoring)) {
if(results[1].adapt_authoring && semver.lt(results[0].adapt_authoring, results[1].adapt_authoring)) {
updateData.adapt_authoring = results[1].adapt_authoring;
}
if(semver.lt(results[0].adapt_framework, results[1].adapt_framework)) {
if(results[1].adapt_framework && semver.lt(results[0].adapt_framework, results[1].adapt_framework)) {
updateData.adapt_framework = results[1].adapt_framework;
}
if(_.isEmpty(updateData)) {
Expand Down Expand Up @@ -205,17 +205,20 @@ function checkLatestAdaptRepoVersion(repoName, versionLimit, callback) {
}, done);
};
var _requestHandler = function(error, response, body) {
// we've exceeded the API limit
if(response.statusCode === 403 && response.headers['x-ratelimit-remaining'] === '0') {
var reqsReset = new Date(response.headers['x-ratelimit-reset']*1000);
error = `You have exceeded GitHub's request limit of ${response.headers['x-ratelimit-limit']} requests per hour. Please wait until at least ${reqsReset.toTimeString()} before trying again.`;
}
else if (response.statusCode !== 200) {
error = 'GitubAPI did not respond with a 200 status code.';
if(response) {
// we've exceeded the API limit
if(response.statusCode === 403 && response.headers['x-ratelimit-remaining'] === '0') {
var reqsReset = new Date(response.headers['x-ratelimit-reset']*1000);
error = `You have exceeded GitHub's request limit of ${response.headers['x-ratelimit-limit']} requests per hour. Please wait until at least ${reqsReset.toTimeString()} before trying again.`;
}
else if(response.statusCode !== 200) {
error = 'GitubAPI did not respond with a 200 status code.';
}
}

// exit, but just log the error
if (error) {
return callback(`Couldn't check latest version of ${repoName}\n${error}`);
log(`Couldn't check latest version of ${repoName}\n${error}`);
return callback();
}
nextPage = parseLinkHeader(response.headers.link).next;
try {
Expand Down Expand Up @@ -287,8 +290,8 @@ function installFramework(opts, callback) {
}
if(!opts.revision) {
return getLatestFrameworkVersion(function(error, version) {
if(error) return callback(error);
opts.revision = version;
// NOTE we default to the master branch
opts.revision = version || 'master';
installFramework(opts, callback);
});
}
Expand Down

0 comments on commit ed3e92c

Please sign in to comment.