Stackedit/js/github-provider.js

34 lines
1.0 KiB
JavaScript
Raw Normal View History

2013-04-14 13:24:29 +00:00
define(["jquery", "github-helper"], function($, githubHelper) {
// Dependencies
var core = undefined;
2013-04-15 21:15:15 +00:00
var githubProvider = {
2013-04-14 13:24:29 +00:00
providerType: PROVIDER_TYPE_PUBLISH_FLAG,
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;
};
githubProvider.init = function(coreModule) {
2013-04-14 13:24:29 +00:00
core = coreModule;
};
2013-04-15 21:15:15 +00:00
return githubProvider;
2013-04-14 13:24:29 +00:00
});