card-mod-thumbnail 0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4f0e562b77514fd447d6415825f66f8aaf47847dfacc286170209a6598f2178a
4
+ data.tar.gz: 5b81a80446d80b7fdf1d2e096f1ce121062effda796971c2b978c9201ff4932d
5
+ SHA512:
6
+ metadata.gz: 6f4c6414209bdb4070bca45f14fa6801f903323318d50b69404d6bad501bcdc252e3cb855ed101b6a0d2f59bc51e36423b0c12fd006fb0ca3c5180a9d2d3f8b3
7
+ data.tar.gz: 7cacefe4a850f536b59277fd041ea85cde8837be44d0857300e62e4524edf9de04623e7b606a52b08ae17d96b75947672335081400e7b3f9c479fae10bf15ecd
data/README.md ADDED
@@ -0,0 +1,51 @@
1
+ <!--
2
+ # @title README - mod: thumbnail
3
+ -->
4
+
5
+ # Thumbnail mod
6
+
7
+ With this mod installed, any set that includes `Abstract::Thumbnail` will
8
+ get a number of helpful (small) image views.
9
+
10
+ ## Views
11
+
12
+ - __:thumbnail__ - a linked image with a title and subtitle
13
+ - __:thumbnail_no_link__ - unlinked image with a title and subtitle
14
+ - __:thumbnail_minimal__ - unlinked image with a title (and no subtitle)
15
+
16
+ ### component views
17
+ - __:thumbnail_image__ - just the image
18
+ - __:thumbnail_subtitle__ - just the subtitle
19
+
20
+ ### configuration
21
+ You can also customize the thumbnail view using voo options, eg
22
+ ```
23
+ nest cardname, view: :thumbnail, size: :large, hide: thumbnail_subtitle
24
+ ```
25
+ voo options include:
26
+ - `show`/`hide`: `thumbnail_image`, `thumbnail_link`, `thumbnail_subtitle`
27
+ - `size`: `icon`, `small` (default), `medium`, `large`, `original`
28
+
29
+ ## Specifying images
30
+
31
+ By default, the thumbnail views in this mod apply to `+:image` cards. For
32
+ example, if the `thumbnail` view of a card named `Bunny` would use the
33
+ `Bunny+:image` card.
34
+
35
+ If you need to override this behavior, you can define an `#image_card` method
36
+ in the html format that returns the image card that you prefer. For example,
37
+ if you had a `Company` cardtype that stored images as `+:logo`, your company
38
+ set might look something like this:
39
+
40
+ in type/company.rb:
41
+ ```
42
+ include_set Abstract::Thumbnail
43
+
44
+ format :html do
45
+ def image_card
46
+ card.fetch :logo
47
+ end
48
+ end
49
+ ```
50
+
51
+
@@ -0,0 +1,6 @@
1
+ .thumbnail{ data: wrap_data(false), class: card.safe_set_keys }
2
+ = render_thumbnail_image
3
+ .thumbnail-text
4
+ .thumbnail-title{ title: card.name }
5
+ = thumbnail_title
6
+ = render_thumbnail_subtitle
@@ -0,0 +1,55 @@
1
+ include_set Abstract::Media
2
+
3
+ format :html do
4
+ # a linked image with a title and subtitle
5
+ view :thumbnail do
6
+ # voo.show :thumbnail_link
7
+ thumbnail
8
+ end
9
+
10
+ view :thumbnail_minimal do
11
+ voo.hide! :thumbnail_subtitle
12
+ voo.hide! :thumbnail_link
13
+ thumbnail
14
+ end
15
+
16
+ view :thumbnail_no_link do
17
+ voo.hide :thumbnail_link
18
+ thumbnail
19
+ end
20
+
21
+ # just an image
22
+ view :thumbnail_image do
23
+ return unless (image = image_card)
24
+
25
+ nest image, view: thumbnail_image_view, size: thumbnail_image_size
26
+ end
27
+
28
+ view :thumbnail_subtitle do
29
+ wrap_with :div, class: "thumbnail-subtitle" do
30
+ thumbnail_subtitle
31
+ end
32
+ end
33
+
34
+ def thumbnail
35
+ haml :thumbnail
36
+ end
37
+
38
+ def thumbnail_image_view
39
+ voo.show?(:thumbnail_link) ? :boxed_link : :boxed
40
+ end
41
+
42
+ def thumbnail_image_size
43
+ voo.size.present? ? voo.size : :small
44
+ end
45
+
46
+ def thumbnail_title
47
+ voo.show :title_link if voo.show? :thumbnail_link
48
+ render_title
49
+ end
50
+
51
+ # for override
52
+ def thumbnail_subtitle
53
+ ""
54
+ end
55
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: card-mod-thumbnail
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Philipp Kühl
8
+ - Ethan McCutchen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2021-10-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: card
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: card-mod-bar_and_box
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ description: ''
43
+ email:
44
+ - info@decko.org
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - README.md
50
+ - set/abstract/thumbnail.rb
51
+ - set/abstract/thumbnail/thumbnail.haml
52
+ homepage: http://decko.org
53
+ licenses:
54
+ - GPL-3.0
55
+ metadata:
56
+ card-mod: thumbnail
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '2.5'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 3.2.28
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: thumbnail
76
+ test_files: []