Stackedit/js/github-provider.js

28 lines
949 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-05-04 00:05:58 +00:00
var PROVIDER_GITHUB = "github";
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);
2013-05-19 18:56:15 +00:00
publishAttributes.path = core.getInputValue($("#input-publish-file-path"), event);
2013-04-15 21:15:15 +00:00
if(event.isPropagationStopped()) {
return undefined;
}
return publishAttributes;
};
return githubProvider;
2013-04-14 13:24:29 +00:00
});