rx/presenters

View on GitHub
app/demo/plugins/image_crop.pom

Summary

Maintainability
Test Coverage
Voom::Presenters.define(:image_crop, namespace: :plugins) do
  helpers Demo::Helpers::IndentedGrid
  attach :top_nav
  attach :plugin_drawer
  plugin :image_crop

  page_title 'Image Crop'

  indented_grid do
    title 'Drag and drop with cropper preview'
    grid do
      column 6 do
        image_crop id: :event_image,
                   aspect_ratio: 1.0,
                   image: 'https://cdn.mos.cms.futurecdn.net/4f6d31c116fdada59a5cb16d136e3068-970-80.jpg' do
        end
      end
      column 6 do
        file_input name: :event_file_name, preview: :event_image, accept: 'image/png, image/jpeg, image/gif, image/svg+xml' do
          grid do
            column 12 do
              card do
                text 'Drop it here'
                button icon: :cloud_upload
              end
            end
          end
        end
      end
      event :change do
        replaces :context_list, ':context_list'
      end
    end
  end

  # image_crop do
  #   event :change do
  #     replaces :context_list, ':context_list'
  #   end
  # end
  attach 'context_list'
  attach :code, file: __FILE__
end