card-mod-format 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a14a87f7d666f6e68411e159ea14f4b217fa6e8e3002dd69186dec8a0b9daeb
4
- data.tar.gz: bdfe37143e119215126613981e2892002bdd254b0a8f6ea58f639cec5727b87b
3
+ metadata.gz: 0b4d77f208c27acef729baedd337735e80be21270337e26b406d27af14638983
4
+ data.tar.gz: d299289e4b5dd0b622a614bdebee3d25ec0b9135b0bfe4bd576367b36c7bc745
5
5
  SHA512:
6
- metadata.gz: 874d45d7ab14d8bba368fbf31c461eeeacf59dff1e2b6cfc1904a055a77727a8d39304fb037690e1b5573db446690b2cb7212f5839185a712544d06dd84e8230
7
- data.tar.gz: 664bd91c44a1f20f2dbdee671fdb405c02454524508d8a77e024ee1712295dc846d2f6725a23a6674ca18e5b575b2adc808ec7337c8e98a9778b1bd220c0ae5d
6
+ metadata.gz: 6463aa97132bf67c91146a19ee245530497a2c1a7fbe9bd1cfe732e289ff764c9d34df54e64db2f72f0824df487c9f570aa5f837fb4465d81acb343174a999b4
7
+ data.tar.gz: 0f44f37aab77229428c58dd2e666d4556a67e0a9bf3773b780b014491fcc80c1fb42aa299f9d58c48c69f2ff5d14911b0d11c2d68d5961b3ddee4bf8544e1b95
@@ -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/set/all/head.rb CHANGED
@@ -18,8 +18,6 @@ format :html do
18
18
 
19
19
  def views_in_head
20
20
  %i[meta_tags page_title_tag favicon_tag head_stylesheet
21
- decko_script_variables head_javascript html5shiv_tag
22
- script_config_and_initiation
23
21
  universal_edit_button rss_links]
24
22
  end
25
23
 
@@ -28,10 +26,6 @@ format :html do
28
26
  haml :meta_tags
29
27
  end
30
28
 
31
- view :html5shiv_tag, unknown: true, perms: :none do
32
- nest :script_html5shiv_printshiv, view: :script_tag
33
- end
34
-
35
29
  view :page_title_tag, unknown: true, perms: :none do
36
30
  content_tag(:title) { render :page_title }
37
31
  end
@@ -56,40 +50,6 @@ format :html do
56
50
  tag "link", href: href, media: "all", rel: "stylesheet", type: "text/css"
57
51
  end
58
52
 
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
53
  def param_or_rule_card setting
94
54
  if params[setting]
95
55
  Card[params[setting]]
@@ -98,10 +58,10 @@ format :html do
98
58
  end
99
59
  end
100
60
 
101
- def debug_or_machine_path setting, &block
61
+ def debug_or_machine_path setting, debug_lambda, machine_path_lambda
102
62
  return unless (asset_card = param_or_rule_card setting)
103
-
104
- debug_path(setting, asset_card, &block) || asset_card.machine_output_url
63
+ debug_path(setting, asset_card, &debug_lambda) ||
64
+ machine_path_lambda.call(asset_card.machine_output_url)
105
65
  end
106
66
 
107
67
  def debug_path setting, asset_card
@@ -110,37 +70,6 @@ format :html do
110
70
  yield asset_card
111
71
  end
112
72
 
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
73
  # TODO: move to rss mod
145
74
  view :rss_links, unknown: true, perms: :none do
146
75
  render :rss_link_tag if rss_link?
@@ -149,4 +78,12 @@ format :html do
149
78
  def rss_link?
150
79
  Card.config.rss_enabled && respond_to?(:rss_link_tag)
151
80
  end
81
+
82
+ def head_stylesheet_path
83
+ debug_or_machine_path(
84
+ :style,
85
+ ->(style_card) { path mark: style_card.name, item: :import, format: :css },
86
+ ->(machine_path) { machine_path }
87
+ )
88
+ end
152
89
  end
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
 
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.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-07-05 00:00:00.000000000 Z
13
+ date: 2021-08-06 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.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.102.0
28
+ version: 1.103.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.12.0
35
+ version: 0.13.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.12.0
42
+ version: 0.13.0
43
43
  description: ''
44
44
  email:
45
45
  - info@decko.org
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  requirements: []
128
- rubygems_version: 3.2.15
128
+ rubygems_version: 3.1.6
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: format