2013-05-27 19:45:33 +00:00
|
|
|
define([
|
|
|
|
"utils",
|
2013-06-22 23:48:57 +00:00
|
|
|
"classes/Provider",
|
2013-05-27 19:45:33 +00:00
|
|
|
"settings",
|
2013-06-10 21:22:32 +00:00
|
|
|
"helpers/githubHelper"
|
2013-06-22 23:48:57 +00:00
|
|
|
], function(utils, Provider, settings, githubHelper) {
|
2013-04-14 13:24:29 +00:00
|
|
|
|
2013-06-22 23:48:57 +00:00
|
|
|
var githubProvider = new Provider("github", "GitHub");
|
|
|
|
githubProvider.publishPreferencesInputIds = [
|
|
|
|
"github-reponame",
|
2013-06-27 23:10:04 +00:00
|
|
|
"github-username",
|
2013-06-22 23:48:57 +00:00
|
|
|
"github-branch"
|
|
|
|
];
|
2013-05-29 19:55:23 +00:00
|
|
|
|
|
|
|
githubProvider.publish = function(publishAttributes, title, content, callback) {
|
|
|
|
var commitMsg = settings.commitMsg;
|
2013-06-27 23:10:04 +00:00
|
|
|
githubHelper.upload(publishAttributes.repository, publishAttributes.username, publishAttributes.branch, publishAttributes.path, content, commitMsg, callback);
|
2013-05-29 19:55:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
githubProvider.newPublishAttributes = function(event) {
|
|
|
|
var publishAttributes = {};
|
|
|
|
publishAttributes.repository = utils.getInputTextValue("#input-publish-github-reponame", event);
|
2013-06-27 23:10:04 +00:00
|
|
|
publishAttributes.username = utils.getInputTextValue("#input-publish-github-username");
|
2013-05-29 19:55:23 +00:00
|
|
|
publishAttributes.branch = utils.getInputTextValue("#input-publish-github-branch", event);
|
|
|
|
publishAttributes.path = utils.getInputTextValue("#input-publish-file-path", event);
|
|
|
|
if(event.isPropagationStopped()) {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
return publishAttributes;
|
|
|
|
};
|
|
|
|
|
|
|
|
return githubProvider;
|
2013-04-14 13:24:29 +00:00
|
|
|
});
|