Sha256: 089f290b5e2eae184b88e338a0b260e5dabfbef65653c916c92ddf53df9dec3d

Contents?: true

Size: 519 Bytes

Versions: 14

Compression:

Stored size: 519 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

    before_save :resize_image_if_size_changed

    def resize_image_if_size_changed
      image.recreate_versions! if image_size_changed?
    end

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

    def user_can_add_childs?
      false
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
kuhsaft-1.2.13 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.12 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.11 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.10 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.9 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.8 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.7 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.6 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.5 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.4 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.3 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.2 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.1 app/models/kuhsaft/image_brick.rb
kuhsaft-1.2.0 app/models/kuhsaft/image_brick.rb