-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Revert "Revert "Adds multiple file upload (#10)" (#108)" This reverts commit 23ae498. * Add some docs about multiple file_fields --------- Co-authored-by: Jeremy Green <[email protected]>
- Loading branch information
1 parent
0363df3
commit 1e1e352
Showing
6 changed files
with
140 additions
and
24 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
bullet_train-fields/app/javascript/controllers/fields/file_item_controller.js
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,23 @@ | ||
import { Controller } from "@hotwired/stimulus"; | ||
|
||
export default class extends Controller { | ||
static targets = [ | ||
"removeFileFlag", | ||
"downloadFileButton", | ||
"removeFileButton", | ||
"fileName" | ||
]; | ||
|
||
static values = { id: Number } | ||
|
||
removeFile() { | ||
if (this.hasDownloadFileButtonTarget) { | ||
this.downloadFileButtonTarget.classList.add("hidden"); | ||
} | ||
|
||
this.removeFileButtonTarget.classList.add("hidden"); | ||
this.fileNameTarget.classList.add("hidden"); | ||
this.removeFileFlagTarget.value = this.idValue; | ||
} | ||
|
||
} |
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
13 changes: 13 additions & 0 deletions
13
bullet_train-themes-tailwind_css/app/views/themes/tailwind_css/attributes/_files.erb
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,13 @@ | ||
<% object ||= current_attributes_object %> | ||
<% strategy ||= current_attributes_strategy || :none %> | ||
<% url ||= nil %> | ||
<% if object.send(attribute).attached? %> | ||
<%= render 'shared/attributes/attribute', object: object, attribute: attribute, strategy: strategy, url: url do %> | ||
<% object.send(attribute).each do |file| %> | ||
<%= link_to url_for(file), class: 'button download-file' do %> | ||
<i class="leading-none mr-2 text-base ti ti-download"></i> | ||
<span>Download File</span> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
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