-
Notifications
You must be signed in to change notification settings - Fork 67
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
file upload functionality and error hijacking #111
Merged
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
cc3d9b4
Initial work on file upload lesson.
mikeal 117c701
Fix linter error
terichadbourne cb0f3af
Merge branch 'code' into file-upload
terichadbourne d8fa09a
Remove unused properties
terichadbourne 7956414
Add dummy file tutorial lesson
terichadbourne 14c2cb8
Offer multiple boilerplates & update instructions
terichadbourne 627eb39
Update UI for file upload
terichadbourne 5cb9e04
Remove "Step 2" header from non-file exercise box
terichadbourne b934a1d
Remove unused console logs
terichadbourne 6c50a79
Add file tutorial to homepage and adjust titles
terichadbourne 2cc679f
Appease linter
terichadbourne f1f16d6
Beautify upload formatting
terichadbourne 9bc44ad
Repair file upload and code submission
terichadbourne f0d5b70
Change icon and fix formatting for uploaded files
terichadbourne be14009
Disable submit button in file lesson until upload
terichadbourne 28d4039
Disallow folder upload
terichadbourne 7204e1a
Add 2nd file lesson
terichadbourne d768208
Improve formatting on disabled button hover
terichadbourne 2c78e7f
Complete files lesson 1 content
terichadbourne 59329d7
Update 2nd file lesson (WIP)
terichadbourne 337e123
More validation flailing
terichadbourne 9071b2c
Update package-lock.json
terichadbourne 4d350c7
Merge branch 'code' into file-upload
terichadbourne e72a8cf
Restructure initial lesson content
terichadbourne bb550f5
Merge branch 'code' into file-upload
terichadbourne 190f1eb
Remove old console logs
terichadbourne 64e3626
Remove `code` and `validate` from text lessons
terichadbourne 2d1d381
Merge branch 'code' into file-upload
terichadbourne ae26690
Update dependencies to fix IPFS import
terichadbourne 8cb8e2b
Fix console logs for file basics lesson 2
terichadbourne e7405e5
Add a lesson #4 on MFS `write` method
terichadbourne 26d5466
Rename `lessons` dir, create `boilerplates` dir
terichadbourne 8beaa63
Change /lessons references to /tutorials
terichadbourne ef4a779
Fix validation for MFS Lesson 4
terichadbourne 2b35f36
Rename file tutorial to be about MFS
terichadbourne 3ddc148
Add lesson on `files.ls`
terichadbourne 40cb898
Update validation error message
terichadbourne 3244aa0
chore: sync with code branch
fsdiogo 0f3f156
chore: boilerplates tidy up and path fix
fsdiogo b94d668
fix: expected result of Lesson 3
fsdiogo e833e79
chore: some rephrasing to the first mfs lessons
fsdiogo 215e98b
Add lesson on files.mkdir
terichadbourne 711cae4
Sync with code branch
fsdiogo 6a2f2ee
feat: add the ability to override external errors
fsdiogo 1e250f6
Merge branch 'code' into file-upload
fsdiogo 68e8e36
chore: add instructions for overriding errors
fsdiogo c5aee7e
chore: hide MFS lesson
fsdiogo ad72e2b
Clarify instructions for adding error override
terichadbourne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ cache: | |
before_script: | ||
npm install | ||
script: | ||
npm test | ||
npm run build | ||
notifications: | ||
email: false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<script> | ||
import Lesson from './Lesson.vue' | ||
|
||
const defaultCode = `/* globals ipfs */ | ||
|
||
const run = async (files) => { | ||
// your code goes here! | ||
// be sure this function returns the requested value | ||
} | ||
|
||
return run | ||
|
||
` | ||
|
||
export default { | ||
extends: Lesson, | ||
beforeCreate: function () { | ||
this.isFileLesson = true | ||
this.defaultCode = defaultCode | ||
}, | ||
methods: { | ||
onFileDrop: function (event) { | ||
event.preventDefault() | ||
event.stopPropagation() | ||
let files = Array.from(event.dataTransfer.files) | ||
for (let f of Array.from(event.dataTransfer.items)) { | ||
let isFile = f.getAsEntry ? f.getAsEntry().isFile : (f.webkitGetAsEntry ? f.webkitGetAsEntry().isFile : true) | ||
if (!isFile) { | ||
return alert("Folder upload is not supported. Please select a file or multiple files.") | ||
} | ||
} | ||
this.onFiles(files) | ||
return false | ||
}, | ||
onFileClick: function (event) { | ||
event.preventDefault() | ||
event.stopPropagation() | ||
let elem = document.createElement('input') | ||
elem.setAttribute("type", "file") | ||
elem.setAttribute('multiple', true) | ||
elem.onchange = () => { | ||
this.onFiles(Array.from(elem.files)) | ||
} | ||
elem.click() | ||
}, | ||
onFiles: function (files) { | ||
this.uploadedFiles = files | ||
window.uploadedFiles = files | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"all": ["dataStructures", "basics", "blog"], | ||
"featured": ["dataStructures", "basics", "blog"] | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@fsdiogo needs more hyphens: