card-mod-format 0.18.1 → 0.19.1

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: 0ae4393c5ae29783e57eeb17d4840da0af745fa793c4d5f13dec9472ac7afe4d
4
- data.tar.gz: 24d7a9768c4865c532ba0da5e0a11841e6d3ddab744dbcaab25ab283a7c0a6a9
3
+ metadata.gz: 8fc4d1dcf48d5a8967ef40a89fbe5eb1039de00f4a262434014a4e4a23c716f2
4
+ data.tar.gz: 69df359302308e13aef004d1ec0c7caa0f73551d8aeac49527cf66077c88d46a
5
5
  SHA512:
6
- metadata.gz: 158b8bb6ba805b03972fca92ab9c31642f21ce53927213459d200209b2732e4121ef7bbf67b46a3289ca340dc017231ac10ac613085bda1f4d729d2b4713ff36
7
- data.tar.gz: f2e54e5296fe3826060a917c74dc514f0843de103c8b0b879ff66c8f18e7ab2acfcff8df147e6864973d401c67ba6cb609fa06b6f977f1ab254e3ee30c7466a5
6
+ metadata.gz: 3777d94b13161662a563486a9c8c24ead1475db20b5257fa5aa78169a8e1911bc36025c2e5de0e65d2839499cfb9e9405aee30f2300b3b86b2655008c44232c4
7
+ data.tar.gz: 662c4507e8bf881665850be12882e08c350f874fd8e60a20bda1931bcbe388ba40dda963799fa7b9768a07ed82c24224be85c838b95e3377c57e7affe7ff9a2d
@@ -27,7 +27,7 @@ window.decko =
27
27
  #~~~~~ ( EVENTS )
28
28
 
29
29
  $(window).ready ->
30
- $.ajaxSetup cache: false
30
+ # $.ajaxSetup cache: false
31
31
 
32
32
  $('body').on 'click', '._confirm', ->
33
33
  confirm $(this).data('confirm-msg') || 'Are you sure?'
@@ -61,11 +61,9 @@ jQuery.fn.extend
61
61
  slotReload: (url) ->
62
62
  @each -> $(this)._slotReloadSingle url
63
63
 
64
- slotReloading: ()->
65
- # TODO: add default spinner behavior
66
-
67
- slotLoadingComplete: ()->
68
- # TODO: add default spinner behavior
64
+ startLoading: () ->
65
+ stopLoading: () ->
66
+ # TODO: add default spinner behavior
69
67
 
70
68
  slotUpdate: (newContent, mode) ->
71
69
  mode ||= "replace"
@@ -120,7 +118,7 @@ jQuery.fn.extend
120
118
  # that's where handleRemote gets the url from
121
119
  # .attr(href, url) only works for anchors
122
120
  $.rails.handleRemote $slot
123
- $slot.slotReloading()
121
+ $slot.startLoading()
124
122
 
125
123
  # ~~~~~~~~~~~~~~~~~~~~~~~~
126
124
  # "private" helper methods
@@ -65,8 +65,10 @@
65
65
  #
66
66
  #
67
67
  $(window).ready ->
68
- $('body').on 'ajax:send', '.slotter', (event, data) ->
69
- $(this).slot().slotReloading()
68
+ $('body').on 'ajax:send', '.slotter', () ->
69
+ slot = $(this).slot()
70
+ slot.hideErrorResponse()
71
+ slot.startLoading()
70
72
 
71
73
  $('body').on 'ajax:success', '.slotter', (event, data) ->
72
74
  $(this).slotterSuccess event, data
@@ -74,8 +76,8 @@ $(window).ready ->
74
76
  $('body').on 'ajax:error', '.slotter', (event, xhr) ->
75
77
  $(this).showErrorResponse xhr.status, xhr.responseText
76
78
 
77
- $('body').on 'ajax:complete', '.slotter', (event, data) ->
78
- $(this).slot().slotLoadingComplete()
79
+ $('body').on 'ajax:complete', '.slotter', () ->
80
+ $(this).slot().stopLoading()
79
81
 
80
82
  $('body').on 'click', 'button.slotter', ->
81
83
  return false if !$.rails.allowAction $(this)
@@ -184,6 +186,9 @@ jQuery.fn.extend
184
186
  @slot().find('.new-current-revision-id').text()
185
187
  )
186
188
 
