samedi 29 juillet 2017

Sort a list of images uploaded with carrierwave

In my application the user can upload multiple images with Carrier Wave. This images are display in a Fotorama library. So, I want to add some feature that the user can sort the list of the images how he likes.
How I am using postgreSQL with a json column like the tutorial on the docs of the gem. The path of the images are storage like this: enter image description here

I can not imagine how to do it.

The code that I am using is below:

In the form:

<%= f.file_field :imagens, multiple: true, class: "float-left" %>

In the model

class Product < ApplicationRecord
  mount_uploaders :imagens, ImagemUploader
end

The uploader is default by the gem.

It is possible to sort this?

Aucun commentaire:

Enregistrer un commentaire