card-mod-format 0.11.2 → 0.12.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c76f350256fd1765dd6c99a1bed1712228e5d32208c532e9aa0215266bf4e3ba
4
- data.tar.gz: 7177aa1e6218a7a33102aeb16a59b3e8a3f36938db16bf2d6263c074f8458d25
3
+ metadata.gz: 7a14a87f7d666f6e68411e159ea14f4b217fa6e8e3002dd69186dec8a0b9daeb
4
+ data.tar.gz: bdfe37143e119215126613981e2892002bdd254b0a8f6ea58f639cec5727b87b
5
5
  SHA512:
6
- metadata.gz: 3a0d6f247d5efb0f51d6aefee39e2dbeacfff2bc4eb1931ef39590cf3a2e54f8b771b2978d2a9a26df5fa32c0610f827de1e83010fda789914857e3de8354885
7
- data.tar.gz: 145ab53b7632f62ca5e84bbb2d21b740f51dc2888348b2a92ea1ed262c031004923e29b823228d7c5d39890b4480c08d9a707e97a7633b8a66c1c05b6e917995
6
+ metadata.gz: 874d45d7ab14d8bba368fbf31c461eeeacf59dff1e2b6cfc1904a055a77727a8d39304fb037690e1b5573db446690b2cb7212f5839185a712544d06dd84e8230
7
+ data.tar.gz: 664bd91c44a1f20f2dbdee671fdb405c02454524508d8a77e024ee1712295dc846d2f6725a23a6674ca18e5b575b2adc808ec7337c8e98a9778b1bd220c0ae5d
data/lib/card/path.rb CHANGED
@@ -59,7 +59,7 @@ class Card
59
59
  name = handle_unknown do
60
60
  opts[:mark] ? Card::Name[opts.delete(:mark)] : @card.name
61
61
  end
62
- (name&.url_key).to_s
62
+ name&.url_key.to_s
63
63
  end
64
64
 
65
65
  def markless?
@@ -99,7 +99,7 @@ class Card
99
99
 
100
100
  # no name info will be lost by using url_key
101
101
  def name_standardish? name
102
- name.s == Card::Name.url_key_to_standard(name.url_key)
102
+ name.url_key == name.tr(" ", "_")
103
103
  end
104
104
  end
105
105
  end
@@ -9,6 +9,7 @@ class Card
9
9
 
10
10
  def cast_path_hash hash, cast_hash=nil
11
11
  return hash unless hash.is_a? Hash
12
+
12
13
  cast_each_path_hash hash, (cast_hash || self.class.cast_params)
13
14
  hash
14
15
  end
@@ -16,6 +17,7 @@ class Card
16
17
  def cast_each_path_hash hash, cast_hash
17
18
  hash.each do |key, value|
18
19
  next unless (cast_to = cast_hash[key])
20
+
19
21
  hash[key] = cast_path_value value, cast_to
20
22
  end
21
23
  end
@@ -1,4 +1,3 @@
1
-
2
1
  # FIXME: -this needs a better home!
3
2
  def format opts={}
4
3
  opts = { format: opts.to_sym } if [Symbol, String].member? opts.class
data/set/all/base.rb CHANGED
@@ -42,6 +42,7 @@ format do
42
42
 
43
43
  def specify_type_in_link! opts
44
44
  return if opts[:known] || !voo.type
45
+
45
46
  opts[:path] = { card: { type: voo.type } }
46
47
  end
47
48
 
@@ -71,6 +72,7 @@ format do
71
72
 
72
73
  def structure_card
73
74
  return nil if voo.structure == true
75
+
74
76
  voo.structure ? Card[voo.structure] : card
75
77
  end
76
78
 
@@ -104,7 +106,7 @@ format do
104
106
  ""
105
107
  end
106
108
 
107
- # note: content and open_content may look like they should be aliased to
109
+ # NOTE: content and open_content may look like they should be aliased to
108
110
  # core, but it's important that they render core explicitly so that core view