189
+ hideErrorResponse: () ->
190
+ $(this).find(".card-notice").hide()
191
+
187
192
  updateModalOrigin: () ->
188
193
  if @overlaySlot()
189
194
  overlayOrigin = @slotOrigin("overlay")
data/data/real.yml CHANGED
@@ -65,3 +65,8 @@
65
65
  :self:
66
66
  :fields:
67
67
  :read: Anyone
68
+
69
+ - :name: "*noindex"
70
+ :codename: noindex
71
+ :type: :list
72
+
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Card
4
4
  class Format
5
+ # card format class for css (cascading stylesheet) views
5
6
  class CssFormat < Format
6
7
  register :css
7
8
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Card
4
4
  class Format
5
+ # card format class for csv (comma separated values) views
5
6
  class CsvFormat < Format
6
7
  register :csv
7
8
 
@@ -25,14 +25,16 @@ class Card
25
25
  "text/html"
26
26
  end
27
27
 
28
+ def stylesheet_link_tag path
29
+ tag "link", href: path, media: "all", rel: "stylesheet", type: "text/css"
30
+ end
31
+
32
+ private
33
+
28
34
  def final_render_call method
29
35
  rendered = super
30
36
  rendered.is_a?(Array) ? output(rendered) : rendered
31
37
  end
32
-
33
- def stylesheet_link_tag path
34
- tag "link", href: path, media: "all", rel: "stylesheet", type: "text/css"
35
- end
36
38
  end
37
39
  end
38
40
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Card
4
4
  class Format
5
+ # card format class for js (JavaScript) views
5
6
  class JsFormat < Format
6
7
  register :js
7
8
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Card
4
4
  class Format
5
+ # card format class for json (JavaScript Object Notation) views
5
6
  class JsonFormat < DataFormat
6
7
  register :json
7
8
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Card
4
4
  class Format
5
+ # card format class for rss (really simple syndication) views
5
6
  class RssFormat < HtmlFormat
6
7
  register :rss
7
8
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Card
4
4
  class Format
5
+ # card format class for plaintext views
5
6
  class TextFormat < Format
6
7
  register :text
7
8
  register :txt
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Card
4
4
  class Format
5
+ # card format class for xml (extensible markup language) views
5
6
  class XmlFormat < DataFormat
6
7
  register :xml
7
8
 
@@ -1,4 +1,5 @@
1
1
  class Card
2
+ # handle card-related uri paths
2
3
  class Path
3
4
  cattr_accessor :cast_params
4
5
  self.cast_params = { slot: { hide: :array, show: :array, wrap: :array } }.freeze
data/set/all/content.rb CHANGED
@@ -1,6 +1,6 @@
1
- format do
2
- ONE_LINE_CHARACTER_LIMIT = 60
1
+ ONE_LINE_CHARACTER_LIMIT = 60
3
2
 
3
+ format do
4
4
  # override to customize by set
5
5
  def chunk_list
6
6
  :default
data/set/all/csv.rb CHANGED
@@ -3,7 +3,7 @@ require "csv"
3
3
  format :csv do
4
4
  def show view, args
5
5
  view ||= :titled
6
- super view, args
6
+ super
7
7
  end
8
8
 
9
9
  def nests
@@ -24,7 +24,7 @@ format :csv do
24
24
  end
25
25
 
26
26
  view :body do
27
- item_cards.map { |item_card| nest item_card }
27
+ card.item_cards.map { |item_card| nest item_card }
28
28
  end
29
29
 
30
30
  view :row do
data/set/all/data.rb CHANGED
@@ -68,7 +68,7 @@ format :data do
68
68
  # NOCACHE because sometimes item_cards is dynamic.
69
69
  # could be safely cached for non-dynamic lists
70
70
  view :items, cache: :never do
71
- listing item_cards, view: (voo_items_view || :atom)
71
+ listing_list item_cards, view: voo_items_view || :atom
72
72
  end
73
73
 
74
74
  view :links do
data/set/all/demo.rb CHANGED
@@ -8,7 +8,7 @@ format :html do
8
8
  view :view_list do
9
9
  view_list.map do |v|
10
10
  wrap_with :p, [content_tag(:h3, v), render(v, show: :menu)]
11
- end.flatten.join ""
11
+ end.flatten.join
12
12
  end
13
13
 
14
14
  def view_list
data/set/all/error.rb CHANGED
@@ -55,17 +55,17 @@ format do
55
55
  end
56
56
 
57
57
  format :json do
58
- view :errors do
58
+ view :errors, perms: :none do
59
59
  {
60
60
  error_status: error_status,
61
61
  errors: card.errors.each_with_object({}) { |e, h| h[e.attribute] = e.message }
62
62
  }
63
63
  end
64
64
 
65
- view :server_error, :errors
66
- view :denial, :errors
67
- view :not_found, :errors
68
- view :bad_address do
65
+ view :server_error, :errors, perms: :none
66
+ view :denial, :errors, perms: :none
67
+ view :not_found, :errors, perms: :none
68
+ view :bad_address, perms: :none do
69
69
  card.errors.add :address, super()
70
70
  render_errors
71
71
  end
data/set/all/haml.rb CHANGED
@@ -48,7 +48,7 @@ format do
48
48
 
49
49
  def haml_partial partial, locals={}
50
50
  locals[:template_path] ||= @template_path
51
- process_haml_template "_#{partial}".to_sym, locals
51
+ process_haml_template :"_#{partial}", locals
52
52
  end
53
53
 
54
54
  private
@@ -76,8 +76,14 @@ format :html do
76
76
  focal? ? loud_denial : quiet_denial
77
77
  end
78
78
 
79
- def view_for_unknown setting_view
80
- main? && voo.root? && ok?(:create) ? :new : super
79
+ private
80
+
81
+ def page_view_for_unknown
82
+ ok?(:create) ? :new : super
83
+ end
84
+
85
+ def page_status_for_unknown
86
+ ok?(:create) ? 200 : 404
81
87
  end
82
88
 
83
89
  def show_all_errors?
@@ -94,9 +100,9 @@ format :html do
94
100
  wrap_with(:span, class: "render-error alert alert-danger") { super }
95
101
  end
96
102
 
97
- def error_modal_id
98
- @error_modal_id ||= unique_id
99
- end
103
+ # def error_modal_id
104
+ # @error_modal_id ||= unique_id
105
+ # end
100
106
 
101
107
  def error_message exception
