Sha256: 393736a7321ceb667b56ccdac75ea168d3207bf97bd40ac8c8235b1789f5f620

Contents?: true

Size: 1.1 KB

Versions: 6

Compression:

Stored size: 1.1 KB

Contents

module YariiCloudinary
  class MediaController < ApplicationController
    def index
      cloudinary_tag = ENV.fetch('yarii_cloudinary_tag', 'yarii_editor')
      json_images = Cloudinary::Api.resources_by_tag(cloudinary_tag, cloud_name: ENV['yarii_cloudinary_cloud_name'], api_key: ENV['yarii_cloudinary_api_key'], api_secret: ENV['yarii_cloudinary_api_secret'], max_results: 200)['resources']

      @images = json_images.map do |image|
        {
          path: "v#{image['version']}/#{image['public_id']}",
          id: image['public_id'],
          format: image['format']
        }
      end

      render layout: false
    end

    def form_thumbnail
      render partial: 'form_thumbnail', layout: nil, formats: [:html], locals: {public_id: params[:id]}
    end

    def multiple_form_item
      render_locals = {
        public_id: params[:id],
        name: params[:name],
        index: params[:index],
        input_classes: params[:input_classes],
        placeholder:  params[:placeholder]
      }
      render partial: 'multiple_form_item', layout: nil, formats: [:html], locals: render_locals
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
yarii-cloudinary-0.2.6 app/controllers/yarii_cloudinary/media_controller.rb
yarii-cloudinary-0.2.5 app/controllers/yarii_cloudinary/media_controller.rb
yarii-cloudinary-0.2.3 app/controllers/yarii_cloudinary/media_controller.rb
yarii-cloudinary-0.2.2 app/controllers/yarii_cloudinary/media_controller.rb
yarii-cloudinary-0.2.1 app/controllers/yarii_cloudinary/media_controller.rb
yarii-cloudinary-0.2.0 app/controllers/yarii_cloudinary/media_controller.rb