Class: RailsDevtools::ImageAssets::ImageDetails
- Inherits:
-
Components::ApplicationComponent
- Object
- Phlex::HTML
- Components::ApplicationComponent
- RailsDevtools::ImageAssets::ImageDetails
- Defined in:
- app/views/rails_devtools/image_assets/image_details.rb
Instance Method Summary collapse
- #delete_button ⇒ Object
- #image_tag_input ⇒ Object
-
#initialize(image_info:) ⇒ ImageDetails
constructor
A new instance of ImageDetails.
- #view_template ⇒ Object
Methods inherited from Components::ApplicationComponent
Constructor Details
#initialize(image_info:) ⇒ ImageDetails
Returns a new instance of ImageDetails.
5 6 7 |
# File 'app/views/rails_devtools/image_assets/image_details.rb', line 5 def initialize(image_info:) @image_info = image_info end |
Instance Method Details
#delete_button ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/views/rails_devtools/image_assets/image_details.rb', line 60 def ( helpers.image_asset_path(@image_info.name, image_path: @image_info.full_path), class: "btn btn-outline btn-error btn-sm", method: :delete, form: { data: { turbo_confirm: "Are you sure you want to delete this image?", action: "turbo:submit-end->checkbox#toggle" } } ) do span { render Components::Lucide::Trash.new(width: 16, height: 16) } plain "delete" end end |
#image_tag_input ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/views/rails_devtools/image_assets/image_details.rb', line 39 def image_tag_input div(class: "mt-8 w-full") do div( class: "join w-full", data_controller: "clipboard", data_clipboard_success_content_value: "Copied!" ) do input( value: @image_info.image_helper_snippet, class: "input input-bordered input-primary input-sm w-full join-item", data_clipboard_target: "source" ) ( class: "btn btn-primary btn-outline btn-sm join-item", data_action: "clipboard#copy", data_clipboard_target: "button" ) { "Copy" } end end end |
#view_template ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/views/rails_devtools/image_assets/image_details.rb', line 9 def view_template turbo_frame_tag("drawer_content", class: "flex flex-col") do figure do img( src: helpers.host_app_image_path(@image_info.devtools_image_path), width: "400" ) end div(class: "mt-4") do h3(class: "text-lg font-bold") { @image_info.basename } div(class: "mt-4 pt-4 border-t-2 border-base-300 grid grid-cols-3 gap-x-4 gap-y-2 mt-2 text-sm text-neutral") do # Image size div(class: "text-right font-bold ") { "Image size" } div(class: "col-span-2") { "#{@image_info.width} x #{@image_info.height}" } # File size div(class: "text-right font-bold text-neutral") { "File size" } div(class: "col-span-2") { bytes_to_kb(@image_info.file_size) } end end image_tag_input div(class: "mt-8 pt-8 border-t-2 border-base-300 flex gap-x-2 justify-end") do end end end |