diff --git a/backend/generator.js b/backend/generator.js
index 3bbe26f3..2b43d054 100644
--- a/backend/generator.js
+++ b/backend/generator.js
@@ -16,6 +16,10 @@ exports.executeScript = function (socket, formData) {
var debug = formData.debug;
var uniqueId = uuidV4();
var webUI = "true";
+ var subProject = ""
+ if (formData.subProject != undefined) {
+ subProject = formData.subProject.join(",")
+ }
var donePercent = 0;
@@ -25,7 +29,8 @@ exports.executeScript = function (socket, formData) {
"-m", email,
"-d", debug,
"-u", uniqueId,
- "-w", webUI
+ "-w", webUI,
+ "-s", subProject
];
var process = spawn("./generate.sh", args);
diff --git a/multiple_generate.sh b/multiple_generate.sh
index cb604e77..bb8dbbe1 100755
--- a/multiple_generate.sh
+++ b/multiple_generate.sh
@@ -84,6 +84,7 @@ if [ "${WEBUI:-false}" == "true" ]; then
cd ..
mv ${UNIQUEID} ${UNIQUEID}_preview
zip -r -q ${UNIQUEID}.zip ${UNIQUEID}_preview
+ exit 0
else
source <(curl -s https://raw.githubusercontent.com/fossasia/yaydoc/master/publish_docs.sh)
fi
diff --git a/public/scripts/form.js b/public/scripts/form.js
index e64ca3e8..80cb8a15 100644
--- a/public/scripts/form.js
+++ b/public/scripts/form.js
@@ -14,6 +14,7 @@ $(function () {
if (validation.isValid(formData)) {
socket.emit('execute', formData);
$(this).attr("disabled", "none");
+ $("#subProject").attr("disabled", "none");
} else {
$('.notification').append($('
')).text(validation.getMessages());
$('#notification-container').css("visibility", "visible");
@@ -29,7 +30,12 @@ $(function () {
socket.on('logs', function (data) {
$('#messages').append($('').text(data.data));
- $("#progress").css("width", data.donePercent + "%");
+ if (data.donePercent >= 90) {
+ $("#progress").css("width", "90%");
+ } else {
+ $("#progress").css("width", data.donePercent + "%");
+ }
+
});
socket.on('err-logs', function (msg) {
@@ -37,6 +43,7 @@ $(function () {
});
socket.on('success', function (data) {
+ $("#progress").css("width", "100%");
$('#btnDownload').css("display", "inline");
$('#btnDownload').attr("href", "/download/" + data.email +"/" + data.uniqueId);
$('#btnPreview').css("display", "inline");
@@ -90,7 +97,21 @@ function getData() {
if (field.name === "debug" ) { data.debug = field.value; }
if (field.name === "heroku_api_key" ) { data.herokuAPIKey = field.value.trim(); }
if (field.name === "heroku_app_name" ) { data.herokuAppName = field.value.trim(); }
+ if (field.name === "subproject_url[]") {
+ if (data.subProject == undefined) {
+ data.subProject = [field.value];
+ } else {
+ data.subProject.push(field.value);
+ }
+ }
});
return data;
}
+
+var tempSubProjectId = 1
+function addSubProject() {
+ $("#subproject").append(``)
+ addSuggestion(`#subproject_${tempSubProjectId}`)
+ tempSubProjectId += 1;
+}
diff --git a/public/scripts/suggestion.js b/public/scripts/suggestion.js
index 566e063c..5b65ee09 100644
--- a/public/scripts/suggestion.js
+++ b/public/scripts/suggestion.js
@@ -1,22 +1,30 @@
+var insertedItem = [];
$( document ).ready(function() {
- var insertedItem = [];
- $('#git_url').editableSelect();
- $('#git_url').keyup(() => {
- var q = $('#git_url').val()
- if (q.length > 3) {
- $.get(`https://api.github.com/search/repositories?q=${q}+fork%3Atrue`,
- (result) => {
- if (result.items != undefined) {
- for (var i = 0; i < result.items.length; i++) {
- if (insertedItem.indexOf(result.items[i].clone_url) < 0) {
- insertedItem.push(result.items[i].clone_url);
- $('#git_url').editableSelect('add', result.items[i].clone_url);
- }
- }
- }
- })
- } else if (q.length == 0) {
- $('#git_url').editableSelect('hide')
- }
- });
+ addSuggestion('#git_url')
})
+
+function addSuggestion(selector) {
+ $(selector).editableSelect();
+ insertedItem.forEach((x) => {
+ $(selector).editableSelect('add', x);
+ })
+ $(selector).keyup(() => {
+ console.log(`hi iam ${selector}`);
+ var q = $(selector).val()
+ if (q.length > 3) {
+ $.get(`https://api.github.com/search/repositories?q=${q}+fork%3Atrue`,
+ (result) => {
+ if (result.items != undefined) {
+ for (var i = 0; i < result.items.length; i++) {
+ if (insertedItem.indexOf(result.items[i].clone_url) < 0) {
+ insertedItem.push(result.items[i].clone_url);
+ $(selector).editableSelect('add', result.items[i].clone_url);
+ }
+ }
+ }
+ })
+ } else if (q.length == 0) {
+ $(selector).editableSelect('hselectore')
+ }
+ });
+}
diff --git a/public/scripts/validation.js b/public/scripts/validation.js
index 98aaffe1..a154b7ae 100644
--- a/public/scripts/validation.js
+++ b/public/scripts/validation.js
@@ -26,6 +26,17 @@
}
}
+ if (formData.subProject != undefined) {
+ for (var i = 0; i < formData.subProject.length; i++) {
+ regex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/;
+ if (!(formData.subProject[i] == "")) {
+ if(!regex.test(formData.subProject[i])) {
+ messages.push("Invalid URL");
+ valid = false;
+ }
+ }
+ }
+ }
return valid;
},
diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css
index 6d3efaae..a8a57fa2 100644
--- a/public/stylesheets/style.css
+++ b/public/stylesheets/style.css
@@ -22,6 +22,10 @@ a {
text-align: left;
}
+.subproject {
+ margin-bottom: 8px;
+}
+
#messages li {
margin-bottom: 5px;
}
@@ -38,6 +42,11 @@ a {
margin-bottom: 20px;
}
+#subProject {
+ margin-bottom: 20px;
+ margin-left: 10px;
+}
+
#btnDownload {
display: none;
width: -moz-fit-content;
diff --git a/views/index.jade b/views/index.jade
index da504383..690168d0 100644
--- a/views/index.jade
+++ b/views/index.jade
@@ -16,6 +16,7 @@ block content
.form-group
label.control-label(for='git_url') GITURL:
select#git_url.form-control(type='text', placeholder='Enter URL of Github Repository', name='git_url')
+ .div#subproject
.form-group
label.control-label(for='doc_theme') Doc Theme:
select#doc_theme.form-control(name='doc_theme')
@@ -42,6 +43,7 @@ block content
input#debug(type='checkbox', value='true', name='debug', checked=false)
.form-group#buttons
button.btn.btn-default(type='button' id='btnGenerate') Generate Docs
+ button.btn.btn-default(type='button' id='subProject' onclick="addSubProject()") Add Sub Project
.row(style='padding-bottom: 25px;')
a.btn.btn-default(id='btnDownload') Download
a.btn.btn-default(id='btnPreview' target='_blank') Preview