Giter Site home page Giter Site logo

carrierwave_globalize's People

Contributors

dalpo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

carrierwave_globalize's Issues

mount_translated_uploader always populates with string of "Uploader" object

Hi there,

I've followed the instructions, and boiled down, the code in use is:

class Bob < ActiveRecord::Base
  translates :message, :button_text, :message_footer, :image_landing_url, :square_image
  extend CarrierwaveGlobalize
  mount_translated_uploader :square_image, SquareImageUploader
end

Uploader:

class SquareImageUploader < CarrierWave::Uploader::Base
  include CarrierWave::MiniMagick
  storage :file
  
  process resize_and_crop: 800

  private

   def resize_and_crop(size)
    manipulate! do |image|
      if image[:width] < image[:height]
        remove = ((image[:height] - image[:width])/2).round
        image.shave("0x#{remove}")
      elsif image[:width] > image[:height]
        remove = ((image[:width] - image[:height])/2).round
        image.shave("#{remove}x0")
      end
      image.resize("#{size}x#{size}")
      image
    end
  end

end

The problem happens when the resulting form (relevant snippet):

= f.fields_for :translations, bob_translations do |ft|
        .col-md-4
          .panel.panel-default
            .panel-heading
              = translation_locale_name(ft.object.locale)
            .panel-body
              = ft.hidden_field :locale
              = ft.file_field :square_image

The form has multipart also set.

But all of the values posted to the fields being saved as string representations of the upload file object, like "#ActionDispatch::Http::UploadedFile:0x00007fd5d44c99e0" - which is not useful.

Any hits for where this might not be working?

Can we get support for rails admin?

I am using a gem 'rails_admin_globalize_field' which provides globalization feature for rails admin.But image fields is showing as text input instead of file upload per locale.Can you please look into for support.

Support for Multiple File Uploaders

It seems like this plugin doesn't have an equivalent mount_translated_uploaders for mount_uploaders. It would be great to be able to handle an arbitrary number of translated files using that feature of carrierwave.

self.remove_attachment!

this method does not work. Even f.input :remove_attachment does not work. How to implement it?

uninitialized constant CarrierWave::Mount::Mounter

The following method has an issue:

def _translations_mounter(column)
@_translations_mounter ||= {}
(@_translations_mounter[Globalize.locale.to_sym] ||= {})[column] ||=
::CarrierWave::Mount::Mounter.new(self, column)
end

We need to change Carrierwave::Mount::Mounter to Carrierwave::Mounter
Reference for solution: neo4jrb/carrierwave-neo4j#11

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.