card-mod-format 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/card/format/css_format.rb +17 -0
- data/lib/card/format/csv_format.rb +19 -0
- data/lib/card/format/data_format.rb +6 -0
- data/lib/card/format/file_format.rb +8 -0
- data/lib/card/format/html_format.rb +45 -0
- data/lib/card/format/js_format.rb +17 -0
- data/lib/card/format/json_format.rb +24 -0
- data/lib/card/format/rss_format.rb +9 -0
- data/lib/card/format/text_format.rb +16 -0
- data/lib/card/format/xml_format.rb +13 -0
- data/lib/card/path.rb +127 -0
- data/set/all/active_card.rb +6 -0
- data/set/all/base.rb +137 -0
- data/set/all/css.rb +37 -0
- data/set/all/csv.rb +93 -0
- data/set/all/error.rb +79 -0
- data/set/all/export.rb +68 -0
- data/set/all/file.rb +9 -0
- data/set/all/frame.rb +53 -0
- data/set/all/haml.rb +75 -0
- data/set/all/head.rb +148 -0
- data/set/all/header.rb +62 -0
- data/set/all/header/header_wrap.haml +4 -0
- data/set/all/html_content.rb +168 -0
- data/set/all/html_content/labeled.haml +4 -0
- data/set/all/html_error.rb +193 -0
- data/set/all/html_error/debug_server_error.haml +1015 -0
- data/set/all/html_error/not_found.haml +7 -0
- data/set/all/html_error/server_error.haml +5 -0
- data/set/all/html_show.rb +53 -0
- data/set/all/html_title.rb +47 -0
- data/set/all/html_wrapper.rb +159 -0
- data/set/all/js.rb +10 -0
- data/set/all/json.rb +166 -0
- data/set/all/links.rb +149 -0
- data/set/all/menu.rb +129 -0
- data/set/all/meta_tags.haml +4 -0
- data/set/all/path.rb +78 -0
- data/set/all/rich_html.rb +4 -0
- data/set/all/rss.rb +76 -0
- data/set/all/text.rb +7 -0
- data/set/self/home.rb +9 -0
- data/set/type/html.rb +27 -0
- data/set/type/json.rb +41 -0
- data/set/type/number.rb +22 -0
- data/set/type/phrase.rb +5 -0
- data/set/type/plain_text.rb +9 -0
- data/set/type/toggle.rb +38 -0
- data/set/type/uri.rb +15 -0
- metadata +123 -0
data/set/self/home.rb
ADDED
data/set/type/html.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
def clean_html?
|
2
|
+
false
|
3
|
+
end
|
4
|
+
|
5
|
+
def diff_args
|
6
|
+
{ diff_format: :raw }
|
7
|
+
end
|
8
|
+
|
9
|
+
format do
|
10
|
+
view :one_line_content do
|
11
|
+
raw_one_line_content
|
12
|
+
end
|
13
|
+
|
14
|
+
def chunk_list
|
15
|
+
:references
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
format :html do
|
20
|
+
def input_type
|
21
|
+
:ace_editor
|
22
|
+
end
|
23
|
+
|
24
|
+
view :one_line_content, wrap: {} do
|
25
|
+
raw_one_line_content
|
26
|
+
end
|
27
|
+
end
|
data/set/type/json.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# include_set Abstract::Pointer
|
2
|
+
|
3
|
+
event :validate_json, :validate, on: :save, changed: :content do
|
4
|
+
check_json_syntax if content.present?
|
5
|
+
end
|
6
|
+
|
7
|
+
def check_json_syntax
|
8
|
+
parse_content
|
9
|
+
rescue JSON::ParserError => e
|
10
|
+
errors.add tr(:invalid_json), e.message.sub(/^\d+: /, "").to_s
|
11
|
+
end
|
12
|
+
|
13
|
+
def parse_content
|
14
|
+
JSON.parse content
|
15
|
+
end
|
16
|
+
|
17
|
+
def item_names _args={}
|
18
|
+
parse_content.keys.map(&:to_name)
|
19
|
+
end
|
20
|
+
|
21
|
+
def item_values
|
22
|
+
parse_content.values
|
23
|
+
end
|
24
|
+
|
25
|
+
def item_value name
|
26
|
+
parse_content[name]
|
27
|
+
end
|
28
|
+
|
29
|
+
format :html do
|
30
|
+
view :core do
|
31
|
+
process_content ::CodeRay.scan(_render_raw, :json).div
|
32
|
+
end
|
33
|
+
|
34
|
+
def input_type
|
35
|
+
:ace_editor
|
36
|
+
end
|
37
|
+
|
38
|
+
def ace_mode
|
39
|
+
:json
|
40
|
+
end
|
41
|
+
end
|
data/set/type/number.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
format :html do
|
3
|
+
def input_type
|
4
|
+
:text_field
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
event :validate_number, :validate, on: :save do
|
9
|
+
errors.add :content, tr(:not_numeric, content: content) unless valid_number?(content)
|
10
|
+
end
|
11
|
+
|
12
|
+
def valid_number? string
|
13
|
+
return true if string.empty?
|
14
|
+
|
15
|
+
valid = true
|
16
|
+
begin
|
17
|
+
Kernel.Float(string)
|
18
|
+
rescue ArgumentError, TypeError
|
19
|
+
valid = false
|
20
|
+
end
|
21
|
+
valid
|
22
|
+
end
|
data/set/type/phrase.rb
ADDED
data/set/type/toggle.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
def checked?
|
2
|
+
content == "1"
|
3
|
+
end
|
4
|
+
|
5
|
+
view :core do
|
6
|
+
case card.content.to_i
|
7
|
+
when 1 then tr(:yes)
|
8
|
+
when 0 then tr(:no)
|
9
|
+
else
|
10
|
+
"?"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
format :html do
|
15
|
+
view :input do
|
16
|
+
toggle
|
17
|
+
end
|
18
|
+
|
19
|
+
view :labeled_editor do
|
20
|
+
toggle + toggle_label
|
21
|
+
end
|
22
|
+
|
23
|
+
def toggle
|
24
|
+
check_box :content
|
25
|
+
end
|
26
|
+
|
27
|
+
def toggle_label
|
28
|
+
label :content, card.name.tag
|
29
|
+
end
|
30
|
+
|
31
|
+
def one_line_content
|
32
|
+
short_content
|
33
|
+
end
|
34
|
+
|
35
|
+
def short_content
|
36
|
+
render_core
|
37
|
+
end
|
38
|
+
end
|
data/set/type/uri.rb
ADDED
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: card-mod-format
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.11.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ethan McCutchen
|
8
|
+
- Philipp Kühl
|
9
|
+
- Gerry Gleason
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2020-12-24 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: card
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - '='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.101.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - '='
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 1.101.0
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: card-mod-content
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - '='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 0.11.0
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - '='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.11.0
|
43
|
+
description: ''
|
44
|
+
email:
|
45
|
+
- info@decko.org
|
46
|
+
executables: []
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- lib/card/format/css_format.rb
|
51
|
+
- lib/card/format/csv_format.rb
|
52
|
+
- lib/card/format/data_format.rb
|
53
|
+
- lib/card/format/file_format.rb
|
54
|
+
- lib/card/format/html_format.rb
|
55
|
+
- lib/card/format/js_format.rb
|
56
|
+
- lib/card/format/json_format.rb
|
57
|
+
- lib/card/format/rss_format.rb
|
58
|
+
- lib/card/format/text_format.rb
|
59
|
+
- lib/card/format/xml_format.rb
|
60
|
+
- lib/card/path.rb
|
61
|
+
- set/all/active_card.rb
|
62
|
+
- set/all/base.rb
|
63
|
+
- set/all/css.rb
|
64
|
+
- set/all/csv.rb
|
65
|
+
- set/all/error.rb
|
66
|
+
- set/all/export.rb
|
67
|
+
- set/all/file.rb
|
68
|
+
- set/all/frame.rb
|
69
|
+
- set/all/haml.rb
|
70
|
+
- set/all/head.rb
|
71
|
+
- set/all/header.rb
|
72
|
+
- set/all/header/header_wrap.haml
|
73
|
+
- set/all/html_content.rb
|
74
|
+
- set/all/html_content/labeled.haml
|
75
|
+
- set/all/html_error.rb
|
76
|
+
- set/all/html_error/debug_server_error.haml
|
77
|
+
- set/all/html_error/not_found.haml
|
78
|
+
- set/all/html_error/server_error.haml
|
79
|
+
- set/all/html_show.rb
|
80
|
+
- set/all/html_title.rb
|
81
|
+
- set/all/html_wrapper.rb
|
82
|
+
- set/all/js.rb
|
83
|
+
- set/all/json.rb
|
84
|
+
- set/all/links.rb
|
85
|
+
- set/all/menu.rb
|
86
|
+
- set/all/meta_tags.haml
|
87
|
+
- set/all/path.rb
|
88
|
+
- set/all/rich_html.rb
|
89
|
+
- set/all/rss.rb
|
90
|
+
- set/all/text.rb
|
91
|
+
- set/self/home.rb
|
92
|
+
- set/type/html.rb
|
93
|
+
- set/type/json.rb
|
94
|
+
- set/type/number.rb
|
95
|
+
- set/type/phrase.rb
|
96
|
+
- set/type/plain_text.rb
|
97
|
+
- set/type/toggle.rb
|
98
|
+
- set/type/uri.rb
|
99
|
+
homepage: http://decko.org
|
100
|
+
licenses:
|
101
|
+
- GPL-3.0
|
102
|
+
metadata:
|
103
|
+
card-mod: format
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '2.5'
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubygems_version: 3.0.3
|
120
|
+
signing_key:
|
121
|
+
specification_version: 4
|
122
|
+
summary: format
|
123
|
+
test_files: []
|