102
108
  %{
@@ -147,7 +153,22 @@ format :html do
147
153
 
148
154
  def signin_link
149
155
  link_to_card :signin, t(:account_sign_in)&.downcase,
150
- class: "signin-link", path: { view: :titled }
156
+ class: "signin-link", path: signin_link_path
157
+ end
158
+
159
+ def signin_link_path
160
+ { view: :titled }.tap do |path|
161
+ unless Cardio.config.allow_anonymous_cookies
162
+ # cookie handles where to go after signin if we have it. if not...
163
+
164
+ target = signin_link_success_target
165
+ path[:success] = { mark: target } if target.present?
166
+ end
167
+ end
168
+ end
169
+
170
+ def signin_link_success_target
171
+ Env.ajax? ? request.referer : request.original_url
151
172
  end
152
173
 
153
174
  def signup_link
data/set/all/html/head.rb CHANGED
@@ -9,9 +9,14 @@ basket[:cache_seed_names] += [
9
9
  %i[all style],
10
10
  %i[all style asset_output],
11
11
  %i[all script],
12
- %i[script right content_options]
12
+ %i[script right content_options],
13
+ :noindex
13
14
  ]
14
15
 
16
+ def noindex?
17
+ unknown? || :noindex.card.include_item?(name)
18
+ end
19
+
15
20
  format do
16
21
  view :page_title, unknown: true, perms: :none do
17
22
  title_parts = [Card::Rule.global_setting(:title)]
@@ -21,6 +26,8 @@ format do
21
26
  end
22
27
 
23
28
  format :html do
29
+ delegate :noindex?, to: :card
30
+
24
31
  view :head, unknown: true, perms: :none, cache: :yes do
25
32
  basket[:head_views].map { |viewname| render viewname }.flatten.compact.join "\n"
26
33
  end
@@ -52,15 +59,21 @@ format :html do
52
59
  # it would then be safe to cache if combined with param handling
53
60
  # (but note that machine clearing would need to reset card cache...)
54
61
  view :stylesheet_tags, cache: :never, unknown: true, perms: :none do
55
- [nest(:style_mods, view: :remote_style_tags), head_stylesheet_path]
62
+ [nest(:style_mods, view: :remote_style_tags), main_stylesheet_tag]
56
63
  end
57
64
 
58
- def head_stylesheet_path
59
- @head_stylesheet_path ||=
65
+ private
66
+
67
+ def main_stylesheet_tag
68
+ @main_stylesheet_tag ||=
60
69
  tag "link", media: "all",
61
70
  rel: "stylesheet",
62
71
  type: "text/css",
63
- href: nest(param_or_rule_card(:style), view: :stylesheet_path)
72
+ href: main_stylesheet_path
73
+ end
74
+
75
+ def main_stylesheet_path
76
+ nest(param_or_rule_card(:style), view: :stylesheet_path)
64
77
  end
65
78
 
66
79
  def param_or_rule_card setting
data/set/all/html/menu.rb CHANGED
@@ -7,6 +7,7 @@ format :html do
7
7
 
8
8
  view :menu, denial: :blank, unknown: true do
9
9
  return "" unless card.known?
10
+
10
11
  # would be preferable to do this with unknown: :blank, but that fails with view
11
12
  # caching on, because voo always thinks it's the root.
12
13
  wrap_with(:div, class: "card-menu #{menu_link_classes}") { menu_items }
@@ -149,7 +150,7 @@ format :html do
149
150
 
150
151
  def edit_link view=:edit, link_text: nil, text: "", modal: nil
151
152
  link_to_view view, link_text || "#{menu_icon} #{text}",
152
- edit_link_opts(modal: (modal || :lg))
153
+ edit_link_opts(modal: modal || :lg)
153
154
  end
154
155
 
155
156
  # Generates options hash for an edit link with optional parameters.
@@ -1,4 +1,4 @@
1
1
  %meta{ charset: "UTF-8" }
2
2
  %meta{ content: "width=device-width, initial-scale=1.0", name: "viewport" }
3
- - if card.unknown?
3
+ - if noindex?
4
4
  %meta{ content: "noindex", name: "robots"}
data/set/all/html/show.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  format :html do
2
2
  def show view, args
3
3
  content = send show_method, view, args
4
- Env.ajax? ? content : wrap_with_html_page(content)
4
+ Env.ajax? || no_layout? ? content : wrap_with_html_page(content)
5
5
  end
6
6
 
7
7
  wrapper :html_page do
@@ -9,7 +9,7 @@ format :html do
9
9
  <!DOCTYPE HTML>
10
10
  <html class="h-100">
11
11
  <head>
12
- #{nest card.rule_card(:head), view: :head_content}
12
+ #{head_content}
13
13
  </head>
14
14
  #{interior}
15
15
  </html>
@@ -18,6 +18,10 @@ format :html do
18
18
 
19
19
  private
20
20
 
21
+ def head_content
22
+ nest card.rule_card(:head), view: :head_content
23
+ end
24
+
21
25
  def show_without_page_layout view, args
22
26
  @main = true if params[:is_main] || args[:main]
23
27
  args.delete(:layout)
@@ -34,6 +38,12 @@ format :html do
34
38
  end
35
39
 
36
40
  def show_layout?
41
+ return false if no_layout?
42
+
37
43
  !Env.ajax? || params[:layout]
38
44
  end
45
+
46
+ def no_layout?
47
+ params[:layout] == "none"
48
+ end
39
49
  end
data/set/all/html/wrap.rb CHANGED
@@ -49,7 +49,7 @@ format :html do
49
49
 
50
50
  def slot_cardname
51
51
  name = card.name
52
- name = card.new? && name.compound? ? name.url_key : name
52
+ name = name.url_key if card.new? && name.compound?
53
53
  h name
54
54
  end
55
55
 
@@ -122,7 +122,7 @@ format :html do
122
122
  end
123
123
 
124
124
  def no_main_wrap?
125
- Env.ajax? || params[:layout] == "none"
125
+ Env.ajax? || no_layout?
126
126
  end
127
127
 
128
128
  def wrap_with tag, content_or_args={}, html_args={}, &block
@@ -140,21 +140,21 @@ format :html do
140
140
  private
141
141
 
142
142
  def content_items_within_wrap content, args
143
- content = block_given? ? yield(args) : content
143
+ content = yield(args) if block_given?
144
144
  content.compact
145
145
  end
146
146
 
147
147
  def content_within_wrap content
148
- content = block_given? ? yield : content
148
+ content = yield if block_given?
149
149
  output(content).to_s.html_safe
150
150
  end
151
151
 
152
152
  def html_escape_except_quotes string
153
153
  # to be used inside single quotes (makes for readable json attributes)
154
- string.to_s.gsub(/&/, "&amp;")
155
- .gsub(/'/, "&apos;")
156
- .gsub(/>/, "&gt;")
157
- .gsub(/</, "&lt;")
154
+ string.to_s.gsub("&", "&amp;")
155
+ .gsub("'", "&apos;")
156
+ .gsub(">", "&gt;")
157
+ .gsub("<", "&lt;")
158
158
  end
159
159
 
160
160
  wrapper :div, :div
data/set/all/links.rb CHANGED
@@ -112,13 +112,13 @@ format :html do
112
112
  name = Card::Name[cardish]
113
113
  slotterify opts if opts[:slotter]
114
114
  add_known_or_wanted_class opts, name
115
- super name, (text || name), opts
115
+ super(name, text || name, opts)
116
116
  end
117
117
 
118
118
  # in HTML, #link_to_view defaults to a remote link with rel="nofollow".
119
119
  def link_to_view view, text=nil, opts={}
120
120
  slotterify opts
121
- super view, (text || view), opts
121
+ super(view, text || view, opts)
122
122
  end
123
123
 
124
124
  # in HTML, #link_to_resource automatically adds a target to external resources
data/set/all/title.rb CHANGED
@@ -32,7 +32,7 @@ format :html do
32
32
  def title_in_context title=nil
33
33
  title = title&.html_safe
34
34
  # escape titles generated from card names, but not those set explicitly
35
- h super(title)
35
+ h super
36
36
  end
37
37
 
38
38
  def wrapped_title title
@@ -42,6 +42,6 @@ format :html do
42
42
  end
43
43
 
44
44
  def wrapped_joint
45
- wrap_with :span, "+", classy("joint")
45
+ wrap_with :span, (voo.joint || "+"), classy("joint")
46
46
  end
47
47
  end
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.1
4
+ version: 0.19.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
8
8
  - Philipp Kühl
9
9
  - Gerry Gleason
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2024-11-22 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: card
@@ -18,28 +17,28 @@ dependencies:
18
17
  requirements:
19
18
  - - '='
20
19
  - !ruby/object:Gem::Version
21
- version: 1.108.1
20
+ version: 1.109.1
22
21
  type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
24
  requirements:
26
25
  - - '='
27
26
  - !ruby/object:Gem::Version
28
- version: 1.108.1
27
+ version: 1.109.1
29
28
  - !ruby/object:Gem::Dependency
30
29
  name: card-mod-content
31
30
  requirement: !ruby/object:Gem::Requirement
32
31
  requirements:
33
32
  - - '='
34
33
  - !ruby/object:Gem::Version
35
- version: 0.18.1
34
+ version: 0.19.1
36
35
  type: :runtime
37
36
  prerelease: false
38
37
  version_requirements: !ruby/object:Gem::Requirement
39
38
  requirements:
40
39
  - - '='
41
40
  - !ruby/object:Gem::Version
42
- version: 0.18.1
41
+ version: 0.19.1
43
42
  description: ''
44
43
  email:
45
44
  - info@decko.org
@@ -69,7 +68,6 @@ files:
69
68
  - config/locales/de.yml
70
69
  - config/locales/en.yml
71
70
  - data/files/credit_image.svg
72
- - data/files/mod_format_script_asset_output/file.js
73
71
  - data/real.yml
74
72
  - lib/card/format/css_format.rb
75
73
  - lib/card/format/csv_format.rb
@@ -216,7 +214,6 @@ metadata:
216
214
  documentation_url: http://docs.decko.org/
217
215
  card-mod: format
218
216
  card-mod-group: gem-defaults
219
- post_install_message:
220
217
  rdoc_options: []
221
218
  require_paths:
222
219
  - lib
@@ -224,15 +221,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
224
221
  requirements:
225
222
  - - ">="
226
223
  - !ruby/object:Gem::Version
227
- version: '3.0'
224
+ version: '3.2'
228
225
  required_rubygems_version: !ruby/object:Gem::Requirement
229
226
  requirements:
230
227
  - - ">="
231
228
  - !ruby/object:Gem::Version
232
229
  version: '0'
233
230
  requirements: []
234
- rubygems_version: 3.5.10
235
- signing_key:
231
+ rubygems_version: 3.6.8
236
232
  specification_version: 4
237
233
  summary: format
238
234
  test_files: []