kuhsaft 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac77e66409517fb5bcb98ff2600257f33637ef2b
4
- data.tar.gz: 10e4316e5017e8d9729280b4720cdee9a3c38b4a
3
+ metadata.gz: 9015d7b905e9b86fc16f6512552ac928803f8544
4
+ data.tar.gz: 1aae93e44517a40d91b752b38b0e29a6b8d1b29a
5
5
  SHA512:
6
- metadata.gz: 4be55cad81853d2572bda9f90d43a3864cd1ff88b857e4177fb1e686e341912fd1cfa2f6236d7168968c3a41486ed62be98a481fbc0f50b88e20748b5e99f598
7
- data.tar.gz: ee3d836f72067c597a0e71e7f20e86c349c3517239ef6dfef4c7106b4a266de3e439982bba7713dcf146c332dc9b4d17a9f1d45b5a647bf57e0f6f2706fc2af5
6
+ metadata.gz: 38ebded0ae4162af01d57248c6af3749cd7e1e6280c54a63603e513e1750ce31a9e8b6ae83808c2fcdf6ebdf3bf47ef3955bd3d11be341ee53987a950556c3a4
7
+ data.tar.gz: 91db21ae33cffa9994e1d8d16f2a173d32cc284bba7b4b30a105480731ed90a40f25dabad14d8dc4e77089155f1eb2295f594ed7127f478baa85a4a01b97724c
data/README.md CHANGED
@@ -73,7 +73,7 @@ the defaults:
73
73
  end
74
74
  end
75
75
 
76
- See "Customizing The Image Brick" for more details.
76
+ See "Configuring the image brick" for more details.
77
77
 
78
78
  ## Authentication
79
79
 
@@ -322,6 +322,19 @@ Simply override the default partial for the main navigation in your app with you
322
322
  * Implement the `fulltext` method on your brick, return anything you want to be searchable.
323
323
  * Customize the edit form behaviour of your brick by overriding methods like `to_style_class?`. See the `Brick` and `BrickList` files for more methods.
324
324
 
325
+ ### Use the Kuhsaft ImageBrickImageUploader for your own Brick
326
+
327
+ Kuhsaft has a module called `ImageUploaderMounting`. This module mounts the ImageBrickImageUploader
328
+ and includes a callback method which handles that the image sizes will be updated after save.
329
+
330
+ class CustomBrick < Brick
331
+ include Kuhsaft::ImageUploaderMounting
332
+ ...
333
+ end
334
+
335
+ If you do not include this module, then the images will not be changed when selecting one of your own image
336
+ sizes. See "Configuring the image brick" for more details on creating your own image sizes.
337
+
325
338
  ## Integrating search
326
339
 
327
340
  Kuhsaft supports fulltext search when using PostgreSQL with a simple
@@ -1,16 +1,10 @@
1
1
  module Kuhsaft
2
2
  class ImageBrick < Brick
3
- mount_uploader :image, Kuhsaft::ImageBrickImageUploader
3
+ include Kuhsaft::ImageUploaderMounting
4
4
 
5
5
  validates :image, :presence => true
6
6
  validates :image_size, :presence => true
7
7
 
8
- after_save :resize_image_if_size_changed
9
-
10
- def resize_image_if_size_changed
11
- image.recreate_versions! if image_size_changed? && image_present?
12
- end
13
-
14
8
  def collect_fulltext
15
9
  [super, caption].join(' ')
16
10
  end
@@ -18,9 +12,5 @@ module Kuhsaft
18
12
  def user_can_add_childs?
19
13
  false
20
14
  end
21
-
22
- def image_present?
23
- image.present?
24
- end
25
15
  end
26
16
  end
@@ -1,6 +1,7 @@
1
1
  module Kuhsaft
2
2
  require 'kuhsaft/engine'
3
3
  require 'kuhsaft/orderable'
4
+ require 'kuhsaft/image_uploader_mounting'
4
5
  require 'kuhsaft/translatable'
