Class: RailsDevtools::ImageAssetsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- ApplicationController
- BaseController
- RailsDevtools::ImageAssetsController
- Defined in:
- app/controllers/rails_devtools/image_assets_controller.rb
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/rails_devtools/image_assets_controller.rb', line 15 def destroy image_info = ImageAssets::ImageInfo.new(params[:image_path]) raise "This is a not an image" unless image_info.valid? File.delete(image_info.full_path) respond_to do |format| format.html { redirect_to image_assets_path, notice: "Image was successfully destroyed." } format.turbo_stream { render turbo_stream: [ turbo_stream.remove(image_info.full_path), turbo_stream.append( "flash_messages", Components::FlashMessage.new( message: "Image was successfully destroyed." ) ) ] } end end |
#index ⇒ Object
10 11 12 13 |
# File 'app/controllers/rails_devtools/image_assets_controller.rb', line 10 def index form = ImageSearchForm.new(search: form_params[:search]) render ImageAssets::Index.new(images_by_folder: form.results, form: form) end |
#show ⇒ Object
5 6 7 8 |
# File 'app/controllers/rails_devtools/image_assets_controller.rb', line 5 def show image_info = ImageAssets::ImageInfo.new(params[:image_path]) render ImageAssets::ImageDetails.new(image_info: image_info) end |