card-mod-format 0.12.0 → 0.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a14a87f7d666f6e68411e159ea14f4b217fa6e8e3002dd69186dec8a0b9daeb
4
- data.tar.gz: bdfe37143e119215126613981e2892002bdd254b0a8f6ea58f639cec5727b87b
3
+ metadata.gz: d6bc5c14f0ec7df2e36dd111eacec69023ac27fc017250594a312838f8431c5a
4
+ data.tar.gz: 3f9a6b4ff18f3abe16a46a0de6c3636d73a246addbc52c2ff489a038dcbacfa0
5
5
  SHA512:
6
- metadata.gz: 874d45d7ab14d8bba368fbf31c461eeeacf59dff1e2b6cfc1904a055a77727a8d39304fb037690e1b5573db446690b2cb7212f5839185a712544d06dd84e8230
7
- data.tar.gz: 664bd91c44a1f20f2dbdee671fdb405c02454524508d8a77e024ee1712295dc846d2f6725a23a6674ca18e5b575b2adc808ec7337c8e98a9778b1bd220c0ae5d
6
+ metadata.gz: fa560ad5e026d85d61da079fce1fadfabe9a7529c6ad421dfa61e6572ba82e9823e81393c0d875268ee6a5b2a011130ef46ee927f2fa75d0589aef7d087658d3
7
+ data.tar.gz: 74238ca4571c1957a26d354f2f71129a39f21a1ed491f37c40c16c9ab35888172876789ed811fc50118dea47a17fe7870ec96b2fb267d9fa0db9619bd41da981
@@ -40,6 +40,10 @@ class Card
40
40
  rendered = super
41
41
  rendered.is_a?(Array) ? output(rendered) : rendered
42
42
  end
43
+
44
+ def stylesheet_link_tag path
45
+ tag "link", href: path, media: "all", rel: "stylesheet", type: "text/css"
46
+ end
43
47
  end
44
48
  end
45
49
  end
data/lib/card/path.rb CHANGED
@@ -35,7 +35,8 @@ class Card
35
35
  end
36
36
 
37
37
  def standard
38
- base + extension + query
38
+ anch = anchor
39
+ base + extension + query + anch
39
40
  end
40
41
 
41
42
  def base
@@ -75,6 +76,11 @@ class Card
75
76
  extension ? ".#{extension}" : ""
76
77
  end
77
78
 
79
+ def anchor
80
+ anchor = opts.delete :anchor
81
+ anchor ? "##{anchor}" : ""
82
+ end
83
+
78
84
  def query
79
85
  query_opts = cast_path_hash opts
80
86
  query_opts.empty? ? "" : "?#{query_opts.to_param}"
data/locales/en.yml ADDED
@@ -0,0 +1,23 @@
1
+ en:
2
+ format_add_card: Add %{cardname}
3
+ format_bad_address: "404: Bad Address"
4
+ format_close: Close
5
+ format_configure_card: Configure %{cardname}
6
+ format_denial: Permission Denied
7
+ format_denied_task: to %{denied_task} this
8
+ format_invalid_json: invalid json
9
+ format_need_permission_task: "You need permission %{task}."
10
+ format_not_found_named: Could not find %{cardname}.
11
+ format_not_found_no_name: the card requested
12
+ format_not_numeric: "'%{content}' is not numeric"
13
+ format_or: "or"
14
+ format_please: Please
15
+ format_problems_name: Problems with %{cardname}
16
+ format_read_only: We are currently in read-only mode. Please try again later.
17
+ format_server_error: "\nWagn Hitch! Server Error. Yuck, sorry about that.\nTo tell us more and follow the fix,\nadd a support ticket at %{ticket_link}\n"
18
+ format_sorry: Sorry!
19
+ format_to_do_that: to do that
20
+ format_toggle_no: "no"
21
+ format_toggle_yes: "yes"
22
+ format_too_deep: Man, you're too deep. (Too many levels of nests at a time)
23
+ format_unsupported_view: view (%{view}) not supported for %{cardname}
data/set/all/head.rb CHANGED
@@ -7,19 +7,12 @@ format do
7
7
  end
8
8
 
9
9
  format :html do
10
- # add tuples containing a
11
- # - the codename of a card with javascript config (usually in json format)
12
- # - the name of a javascript method that handles the config
13
- basket :mod_js_config
14
-
15
10
  view :head, unknown: true, perms: :none do
16
11
  views_in_head.map { |viewname| render viewname }.flatten.compact.join "\n"
17
12
  end
18
13
 