5
6
  require 'kuhsaft/searchable'
6
7
  require 'kuhsaft/brick_list'
@@ -0,0 +1,24 @@
1
+ require 'carrierwave'
2
+ require 'active_support/concern'
3
+
4
+ module Kuhsaft
5
+ module ImageUploaderMounting
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ extend CarrierWave::Mount
10
+
11
+ mount_uploader :image, Kuhsaft::ImageBrickImageUploader
12
+
13
+ after_save :resize_image_if_size_changed
14
+
15
+ def resize_image_if_size_changed
16
+ image.recreate_versions! if image_size_changed? && image_present?
17
+ end
18
+
19
+ def image_present?
20
+ image.present?
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Kuhsaft
2
- VERSION = "2.2.2"
2
+ VERSION = "2.2.3"
3
3
  end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Kuhsaft::ImageUploaderMounting do
4
+
5
+ let :brick do
6
+ Kuhsaft::ImageBrick.new
7
+ end
8
+
9
+ describe '#uploader_mounting' do
10
+ it 'has a uploader mounted' do
11
+ brick.class.ancestors.include?(CarrierWave::Mount::Extension).should be_true
12
+ end
13
+ end
14
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuhsaft
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Immanuel Häussermann
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-10-10 00:00:00.000000000 Z
15
+ date: 2013-11-20 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -200,16 +200,16 @@ dependencies:
200
200
  name: bootstrap-sass
201
201
  requirement: !ruby/object:Gem::Requirement
202
202
  requirements:
203
- - - '>='
203
+ - - '='
204
204
  - !ruby/object:Gem::Version
205
- version: '0'
205
+ version: 2.3.2.2
206
206
  type: :runtime
207
207
  prerelease: false
208
208
  version_requirements: !ruby/object:Gem::Requirement
209
209
  requirements:
210
- - - '>='
210
+ - - '='
211
211
  - !ruby/object:Gem::Version
212
- version: '0'
212
+ version: 2.3.2.2
213
213
  - !ruby/object:Gem::Dependency
214
214
  name: ckeditor_rails
215
215
  requirement: !ruby/object:Gem::Requirement
@@ -525,6 +525,7 @@ files:
525
525
  - lib/generators/kuhsaft/translations/add_generator.rb
526
526
  - lib/kuhsaft/brick_list.rb
527
527
  - lib/kuhsaft/engine.rb
528
+ - lib/kuhsaft/image_uploader_mounting.rb
528
529
  - lib/kuhsaft/orderable.rb
529
530
  - lib/kuhsaft/page_tree.rb
530
531
  - lib/kuhsaft/partial_extractor.rb
@@ -591,6 +592,7 @@ files:
591
592
  - spec/kuhsaft_spec.rb
592
593
  - spec/lib/brick_list_spec.rb
593
594
  - spec/lib/engine_spec.rb
595
+ - spec/lib/image_uploader_mounting_spec.rb
594
596
  - spec/lib/page_tree_spec.rb
595
597
  - spec/lib/searchable_spec.rb
596
598
  - spec/lib/translatable_spec.rb
@@ -634,7 +636,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
634
636
  version: '0'
635
637
  requirements: []
636
638
  rubyforge_project: kuhsaft
637
- rubygems_version: 2.0.3
639
+ rubygems_version: 2.1.10
638
640
  signing_key:
639
641
  specification_version: 4
640
642
  summary: A tool that helps you to manage your content within your app.
@@ -689,6 +691,7 @@ test_files:
689
691
  - spec/kuhsaft_spec.rb
690
692
  - spec/lib/brick_list_spec.rb
691
693
  - spec/lib/engine_spec.rb
694
+ - spec/lib/image_uploader_mounting_spec.rb
692
695
  - spec/lib/page_tree_spec.rb
693
696
  - spec/lib/searchable_spec.rb
694
697
  - spec/lib/translatable_spec.rb