korgi 0.2.2 → 0.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 +8 -2
- data/lib/korgi/file_upload_filter.rb +2 -2
- data/lib/korgi/named_route_filter.rb +1 -1
- data/lib/korgi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e278324bb06eb18630adcb51bfc63975cd95b7e8
|
4
|
+
data.tar.gz: cf39464e72e46331c4e2b24bab6366d9085a9360
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d97bcce077c0827cb62be7a125b5c322689759ab87ab42f26b6f36a94b7c2720dc1bf62eb2ad95ea52893331d30fc6171a6636573ad774cbb655202a4fdd93bb
|
7
|
+
data.tar.gz: 36169693edc1c22f88e237daacc74e2fe1f4e994087195bf651b5831e97d3a69b6199562f158581eea6e610433c3d8bfb0d9adcd35c3e4059061e98b28391eda
|
data/README.md
CHANGED
@@ -24,12 +24,18 @@ $+image.1$
|
|
24
24
|
```
|
25
25
|
# config/initializers/korgi.rb
|
26
26
|
Korgi.configure do |config|
|
27
|
-
config.file_uploads = { image: { model: Image, mount: :file, default_version: :thumb }
|
27
|
+
config.file_uploads = { image: { model: :Image, mount: :file, default_version: :thumb }
|
28
28
|
end
|
29
29
|
```
|
30
30
|
|
31
31
|
This tells *korgi* that you have a CarrierWave uploader mounted to `Image` on `:file`, with `:thumb` as its default version. You can then simply write `$+image.1$` or `$+image.1.large$` in your markdown input, and *korgi* will replace the syntax with the associated url (and version).
|
32
32
|
|
33
|
+
If you are using a [Null Object Pattern](https://robots.thoughtbot.com/rails-refactoring-example-introduce-null-object), you can also set an optional `nil_object` for unavailable files to fallback for:
|
34
|
+
|
35
|
+
```
|
36
|
+
image: { ..., nil_object: :NullImage }
|
37
|
+
```
|
38
|
+
|
33
39
|
If you need the full url instead, you should change the settings for CarrierWave:
|
34
40
|
|
35
41
|
```
|
@@ -66,7 +72,7 @@ In Rails speak, this means that *korgi* will replace `$#post.1$` with the resul
|
|
66
72
|
```
|
67
73
|
# config/initializers/korgi.rb
|
68
74
|
Korgi.configure do |config|
|
69
|
-
config.named_routes = { post: { controller: :posts, model: Post, primary_key: :slug } }
|
75
|
+
config.named_routes = { post: { controller: :posts, model: :Post, primary_key: :slug } }
|
70
76
|
end
|
71
77
|
```
|
72
78
|
|
@@ -36,7 +36,7 @@ module Korgi
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def klass
|
39
|
-
configured_value(:model)
|
39
|
+
Object.const_get(configured_value(:model))
|
40
40
|
end
|
41
41
|
|
42
42
|
def mount
|
@@ -44,7 +44,7 @@ module Korgi
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def nil_object
|
47
|
-
configured_value(:nil_object)
|
47
|
+
Object.const_get(configured_value(:nil_object))
|
48
48
|
end
|
49
49
|
|
50
50
|
def default_version
|
data/lib/korgi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: korgi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tsehau Chao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|