Sha256: 1b0b6c46c86c697e32e10252cf4ae5b56a5005f10ac9099976640d0bf21b040e

Contents?: true

Size: 589 Bytes

Versions: 19

Compression:

Stored size: 589 Bytes

Contents

module Kuhsaft
  class ImageBrick < Brick
    attr_accessible :image, :caption, :href, :image_size
    mount_uploader :image, Kuhsaft::ImageBrickImageUploader

    validates :image, :presence => true
    validates :image_size, :presence => true

    after_save :resize_image_if_size_changed

    def resize_image_if_size_changed
      image.recreate_versions! if image_size_changed? && image_present?
    end

    def collect_fulltext
      [super, caption].join(' ')
    end

    def user_can_add_childs?
      false
    end

    def image_present?
      image.present?
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
kuhsaft-1.8.6 app/models/kuhsaft/image_brick.rb
kuhsaft-1.8.5 app/models/kuhsaft/image_brick.rb
kuhsaft-2.0.2 app/models/kuhsaft/image_brick.rb
kuhsaft-1.8.4 app/models/kuhsaft/image_brick.rb
kuhsaft-1.8.1 app/models/kuhsaft/image_brick.rb
kuhsaft-2.0.1 app/models/kuhsaft/image_brick.rb
kuhsaft-2.0.0 app/models/kuhsaft/image_brick.rb
kuhsaft-1.8.0 app/models/kuhsaft/image_brick.rb
kuhsaft-1.7.1 app/models/kuhsaft/image_brick.rb
kuhsaft-1.7.0 app/models/kuhsaft/image_brick.rb
kuhsaft-1.6.0 app/models/kuhsaft/image_brick.rb
kuhsaft-1.5.0 app/models/kuhsaft/image_brick.rb
kuhsaft-1.4.3 app/models/kuhsaft/image_brick.rb
kuhsaft-1.4.2 app/models/kuhsaft/image_brick.rb
kuhsaft-1.4.1 app/models/kuhsaft/image_brick.rb
kuhsaft-1.4.0 app/models/kuhsaft/image_brick.rb
kuhsaft-1.3.1 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.15 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.14 app/models/kuhsaft/image_brick.rb