109
111
  # overrides work. the titled and labeled views below, however, are not
110
112
  # intended for frequent override, so this shortcut is fine.
@@ -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/css.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  format :css do
3
2
  def default_nest_view
4
3
  :raw
data/set/all/csv.rb CHANGED
@@ -18,7 +18,7 @@ format :csv do
18
18
  end
19
19
 
20
20
  view :csv_row do
21
- array = _render_raw.scan(/\{\{[^\}]*\}\}/).map do |inc|
21
+ array = _render_raw.scan(/\{\{[^}]*\}\}/).map do |inc|
22
22
  process_content(inc).strip
23
23
  end
24
24
 
@@ -69,6 +69,7 @@ format :csv do
69
69
  def title_row extra_titles=nil
70
70
  titles = column_titles extra_titles
71
71
  return "" unless titles.present?
72
+
72
73
  CSV.generate_line titles.map(&:upcase)
73
74
  end
74
75
 
data/set/all/error.rb CHANGED
@@ -8,21 +8,21 @@ format do
8
8
  end
9
9
 
10
10
  view :server_error, perms: :none do
11
- tr(:server_error)
11
+ t(:format_server_error)
12
12
  end
13
13
 
14
14
  view :denial, perms: :none do
15
- focal? ? tr(:denial) : ""
15
+ focal? ? t(:format_denial) : ""
16
16
  end
17
17
 
18
18
  view :not_found, perms: :none do
19
- error_name = card.name.present? ? safe_name : tr(:not_found_no_name)
20
- tr(:not_found_named, cardname: error_name)
19
+ error_name = card.name.present? ? safe_name : t(:format_not_found_no_name)
20
+ t(:format_not_found_named, cardname: error_name)
21
21
  end
22
22
 
23
23
  view :bad_address, perms: :none do
24
24
  root.error_status = 404
25
- tr(:bad_address)
25
+ t(:format_bad_address)
26
26
  end
27
27
 
28
28
  view :errors do
@@ -50,7 +50,7 @@ format do
50
50
  end
51
51
 
52
52
  def unsupported_view_error_message view
53
- tr(:unsupported_view, view: view, cardname: card.name)
53
+ t(:format_unsupported_view, view: view, cardname: card.name)
54
54
  end
55
55
  end
56
56
 
data/set/all/export.rb CHANGED
@@ -35,6 +35,7 @@ format :json do
35
35
 
36
36
  def track_exporting card
37
37
  return unless @exported_keys
38
+
38
39
  @exported_keys << card.key
39
40
  end
40
41
 
@@ -52,6 +53,7 @@ format :json do
52
53
  def items_for_export
53
54
  nest_chunks.map do |chunk|
54
55
  next if chunk.try :main?
56
+
55
57
  chunk.referee_card
56
58
  end.compact
57
59
  end
data/set/all/frame.rb CHANGED
@@ -10,9 +10,9 @@ format :html do
10
10
  standard_frame(&block)
11
11
  end
12
12
 
13
- def standard_frame slot=true
13
+ def standard_frame slot=true, &block
14
14
  with_frame slot do
15
- wrap_body { yield } if block_given?
15
+ wrap_body(&block) if block_given?
16
16
  end
17
17
  end
18
18
 
@@ -36,18 +36,14 @@ format :html do
36
36
  end
37
37
  end
38
38
 
39
- def frame_and_form action, form_opts={}
39
+ def frame_and_form action, form_opts={}, &block
40
40
  form_opts ||= {}
41
41
  frame do
42
- card_form action, form_opts do
43
- yield
44
- end
42
+ card_form action, form_opts, &block
45
43
  end
46
44
  end
47
45
 
48
- def panel
49
- wrap_with :div, class: classy("d0-card-frame") do
50
- yield
51
- end
46
+ def panel &block
47
+ wrap_with :div, class: classy("d0-card-frame"), &block
52
48
  end
53
49
  end
data/set/all/head.rb CHANGED
@@ -42,6 +42,7 @@ format :html do
42
42
 
