Stackedit/js/github-provider.js

26 lines
916 B
JavaScript
Raw Normal View History

2013-04-21 00:07:27 +00:00
define(["jquery", "core", "github-helper"], function($, core, githubHelper) {
2013-04-14 13:24:29 +00:00
2013-04-15 21:15:15 +00:00
var githubProvider = {
2013-04-14 13:24:29 +00:00
providerId: PROVIDER_GITHUB,
providerName: "GitHub"
};
2013-04-15 21:15:15 +00:00
githubProvider.publish = function(publishAttributes, title, content, callback) {
2013-04-14 13:24:29 +00:00
var commitMsg = core.settings.commitMsg;
2013-04-14 21:15:40 +00:00
githubHelper.upload(publishAttributes.repository, publishAttributes.branch,
publishAttributes.path, content, commitMsg, callback);
2013-04-14 13:24:29 +00:00
};
2013-04-15 21:15:15 +00:00
githubProvider.newPublishAttributes = function(event) {
var publishAttributes = {};
publishAttributes.repository = core.getInputValue($("#input-publish-github-reponame"), event);
publishAttributes.branch = core.getInputValue($("#input-publish-github-branch"), event);
publishAttributes.path = core.getInputValue($("#input-publish-github-path"), event);
if(event.isPropagationStopped()) {
return undefined;
}
return publishAttributes;
};
return githubProvider;
2013-04-14 13:24:29 +00:00
});