2013-05-25 18:13:59 +00:00
|
|
|
define(["core", "utils", "github-helper"], function(core, utils, 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,
|
2013-05-22 21:54:14 +00:00
|
|
|
providerName: "GitHub",
|
|
|
|
publishPreferencesInputIds: ["github-reponame", "github-branch"]
|
2013-04-14 13:24:29 +00:00
|
|
|
};
|
|
|
|
|
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 = {};
|
2013-05-25 18:13:59 +00:00
|
|
|
publishAttributes.repository = utils.getInputTextValue("#input-publish-github-reponame", event);
|
|
|
|
publishAttributes.branch = utils.getInputTextValue("#input-publish-github-branch", event);
|
|
|
|
publishAttributes.path = utils.getInputTextValue("#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
|
|
|
});
|