card 1.18.3 → 1.18.4
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 +4 -4
- data/VERSION +1 -1
- data/card.gemspec +5 -3
- data/db/schema.rb +1 -1
- data/lib/card/active_record_helper.rb +2 -1
- data/lib/card/core_ext.rb +8 -0
- data/lib/card/format/nest.rb +13 -2
- data/lib/card/format/render.rb +7 -1
- data/lib/card/migration.rb +2 -1
- data/lib/card/set.rb +55 -70
- data/lib/card/set/trait.rb +70 -0
- data/lib/card/stage.rb +33 -8
- data/lib/card/stage_director.rb +3 -1
- data/lib/cardio.rb +2 -1
- data/mod/01_core/chunk/link.rb +7 -6
- data/mod/01_core/set/all/collection.rb +15 -52
- data/mod/01_core/set/all/fetch.rb +26 -6
- data/mod/01_core/set/all/references.rb +11 -3
- data/mod/01_core/set/all/subcards.rb +2 -2
- data/mod/01_core/set/all/tracked_attributes.rb +5 -1
- data/mod/01_core/set/all/utils.rb +1 -1
- data/mod/01_core/spec/set/all/collection_spec.rb +2 -2
- data/mod/01_history/set/all/content_history.rb +10 -11
- data/mod/02_basic_types/set/abstract/code_file.rb +57 -0
- data/mod/02_basic_types/set/type/pointer.rb +9 -5
- data/mod/03_machines/lib/javascript/wagn.js.coffee +4 -1
- data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +29 -24
- data/mod/03_machines/set/self/script_ace.rb +1 -11
- data/mod/03_machines/set/self/script_card_menu.rb +1 -10
- data/mod/03_machines/set/self/script_html5shiv_printshiv.rb +1 -2
- data/mod/03_machines/set/self/script_jquery.rb +1 -2
- data/mod/03_machines/set/self/script_jquery_helper.rb +4 -7
- data/mod/03_machines/set/self/script_slot.rb +4 -6
- data/mod/03_machines/set/self/script_tinymce.rb +1 -2
- data/mod/03_machines/set/self/style_bootstrap_compatible.rb +1 -5
- data/mod/03_machines/set/self/style_cards.rb +1 -6
- data/mod/03_machines/set/self/style_jquery_ui_smoothness.rb +1 -2
- data/mod/03_machines/set/type/coffee_script.rb +1 -1
- data/mod/03_machines/set/type/css.rb +10 -1
- data/mod/03_machines/set/type/java_script.rb +16 -1
- data/mod/03_machines/set/type/scss.rb +3 -2
- data/mod/05_standard/lib/image_uploader.rb +15 -0
- data/mod/05_standard/set/all/rich_html/editing.rb +2 -2
- data/mod/05_standard/set/all/rich_html/form.rb +40 -19
- data/mod/05_standard/set/all/rich_html/modal.rb +4 -2
- data/mod/05_standard/set/all/rich_html/toolbar.rb +88 -39
- data/mod/05_standard/set/type/search_type.rb +6 -3
- data/mod/06_bootstrap/set/all/bootstrap/table.rb +55 -0
- data/mod/06_bootstrap/set/all/bootstrap/tabs.rb +81 -0
- data/mod/06_bootstrap/set/self/bootstrap_cards.rb +1 -9
- data/mod/06_bootstrap/set/self/bootstrap_js.rb +4 -6
- data/mod/06_bootstrap/set/self/bootswatch_shared.rb +11 -3
- data/mod/06_bootstrap/set/self/smartmenu_css.rb +3 -5
- data/mod/06_bootstrap/set/self/smartmenu_js.rb +3 -5
- data/spec/lib/card/set/trait_spec.rb +62 -0
- metadata +24 -3
data/lib/card/stage_director.rb
CHANGED
@@ -48,6 +48,7 @@ class Card
|
|
48
48
|
|
49
49
|
@stage = nil
|
50
50
|
@running = false
|
51
|
+
@prepared = false
|
51
52
|
@parent = opts[:parent]
|
52
53
|
# has card to be stored before the supercard?
|
53
54
|
@prior_store = opts[:priority]
|
@@ -72,7 +73,8 @@ class Card
|
|
72
73
|
end
|
73
74
|
|
74
75
|
def prepare_for_phases
|
75
|
-
@card.prepare_for_phases
|
76
|
+
@card.prepare_for_phases unless @prepared
|
77
|
+
@prepared = true
|
76
78
|
@subdirectors.each(&:prepare_for_phases)
|
77
79
|
end
|
78
80
|
|
data/lib/cardio.rb
CHANGED
@@ -169,7 +169,8 @@ module Cardio
|
|
169
169
|
original_suffix = ActiveRecord::Base.table_name_suffix
|
170
170
|
ActiveRecord::Base.table_name_suffix = new_suffix
|
171
171
|
ActiveRecord::SchemaMigration.reset_table_name
|
172
|
-
|
172
|
+
paths = Cardio.migration_paths(type)
|
173
|
+
yield(paths)
|
173
174
|
ActiveRecord::Base.table_name_suffix = original_suffix
|
174
175
|
ActiveRecord::SchemaMigration.reset_table_name
|
175
176
|
end
|
data/mod/01_core/chunk/link.rb
CHANGED
@@ -4,14 +4,15 @@ require_dependency File.expand_path('../reference', __FILE__)
|
|
4
4
|
|
5
5
|
module Card::Content::Chunk
|
6
6
|
class Link < Reference
|
7
|
+
CODE = 'L'.freeze # L for "Link"
|
7
8
|
attr_reader :link_text
|
8
9
|
# Groups: $1, [$2]: [[$1]] or [[$1|$2]] or $3, $4: [$3][$4]
|
9
10
|
Card::Content::Chunk.register_class self,
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
prefix_re: '\\[',
|
12
|
+
full_re: /^\[\[([^\]]+)\]\]/,
|
13
|
+
idx_char: '['
|
13
14
|
def reference_code
|
14
|
-
|
15
|
+
CODE
|
15
16
|
end
|
16
17
|
|
17
18
|
def interpret match, _content
|
@@ -37,7 +38,7 @@ module Card::Content::Chunk
|
|
37
38
|
# point is to find the first pipe that's not inside an nest
|
38
39
|
return unless string.index '|'
|
39
40
|
string_copy = "#{string}" # had to do this to create new string?!
|
40
|
-
string.scan
|
41
|
+
string.scan(/\{\{[^\}]*\}\}/) do |incl|
|
41
42
|
string_copy.gsub! incl, ('x' * incl.length)
|
42
43
|
end
|
43
44
|
string_copy.index '|'
|
@@ -77,7 +78,7 @@ module Card::Content::Chunk
|
|
77
78
|
def replace_reference old_name, new_name
|
78
79
|
replace_name_reference old_name, new_name
|
79
80
|
|
80
|
-
if Card::Content
|
81
|
+
if @link_text.is_a?(Card::Content)
|
81
82
|
@link_text.find_chunks(Card::Content::Chunk::Reference).each do |chunk|
|
82
83
|
chunk.replace_reference old_name, new_name
|
83
84
|
end
|
@@ -253,23 +253,19 @@ format :html do
|
|
253
253
|
end
|
254
254
|
|
255
255
|
view :tabs do |args|
|
256
|
-
|
257
|
-
|
258
|
-
|
256
|
+
active_name = nil
|
257
|
+
active_content = nil
|
258
|
+
tabs = {}
|
259
259
|
each_reference_with_args(item: :content) do |name, nest_args|
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
# only render the first active tab, other tabs get loaded via ajax
|
268
|
-
tab_content = active_tab ? nest(Card.fetch(name, new: {}), nest_args) : ''
|
269
|
-
tab_panes += tab_pane(id, tab_content, active_tab)
|
270
|
-
active_tab = false
|
260
|
+
tab_name = nest_args[:title] || name
|
261
|
+
tabs[tab_name] = nest_path(name, nest_args).html_safe
|
262
|
+
|
263
|
+
active_name ||= tab_name
|
264
|
+
# warning: nest changes nest_args
|
265
|
+
active_content ||= nest(Card.fetch(name, new: {}), nest_args)
|
271
266
|
end
|
272
|
-
|
267
|
+
lazy_loading_tabs tabs, active_name, active_content,
|
268
|
+
type: args[:tab_type]
|
273
269
|
end
|
274
270
|
def default_tabs_args args
|
275
271
|
args[:tab_type] ||= 'tabs'
|
@@ -290,15 +286,11 @@ format :html do
|
|
290
286
|
end
|
291
287
|
|
292
288
|
view :tabs_static do |args|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
id = "#{card.cardname.safe_key}-#{item.cardname.safe_key}"
|
297
|
-
tab_buttons += tab_button("##{id}", item.name, index == 0)
|
298
|
-
tab_content = nest item, item_args(args)
|
299
|
-
tab_panes += tab_pane(id, tab_content, index == 0)
|
289
|
+
tabs = {}
|
290
|
+
card.item_cards.each do |item|
|
291
|
+
tabs[item.name] = nest item, item_args(args)
|
300
292
|
end
|
301
|
-
|
293
|
+
static_tabs tabs, args[:tab_type]
|
302
294
|
end
|
303
295
|
def default_tabs_static_args args
|
304
296
|
args[:tab_type] ||= 'tabs'
|
@@ -308,33 +300,4 @@ format :html do
|
|
308
300
|
def default_tabs_static_args args
|
309
301
|
args[:tab_type] ||= 'pills'
|
310
302
|
end
|
311
|
-
|
312
|
-
def tab_panel tab_buttons, tab_panes, tab_type='tabs'
|
313
|
-
wrap_with :div, role: 'tabpanel' do
|
314
|
-
[
|
315
|
-
content_tag(:ul, tab_buttons.html_safe, class: "nav nav-#{tab_type}",
|
316
|
-
role: 'tablist'),
|
317
|
-
content_tag(:div, tab_panes.html_safe, class: 'tab-content')
|
318
|
-
]
|
319
|
-
end
|
320
|
-
end
|
321
|
-
|
322
|
-
def tab_button target, text, active=false, link_attr={}
|
323
|
-
link = link_to(
|
324
|
-
fancy_title(text),
|
325
|
-
target,
|
326
|
-
link_attr.merge('role' => 'tab', 'data-toggle' => 'tab'))
|
327
|
-
li_args = { role: :presentation }
|
328
|
-
li_args[:class] = 'active' if active
|
329
|
-
content_tag :li, link, li_args
|
330
|
-
end
|
331
|
-
|
332
|
-
def tab_pane id, content, active=false
|
333
|
-
div_args = {
|
334
|
-
role: :tabpanel,
|
335
|
-
id: id,
|
336
|
-
class: "tab-pane #{'active' if active}"
|
337
|
-
}
|
338
|
-
content_tag :div, content.html_safe, div_args
|
339
|
-
end
|
340
303
|
end
|
@@ -10,11 +10,12 @@ module ClassMethods
|
|
10
10
|
# - database
|
11
11
|
# - virtual cards
|
12
12
|
#
|
13
|
-
#
|
13
|
+
# @param [Integer, String, Card::Name, Symbol] mark one of three unique
|
14
|
+
# identifiers
|
14
15
|
# 1. a numeric id (Integer)
|
15
16
|
# 2. a name/key (String or Card::Name)
|
16
17
|
# 3. a codename (Symbol)
|
17
|
-
#
|
18
|
+
# @param [Hash] opts ({})
|
18
19
|
# Options:
|
19
20
|
# :skip_virtual Real cards only
|
20
21
|
# :skip_modules Don't load Set modules
|
@@ -38,6 +39,25 @@ module ClassMethods
|
|
38
39
|
standard_fetch_results card, mark, opts
|
39
40
|
end
|
40
41
|
|
42
|
+
# #fetch converts String to Card::Name. That can break in some cases.
|
43
|
+
# For example if you fetch "Siemens" by its key "siemen", you won't get
|
44
|
+
# "Siemens" because "siemen".to_name.key == "sieman"
|
45
|
+
# If you have a key of a real card use this method.
|
46
|
+
def fetch_real_by_key key, opts={}
|
47
|
+
raise Card::Error, 'fetch_real_by_key called with new args' if opts[:new]
|
48
|
+
|
49
|
+
# look in cache
|
50
|
+
card = fetch_from_cache_by_key key, opts[:local_only]
|
51
|
+
# look in db if needed
|
52
|
+
if retrieve_from_db?(card, opts)
|
53
|
+
card = fetch_from_db :key, key, opts
|
54
|
+
write_to_cache card, opts if !card.nil? && !card.trash
|
55
|
+
end
|
56
|
+
return if card.nil?
|
57
|
+
card.include_set_modules unless opts[:skip_modules]
|
58
|
+
card
|
59
|
+
end
|
60
|
+
|
41
61
|
def standard_fetch_results card, mark, opts
|
42
62
|
if card.new_card?
|
43
63
|
case
|
@@ -174,8 +194,8 @@ module ClassMethods
|
|
174
194
|
|
175
195
|
def new_for_cache card, name, opts
|
176
196
|
return if name.is_a? Integer
|
177
|
-
return if
|
178
|
-
return
|
197
|
+
return if name.blank? && !opts[:new]
|
198
|
+
return if card && (card.type_known? || skip_type_lookup?(opts))
|
179
199
|
new name: name,
|
180
200
|
skip_modules: true,
|
181
201
|
skip_type_lookup: skip_type_lookup?(opts)
|
@@ -294,8 +314,8 @@ def eager_renew? opts
|
|
294
314
|
opts[:skip_virtual] && new_card? && opts[:new].present?
|
295
315
|
end
|
296
316
|
|
297
|
-
def
|
298
|
-
type_id.
|
317
|
+
def type_known?
|
318
|
+
type_id.present?
|
299
319
|
end
|
300
320
|
|
301
321
|
def name_from_mark! mark, opts
|
@@ -65,9 +65,8 @@ end
|
|
65
65
|
# insert entries in reference table
|
66
66
|
def create_references_out
|
67
67
|
ref_hash = {}
|
68
|
-
|
69
|
-
|
70
|
-
interpret_reference ref_hash, chunk.referee_name, chunk.reference_code
|
68
|
+
each_reference_out do |referee_name, ref_type|
|
69
|
+
interpret_reference ref_hash, referee_name, ref_type
|
71
70
|
end
|
72
71
|
return if ref_hash.empty?
|
73
72
|
Card::Reference.mass_insert reference_values_array(ref_hash)
|
@@ -121,6 +120,15 @@ def reference_values_array ref_hash
|
|
121
120
|
values
|
122
121
|
end
|
123
122
|
|
123
|
+
# invokes the given block for each reference in raw_content with
|
124
|
+
# the reference name and reference type
|
125
|
+
def each_reference_out
|
126
|
+
content_obj = Card::Content.new raw_content, self
|
127
|
+
content_obj.find_chunks(Card::Content::Chunk::Reference).each do |chunk|
|
128
|
+
yield(chunk.referee_name, chunk.reference_code)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
124
132
|
protected
|
125
133
|
|
126
134
|
# test for updating referer content & preload referer list
|
@@ -1,7 +1,6 @@
|
|
1
1
|
def assign_attributes args={}
|
2
2
|
if args
|
3
3
|
args = args.stringify_keys
|
4
|
-
|
5
4
|
@set_specific = {}
|
6
5
|
Card.set_specific_attributes.each do |key|
|
7
6
|
@set_specific[key] = args.delete(key) if args[key]
|
@@ -31,6 +30,11 @@ protected
|
|
31
30
|
|
32
31
|
def extract_subcard_args! args
|
33
32
|
subcards = args.delete('subcards') || {}
|
33
|
+
if (subfields = args.delete('subfields'))
|
34
|
+
subfields.each_pair do |key, value|
|
35
|
+
subcards[cardname.field(key)] = value
|
36
|
+
end
|
37
|
+
end
|
34
38
|
args.keys.each do |key|
|
35
39
|
subcards[key] = args.delete(key) if key =~ /^\+/
|
36
40
|
end
|
@@ -142,9 +142,9 @@ describe Card::Set::All::Collection do
|
|
142
142
|
tabs = render_card :tabs, name: 'tab_test', type_id: Card::PlainTextID,
|
143
143
|
content: '{{A|type;title:my tab title}}'
|
144
144
|
assert_view_select tabs, 'div[role=tabpanel]' do
|
145
|
-
assert_select 'li > a[data-toggle=tab][href="#tab_test-
|
145
|
+
assert_select 'li > a[data-toggle=tab][href="#tab_test-my_tab_title"]',
|
146
146
|
'my tab title'
|
147
|
-
assert_select 'div.tab-pane#tab_test-
|
147
|
+
assert_select 'div.tab-pane#tab_test-my_tab_title', 'Basic'
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
@@ -28,21 +28,20 @@ def save_content_draft content
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def last_change_on field, opts={}
|
31
|
-
where_sql = 'card_actions.card_id = :card_id AND field = :field
|
32
|
-
where_sql += 'AND (draft is not true)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
''
|
39
|
-
end
|
31
|
+
where_sql = 'card_actions.card_id = :card_id AND field = :field'
|
32
|
+
where_sql += ' AND (draft is not true)' unless opts[:including_drafts]
|
33
|
+
if opts[:before]
|
34
|
+
where_sql += ' AND card_action_id < :action_id'
|
35
|
+
elsif opts[:not_after]
|
36
|
+
where_sql += ' AND card_action_id <= :action_id'
|
37
|
+
end
|
40
38
|
|
41
39
|
action_arg = opts[:before] || opts[:not_after]
|
42
40
|
action_id = action_arg.is_a?(Card::Action) ? action_arg.id : action_arg
|
43
|
-
field_index = Card::TRACKED_FIELDS.index(field.to_s)
|
44
41
|
Change.joins(:action).where(
|
45
|
-
where_sql, card_id: id,
|
42
|
+
where_sql, card_id: id,
|
43
|
+
field: Card::Change.field_index(field),
|
44
|
+
action_id: action_id
|
46
45
|
).order(:id).last
|
47
46
|
end
|
48
47
|
|
@@ -0,0 +1,57 @@
|
|
1
|
+
def self.included host_class
|
2
|
+
# extract the mod name from the path of the set's tmp file
|
3
|
+
# the caller that included the set file is set.rb
|
4
|
+
# seems like the actual set file is in fourth position in
|
5
|
+
# the backtrace but I'm not 100% sure if that is always the case
|
6
|
+
path, = caller[4].partition(':')
|
7
|
+
path_parts = path.split(File::SEPARATOR)
|
8
|
+
mod_dir = path_parts[path_parts.index('set') + 1]
|
9
|
+
raise Card::Error, "not a set path: #{path}" unless mod_dir
|
10
|
+
match = mod_dir.match(/^mod\d+-(?<mod_name>.+)$/)
|
11
|
+
host_class.mattr_accessor :file_content_mod_name
|
12
|
+
host_class.file_content_mod_name = match[:mod_name]
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [Array<String>, String] the name of file(s) to be loaded
|
16
|
+
def source_files
|
17
|
+
case type_id
|
18
|
+
when CoffeeScriptID then "#{codename}.js.coffee"
|
19
|
+
when JavaScriptID then "#{codename}.js"
|
20
|
+
when CssID then "#{codename}.css"
|
21
|
+
when ScssID then "#{codename}.scss"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def source_dir
|
26
|
+
case type_id
|
27
|
+
when CoffeeScriptID, JavaScriptID then 'javascript'
|
28
|
+
when CssID, ScssID then 'stylesheets'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def find_file filename
|
33
|
+
Card.paths['mod'].to_a.each do |mod_path|
|
34
|
+
file_path =
|
35
|
+
File.join(mod_path, file_content_mod_name, 'lib', source_dir, filename)
|
36
|
+
return file_path if File.exist? file_path
|
37
|
+
end
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
|
41
|
+
view :raw do |_args|
|
42
|
+
Array.wrap(card.source_files).map do |filename|
|
43
|
+
if (source_path = card.find_file(filename))
|
44
|
+
Rails.logger.info "reading file: #{source_path}"
|
45
|
+
File.read source_path
|
46
|
+
else
|
47
|
+
Rails.logger.info "couldn't locate file: #{filename}"
|
48
|
+
nil
|
49
|
+
end
|
50
|
+
end.compact.join "\n"
|
51
|
+
end
|
52
|
+
|
53
|
+
format :html do
|
54
|
+
view :editor do |_args|
|
55
|
+
"Content is stored in file and can't be edited."
|
56
|
+
end
|
57
|
+
end
|
@@ -240,17 +240,21 @@ end
|
|
240
240
|
# while a card's card type and content are updated in the same request,
|
241
241
|
# the new module will override the old module's events and functions.
|
242
242
|
# this event is only on pointer card. Other type cards do not have this event,
|
243
|
-
# so it is not overridden and will be run while updating type and content in
|
244
|
-
|
245
|
-
|
246
|
-
|
243
|
+
# so it is not overridden and will be run while updating type and content in
|
244
|
+
# the same request.
|
245
|
+
event :standardize_items, :prepare_to_validate,
|
246
|
+
on: :save,
|
247
|
+
changed: :content,
|
248
|
+
when: proc { |c| c.type_id == Card::PointerID } do
|
249
|
+
self.content = item_names(context: :raw).map do |name|
|
250
|
+
"[[#{name}]]"
|
251
|
+
end.join "\n"
|
247
252
|
end
|
248
253
|
|
249
254
|
def diff_args
|
250
255
|
{ format: :pointer }
|
251
256
|
end
|
252
257
|
|
253
|
-
|
254
258
|
def item_cards args={}
|
255
259
|
if args[:complete]
|
256
260
|
query = args.reverse_merge referred_to_by: name
|
@@ -43,7 +43,7 @@ jQuery.fn.extend {
|
|
43
43
|
target_slot = $(parent_slot).find(@data('slot-selector'))
|
44
44
|
parent_slot = $(parent_slot).parent().closest '.card-slot'
|
45
45
|
if target_slot.length == 0
|
46
|
-
$(
|
46
|
+
$(@data('slot-selector'))
|
47
47
|
else
|
48
48
|
target_slot
|
49
49
|
else
|
@@ -167,11 +167,14 @@ $(window).ready ->
|
|
167
167
|
unless event.slotSuccessful
|
168
168
|
slot_top_pos = $(this).slot().offset().top
|
169
169
|
$(this).slotSuccess data
|
170
|
+
if $(this).hasClass "close-modal"
|
171
|
+
$(this).closest('.modal').modal('hide')
|
170
172
|
# should scroll to top after clicking on new page
|
171
173
|
if $(this).hasClass "card-paging-link"
|
172
174
|
$("body").scrollTop slot_top_pos
|
173
175
|
event.slotSuccessful = true
|
174
176
|
|
177
|
+
|
175
178
|
$('body').on 'loaded.bs.modal', null, (event) ->
|
176
179
|
unless event.slotSuccessful
|
177
180
|
wagn.initializeEditors $(event.target)
|
@@ -4,35 +4,34 @@ window.wagn ||= {} #needed to run w/o *head. eg. jasmine
|
|
4
4
|
|
5
5
|
$.extend wagn,
|
6
6
|
editorContentFunctionMap: {
|
7
|
-
'.ace-editor-textarea'
|
8
|
-
'.tinymce-textarea'
|
9
|
-
'.pointer-select'
|
10
|
-
'.pointer-multiselect'
|
11
|
-
'.pointer-radio-list'
|
12
|
-
'.pointer-list-ul'
|
7
|
+
'.ace-editor-textarea': -> ace_editor_content this[0]
|
8
|
+
'.tinymce-textarea': -> tinyMCE.get(@[0].id).getContent()
|
9
|
+
'.pointer-select': -> pointerContent @val()
|
10
|
+
'.pointer-multiselect': -> pointerContent @val()
|
11
|
+
'.pointer-radio-list': -> pointerContent @find('input:checked').val()
|
12
|
+
'.pointer-list-ul': ->
|
13
13
|
pointerContent @find('input').map( -> $(this).val() )
|
14
|
-
'.pointer-checkbox-list'
|
14
|
+
'.pointer-checkbox-list': ->
|
15
15
|
pointerContent @find('input:checked').map( -> $(this).val() )
|
16
|
-
'.pointer-select-list'
|
16
|
+
'.pointer-select-list': ->
|
17
17
|
pointerContent @find('.pointer-select select').map( -> $(this).val() )
|
18
|
-
'.pointer-mixed'
|
18
|
+
'.pointer-mixed': ->
|
19
19
|
element = '.pointer-checkbox-sublist input:checked,\
|
20
20
|
.pointer-sublist-ul input'
|
21
21
|
pointerContent @find(element).map( -> $(this).val() )
|
22
22
|
# must happen after pointer-list-ul, I think
|
23
|
-
'.perm-editor'
|
23
|
+
'.perm-editor': -> permissionsContent this
|
24
24
|
}
|
25
|
-
|
26
25
|
editorInitFunctionMap: {
|
27
|
-
'.date-editor'
|
28
|
-
'textarea'
|
29
|
-
'.ace-editor-textarea'
|
30
|
-
'.tinymce-textarea'
|
31
|
-
'.pointer-list-editor'
|
26
|
+
'.date-editor': -> @datepicker { dateFormat: 'yy-mm-dd' }
|
27
|
+
'textarea': -> $(this).autosize()
|
28
|
+
'.ace-editor-textarea': -> wagn.initAce $(this)
|
29
|
+
'.tinymce-textarea': -> wagn.initTinyMCE @[0].id
|
30
|
+
'.pointer-list-editor': ->
|
32
31
|
@sortable({handle : '.handle', cancel : ''})
|
33
32
|
wagn.initPointerList @find('input')
|
34
|
-
'.file-upload'
|
35
|
-
'.etherpad-textarea'
|
33
|
+
'.file-upload': -> wagn.upload_file(this)
|
34
|
+
'.etherpad-textarea': ->
|
36
35
|
$(this).closest('form')
|
37
36
|
.find('.edit-submit-button')
|
38
37
|
.attr('class', 'etherpad-submit-button')
|
@@ -48,8 +47,8 @@ $.extend wagn,
|
|
48
47
|
card_name = $_this.siblings(".attachment_card_name:first").attr("name")
|
49
48
|
type_id = $_this.siblings("#attachment_type_id").val()
|
50
49
|
data.formData = {
|
51
|
-
"card[type_id]"
|
52
|
-
"attachment_upload"
|
50
|
+
"card[type_id]": type_id,
|
51
|
+
"attachment_upload": card_name
|
53
52
|
}
|
54
53
|
$_fileupload = $(fileupload)
|
55
54
|
if $_fileupload.closest("form").attr("action").indexOf("update") > -1
|
@@ -177,8 +176,11 @@ $.extend wagn,
|
|
177
176
|
# sidebars
|
178
177
|
|
179
178
|
wrapDeckoLayout = () ->
|
180
|
-
$('body >
|
179
|
+
$footer = $('body > footer').first()
|
180
|
+
$('body > article, body > aside').wrapAll('<div class="container"/>')
|
181
181
|
$('div.container > article, div.container > aside').wrapAll('<div class="row row-offcanvas">')
|
182
|
+
if $footer
|
183
|
+
$('body').append $footer
|
182
184
|
|
183
185
|
wrapSidebarToggle = (toggle) ->
|
184
186
|
"<div class='container'><div class='row'>#{toggle}</div></div>"
|
@@ -210,6 +212,7 @@ doubleSidebar = ->
|
|
210
212
|
$('body').append($asideLeft).append($article).append($asideRight)
|
211
213
|
|
212
214
|
wrapDeckoLayout()
|
215
|
+
|
213
216
|
$article.prepend(wrapSidebarToggle("#{sidebarToggle('right')}#{sidebarToggle('left')}"))
|
214
217
|
|
215
218
|
$(window).ready ->
|
@@ -316,15 +319,15 @@ $(window).ready ->
|
|
316
319
|
|
317
320
|
# modal mod
|
318
321
|
|
319
|
-
$('body').on '
|
320
|
-
$(event.target).find('.modal-dialog > .modal-content')
|
322
|
+
$('body').on 'hidden.bs.modal', (event) ->
|
323
|
+
modal_content = $(event.target).find('.modal-dialog > .modal-content')
|
321
324
|
if $(event.target).attr('id') != 'modal-main-slot'
|
322
325
|
slot = $( event.target ).slot()
|
323
326
|
menu_slot = slot.find '.menu-slot:first'
|
324
327
|
url = wagn.rootPath + '/~' + slot.data('card-id')
|
325
328
|
params = { view: 'menu' }
|
326
329
|
params['is_main'] = true if slot.isMain()
|
327
|
-
|
330
|
+
modal_content.empty()
|
328
331
|
$.ajax url, {
|
329
332
|
type : 'GET'
|
330
333
|
data: params
|
@@ -332,6 +335,8 @@ $(window).ready ->
|
|
332
335
|
menu_slot.replaceWith data
|
333
336
|
}
|
334
337
|
|
338
|
+
|
339
|
+
|
335
340
|
# for slot in $('.card-slot')
|
336
341
|
# menu_slot = $(slot).find '.menu-slot:first'
|
337
342
|
# if menu_slot.size() > 0
|