forked from arbory/arbory
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request arbory#64 from roboc/file_field
Fix arbory#37: Don't delete file on form submit
- Loading branch information
Showing
5 changed files
with
70 additions
and
32 deletions.
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
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,27 @@ | ||
export default class File { | ||
/** | ||
* @param element | ||
*/ | ||
constructor(element) { | ||
this.element = element; | ||
|
||
this.registerEventHandlers(); | ||
} | ||
|
||
/** | ||
* @return {void} | ||
*/ | ||
registerEventHandlers() { | ||
let field = this.getField(); | ||
|
||
field.find('button.remove').on('click', function () { | ||
field.find('input.remove').val(1); | ||
field.find('.thumbnail').hide(); | ||
field.find('.file-details').hide(); | ||
}); | ||
} | ||
|
||
getField() { | ||
return jQuery(this.element); | ||
} | ||
} |
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