card-mod-format 0.11.7 → 0.13.2

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: 9eb7a02d7b66e39f50886eb18dd3a4c3d5fb168b0448251777c70f853c275e0b
4
- data.tar.gz: 634f343beb787ffd794e27caebb78ba95f0cf2ca7f63206365cffa9fb88a4c20
3
+ metadata.gz: 0b5eba52fcc743e248f18a00a831e82ff2c26c7b39971e4cbf51157e526e570c
4
+ data.tar.gz: c384fb08ea3a69ee0403ce37f3f388b2ec70bc31af3152158d4feff719f4b702
5
5
  SHA512:
6
- metadata.gz: 8561c041d4050418217258a3311994892a1356dada9550c63099d1540c4044a8824895d9787a6e02866b1f576f783ec63798f847985b360701ddfb5bd18a32bc
7
- data.tar.gz: 79efb8df8fd8b0b583a82320b5ea9a6fada477801c14e270f1737f8e536f0da066fadbbe51c422e8adc95f05953db9a99eeec56a161d79c865932380cc16da0d
6
+ metadata.gz: 49e90f15050ccc0b22bc8cb36785c0e97c0ae92ba1f973db21dba261e4d175f5af39fc2af944aea7bb90fc0347062c59e70ce5bbf5ace98230e78728b53c29d0
7
+ data.tar.gz: caed17f4e4161215445a67e0f9a15ed38dd772b54ea1deb909935211446c965d0fb239f037e87c8a5d7815619f9360790d024456b09d8a574a2db4ea5fddb7ae
@@ -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/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
@@ -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
 
data/set/all/links.rb CHANGED
@@ -73,7 +73,7 @@ format do
73
73
  def clean_resource resource, resource_type
74
74
  if resource_type == "internal-link"
75
75
  # remove initial slash; #contextualize_path handles relative root
76
- contextualize_path resource[1..-1].sub %r{^/}, ""
76
+ contextualize_path resource.sub(%r{^/}, "")
77
77
  else
78
78
  resource
79
79
  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
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
 
data/set/all/text.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require "htmlentities"
2
+
1
3
  format :text do
2
4
  view :core do
3
5
  HTMLEntities.new.decode strip_tags(super()).to_s
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?
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.7
4
+ version: 0.13.2
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-08-01 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.101.7
21
+ version: 1.103.2
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.7
28
+ version: 1.103.2
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.7
35
+ version: 0.13.2
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.7
42
+ version: 0.13.2
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