card-mod-format 0.11.5 → 0.11.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/set/all/content.rb +68 -0
  3. data/set/all/links.rb +4 -3
  4. metadata +7 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7282ec52f287bd080b84b1a539733d85c17f859f1eccd038ff4cd67a1c572d55
4
- data.tar.gz: 1b36bb6b8d5b10512774e1dee08f3dd60a79bff24495a569ed91013fd3eacaa8
3
+ metadata.gz: a6d456d6bb2c8990d8a69589a71caeebab04a24027dfeebf09a071f755413c5d
4
+ data.tar.gz: 10d5c52cc7d3c708b014cd5ac96e3c004be92b1ca295c730d3ec40cf62bfbc92
5
5
  SHA512:
6
- metadata.gz: 901b4a5f4458f02650af6ebabb0af3e04deadbc392f3d69a118d29d54d30f3bfd44a0d90e842d45ee72d584a20f015079e7e3d48630e39cbd0e26addd90b057b
7
- data.tar.gz: 21c3fb950df2ed3004e9a21048b3a17ea3e66200dca345984e95b9e57672d497afd1ccc1a999af661bc4ca0a2b6200f4ab315a8243f5bfc27f11567298091032
6
+ metadata.gz: 0fb99bd738a84c124db0b47c22075057a2df33526320b8cb1d038275bce37265564abdb04ab103feb590d281a1a94a399b7890dcb6c1491d5c44d8d8bdff2ec3
7
+ data.tar.gz: bf4fec545a683495a08a55446791e3d5d4291fcf8e3dd657e5fc94cf358d7c94b7966a355fd1495b9d98a0a05a588cf84555ab0758d37a9b87aaaff3e9c9f2f8
@@ -0,0 +1,68 @@
1
+ format do
2
+ ONE_LINE_CHARACTER_LIMIT = 60
3
+
4
+ # override to customize by set
5
+ def chunk_list
6
+ :default
7
+ end
8
+
9
+ view :one_line_content do
10
+ with_nest_mode :compact do
11
+ one_line_content
12
+ end
13
+ end
14
+
15
+ # DEPRECATED
16
+ view :closed_content, :one_line_content
17
+
18
+ view :raw_one_line_content do
19
+ raw_one_line_content
20
+ end
21
+
22
+ view :label do
23
+ card.label.to_s
24
+ end
25
+
26
+ view :smart_label, cache: :never, unknown: true do
27
+ label_with_description render_label, label_description
28
+ end
29
+
30
+ def label_with_description label, description
31
+ return label unless description
32
+
33
+ "#{label} #{popover_link description}"
34
+ end
35
+
36
+ # TODO: move this into a nest once popovers are stub safe
37
+ def label_description
38
+ return unless (desc = card.field :description)
39
+
40
+ desc.format.render_core
41
+ end
42
+
43
+ def raw_one_line_content
44
+ cut_with_ellipsis render_raw
45
+ end
46
+
47
+ def one_line_content
48
+ Content.smart_truncate render_core
49
+ end
50
+
51
+ def cut_with_ellipsis text, limit=one_line_character_limit
52
+ if text.size <= limit
53
+ text
54
+ else
55
+ "#{text[0..(limit - 3)]}..."
56
+ end
57
+ end
58
+
59
+ def one_line_character_limit
60
+ voo.size || ONE_LINE_CHARACTER_LIMIT
61
+ end
62
+ end
63
+
64
+ format :html do
65
+ view :hidden_content_field, unknown: true, cache: :never do
66
+ hidden_field :content, class: "d0-card-content"
67
+ end
68
+ end
data/set/all/links.rb CHANGED
@@ -63,16 +63,17 @@ format do
63
63
 
64
64
  def resource_type resource
65
65
  case resource
66
- when /^https?:/ then "external-link"
66
+ when /^https?:/ then "external-link"
67
67
  when %r{^/} then "internal-link"
68
- when /^mailto:/ then "email-link"
68
+ when /^mailto:/ then "email-link"
69
69
  when RESOURCE_TYPE_REGEXP then "#{Regexp.last_match(1)}-link"
70
70
  end
71
71
  end
72
72
 
73
73
  def clean_resource resource, resource_type
74
74
  if resource_type == "internal-link"
75
- contextualize_path resource[1..-1]
75
+ # remove initial slash; #contextualize_path handles relative root
76
+ contextualize_path resource[1..-1].sub %r{^/}, ""
76
77
  else
77
78
  resource
78
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.5
4
+ version: 0.11.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-05-10 00:00:00.000000000 Z
13
+ date: 2021-05-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: card
@@ -18,28 +18,28 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.101.5
21
+ version: 1.101.6
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 1.101.5
28
+ version: 1.101.6
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: card-mod-content
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.11.5
35
+ version: 0.11.6
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.11.5
42
+ version: 0.11.6
43
43
  description: ''
44
44
  email:
45
45
  - info@decko.org
@@ -61,6 +61,7 @@ files:
61
61
  - lib/card/path/cast_params.rb
62
62
  - set/all/active_card.rb
63
63
  - set/all/base.rb
64
+ - set/all/content.rb
64
65
  - set/all/css.rb
65
66
  - set/all/csv.rb
66
67
  - set/all/demo.rb