43
43
  view :universal_edit_button, unknown: true, denial: :blank, perms: :update do
44
44
  return if card.new?
45
+
45
46
  tag "link", rel: "alternate", type: "application/x-wiki",
46
47
  title: "Edit this page!", href: path(view: :edit)
47
48
  end
@@ -51,6 +52,7 @@ format :html do
51
52
  # (but note that machine clearing would need to reset card cache...)
52
53
  view :head_stylesheet, unknown: true, cache: :never, perms: :none do
53
54
  return unless (href = head_stylesheet_path)
55
+
54
56
  tag "link", href: href, media: "all", rel: "stylesheet", type: "text/css"
55
57
  end
56
58
 
@@ -82,7 +84,7 @@ format :html do
82
84
  if value.is_a? Hash
83
85
  string = "{"
84
86
  value.each { |k, v| string += "#{k}:#{script_variable_to_js v}" }
85
- string + "}"
87
+ "#{string}}"
86
88
  else
87
89
  "'#{value}'"
88
90
  end
@@ -98,11 +100,13 @@ format :html do
98
100
 
99
101
  def debug_or_machine_path setting, &block
100
102
  return unless (asset_card = param_or_rule_card setting)
103
+
101
104
  debug_path(setting, asset_card, &block) || asset_card.machine_output_url
102
105
  end
103
106
 
104
107
  def debug_path setting, asset_card
105
108
  return unless params[:debug] == setting.to_s
109
+
106
110
  yield asset_card
107
111
  end
108
112
 
@@ -17,7 +17,7 @@ format :html do
17
17
  prepare_content_slot
18
18
  end
19
19
 
20
- view :content_with_edit_button do
20
+ view :content_with_edit_button, unknown: true do
21
21
  wrap do
22
22
  [_render_menu, _render_core, _render_edit_button(edit: :inline)]
23
23
  end
@@ -136,6 +136,7 @@ format :html do
136
136
 
137
137
  def short_content_items
138
138
  return unless card.respond_to? :count
139
+
139
140
  "#{count} #{'item'.pluralize count}"
140
141
  end
141
142
 
@@ -52,7 +52,12 @@ format :html do
52
52
  view :errors, perms: :none do
53
53
  return if card.errors.empty?
54
54
 
55
- voo.title = card.name.blank? ? "Problems" : tr(:problems_name, cardname: card.name)
55
+ voo.title = if card.name.blank?
56
+ "Problems"
57
+ else
58
+ t(:format_problems_name,
59
+ cardname: card.name)
60
+ end
56
61
  voo.hide! :menu
57
62
  class_up "alert", "card-error-msg"
58
63
  standard_errors voo.title
@@ -133,21 +138,21 @@ format :html do
133
138
  def sign_in_or_up_links to_task
134
139
  return if Auth.signed_in?
135
140
 
136
- links = [signin_link, signup_link].compact.join " #{tr :or} "
141
+ links = [signin_link, signup_link].compact.join " #{t(:format_or)} "
137
142
  wrap_with(:div) do
138
- [tr(:please), links, to_task].join(" ") + "."
143
+ "#{[t(:format_please), links, to_task].join(' ')}."
139
144
  end
140
145
  end
141
146
 
142
147
  def signin_link
143
- link_to_card :signin, tr(:sign_in, mod: "card-mod-account"),
148
+ link_to_card :signin, t(:account_sign_in)&.downcase,
144
149
  class: "signin-link", slotter: true, path: { view: :open }
145
150
  end
146
151
 
147
152
  def signup_link
148
153
  return unless signup_ok?
149
154
 
150
- link_to_card :signup, tr(:sign_up),
155
+ link_to_card :signup, t(:account_sign_up)&.downcase,
151
156
  class: "signup-link", slotter: true, path: { action: :new }
152
157
  end
153
158
 
@@ -164,19 +169,24 @@ format :html do
164
169
  def loud_denial