19
14
  def views_in_head
20
15
  %i[meta_tags page_title_tag favicon_tag head_stylesheet
21
- decko_script_variables head_javascript html5shiv_tag
22
- script_config_and_initiation
23
16
  universal_edit_button rss_links]
24
17
  end
25
18
 
@@ -28,10 +21,6 @@ format :html do
28
21
  haml :meta_tags
29
22
  end
30
23
 
31
- view :html5shiv_tag, unknown: true, perms: :none do
32
- nest :script_html5shiv_printshiv, view: :script_tag
33
- end
34
-
35
24
  view :page_title_tag, unknown: true, perms: :none do
36
25
  content_tag(:title) { render :page_title }
37
26
  end
@@ -56,40 +45,6 @@ format :html do
56
45
  tag "link", href: href, media: "all", rel: "stylesheet", type: "text/css"
57
46
  end
58
47
 
59
- view :head_javascript, unknown: true, cache: :never, perms: :none do
60
- Array.wrap(head_javascript_paths).map do |path|
61
- javascript_include_tag path
62
- end
63
- end
64
-
65
- view :decko_script_variables, unknown: true, cache: :never, perms: :none do
66
- string = ""
67
- decko_script_variables.each do |k, v|
68
- string += "#{k}=#{script_variable_to_js v};\n"
69
- end
70
- javascript_tag { string }
71
- end
72
-
73
- def decko_script_variables
74
- {
75
- "window.decko": { rootUrl: card_url("") },
76
- "decko.doubleClick": Card.config.double_click,
77
- "decko.cssPath": head_stylesheet_path,
78
- "decko.currentUserId": (Auth.current_id if Auth.signed_in?)
79
-
80
- }
81
- end
82
-
83
- def script_variable_to_js value
84
- if value.is_a? Hash
85
- string = "{"
86
- value.each { |k, v| string += "#{k}:#{script_variable_to_js v}" }
87
- "#{string}}"
88
- else
89
- "'#{value}'"
90
- end
91
- end
92
-
93
48
  def param_or_rule_card setting
94
49
  if params[setting]
95
50
  Card[params[setting]]
@@ -98,10 +53,10 @@ format :html do
98
53
  end
99
54
  end
100
55
 
101
- def debug_or_machine_path setting, &block
56
+ def debug_or_machine_path setting, debug_lambda, machine_path_lambda
102
57
  return unless (asset_card = param_or_rule_card setting)
103
-
104
- debug_path(setting, asset_card, &block) || asset_card.machine_output_url
58
+ debug_path(setting, asset_card, &debug_lambda) ||
59
+ machine_path_lambda.call(asset_card.machine_output_url)
105
60
  end
106
61
 
107
62
  def debug_path setting, asset_card
@@ -110,37 +65,6 @@ format :html do
110
65
  yield asset_card
111
66
  end
112
67
 
113
- def head_stylesheet_path
114
- debug_or_machine_path :style do |style_card|
115
- path mark: style_card.name, item: :import, format: :css
116
- end
117
- end
118
-
119
- def head_javascript_paths
120
- debug_or_machine_path :script do |script_card|
121
- script_card.item_cards.map do |script|
122
- script.format(:js).render :source
123
- end
124
- end
125
- end
126
-
127
- view :script_config_and_initiation, unknown: true, perms: :none do
128
- javascript_tag do
129
- (mod_js_configs << trigger_slot_ready).join "\n\n"
130
- end
131
- end
132
-
133
- def mod_js_configs
134
- mod_js_config.map do |codename, js_decko_function|
135
- config_json = escape_javascript Card::Rule.global_setting(codename)
136
- "decko.#{js_decko_function}('#{config_json}')"
137
- end
138
- end
139
-
140
- def trigger_slot_ready
141
- "$('document').ready(function() { $('.card-slot').trigger('slotReady'); })"
142
- end
143
-
144
68
  # TODO: move to rss mod
145
69
  view :rss_links, unknown: true, perms: :none do
146
70
  render :rss_link_tag if rss_link?
@@ -149,4 +73,12 @@ format :html do
149
73
  def rss_link?
150
74
  Card.config.rss_enabled && respond_to?(:rss_link_tag)
151
75
  end
76
+
77
+ def head_stylesheet_path
78
+ debug_or_machine_path(
79
+ :style,
80
+ ->(style_card) { path mark: style_card.name, item: :import, format: :css },
81
+ ->(machine_path) { machine_path }
82
+ )
83
+ end
152
84
  end
