card-mod-format 0.14.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/script/decko/clicks_and_hovers.js.coffee +49 -0
- data/assets/script/decko/decko.js.coffee +32 -0
- data/assets/script/decko/decko_jquery.js.coffee +25 -0
- data/assets/script/decko/slot.js.coffee +150 -0
- data/assets/script/decko/slot_ready.js.coffee +11 -0
- data/assets/script/decko/slotter.js.coffee +208 -0
- data/assets/script/jquery/jquery-ui.min.js +13 -0
- data/assets/script/jquery/jquery.autosize.js +274 -0
- data/assets/script/jquery/jquery.ui.autocomplete.html.js +41 -0
- data/assets/script/manifest.yml +38 -0
- data/assets/style/common.scss +73 -0
- data/assets/style/logo_and_credit.scss +24 -0
- data/assets/style/menu.scss +43 -0
- data/assets/style/messaging.scss +59 -0
- data/assets/style/misc.scss +90 -0
- data/assets/style/open_and_closed.scss +68 -0
- data/data/files/credit_image.svg +59 -0
- data/data/files/mod_format_script_asset_output/file.js +66 -0
- data/data/real.yml +67 -0
- data/lib/card/format/html_format.rb +0 -2
- data/lib/card/mod/format.rb +4 -0
- data/lib/card/path.rb +20 -20
- data/set/all/base.rb +1 -11
- data/set/all/content.rb +3 -11
- data/set/all/csv.rb +22 -74
- data/set/all/data.rb +2 -2
- data/set/all/demo.rb +6 -2
- data/set/all/error.rb +1 -1
- data/set/all/html/error.rb +1 -1
- data/set/all/html/head.rb +22 -12
- data/set/all/html/header.rb +10 -40
- data/set/all/html/header_wrap.haml +3 -4
- data/set/all/html/labeled.haml +1 -1
- data/set/all/html/menu.rb +36 -12
- data/set/all/html/views.rb +8 -17
- data/set/all/html/wrap.rb +5 -4
- data/set/all/html.rb +2 -3
- data/set/all/json.rb +1 -5
- data/set/right/head.rb +1 -0
- data/set/type/cardtype.rb +4 -6
- data/set/type/json.rb +1 -1
- data/set/type/number.rb +1 -16
- data/vendor/jquery_file_upload/LICENSE.txt +20 -0
- data/vendor/jquery_file_upload/README.md +224 -0
- data/vendor/jquery_file_upload/SECURITY.md +227 -0
- data/vendor/jquery_file_upload/VULNERABILITIES.md +118 -0
- data/vendor/jquery_file_upload/cors/postmessage.html +85 -0
- data/vendor/jquery_file_upload/cors/result.html +26 -0
- data/vendor/jquery_file_upload/css/jquery.fileupload-noscript.css +22 -0
- data/vendor/jquery_file_upload/css/jquery.fileupload-ui-noscript.css +17 -0
- data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +68 -0
- data/vendor/jquery_file_upload/css/jquery.fileupload.css +36 -0
- data/vendor/jquery_file_upload/docker-compose.yml +55 -0
- data/vendor/jquery_file_upload/img/loading.gif +0 -0
- data/vendor/jquery_file_upload/img/progressbar.gif +0 -0
- data/vendor/jquery_file_upload/index.html +357 -0
- data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +126 -0
- data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +97 -0
- data/vendor/jquery_file_upload/js/demo.js +75 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +101 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +347 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +170 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +759 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +119 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +101 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload.js +1604 -0
- data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +227 -0
- data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +805 -0
- data/vendor/jquery_file_upload/package-lock.json +6853 -0
- data/vendor/jquery_file_upload/package.json +116 -0
- data/vendor/jquery_file_upload/server/gae-python/app.yaml +18 -0
- data/vendor/jquery_file_upload/server/gae-python/main.py +204 -0
- data/vendor/jquery_file_upload/server/gae-python/static/favicon.ico +0 -0
- data/vendor/jquery_file_upload/server/gae-python/static/robots.txt +2 -0
- data/vendor/jquery_file_upload/server/php/Dockerfile +44 -0
- data/vendor/jquery_file_upload/server/php/UploadHandler.php +1480 -0
- data/vendor/jquery_file_upload/server/php/index.php +15 -0
- data/vendor/jquery_file_upload/server/php/php.ini +5 -0
- data/vendor/jquery_file_upload/test/index.html +49 -0
- data/vendor/jquery_file_upload/test/unit.js +989 -0
- data/vendor/jquery_file_upload/test/vendor/chai.js +10854 -0
- data/vendor/jquery_file_upload/test/vendor/mocha.css +325 -0
- data/vendor/jquery_file_upload/test/vendor/mocha.js +18178 -0
- data/vendor/jquery_file_upload/wdio/LICENSE.txt +20 -0
- data/vendor/jquery_file_upload/wdio/assets/black+white-3x2.jpg +0 -0
- data/vendor/jquery_file_upload/wdio/assets/black+white-60x40.gif +0 -0
- data/vendor/jquery_file_upload/wdio/conf/chrome.js +40 -0
- data/vendor/jquery_file_upload/wdio/conf/firefox.js +25 -0
- data/vendor/jquery_file_upload/wdio/hooks/index.js +36 -0
- data/vendor/jquery_file_upload/wdio/test/pages/file-upload.js +79 -0
- data/vendor/jquery_file_upload/wdio/test/specs/01-file-upload.js +25 -0
- data/vendor/jquery_file_upload/wdio/wdio.conf.js +4 -0
- data/vendor/jquery_rails/CHANGELOG.md +359 -0
- data/vendor/jquery_rails/CONTRIBUTING.md +132 -0
- data/vendor/jquery_rails/Gemfile +22 -0
- data/vendor/jquery_rails/MIT-LICENSE +21 -0
- data/vendor/jquery_rails/README.md +75 -0
- data/vendor/jquery_rails/Rakefile +59 -0
- data/vendor/jquery_rails/VERSIONS.md +62 -0
- data/vendor/jquery_rails/jquery-rails.gemspec +26 -0
- data/vendor/jquery_rails/lib/jquery/assert_select.rb +149 -0
- data/vendor/jquery_rails/lib/jquery/rails/engine.rb +6 -0
- data/vendor/jquery_rails/lib/jquery/rails/version.rb +9 -0
- data/vendor/jquery_rails/lib/jquery/rails.rb +8 -0
- data/vendor/jquery_rails/lib/jquery-rails.rb +1 -0
- data/vendor/jquery_rails/test/assert_select_jquery_test.rb +85 -0
- data/vendor/jquery_rails/test/test_helper.rb +6 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery.js +11008 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.js +5 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.map +1 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.js +9814 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.js +4 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.map +1 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.js +10364 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.js +2 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.map +1 -0
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery_ujs.js +555 -0
- metadata +104 -7
data/data/real.yml
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
---
|
2
|
+
|
3
|
+
|
4
|
+
- :name: JSON
|
5
|
+
:type: :cardtype
|
6
|
+
:codename: json
|
7
|
+
- :name: RichText
|
8
|
+
:type: :cardtype
|
9
|
+
:codename: basic
|
10
|
+
:fields:
|
11
|
+
:description: "<p>Basic cards are for rich text, and are the default type for new cards.</p>"
|
12
|
+
- :name: Number
|
13
|
+
:type: :cardtype
|
14
|
+
:codename: number
|
15
|
+
:fields:
|
16
|
+
:description: "<p>Can contain only numerical values.</p>"
|
17
|
+
- :name: PlainText
|
18
|
+
:type: :cardtype
|
19
|
+
:codename: plain_text
|
20
|
+
:fields:
|
21
|
+
:description: "<p>PlainText cards are for unstyled text.</p>"
|
22
|
+
- :name: HTML
|
23
|
+
:type: :cardtype
|
24
|
+
:codename: html
|
25
|
+
:fields:
|
26
|
+
:description: "<p>These cards allow unrestricted HTML. [[http://decko.org/wagn/HTML|more]]</p>"
|
27
|
+
- :name: Toggle
|
28
|
+
:type: :cardtype
|
29
|
+
:codename: toggle
|
30
|
+
:fields:
|
31
|
+
:description: "<p>Toggles simply indicate yes or no. [[http://decko.org/wagn/Toggle|more]].</p>"
|
32
|
+
- :name: Phrase
|
33
|
+
:type: :cardtype
|
34
|
+
:codename: phrase
|
35
|
+
:fields:
|
36
|
+
:description: "<p>Phrase cards are for short unstyled text.</p>"
|
37
|
+
- :name: URI
|
38
|
+
:type: :cardtype
|
39
|
+
:codename: uri
|
40
|
+
|
41
|
+
- :name: "*head"
|
42
|
+
:type: :setting
|
43
|
+
:codename: head
|
44
|
+
:fields:
|
45
|
+
:self:
|
46
|
+
:fields:
|
47
|
+
:read: Anyone
|
48
|
+
|
49
|
+
- :name:
|
50
|
+
- :all
|
51
|
+
- :head
|
52
|
+
:content: "{{:head|core}}"
|
53
|
+
|
54
|
+
- :name: "*title"
|
55
|
+
:type: :phrase
|
56
|
+
:codename: title
|
57
|
+
:content: My Deck
|
58
|
+
- :name: "*credit"
|
59
|
+
:type: :html
|
60
|
+
:codename: credit
|
61
|
+
:content: |
|
62
|
+
{{+:image|core}}
|
63
|
+
<a href="http://decko.org">Decko v{{:version|core}}</a>
|
64
|
+
:fields:
|
65
|
+
:self:
|
66
|
+
:fields:
|
67
|
+
:read: Anyone
|
data/lib/card/path.rb
CHANGED
@@ -16,22 +16,12 @@ class Card
|
|
16
16
|
|
17
17
|
attr_reader :opts
|
18
18
|
|
19
|
-
def action
|
20
|
-
@action ||= opts.delete(:action)&.to_sym
|
21
|
-
end
|
22
|
-
|
23
19
|
def new_cardtype
|
24
|
-
return unless new_cardtype?
|
25
|
-
|
26
|
-
"#{action}/#{mark}#{query}"
|
27
|
-
end
|
28
|
-
|
29
|
-
def new_cardtype?
|
30
|
-
return false unless action.in? %i[new type]
|
31
|
-
|
32
20
|
# "new" and "type" are not really an action and are only
|
33
21
|
# a valid value here for this path
|
34
|
-
|
22
|
+
return unless action.in?(%i[new type]) && mark.present?
|
23
|
+
|
24
|
+
"#{action}/#{mark}#{query}"
|
35
25
|
end
|
36
26
|
|
37
27
|
def standard
|
@@ -40,7 +30,13 @@ class Card
|
|
40
30
|
end
|
41
31
|
|
42
32
|
def base
|
43
|
-
|
33
|
+
if action.in? %i[create update delete]
|
34
|
+
action_base
|
35
|
+
elsif mark.present? && view.present?
|
36
|
+
"#{mark}/#{view}"
|
37
|
+
else
|
38
|
+
mark
|
39
|
+
end
|
44
40
|
end
|
45
41
|
|
46
42
|
def action_base
|
@@ -48,8 +44,16 @@ class Card
|
|
48
44
|
# the card/ prefix prevents interpreting action as cardname
|
49
45
|
end
|
50
46
|
|
51
|
-
def
|
52
|
-
action
|
47
|
+
def action
|
48
|
+
@action ||= opts.delete(:action)&.to_sym
|
49
|
+
end
|
50
|
+
|
51
|
+
def view
|
52
|
+
@view ||= opts.delete :view
|
53
|
+
end
|
54
|
+
|
55
|
+
def no_mark?
|
56
|
+
@no_mark ||= opts.delete :no_mark
|
53
57
|
end
|
54
58
|
|
55
59
|
def mark
|
@@ -67,10 +71,6 @@ class Card
|
|
67
71
|
action == :create || no_mark?
|
68
72
|
end
|
69
73
|
|
70
|
-
def no_mark?
|
71
|
-
@no_mark ||= opts.delete :no_mark
|
72
|
-
end
|
73
|
-
|
74
74
|
def extension
|
75
75
|
extension = opts.delete :format
|
76
76
|
extension ? ".#{extension}" : ""
|
data/set/all/base.rb
CHANGED
@@ -94,9 +94,7 @@ format do
|
|
94
94
|
end
|
95
95
|
|
96
96
|
view :one_line_content, compact: true do
|
97
|
-
with_nest_mode
|
98
|
-
Card::Content.smart_truncate _render_core
|
99
|
-
end
|
97
|
+
with_nest_mode(:compact) { truncate render_core }
|
100
98
|
end
|
101
99
|
|
102
100
|
view :labeled_content, unknown: :mini_unknown do
|
@@ -127,12 +125,4 @@ format do
|
|
127
125
|
"#{card.name}: #{_render_labeled_content}"
|
128
126
|
end
|
129
127
|
view :closed, :labeled
|
130
|
-
|
131
|
-
# SPECIAL VIEWS
|
132
|
-
|
133
|
-
view :array, cache: :never do
|
134
|
-
card.item_cards(limit: 0).map do |item_card|
|
135
|
-
subformat(item_card)._render_core
|
136
|
-
end.inspect
|
137
|
-
end
|
138
128
|
end
|
data/set/all/content.rb
CHANGED
@@ -35,25 +35,17 @@ format do
|
|
35
35
|
|
36
36
|
# TODO: move this into a nest once popovers are stub safe
|
37
37
|
def label_description
|
38
|
-
return unless (desc = card.
|
38
|
+
return unless (desc = card.fetch :description)
|
39
39
|
|
40
40
|
desc.format.render_core
|
41
41
|
end
|
42
42
|
|
43
43
|
def raw_one_line_content
|
44
|
-
|
44
|
+
truncate strip_tags(render_raw), length: one_line_character_limit
|
45
45
|
end
|
46
46
|
|
47
47
|
def one_line_content
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
def cut_with_ellipsis text, limit=one_line_character_limit
|
52
|
-
if text.size <= limit
|
53
|
-
text
|
54
|
-
else
|
55
|
-
"#{text[0..(limit - 3)]}..."
|
56
|
-
end
|
48
|
+
truncate strip_tags(render_core), length: one_line_character_limit
|
57
49
|
end
|
58
50
|
|
59
51
|
def one_line_character_limit
|
data/set/all/csv.rb
CHANGED
@@ -1,94 +1,42 @@
|
|
1
1
|
require "csv"
|
2
2
|
|
3
|
-
format :csv
|
4
|
-
def
|
5
|
-
:
|
3
|
+
format :csv do
|
4
|
+
def show view, args
|
5
|
+
view ||= :titled
|
6
|
+
super view, args
|
6
7
|
end
|
7
8
|
|
8
|
-
def
|
9
|
-
|
9
|
+
def nests
|
10
|
+
[["_self", { view: :name }], ["_self", { view: :type }]]
|
10
11
|
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
title_row("item name") + name_with_field_rows
|
15
|
-
else
|
16
|
-
super()
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
view :csv_row do
|
21
|
-
array = _render_raw.scan(/\{\{[^}]*\}\}/).map do |inc|
|
22
|
-
process_content(inc).strip
|
23
|
-
end
|
24
|
-
|
25
|
-
CSV.generate_line(array).strip
|
26
|
-
# strip is because search already joins with newlines
|
27
|
-
end
|
28
|
-
|
29
|
-
view :unknown do
|
30
|
-
""
|
31
|
-
end
|
32
|
-
|
33
|
-
view :name_with_fields do
|
34
|
-
CSV.generate_line name_with_fields_row
|
35
|
-
end
|
36
|
-
|
37
|
-
def name_with_fields_row
|
38
|
-
nested_field_names.each_with_object([card.name]) do |field_name, row|
|
39
|
-
row << nest(field_name)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def name_with_field_rows
|
44
|
-
return [] unless row_card_names.present?
|
45
|
-
|
46
|
-
row_card_names.map do |item_name|
|
47
|
-
CSV.generate_line row_from_field_names(item_name, columns)
|
48
|
-
end.join
|
49
|
-
end
|
50
|
-
|
51
|
-
def row_card_names
|
52
|
-
@row_cards ||= card.item_names
|
13
|
+
def default_nest_view
|
14
|
+
:titled
|
53
15
|
end
|
54
16
|
|
55
|
-
def
|
56
|
-
|
17
|
+
def default_item_view
|
18
|
+
:name
|
57
19
|
end
|
58
20
|
|
59
|
-
|
60
|
-
|
21
|
+
view :titled do
|
22
|
+
voo.items[:view] ||= :row
|
23
|
+
(render_header + render_core).map { |row| CSV.generate_line row }.join
|
61
24
|
end
|
62
25
|
|
63
|
-
|
64
|
-
|
65
|
-
row << nest([parent_name, field], view: view)
|
66
|
-
end
|
26
|
+
view :core do
|
27
|
+
item_cards.map { |item_card| nest item_card }
|
67
28
|
end
|
68
29
|
|
69
|
-
|
70
|
-
|
71
|
-
return "" unless titles.present?
|
72
|
-
|
73
|
-
CSV.generate_line titles.map(&:upcase)
|
30
|
+
view :row do
|
31
|
+
nests.map { |nest_args| nest(*nest_args) }
|
74
32
|
end
|
75
33
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
card1.nest_chunks.each do |chunk|
|
80
|
-
res << column_title(chunk.options)
|
81
|
-
end
|
82
|
-
res.compact
|
34
|
+
# localize
|
35
|
+
view :header do
|
36
|
+
[%w[Name Type]]
|
83
37
|
end
|
84
38
|
|
85
|
-
|
86
|
-
|
87
|
-
opts[:title]
|
88
|
-
elsif %w[name link].member? opts[:view]
|
89
|
-
opts[:view]
|
90
|
-
else
|
91
|
-
opts[:nest_name].to_name.tag
|
92
|
-
end
|
39
|
+
view :unknown do
|
40
|
+
""
|
93
41
|
end
|
94
42
|
end
|
data/set/all/data.rb
CHANGED
@@ -7,10 +7,10 @@ def export_hash field_tags: []
|
|
7
7
|
type: export_type,
|
8
8
|
codename: codename,
|
9
9
|
content: export_content,
|
10
|
-
|
10
|
+
fields: export_fields(field_tags) }.compact_blank
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def export_fields marks
|
14
14
|
marks.each_with_object({}) do |mark, hash|
|
15
15
|
hash[mark] = [name, mark].card&.export_content
|
16
16
|
end.compact_blank
|
data/set/all/demo.rb
CHANGED
@@ -6,11 +6,15 @@ format :html do
|
|
6
6
|
end
|
7
7
|
|
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
11
|
end.flatten.join ""
|
12
12
|
end
|
13
13
|
|
14
|
+
def view_list
|
15
|
+
%i[content titled labeled bar box open closed content_panel]
|
16
|
+
end
|
17
|
+
|
14
18
|
def demo_view
|
15
19
|
Env.params[:demo_view] || :core
|
16
20
|
end
|
@@ -31,6 +35,6 @@ format :html do
|
|
31
35
|
|
32
36
|
def all_views
|
33
37
|
Card::Set::Format::AbstractFormat::ViewDefinition
|
34
|
-
.views.slice(*self.class.ancestors).values.map(&:keys).flatten.uniq
|
38
|
+
.views.slice(*self.class.ancestors).values.map(&:keys).flatten.uniq.sort
|
35
39
|
end
|
36
40
|
end
|
data/set/all/error.rb
CHANGED
data/set/all/html/error.rb
CHANGED
data/set/all/html/head.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
basket[:head_views] =
|
2
|
+
%i[page_title_tag meta_tags favicon_tag
|
3
|
+
head_stylesheet head_remote_stylesheets
|
4
|
+
universal_edit_button rss_links]
|
5
|
+
# TODO: the last two should be in mods
|
6
|
+
|
1
7
|
format do
|
2
8
|
view :page_title, unknown: true, perms: :none do
|
3
9
|
title_parts = [Card::Rule.global_setting(:title)]
|
@@ -8,18 +14,10 @@ end
|
|
8
14
|
|
9
15
|
format :html do
|
10
16
|
view :head, unknown: true, perms: :none do
|
11
|
-
|
17
|
+
basket[:head_views].map { |viewname| render viewname }.flatten.compact.join "\n"
|
12
18
|
end
|
13
19
|
|
14
|
-
|
15
|
-
%i[meta_tags page_title_tag favicon_tag head_stylesheet
|
16
|
-
universal_edit_button rss_links]
|
17
|
-
end
|
18
|
-
|
19
|
-
# FIXME: tags not working with `template: :haml`
|
20
|
-
view :meta_tags, unknown: true, perms: :none do
|
21
|
-
haml :meta_tags
|
22
|
-
end
|
20
|
+
view :meta_tags, unknown: true, perms: :none, template: :haml
|
23
21
|
|
24
22
|
view :page_title_tag, unknown: true, perms: :none do
|
25
23
|
content_tag(:title) { render :page_title }
|
@@ -29,7 +27,7 @@ format :html do
|
|
29
27
|
nest :favicon, view: :link_tag
|
30
28
|
end
|
31
29
|
|
32
|
-
view :universal_edit_button, unknown:
|
30
|
+
view :universal_edit_button, unknown: :blank, denial: :blank, perms: :update do
|
33
31
|
return if card.new?
|
34
32
|
|
35
33
|
tag "link", rel: "alternate", type: "application/x-wiki",
|
@@ -42,7 +40,11 @@ format :html do
|
|
42
40
|
view :head_stylesheet, unknown: true, cache: :never, perms: :none do
|
43
41
|
return unless (href = head_stylesheet_path)
|
44
42
|
|
45
|
-
tag
|
43
|
+
tag("link", href: href, media: "all", rel: "stylesheet", type: "text/css")
|
44
|
+
end
|
45
|
+
|
46
|
+
view :head_remote_stylesheets, unknown: true, cache: :never, perms: :none do
|
47
|
+
remote_style_tags
|
46
48
|
end
|
47
49
|
|
48
50
|
def param_or_rule_card setting
|
@@ -74,6 +76,14 @@ format :html do
|
|
74
76
|
Card.config.rss_enabled && respond_to?(:rss_link_tag)
|
75
77
|
end
|
76
78
|
|
79
|
+
def remote_style_tags
|
80
|
+
return unless (asset_card = Card[:style_mods])
|
81
|
+
|
82
|
+
asset_card.item_cards.map do |mod_style_card|
|
83
|
+
nest mod_style_card, view: :remote_include_tags
|
84
|
+
end.select(&:present?)
|
85
|
+
end
|
86
|
+
|
77
87
|
def head_stylesheet_path
|
78
88
|
debug_or_machine_path(
|
79
89
|
:style,
|
data/set/all/html/header.rb
CHANGED
@@ -3,59 +3,29 @@ TOGGLE_MAP = { close: %w[open open], open: %w[close closed] }.freeze
|
|
3
3
|
|
4
4
|
format :html do
|
5
5
|
view :header, perms: :none do
|
6
|
-
|
6
|
+
header_wrap [render_header_title, render_menu]
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
def header_wrap content=nil
|
14
|
-
haml :header_wrap, content: (block_given? ? yield : output(content))
|
9
|
+
def header_wrap header_parts
|
10
|
+
wrap_with :div, class: classy("d0-card-header") do
|
11
|
+
output Array.wrap(header_parts)
|
12
|
+
end
|
15
13
|
end
|
16
14
|
|
17
15
|
view :header_title, perms: :none do
|
18
|
-
|
16
|
+
wrap_with (voo.header || default_header), class: classy("d0-card-header-title") do
|
17
|
+
render_title
|
18
|
+
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
22
|
-
|
23
|
-
title_view = show_view?(:title_toggle, :hide) ? :title_toggle : :title
|
24
|
-
[_render_icon_toggle(optional: :hide), _render(title_view)]
|
21
|
+
def default_header
|
22
|
+
main? ? :h1 : :h2
|
25
23
|
end
|
26
24
|
|
27
25
|
def show_draft_link?
|
28
26
|
card.drafts.present? && @slot_view == :edit
|
29
27
|
end
|
30
28
|
|
31
|
-
view :title_toggle, perms: :none do
|
32
|
-
content_toggle(_render_title(hide: :title_link))
|
33
|
-
end
|
34
|
-
|
35
|
-
view :icon_toggle, perms: :none do
|
36
|
-
direction = @toggle_mode == :close ? :expand : :collapse_down
|
37
|
-
content_toggle icon_tag(direction)
|
38
|
-
end
|
39
|
-
|
40
|
-
view :toggle, :icon_toggle # deprecated; use icon_toggle
|
41
|
-
|
42
|
-
def content_toggle text=""
|
43
|
-
return if text.nil?
|
44
|
-
|
45
|
-
verb, adjective = toggle_verb_adjective
|
46
|
-
link_to_view adjective, text, title: "#{verb} #{card.name}", # LOCALIZE
|
47
|
-
class: "toggle-#{adjective} toggler nodblclick"
|
48
|
-
end
|
49
|
-
|
50
|
-
def toggle_view
|
51
|
-
toggle_verb_adjective.last
|
52
|
-
end
|
53
|
-
|
54
|
-
def toggle_verb_adjective
|
55
|
-
TOGGLE_MAP[@toggle_mode || :open] ||
|
56
|
-
raise(Card::Error, "invalid toggle mode: #{@toggle_mode}")
|
57
|
-
end
|
58
|
-
|
59
29
|
def structure_editable?
|
60
30
|
card.structure && card.template.ok?(:update)
|
61
31
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
= content
|
1
|
+
= render_menu
|
2
|
+
%div{ class: classy("d0-card-header-title") }
|
3
|
+
= title
|
data/set/all/html/labeled.haml
CHANGED
data/set/all/html/menu.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
format :html do
|
2
2
|
view :menu, denial: :blank, unknown: true do
|
3
|
-
return ""
|
4
|
-
|
3
|
+
return "" unless card.known?
|
4
|
+
# would be preferable to do this with unknown: :blank, but that fails with view
|
5
|
+
# caching on, because voo always thinks it's the root.
|
5
6
|
wrap_with :div, class: "card-menu #{menu_link_classes}" do
|
6
7
|
[render_help_link,
|
7
8
|
menu_link,
|
8
|
-
(voo.show?(:bridge_link) ? bridge_link(false) : nil)]
|
9
|
+
(voo.show?(:bridge_link) ? bridge_link(in_modal: false) : nil)]
|
9
10
|
end
|
10
11
|
end
|
11
12
|
|
@@ -35,6 +36,11 @@ format :html do
|
|
35
36
|
edit_link edit_link_view
|
36
37
|
end
|
37
38
|
|
39
|
+
view :edit_button do
|
40
|
+
view = voo.edit == :inline ? :edit_inline : :edit
|
41
|
+
link_to_view view, "Edit", class: "btn btn-sm btn-outline-primary me-2"
|
42
|
+
end
|
43
|
+
|
38
44
|
def edit_link_view
|
39
45
|
:edit
|
40
46
|
end
|
@@ -47,13 +53,13 @@ format :html do
|
|
47
53
|
bridge_link
|
48
54
|
end
|
49
55
|
|
50
|
-
def bridge_link in_modal
|
56
|
+
def bridge_link text: "", in_modal: true
|
51
57
|
opts = { class: "bridge-link" }
|
52
58
|
if in_modal
|
53
59
|
# add_class opts, "close"
|
54
60
|
opts["data-slotter-mode"] = "modal-replace"
|
55
61
|
end
|
56
|
-
link_to_view :bridge,
|
62
|
+
link_to_view :bridge, "#{bridge_icon} #{text}", opts
|
57
63
|
end
|
58
64
|
|
59
65
|
# no caching because help_text view doesn't cache, and we can't have a
|
@@ -70,7 +76,7 @@ format :html do
|
|
70
76
|
|
71
77
|
def help_popover_opts text=nil, title=nil
|
72
78
|
text ||= render_help_text
|
73
|
-
opts = { "data-placement": :left, class: "help-link" }
|
79
|
+
opts = { "data-bs-placement": :left, class: "help-link" }
|
74
80
|
popover_opts text, title, opts
|
75
81
|
end
|
76
82
|
|
@@ -88,8 +94,18 @@ format :html do
|
|
88
94
|
end.join Card::Name.joint
|
89
95
|
end
|
90
96
|
|
91
|
-
def full_page_link
|
92
|
-
link_to_card full_page_card, full_page_icon
|
97
|
+
def full_page_link text: ""
|
98
|
+
link_to_card full_page_card, "#{full_page_icon} #{text}",
|
99
|
+
class: classy("full-page-link")
|
100
|
+
end
|
101
|
+
|
102
|
+
def modal_page_link text: ""
|
103
|
+
modal_link "#{modal_icon} #{text}",
|
104
|
+
path: { mark: card }, size: modal_page_size, class: "_modal-page-link"
|
105
|
+
end
|
106
|
+
|
107
|
+
def modal_page_size
|
108
|
+
:xl
|
93
109
|
end
|
94
110
|
|
95
111
|
def full_page_card
|
@@ -97,12 +113,12 @@ format :html do
|
|
97
113
|
end
|
98
114
|
|
99
115
|
def edit_in_bridge_link opts={}
|
100
|
-
edit_link :bridge, opts
|
116
|
+
edit_link :bridge, *opts
|
101
117
|
end
|
102
118
|
|
103
|
-
def edit_link view=:edit,
|
104
|
-
link_to_view view,
|
105
|
-
edit_link_opts(modal: (
|
119
|
+
def edit_link view=:edit, link_text: nil, text: "", modal: nil
|
120
|
+
link_to_view view, link_text || "#{menu_icon} #{text}",
|
121
|
+
edit_link_opts(modal: (modal || :lg))
|
106
122
|
end
|
107
123
|
|
108
124
|
# @param modal [Symbol] modal size
|
@@ -126,4 +142,12 @@ format :html do
|
|
126
142
|
def full_page_icon
|
127
143
|
icon_tag :open_in_new
|
128
144
|
end
|
145
|
+
|
146
|
+
def modal_icon
|
147
|
+
fa_icon :expand
|
148
|
+
end
|
149
|
+
|
150
|
+
def bridge_icon
|
151
|
+
fa_icon :box
|
152
|
+
end
|
129
153
|
end
|