165
170
  voo.hide :menu
166
171
  frame do
167
- [wrap_with(:h1, tr(:sorry)),
172
+ [wrap_with(:h1, t(:format_sorry)),
168
173
  wrap_with(:div, loud_denial_message)]
169
174
  end
170
175
  end
171
176
 
172
177
  def loud_denial_message
173
- to_task = @denied_task ? tr(:denied_task, denied_task: @denied_task) : tr(:to_do_that)
178
+ to_task = if @denied_task
179
+ t(:format_denied_task,
180
+ denied_task: @denied_task)
181
+ else
182
+ t(:format_to_do_that)
183
+ end
174
184
 
175
185
  case
176
186
  when not_denied_task_read?
177
- tr(:read_only)
187
+ t(:format_read_only)
178
188
  when Auth.signed_in?
179
- tr(:need_permission_task, task: to_task)
189
+ t(:format_need_permission_task, task: to_task)
180
190
  else
181
191
  Env.save_interrupted_action request.env["REQUEST_URI"]
182
192
  sign_in_or_up_links to_do_unauthorized_task
@@ -188,6 +198,11 @@ format :html do
188
198
  end
189
199
 
190
200
  def to_do_unauthorized_task
191
- @denied_task ? tr(:denied_task, denied_task: @denied_task) : tr(:to_do_that)
201
+ if @denied_task
202
+ t(:format_denied_task,
203
+ denied_task: @denied_task)
204
+ else
205
+ t(:format_to_do_that)
206
+ end
192
207
  end
193
208
  end
@@ -37,7 +37,12 @@ format :html do
37
37
 
38
38
  def wrap_data slot=true
39
39
  with_slot_data slot do
40
- { "card-id": card.id, "card-name": slot_cardname, "slot-id": SecureRandom.hex(10) }
40
+ {
41
+ "card-id": card.id,
42
+ "card-name": slot_cardname,
43
+ "card-link-name": card.name.url_key,
44
+ "slot-id": SecureRandom.hex(10)
45
+ }
41
46
  end
42
47
  end
43
48
 
@@ -71,8 +76,8 @@ format :html do
71
76
  opts[:name_context] = initial_context_names.map(&:key) * ","
72
77
  end
73
78
 
74
- def debug_slot
75
- debug_slot? ? debug_slot_wrap { yield } : yield
79
+ def debug_slot &block
80
+ debug_slot? ? debug_slot_wrap(&block) : yield
76
81
  end
77
82
 
78
83
  def debug_slot?
@@ -92,13 +97,13 @@ format :html do
92
97
  classy list
93
98
  end
94
99
 
95
- def wrap_body
96
- wrap_with(:div, class: body_css_classes) { yield }
100
+ def wrap_body &block
101
+ wrap_with(:div, class: body_css_classes, &block)
97
102
  end
98
103
 
99
- def haml_wrap_body
104
+ def haml_wrap_body &block
100
105
  wrap_body do
101
- capture_haml { yield }
106
+ capture_haml(&block)
102
107
  end
103
108
  end
104
109
 
@@ -145,7 +150,7 @@ format :html do
145
150
  def html_escape_except_quotes string
146
151
  # to be used inside single quotes (makes for readable json attributes)
147
152
  string.to_s.gsub(/&/, "&amp;")
148
- .gsub(/\'/, "&apos;")
153
+ .gsub(/'/, "&apos;")
149
154
  .gsub(/>/, "&gt;")
150
155
  .gsub(/</, "&lt;")
151
156
  end
data/set/all/js.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  format :js do
3
2
  def default_item_view
4
3
  :core
data/set/all/json.rb CHANGED
@@ -48,7 +48,6 @@ format :json do
48
48
  { key: card.key,
49
49
  url_key: card.name.url_key,
50
50
  status: card.state }.tap do |h|
51
-
52
51
  h[:id] = card.id if h[:status] == :real
53
52
  end
54
53
  end
@@ -129,6 +128,7 @@ format :json do
129
128
 
130
129
  def essentials
131
130
  return {} if card.structure
131
+
132
132
  { content: card.db_content }
133
133
  end
134
134
 
@@ -140,7 +140,6 @@ format :json do
140
140
  name: card.name,
141
141
  type: card.type_name,
142
142
  url: path(format: :json) }.tap do |h|
143
-
144
143
  h[:codename] = card.codename if card.codename
145
144
  end
146
145
  end
data/set/all/links.rb CHANGED
@@ -1,4 +1,4 @@
1
- RESOURCE_TYPE_REGEXP = /^([a-zA-Z][\-+\.a-zA-Z\d]*):/
1
+ RESOURCE_TYPE_REGEXP = /^([a-zA-Z][\-+.a-zA-Z\d]*):/
2
2
 
3
3
  # The #link_to methods support smart formatting of links in multiple formats.
4
4
  format do
@@ -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"
69
- when RESOURCE_TYPE_REGEXP then Regexp.last_match(1) + "-link"
68
+ when /^mailto:/ then "email-link"
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.sub(%r{^/}, "")
76
77
  else
77
78
  resource
78
79
  end
@@ -138,6 +139,7 @@ format :html do
138
139
  def interpret_data_opts_to_link_to opts
139
140
  %i[remote method].each do |key|
140
141
  next unless (val = opts.delete key)
142
+
141
143
  opts["data-#{key}"] = val
142
144
  end
143
145
  end
data/set/all/menu.rb CHANGED
@@ -102,7 +102,7 @@ format :html do
102
102
 
103
103
  def edit_link view=:edit, opts={}
104
104
  link_to_view view, opts.delete(:link_text) || menu_icon,
105
- edit_link_opts(opts.reverse_merge(modal: :lg))
105
+ edit_link_opts(modal: (opts[:modal] || :lg))
106
106
  end
107
107
 
108
108
  # @param modal [Symbol] modal size
@@ -116,7 +116,7 @@ format :html do
116
116
  end
117
117
 
118
118
  def menu_link_classes
119
- "nodblclick" + (show_view?(:hover_link) ? " _show-on-hover" : "")
119
+ "nodblclick#{show_view?(:hover_link) ? ' _show-on-hover' : ''}"
120
120
  end
121
121
 
122
122
  def menu_icon
data/set/all/path.rb CHANGED
@@ -34,6 +34,7 @@ format do
34
34
 
35
35
  def path opts={}
36
36
  return opts unless opts.is_a? Hash
37
+
37
38
  path = Card::Path.new(card, opts)&.render
38
39
  contextualize_path path
39
40
  end
data/set/all/rss.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require "builder"
2
+
1
3
  format :rss do
2
4
  attr_accessor :xml
3
5
 
@@ -14,6 +16,7 @@ format :rss do
14
16
  # FIXME: integrate this with common XML features when it is added
15
17
  view :feed, cache: :never do
16
18
  return "RSS feeds disabled" unless Cardio.config.rss_enabled
19
+
17
20
  begin
18
21
  @xml.instruct! :xml, version: "1.0", standalone: "yes"
19
22
  @xml.rss version: "2.0",
@@ -25,7 +28,7 @@ format :rss do
25
28
  render_feed_body
26
29
  end
27
30
  end
28
- rescue => e
31
+ rescue StandardError => e
29
32
  @xml.error "\n\nERROR rendering RSS: #{e.inspect}\n\n #{e.backtrace}"
30
33
  end
31
34
  end
@@ -43,7 +46,7 @@ format :rss do
43
46
  end
44
47
 
45
48
  view :feed_title do
46
- Card::Rule.global_setting(:title) + " : " + card.name.gsub(/^\*/, "")
49
+ "#{Card::Rule.global_setting(:title)} : #{card.name.gsub(/^\*/, '')}"
47
50
  end
48
51
 
49
52
  view :feed_item do
data/set/all/text.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "htmlentities"
1
2
 
2
3
  format :text do
3
4
  view :core do
data/set/type/cardtype.rb CHANGED
@@ -5,7 +5,7 @@ format :html do
5
5
 
6
6
  def type_formgroup args={}
7
7
  if card.cards_of_type_exist?
8
- wrap_with :div, tr(:cards_exist, scope: "core", cardname: safe_name)
8
+ wrap_with :div, t(:format_cards_exist, scope: "core", cardname: safe_name)
9
9
  else
10
10
  super
11
11
  end
@@ -20,7 +20,7 @@ format :html do
20
20
  end
21
21
 
22
22
  def add_link opts={}
23
- voo.title ||= tr(:add_card, cardname: safe_name)
23
+ voo.title ||= t(:format_add_card, cardname: safe_name)
24
24
  link_to render_title, add_link_opts(opts)
25
25
  end
26
26
 
@@ -67,7 +67,7 @@ format :html do
67
67
  def configure_link css_class=nil
68
68
  return "" unless Card.fetch(card, :type, :structure, new: {}).ok? :update
69
69
 
70
- voo.title ||= tr(:configure_card, cardname: safe_name.pluralize)
70
+ voo.title ||= t(:format_configure_card, cardname: safe_name.pluralize)
71
71
  title = _render_title
72
72
  link_to_card card, title,
73
73
  path: { view: :bridge,
@@ -79,7 +79,7 @@ format :html do
79
79
  private
80
80
 
81
81
  def process_voo_params path_args
82
- context = ((@parent&.card) || card).name
82
+ context = (@parent&.card || card).name
83
83
  Rack::Utils.parse_nested_query(voo.params).each do |key, value|
84
84
  value = value.to_name.absolute(context) if value
85
85
  key = key.to_name.absolute(context)
data/set/type/json.rb CHANGED
@@ -1,4 +1,4 @@
1
- # include_set Abstract::Pointer
1
+ require "coderay"
2
2
 
3
3
  event :validate_json, :validate, on: :save, changed: :content do
4
4
  check_json_syntax if content.present?
@@ -7,7 +7,7 @@ end
7
7
  def check_json_syntax
8
8
  parse_content
9
9
  rescue JSON::ParserError => e
10
- errors.add tr(:invalid_json), e.message.sub(/^\d+: /, "").to_s
10
+ errors.add t(:format_invalid_json), e.message.sub(/^\d+: /, "").to_s
11
11
  end
12
12
 
13
13
  def parse_content
data/set/type/number.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  format :html do
3
2
  def input_type
4
3
  :text_field
@@ -6,7 +5,10 @@ format :html do
6
5
  end
7
6
 
8
7
  event :validate_number, :validate, on: :save do
9
- errors.add :content, tr(:not_numeric, content: content) unless valid_number?(content)
8
+ unless valid_number?(content)
9
+ errors.add :content,
10
+ t(:format_not_numeric, content: content)
11
+ end
10
12
  end
11
13
 
12
14
  def valid_number? string
data/set/type/toggle.rb CHANGED
@@ -4,8 +4,8 @@ end
4
4
 
5
5
  view :core do
6
6
  case card.content.to_i
7
- when 1 then tr :toggle_yes
8
- when 0 then tr :toggle_no
7
+ when 1 then t(:format_toggle_yes)
8
+ when 0 then t(:format_toggle_no)
9
9
  else
10
10
  "?"
11
11
  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.2
4
+ version: 0.12.0
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-03-15 00:00:00.000000000 Z
13
+ date: 2021-07-05 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.2
21
+ version: 1.102.0
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.2
28
+ version: 1.102.0
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.2
35
+ version: 0.12.0
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.2
42
+ version: 0.12.0
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
@@ -124,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
125
  - !ruby/object:Gem::Version
125
126
  version: '0'
126
127
  requirements: []
127
- rubygems_version: 3.0.3
128
+ rubygems_version: 3.2.15
128
129
  signing_key:
129
130
  specification_version: 4
130
131
  summary: format