data/set/all/html_show.rb CHANGED
@@ -13,7 +13,7 @@ format :html do
13
13
  def show_without_page_layout view, args
14
14
  @main = true if params[:is_main] || args[:main]
15
15
  args.delete(:layout)
16
- view ||= args[:home_view] || :open # default_nest_view
16
+ view ||= args[:home_view] || default_page_view
17
17
  render! view, args
18
18
  end
19
19
 
File without changes
File without changes
data/set/all/json.rb CHANGED
@@ -9,7 +9,7 @@ format :json do
9
9
  end
10
10
 
11
11
  def default_item_view
12
- params[:item] || :name
12
+ :name
13
13
  end
14
14
 
15
15
  def max_depth
@@ -41,7 +41,7 @@ format :json do
41
41
  def page_details obj
42
42
  return obj unless obj.is_a? Hash
43
43
 
44
- obj.merge url: request_url, timestamp: Time.now.to_s
44
+ obj.merge url: request_url, requested_at: Time.now.to_s
45
45
  end
46
46
 
47
47
  view :status, unknown: true, perms: :none do
@@ -84,7 +84,7 @@ format :json do
84
84
  # NOCACHE because sometimes item_cards is dynamic.
85
85
  # could be safely cached for non-dynamic lists
86
86
  view :items, cache: :never do
87
- listing item_cards, view: :atom
87
+ listing item_cards, view: (voo_items_view || :atom)
88
88
  end
89
89
 
90
90
  view :links do
@@ -155,7 +155,9 @@ format :json do
155
155
  links: _render_links,
156
156
  ancestors: _render_ancestors,
157
157
  html_url: path,
158
- type: nest(card.type_card, view: :nucleus)
158
+ type: nest(card.type_card, view: :nucleus),
159
+ created_at: card.created_at,
160
+ updated_at: card.updated_at
159
161
  end
160
162
  end
161
163
 
data/set/all/text.rb CHANGED
@@ -1,8 +1,25 @@
1
1
  require "htmlentities"
2
2
 
3
+ format do
4
+ def to_text html
5
+ HTMLEntities.new.decode strip_tags(html).to_s
6
+ end
7
+
8
+ def nestless_content
9
+ content_obj = content_object card.content
10
+ content_obj.strip_nests
11
+ content_obj.process_chunks
12
+ content_obj.to_s
13
+ end
14
+
15
+ view :text_without_nests do
16
+ to_text nestless_content
17
+ end
18
+ end
19
+
3
20
  format :text do
21
+ # TODO: override this in cards without html content
4
22
  view :core do
5
- HTMLEntities.new.decode strip_tags(super()).to_s
6
- # need this string method to get out of html_safe mode
23
+ to_text super()
7
24
  end
8
25
  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.12.0
4
+ version: 0.13.3
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-07-05 00:00:00.000000000 Z
13
+ date: 2021-09-24 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.102.0
21
+ version: 1.103.3
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.102.0
28
+ version: 1.103.3
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.12.0
35
+ version: 0.13.3
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.12.0
42
+ version: 0.13.3
43
43
  description: ''
44
44
  email:
45
45
  - info@decko.org
@@ -59,6 +59,7 @@ files:
59
59
  - lib/card/format/xml_format.rb
60
60
  - lib/card/path.rb
61
61
  - lib/card/path/cast_params.rb
62
+ - locales/en.yml
62
63
  - set/all/active_card.rb
63
64
  - set/all/base.rb
64
65
  - set/all/content.rb
@@ -73,14 +74,14 @@ files:
73
74
  - set/all/head.rb
74
75
  - set/all/header.rb
75
76
  - set/all/header/header_wrap.haml
76
- - set/all/html_content.rb
77
- - set/all/html_content/labeled.haml
78
77
  - set/all/html_error.rb
79
78
  - set/all/html_error/debug_server_error.haml
80
79
  - set/all/html_error/not_found.haml
81
80
  - set/all/html_error/server_error.haml
82
81
  - set/all/html_show.rb
83
82
  - set/all/html_title.rb
83
+ - set/all/html_views.rb
84
+ - set/all/html_views/labeled.haml
84
85
  - set/all/html_wrapper.rb
85
86
  - set/all/js.rb
86
87
  - set/all/json.rb
@@ -125,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
126
  - !ruby/object:Gem::Version
126
127
  version: '0'
127
128
  requirements: []
128
- rubygems_version: 3.2.15
129
+ rubygems_version: 3.1.6
129
130
  signing_key:
130
131
  specification_version: 4
131
132
  summary: format