-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
40 retrieve config files from GitHub to display as default #46
40 retrieve config files from GitHub to display as default #46
Conversation
main.js
Outdated
} | ||
} | ||
} | ||
else return; // no config file selected | ||
|
||
if (!alreadyReadConfigFiles.includes(file)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment explaining what this does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition check if (!alreadyReadConfigFiles.includes(file)){}
is from the original code. I guess the purpose is to only read each config file once. However, this does not seem necessary at the moment since we can only read maximum of 1 config file in the upload screen before going to the edit screen. When we want to go back to upload screen again to upload another config file, the window reloads and alreadyReadConfigFiles
array is reset to empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean add a comment in the code, so that when someone wants to go over the code, instead of unpacking code blocks, they read comments.
viewtree.html
Outdated
@@ -150,6 +154,74 @@ | |||
<script src="scripts/saveSvgAsPng.js"></script> | |||
<script src="scripts/underscore-min.js"></script> | |||
<script src="scripts/cycle.js"></script> | |||
<script> | |||
var defaultConfigFiles = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this to a JS file (preferably a new file).
viewtree.html
Outdated
var defaultConfigFiles = []; | ||
|
||
function populateConfigFileSelectorHelper(files) { | ||
let option; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add comments explaining what each of these functions does?
<option>Choose File</option> | ||
<option>Upload your config file</option> | ||
</select> | ||
<input style="float:left; display:none" type="file" name="configFile" id="configFile"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When defining IDs sometimes camel case is used, while other times snake case is used. Please be consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will consistently define ids in camel case (as is with the original code)
This PR retrieves config files in this repo using Github API. The option for users to upload their own config file is preserved.