kuhsaft 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -1
- data/app/models/kuhsaft/image_brick.rb +1 -11
- data/lib/kuhsaft.rb +1 -0
- data/lib/kuhsaft/image_uploader_mounting.rb +24 -0
- data/lib/kuhsaft/version.rb +1 -1
- data/spec/lib/image_uploader_mounting_spec.rb +14 -0
- metadata +10 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9015d7b905e9b86fc16f6512552ac928803f8544
|
4
|
+
data.tar.gz: 1aae93e44517a40d91b752b38b0e29a6b8d1b29a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 "
|
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
|
-
|
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
|
data/lib/kuhsaft.rb
CHANGED
@@ -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
|
data/lib/kuhsaft/version.rb
CHANGED
@@ -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.
|
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-
|
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:
|
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:
|
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.
|
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
|