card 1.15.1 → 1.15.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/card.gemspec +19 -16
- data/config/initializers/recaptcha.rb +1 -0
- data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +13 -14
- data/db/migrate_core_cards/20150326205655_bootswatch_themes.rb +30 -0
- data/db/migrate_core_cards/20150331135745_new_card_menu.rb +8 -0
- data/db/migrate_core_cards/20150508212032_menu_compatibility.rb +27 -0
- data/db/migrate_core_cards/20150510031118_fix_skin_images.rb +13 -0
- data/db/migrate_core_cards/data/1.12_stylesheets/classic_cards.scss +9 -5
- data/db/migrate_core_cards/data/1.12_stylesheets/common.scss +5 -5
- data/{test/fixtures/.gitkeep → db/migrate_core_cards/data/themes/bootstrap_default/_bootswatch.scss} +0 -0
- data/db/migrate_core_cards/data/themes/bootstrap_default/_variables.scss +866 -0
- data/db/migrate_core_cards/data/themes/cerulean/_bootswatch.scss +125 -0
- data/db/migrate_core_cards/data/themes/cerulean/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/cosmo/_bootswatch.scss +237 -0
- data/db/migrate_core_cards/data/themes/cosmo/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/cyborg/_bootswatch.scss +210 -0
- data/db/migrate_core_cards/data/themes/cyborg/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/darkly/_bootswatch.scss +330 -0
- data/db/migrate_core_cards/data/themes/darkly/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/flatly/_bootswatch.scss +313 -0
- data/db/migrate_core_cards/data/themes/flatly/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/journal/_bootswatch.scss +120 -0
- data/db/migrate_core_cards/data/themes/journal/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/lumen/_bootswatch.scss +496 -0
- data/db/migrate_core_cards/data/themes/lumen/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/paper/_bootswatch.scss +607 -0
- data/db/migrate_core_cards/data/themes/paper/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/readable/_bootswatch.scss +174 -0
- data/db/migrate_core_cards/data/themes/readable/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/sandstone/_bootswatch.scss +194 -0
- data/db/migrate_core_cards/data/themes/sandstone/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/simplex/_bootswatch.scss +142 -0
- data/db/migrate_core_cards/data/themes/simplex/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/slate/_bootswatch.scss +417 -0
- data/db/migrate_core_cards/data/themes/slate/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/spacelab/_bootswatch.scss +137 -0
- data/db/migrate_core_cards/data/themes/spacelab/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/superhero/_bootswatch.scss +332 -0
- data/db/migrate_core_cards/data/themes/superhero/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/united/_bootswatch.scss +42 -0
- data/db/migrate_core_cards/data/themes/united/_variables.scss +861 -0
- data/db/migrate_core_cards/data/themes/yeti/_bootswatch.scss +437 -0
- data/db/migrate_core_cards/data/themes/yeti/_variables.scss +861 -0
- data/db/seed/README.md +2 -0
- data/db/{bootstrap → seed/new}/card_actions.yml +561 -295
- data/db/{bootstrap → seed/new}/card_acts.yml +1 -1
- data/db/seed/new/card_changes.yml +29331 -0
- data/db/{bootstrap → seed/new}/card_references.yml +1544 -1355
- data/db/seed/new/cards.yml +28057 -0
- data/db/seed/test/fixtures/.gitkeep +0 -0
- data/{test → db/seed/test}/fixtures/card_actions.yml +1501 -1235
- data/{test → db/seed/test}/fixtures/card_acts.yml +244 -244
- data/db/seed/test/fixtures/card_changes.yml +34527 -0
- data/{test → db/seed/test}/fixtures/card_references.yml +2215 -2026
- data/db/seed/test/fixtures/cards.yml +32708 -0
- data/{test → db/seed/test}/fixtures/mao2.jpg +0 -0
- data/{test → db/seed/test}/fixtures/rails.gif +0 -0
- data/{test → db/seed/test}/seed.rb +0 -0
- data/db/version_core_cards.txt +1 -1
- data/lib/card/format.rb +56 -56
- data/lib/cardio.rb +7 -5
- data/mod/01_core/chunk/include.rb +1 -1
- data/mod/01_core/set/all/fetch.rb +27 -27
- data/mod/01_core/set/all/rules.rb +53 -53
- data/mod/01_core/set/all/states.rb +5 -0
- data/mod/01_core/spec/format/html_format_spec.rb +6 -6
- data/mod/01_core/spec/set/all/rules2_spec.rb +6 -6
- data/mod/01_history/set/all/history.rb +4 -4
- data/mod/02_basic_types/set/all/rss.rb +10 -9
- data/mod/03_machines/lib/javascript/script_card_menu.js.coffee +20 -0
- data/mod/03_machines/lib/javascript/wagn.js.coffee +46 -34
- data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +36 -148
- data/mod/03_machines/lib/stylesheets/style_bootstrap_compatible.css +10 -96
- data/mod/03_machines/lib/stylesheets/style_cards.scss +127 -87
- data/mod/03_machines/set/self/script_card_menu.rb +10 -2
- data/mod/05_email/set/all/follow.rb +38 -22
- data/mod/05_email/set/right/follow.rb +79 -1
- data/mod/05_email/set/type_plus_right/user/follow.rb +31 -31
- data/mod/05_email/spec/set/all/follow_spec.rb +37 -28
- data/mod/05_email/spec/set/right/followers_spec.rb +29 -29
- data/mod/05_standard/set/all/error.rb +17 -20
- data/mod/05_standard/set/all/links.rb +31 -18
- data/mod/05_standard/set/all/rich_html/content.rb +41 -18
- data/mod/05_standard/set/all/rich_html/editing.rb +21 -17
- data/mod/05_standard/set/all/rich_html/header.rb +13 -48
- data/mod/05_standard/set/all/rich_html/menu.rb +147 -0
- data/mod/05_standard/set/all/rich_html/modal.rb +54 -0
- data/mod/05_standard/set/all/rich_html/toolbar.rb +237 -0
- data/mod/05_standard/set/all/rich_html/wrapper.rb +43 -25
- data/mod/05_standard/set/right/account.rb +8 -7
- data/mod/05_standard/set/rstar/rules.rb +111 -84
- data/mod/05_standard/set/self/head.rb +15 -15
- data/mod/05_standard/set/type/set.rb +65 -34
- data/mod/05_standard/spec/set/all/attach_spec.rb +1 -1
- data/mod/05_standard/spec/set/all/rich_html/wrapper_spec.rb +13 -9
- data/mod/05_standard/spec/set/rstar/rules_spec.rb +1 -1
- data/mod/06_bootstrap/lib/javascript/bootstrap.js +108 -97
- data/mod/06_bootstrap/lib/javascript/smartmenu.js +94 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_alerts.scss +73 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_badges.scss +68 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_breadcrumbs.scss +26 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_button-groups.scss +243 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_buttons.scss +160 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_carousel.scss +269 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_close.scss +36 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_code.scss +69 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_component-animations.scss +37 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_dropdowns.scss +214 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_forms.scss +578 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_glyphicons.scss +305 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_grid.scss +84 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_input-groups.scss +166 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_jumbotron.scss +50 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_labels.scss +66 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_list-group.scss +124 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_media.scss +61 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_mixins.scss +39 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_modals.scss +150 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_navbar.scss +662 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_navs.scss +242 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_normalize.scss +427 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_pager.scss +54 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_pagination.scss +88 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_panels.scss +265 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_popovers.scss +135 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_print.scss +107 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_progress-bars.scss +87 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_responsive-embed.scss +35 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_responsive-utilities.scss +177 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_scaffolding.scss +162 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_tables.scss +234 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_theme.scss +273 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_thumbnails.scss +38 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_tooltip.scss +102 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_type.scss +298 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_utilities.scss +55 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_variables.scss +866 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/_wells.scss +29 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_alerts.scss +14 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_background-variant.scss +11 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_buttons.scss +52 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_forms.scss +88 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_gradients.scss +58 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_grid.scss +122 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_image.scss +33 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_labels.scss +12 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_list-group.scss +31 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_opacity.scss +8 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_pagination.scss +23 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_panels.scss +24 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_progress-bar.scss +10 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_resize.scss +6 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_responsive-visibility.scss +21 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_size.scss +10 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_text-emphasis.scss +11 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
- data/mod/06_bootstrap/lib/stylesheets/{bootswatch_mixins.scss → bootstrap/mixins/_vendor-prefixes.scss} +1 -61
- data/mod/06_bootstrap/lib/stylesheets/bootstrap_cards.scss +20 -13
- data/mod/06_bootstrap/lib/stylesheets/smartmenu.css +433 -0
- data/mod/06_bootstrap/set/all/bootstrap/wrapper.rb +2 -2
- data/mod/06_bootstrap/set/all/rich_bootstrap.rb +58 -4
- data/mod/06_bootstrap/set/self/bootstrap_js.rb +1 -1
- data/mod/06_bootstrap/set/self/bootswatch_shared.rb +32 -0
- data/mod/06_bootstrap/set/self/smartmenu_css.rb +7 -0
- data/mod/06_bootstrap/set/self/smartmenu_js.rb +7 -0
- data/spec/spec_helper.rb +16 -16
- metadata +133 -93
- data/db/bootstrap/card_changes.yml +0 -12765
- data/db/bootstrap/cards.yml +0 -11567
- data/db/seeds.rb +0 -8
- data/mod/03_machines/lib/javascript/script_card_menu.js +0 -72
- data/mod/06_bootstrap/lib/stylesheets/bootstrap_css.css +0 -6565
- data/mod/06_bootstrap/lib/stylesheets/theme_bootstrap_default.css +0 -476
- data/mod/06_bootstrap/lib/stylesheets/theme_cerulean.css +0 -6721
- data/mod/06_bootstrap/lib/stylesheets/theme_cosmo.css +0 -5898
- data/mod/06_bootstrap/lib/stylesheets/theme_cyborg.css +0 -5876
- data/mod/06_bootstrap/lib/stylesheets/theme_darkly.css +0 -5986
- data/mod/06_bootstrap/lib/stylesheets/theme_flatly.css +0 -6830
- data/mod/06_bootstrap/lib/stylesheets/theme_journal.css +0 -6647
- data/mod/06_bootstrap/lib/stylesheets/theme_lumen.css +0 -6097
- data/mod/06_bootstrap/lib/stylesheets/theme_paper.css +0 -6647
- data/mod/06_bootstrap/lib/stylesheets/theme_readable.css +0 -5896
- data/mod/06_bootstrap/lib/stylesheets/theme_sandstone.css +0 -6733
- data/mod/06_bootstrap/lib/stylesheets/theme_simplex.css +0 -5886
- data/mod/06_bootstrap/lib/stylesheets/theme_slate.css +0 -7057
- data/mod/06_bootstrap/lib/stylesheets/theme_spacelab.css +0 -5935
- data/mod/06_bootstrap/lib/stylesheets/theme_superhero.css +0 -5964
- data/mod/06_bootstrap/lib/stylesheets/theme_united.css +0 -6588
- data/mod/06_bootstrap/lib/stylesheets/theme_yeti.css +0 -6088
- data/mod/06_bootstrap/set/self/bootstrap_css.rb +0 -9
- data/mod/06_bootstrap/set/self/bootswatch_mixins.rb +0 -9
- data/mod/06_bootstrap/set/self/theme_bootstrap_default.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_cerulean.rb +0 -9
- data/mod/06_bootstrap/set/self/theme_cosmo.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_cyborg.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_darkly.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_flatly.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_journal.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_lumen.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_paper.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_readable.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_sandstone.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_simplex.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_slate.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_spacelab.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_superhero.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_united.rb +0 -2
- data/mod/06_bootstrap/set/self/theme_yeti.rb +0 -2
- data/test/fixtures/card_changes.yml +0 -17961
- data/test/fixtures/cards.yml +0 -16218
@@ -0,0 +1,20 @@
|
|
1
|
+
wagn.slotReady (slot) ->
|
2
|
+
menu = $(slot).find('.open-menu.dropdown-toggle')
|
3
|
+
if menu?
|
4
|
+
$(menu).dropdown('toggle')
|
5
|
+
|
6
|
+
$(window).ready ->
|
7
|
+
$('body').on 'click', '.toolbar .nav-pills > li', ->
|
8
|
+
$(this).tab('show')
|
9
|
+
|
10
|
+
$(document).on 'tap', '.card-header', (event) ->
|
11
|
+
link = $(this).find('.card-menu > a')
|
12
|
+
unless !link[0] or # no gear
|
13
|
+
event.pageX - $(this).offset().left < $(this).width() / 2 # left half of header
|
14
|
+
|
15
|
+
link.click()
|
16
|
+
event.preventDefault()
|
17
|
+
|
18
|
+
$(document).on 'tap', 'body', (event) ->
|
19
|
+
unless $(event.target).closest('.card-header')[0] or $(event.target).closest('.card-menu-link')[0]
|
20
|
+
$('.card-menu .dropdown-toggle').dropdown('toggle')
|
@@ -13,9 +13,9 @@ $.extend wagn,
|
|
13
13
|
xtra['is_main'] = true if slot.isMain()
|
14
14
|
slotdata = slot.data 'slot'
|
15
15
|
wagn.slotParams slotdata, xtra, 'slot' if slotdata?
|
16
|
-
|
16
|
+
|
17
17
|
url + ( (if url.match /\?/ then '&' else '?') + $.param(xtra) )
|
18
|
-
|
18
|
+
|
19
19
|
slotParams: (raw, processed, prefix)->
|
20
20
|
$.each raw, (key, value)->
|
21
21
|
cgiKey = prefix + '[' + snakeCase(key) + ']'
|
@@ -23,19 +23,29 @@ $.extend wagn,
|
|
23
23
|
wagn.slotParams value, processed, cgiKey
|
24
24
|
else
|
25
25
|
processed[cgiKey] = value
|
26
|
-
|
26
|
+
|
27
27
|
slotReady: (func)->
|
28
28
|
$('document').ready ->
|
29
29
|
$('body').on 'slotReady', '.card-slot', (e) ->
|
30
30
|
e.stopPropagation()
|
31
31
|
func.call this, $(this)
|
32
32
|
pingName: (name, success)->
|
33
|
-
$.getJSON wagn.rootPath + '/', { format: 'json', view: 'status', 'card[name]': name }, success
|
33
|
+
$.getJSON wagn.rootPath + '/', { format: 'json', view: 'status', 'card[name]': name }, success
|
34
34
|
|
35
35
|
jQuery.fn.extend {
|
36
|
-
slot: ->
|
37
|
-
if @
|
38
|
-
@closest
|
36
|
+
slot: ->
|
37
|
+
if @data('slot-selector')
|
38
|
+
target_slot = @closest(@data('slot-selector'))
|
39
|
+
parent_slot = @closest '.card-slot'
|
40
|
+
|
41
|
+
# if slot-selector doesn't apply to a child, search in all parent slots and finally in the body
|
42
|
+
while target_slot.length == 0 and parent_slot.length > 0
|
43
|
+
target_slot = $(parent_slot).find(@data('slot-selector'))
|
44
|
+
parent_slot = $(parent_slot).parent().closest '.card-slot'
|
45
|
+
if target_slot.length == 0
|
46
|
+
$('body').find(@data('slot-selector'))
|
47
|
+
else
|
48
|
+
target_slot
|
39
49
|
else
|
40
50
|
@closest '.card-slot'
|
41
51
|
|
@@ -57,7 +67,7 @@ jQuery.fn.extend {
|
|
57
67
|
else
|
58
68
|
notice = @attr('notify-success')
|
59
69
|
newslot = @setSlotContent data
|
60
|
-
|
70
|
+
|
61
71
|
if newslot.jquery # sometimes response is plaintext
|
62
72
|
wagn.initializeEditors newslot
|
63
73
|
if notice?
|
@@ -82,7 +92,7 @@ jQuery.fn.extend {
|
|
82
92
|
if form[0]
|
83
93
|
$(form[0]).append notice
|
84
94
|
else
|
85
|
-
slot.append notice
|
95
|
+
slot.append notice
|
86
96
|
notice.html message
|
87
97
|
notice.show 'blind'
|
88
98
|
|
@@ -156,6 +166,12 @@ $(window).ready ->
|
|
156
166
|
$("body").scrollTop slot_top_pos
|
157
167
|
event.slotSuccessful = true
|
158
168
|
|
169
|
+
$('body').on 'loaded.bs.modal', null, (event) ->
|
170
|
+
unless event.slotSuccessful
|
171
|
+
wagn.initializeEditors $(event.target)
|
172
|
+
event.slotSuccessful = true
|
173
|
+
|
174
|
+
|
159
175
|
$('body').on 'ajax:error', '.slotter', (event, xhr) ->
|
160
176
|
$(this).slotError xhr.status, xhr.responseText
|
161
177
|
|
@@ -165,7 +181,7 @@ $(window).ready ->
|
|
165
181
|
|
166
182
|
$('body').on 'ajax:beforeSend', '.slotter', (event, xhr, opt)->
|
167
183
|
return if opt.skip_before_send
|
168
|
-
|
184
|
+
|
169
185
|
unless opt.url.match /home_view/ #avoiding duplication. could be better test?
|
170
186
|
opt.url = wagn.prepUrl opt.url, $(this).slot()
|
171
187
|
|
@@ -190,7 +206,7 @@ $(window).ready ->
|
|
190
206
|
iframeUploadFilter = (data)-> data.find('body').html()
|
191
207
|
opt.dataFilter = iframeUploadFilter
|
192
208
|
# gets rid of default html and body tags
|
193
|
-
|
209
|
+
|
194
210
|
args = $.extend opt, (widget._getAJAXSettings data), url: opt.url
|
195
211
|
# combines settings from wagn's slotter and jQuery UI's upload widget
|
196
212
|
args.skip_before_send = true #avoid looping through this method again
|
@@ -205,33 +221,33 @@ $(window).ready ->
|
|
205
221
|
|
206
222
|
$('body').on 'click', '.submitter', ->
|
207
223
|
$(this).closest('form').submit()
|
208
|
-
|
224
|
+
|
209
225
|
$('body').on 'click', '.renamer-updater', ->
|
210
226
|
$(this).closest('form').find('#card_update_referencers').val 'true'
|
211
|
-
|
227
|
+
|
212
228
|
$('body').on 'submit', '.edit_name-view .card-form', ->
|
213
229
|
confirmer = $(this).find '.alert'
|
214
230
|
if confirmer.is ':hidden'
|
215
231
|
if $(this).find('#referers').val() > 0
|
216
232
|
$(this).find('.renamer-updater').show()
|
217
|
-
|
233
|
+
|
218
234
|
confirmer.show 'blind'
|
219
235
|
false
|
220
|
-
|
221
|
-
|
222
|
-
|
236
|
+
|
237
|
+
|
238
|
+
|
223
239
|
$('body').on 'click', '.follow-updater', ->
|
224
240
|
$(this).closest('form').find('#card_update_all_users').val 'true'
|
225
|
-
|
241
|
+
|
226
242
|
$('body').on 'submit', '.edit-view.SELF-Xfollow_default .card-form', ->
|
227
243
|
confirmer = $(this).find '.confirm_update_all-view'
|
228
244
|
if confirmer.is ':hidden'
|
229
245
|
$(this).find('.follow-updater').show()
|
230
|
-
|
246
|
+
|
231
247
|
confirmer.show 'blind'
|
232
248
|
false
|
233
|
-
|
234
|
-
|
249
|
+
|
250
|
+
|
235
251
|
$('body').on 'click', 'button.redirecter', ->
|
236
252
|
window.location = $(this).attr('href')
|
237
253
|
|
@@ -239,10 +255,14 @@ $(window).ready ->
|
|
239
255
|
$('body').on 'dblclick', 'div', (event) ->
|
240
256
|
t = $(this)
|
241
257
|
return false if t.closest( '.nodblclick' )[0]
|
258
|
+
# fail if inside a div with "nodblclick" class
|
242
259
|
return false if t.closest( '.card-header' )[0]
|
243
|
-
|
260
|
+
# fail if inside a card header
|
244
261
|
s = t.slot()
|
262
|
+
return false if s.find( '.card-editor' )[0]
|
263
|
+
# fail if there is an editor open in your slot
|
245
264
|
return false unless s.data('cardId')
|
265
|
+
# fail if slot has not card id
|
246
266
|
s.addClass 'slotter'
|
247
267
|
s.attr 'href', wagn.rootPath + '/card/edit/~' + s.data('cardId')
|
248
268
|
$.rails.handleRemote(s)
|
@@ -256,13 +276,6 @@ $(window).ready ->
|
|
256
276
|
if input and !(input.val().match /^REDIRECT/)
|
257
277
|
input.val ( if target == 'REDIRECT' then target + ': ' + input.val() else target )
|
258
278
|
|
259
|
-
#more of this info should be in views; will need to refactor for HTTP DELETE anyway...
|
260
|
-
$('.card-slot').on 'click', '.standard-delete', ->
|
261
|
-
return if $(this).attr('success-ready') == 'true' #prevent double-click weirdness
|
262
|
-
s = if $(this).isMain() then 'REDIRECT: *previous' else 'TEXT:' + $(this).slot().data('cardName') + ' removed'
|
263
|
-
$(this).attr 'href', $(this).attr('href') + '?success=' + encodeURIComponent(s)
|
264
|
-
$(this).attr 'success-ready', 'true'
|
265
|
-
|
266
279
|
$('body').on 'change', '.live-type-field', ->
|
267
280
|
$(this).data 'params', $(this).closest('form').serialize()
|
268
281
|
$(this).data 'url', $(this).attr 'href'
|
@@ -279,7 +292,7 @@ $(window).ready ->
|
|
279
292
|
$(this).html $(this).attr( 'hover_content' )
|
280
293
|
$('body').on 'mouseleave', '[hover_content]', ->
|
281
294
|
$(this).html $(this).attr( 'hover_restore' )
|
282
|
-
|
295
|
+
|
283
296
|
$('body').on 'keyup', '.name-editor input', ->
|
284
297
|
box = $(this)
|
285
298
|
name = box.val()
|
@@ -297,7 +310,7 @@ $(window).ready ->
|
|
297
310
|
slot_id = box.slot().data 'cardId' # use id to avoid warning when renaming to name variant
|
298
311
|
if status != 'unknown' and !(slot_id && parseInt(slot_id) == data['id'])
|
299
312
|
ed.addClass status + '-name known-name'
|
300
|
-
link =
|
313
|
+
link =
|
301
314
|
qualifier = if status == 'virtual' #wish coffee would let me use a ? b : c syntax here
|
302
315
|
'in virtual'
|
303
316
|
else
|
@@ -305,13 +318,13 @@ $(window).ready ->
|
|
305
318
|
msg.html '"<a href="' + wagn.rootPath + '/' + data['url_key'] + '">' + name + '</a>" ' + qualifier + ' use'
|
306
319
|
else
|
307
320
|
msg.html ''
|
308
|
-
|
321
|
+
|
309
322
|
$('body').on 'click', '.render-error-link', (event) ->
|
310
323
|
msg = $(this).closest('.render-error').find '.render-error-message'
|
311
324
|
msg.show()
|
312
325
|
# msg.dialog()
|
313
326
|
event.preventDefault()
|
314
|
-
|
327
|
+
|
315
328
|
|
316
329
|
# important: this prevents jquery-mobile from taking over everything
|
317
330
|
$( document ).on "mobileinit", ->
|
@@ -321,7 +334,6 @@ $( document ).on "mobileinit", ->
|
|
321
334
|
}
|
322
335
|
|
323
336
|
|
324
|
-
|
325
337
|
newCaptcha = (form)->
|
326
338
|
recapUri = 'https://www.google.com/recaptcha/api/js/recaptcha_ajax.js'
|
327
339
|
recapDiv = $('<div class="recaptcha-box"></div>')
|
@@ -29,13 +29,13 @@ $.extend wagn,
|
|
29
29
|
input.autocomplete { source: wagn.prepUrl wagn.rootPath + '/' + optionsCard + '.json?view=name_complete' }
|
30
30
|
|
31
31
|
setTinyMCEConfig: (string)->
|
32
|
-
setter = ()->
|
32
|
+
setter = ()->
|
33
33
|
try
|
34
34
|
$.parseJSON string
|
35
35
|
catch
|
36
36
|
{}
|
37
37
|
wagn.tinyMCEConfig = setter()
|
38
|
-
|
38
|
+
|
39
39
|
initAce: (textarea) ->
|
40
40
|
type_code = textarea.attr "data-card-type-code"
|
41
41
|
hash = {}
|
@@ -67,8 +67,8 @@ $.extend wagn,
|
|
67
67
|
editor.setOption "showPrintMargin", false
|
68
68
|
editor.getSession().setTabSize 2
|
69
69
|
editor.getSession().setUseSoftTabs true
|
70
|
-
editor.setOptions maxLines: 30
|
71
|
-
|
70
|
+
editor.setOptions maxLines: 30
|
71
|
+
|
72
72
|
textarea.closest("form").submit ->
|
73
73
|
textarea.val editor.getSession().getValue()
|
74
74
|
return
|
@@ -126,113 +126,6 @@ $.extend wagn,
|
|
126
126
|
editor.append '<input type="hidden" value="CHOSEN" class="upload-card-content" name="' + contentFieldName + '">'
|
127
127
|
# we add and remove the contentField to insure that nothing is added / updated when nothing is chosen.
|
128
128
|
|
129
|
-
openMenu: (link, tapped) ->
|
130
|
-
l = $(link)
|
131
|
-
cm = l.data 'menu'
|
132
|
-
if !cm?
|
133
|
-
cm = wagn.generateMenu l.slot(), l.data('menu-vars')
|
134
|
-
l.data 'menu', cm
|
135
|
-
cm.menu position: { my:'right top', at:'left-2 top-3' }, icons: { submenu:'ui-icon-carat-1-w' }
|
136
|
-
#TODO submenu should use glyphicon glyphicon-menu-left
|
137
|
-
|
138
|
-
if tapped
|
139
|
-
cm.addClass 'card-menu-tappable'
|
140
|
-
|
141
|
-
cm.show()
|
142
|
-
cm.position my:'right top', at:'right+2 top+2', of: link
|
143
|
-
|
144
|
-
closeMenu: (menu) ->
|
145
|
-
$(menu).hide()
|
146
|
-
$(menu).menu "collapseAll", null, true
|
147
|
-
|
148
|
-
|
149
|
-
generateMenu: (slot, vars) ->
|
150
|
-
template_clone = $.extend true, {}, wagn.menu_template
|
151
|
-
items = wagn.generateMenuItems template_clone, vars
|
152
|
-
|
153
|
-
m = $( '<ul class="card-menu">' + items.join("\n") + '</ul>' )
|
154
|
-
slot.append m
|
155
|
-
m
|
156
|
-
|
157
|
-
generateMenuItems: (template, vars)->
|
158
|
-
items = []
|
159
|
-
$.each template, (index, i)->
|
160
|
-
return true if i.if && !vars[i.if]
|
161
|
-
|
162
|
-
if i.text
|
163
|
-
i.text = i.text.replace /\%\{([^}]*)\}/, (m, val)-> vars[val]
|
164
|
-
i.text = $('<div/>').text(i.text).html() #escapes html
|
165
|
-
|
166
|
-
item =
|
167
|
-
if i.raw
|
168
|
-
i.raw
|
169
|
-
else if i.link
|
170
|
-
vars[i.link]
|
171
|
-
else if i.plain
|
172
|
-
'<a>' + i.plain + '</a>'
|
173
|
-
else if i.page
|
174
|
-
page = vars[i.page] || i.page
|
175
|
-
text = i.text || page
|
176
|
-
if page == vars['self']
|
177
|
-
relpath = vars['linkname']
|
178
|
-
else if page.match /^[\w\+\*]+$/
|
179
|
-
relpath = page
|
180
|
-
else
|
181
|
-
relpath = '?' + $.param( 'card[name]' : page )
|
182
|
-
|
183
|
-
'<a href="' + wagn.rootPath + '/' + relpath + '">' + text + ' ↵</a>'
|
184
|
-
else
|
185
|
-
wagn.generateStandardMenuItem i, vars
|
186
|
-
|
187
|
-
if item
|
188
|
-
if i.list
|
189
|
-
if listsub = wagn.generateListTemplate i.list, vars
|
190
|
-
i.sub = listsub if listsub.length > 0
|
191
|
-
|
192
|
-
if i.sub
|
193
|
-
item += '<ul>' + wagn.generateMenuItems(i.sub, vars).join("\n") + '</ul>'
|
194
|
-
|
195
|
-
items.push('<li>' + item + '</li>')
|
196
|
-
items
|
197
|
-
|
198
|
-
generateListTemplate: (list, vars)->
|
199
|
-
items = []
|
200
|
-
if list_vars = vars[list.name]
|
201
|
-
$.each list_vars, (index, itemvars)->
|
202
|
-
template = $.extend {}, list.template
|
203
|
-
$.map template, (val, key)->
|
204
|
-
template[key] = itemvars[template[key]] || template[key]
|
205
|
-
items.push template
|
206
|
-
|
207
|
-
if list.append
|
208
|
-
items = items.concat list.append
|
209
|
-
|
210
|
-
items
|
211
|
-
|
212
|
-
generateStandardMenuItem: (i, vars)->
|
213
|
-
params = i.path_opts || {}
|
214
|
-
|
215
|
-
if i.related
|
216
|
-
i.view='related'
|
217
|
-
params['related'] = if typeof(i.related) == 'object'
|
218
|
-
$.extend {}, i.related, name: vars[i.related.name]
|
219
|
-
else
|
220
|
-
i.text ||= i.related
|
221
|
-
{ 'name': '+*' + i.related }
|
222
|
-
|
223
|
-
if i.view #following basically reproduces link_to_view. make own function?
|
224
|
-
path = wagn.rootPath + '/'
|
225
|
-
if vars['creator']
|
226
|
-
path += vars['linkname']
|
227
|
-
else
|
228
|
-
params['card[name]'] = vars['self']
|
229
|
-
|
230
|
-
params['view'] = i.view unless i.view == 'home'
|
231
|
-
path += '?' + $.param(params) unless $.isEmptyObject params
|
232
|
-
|
233
|
-
text = i.text || i.view
|
234
|
-
'<a href="' + path + '" data-remote="true" class="slotter">' + text + '</a>'
|
235
|
-
|
236
129
|
|
237
130
|
$(window).ready ->
|
238
131
|
|
@@ -253,31 +146,6 @@ $(window).ready ->
|
|
253
146
|
# sadly, it also causes odd navbox behavior, resetting the search term
|
254
147
|
}
|
255
148
|
|
256
|
-
$('body').on 'mouseenter', '.card-menu-link', ->
|
257
|
-
wagn.openMenu this, false
|
258
|
-
|
259
|
-
$('body').on 'mouseleave', '.card-menu', ->
|
260
|
-
wagn.closeMenu this
|
261
|
-
|
262
|
-
$(document).on 'tap', '.card-header', (event) ->
|
263
|
-
link = $(this).find('.card-menu-link')
|
264
|
-
unless !link[0] or # no gear
|
265
|
-
link.data('menu') or # already has menu
|
266
|
-
event.pageX - $(this).offset().left < $(this).width() / 2 # left half of header
|
267
|
-
|
268
|
-
wagn.openMenu link, true
|
269
|
-
event.preventDefault()
|
270
|
-
|
271
|
-
$(document).on 'tap', 'body', (event) ->
|
272
|
-
unless $(event.target).closest('.card-header')[0] or $(event.target).closest('.card-menu-link')[0]
|
273
|
-
$('.card-menu').hide()
|
274
|
-
# this and mouseleave should use a close menu method that handles collapsing. (though not seeing bad behavior...)
|
275
|
-
|
276
|
-
$(document).on 'tap', '.ui-menu-icon', (event)->
|
277
|
-
$(this).closest('li').trigger('mouseenter')
|
278
|
-
event.preventDefault()
|
279
|
-
|
280
|
-
|
281
149
|
#pointer mod
|
282
150
|
$('body').on 'click', '.pointer-item-add', (event)->
|
283
151
|
last_item = $(this).closest('.content-editor').find '.pointer-li:last'
|
@@ -294,13 +162,13 @@ $(window).ready ->
|
|
294
162
|
item.remove()
|
295
163
|
else
|
296
164
|
item.find('input').val ''
|
297
|
-
|
165
|
+
|
298
166
|
# following mod
|
299
167
|
$('body').on 'click', '.btn-item-delete', ->
|
300
168
|
$(this).find('.glyphicon').addClass("glyphicon-hourglass").removeClass("glyphicon-remove")
|
301
169
|
$('body').on 'click', '.btn-item-add', ->
|
302
170
|
$(this).find('.glyphicon').addClass("glyphicon-hourglass").removeClass("glyphicon-plus")
|
303
|
-
|
171
|
+
|
304
172
|
$('body').on 'mouseenter', '.btn-item-delete', ->
|
305
173
|
$(this).find('.glyphicon').addClass("glyphicon-remove").removeClass("glyphicon-ok")
|
306
174
|
$(this).addClass("btn-danger").removeClass("btn-primary")
|
@@ -308,6 +176,23 @@ $(window).ready ->
|
|
308
176
|
$(this).find('.glyphicon').addClass("glyphicon-ok").removeClass("glyphicon-remove")
|
309
177
|
$(this).addClass("btn-primary").removeClass("btn-danger")
|
310
178
|
|
179
|
+
|
180
|
+
$('body').on 'click', '.update-follow-link', (event) ->
|
181
|
+
anchor = $(this)
|
182
|
+
url = wagn.rootPath + '/' + anchor.data('card_key') + '.json?view=follow_status'
|
183
|
+
modal = anchor.closest('.modal')
|
184
|
+
modal.removeData()
|
185
|
+
$.ajax url, {
|
186
|
+
type : 'GET'
|
187
|
+
dataType : 'json'
|
188
|
+
success : (data) ->
|
189
|
+
tags = $(modal).parent().find('.follow-link')
|
190
|
+
tags.find('.follow-verb').html data.verb
|
191
|
+
tags.attr 'href', data.path
|
192
|
+
tags.attr 'title', data.title
|
193
|
+
tags.data 'follow', data
|
194
|
+
}
|
195
|
+
|
311
196
|
$('body').on 'click', '.follow-toggle', (event) ->
|
312
197
|
anchor = $(this)
|
313
198
|
url = wagn.rootPath + '/update/' + anchor.data('rule_name') + '.json'
|
@@ -320,14 +205,14 @@ $(window).ready ->
|
|
320
205
|
'success[id]' : anchor.data('card_key')
|
321
206
|
}
|
322
207
|
success : (data) ->
|
323
|
-
tags = anchor.closest('.
|
208
|
+
tags = anchor.closest('.modal').parent().find('.follow-toggle')
|
324
209
|
tags.find('.follow-verb').html data.verb
|
325
210
|
tags.attr 'title', data.title
|
326
211
|
tags.removeClass( 'follow-toggle-on follow-toggle-off').addClass data.class
|
327
212
|
tags.data 'follow', data
|
328
213
|
}
|
329
214
|
event.preventDefault() # Prevent link from following its href
|
330
|
-
|
215
|
+
|
331
216
|
|
332
217
|
# permissions mod
|
333
218
|
$('body').on 'click', '.perm-vals input', ->
|
@@ -343,8 +228,8 @@ $(window).ready ->
|
|
343
228
|
f = $(this).closest('form')
|
344
229
|
checked = f.find('.set-editor input:checked')
|
345
230
|
if checked.val()
|
346
|
-
if checked.attr('warning')
|
347
|
-
confirm checked.attr('warning')
|
231
|
+
if checked.attr('warning')
|
232
|
+
confirm checked.attr('warning')
|
348
233
|
else
|
349
234
|
true
|
350
235
|
else
|
@@ -356,6 +241,9 @@ $(window).ready ->
|
|
356
241
|
# $(this).closest('tr').find('.close-rule-link').click()
|
357
242
|
|
358
243
|
|
244
|
+
$('body').on 'click', '.submit-modal', ->
|
245
|
+
$(this).closest('.modal-content').find('form').submit()
|
246
|
+
|
359
247
|
#wagn_org mod (for now)
|
360
248
|
$('body').on 'click', '.shade-view h1', ->
|
361
249
|
toggleThis = $(this).slot().find('.shade-content').is ':hidden'
|
@@ -366,10 +254,10 @@ $(window).ready ->
|
|
366
254
|
|
367
255
|
if firstShade = $('.shade-view h1')[0]
|
368
256
|
$(firstShade).trigger 'click'
|
369
|
-
|
257
|
+
|
370
258
|
|
371
259
|
# following not in use??
|
372
|
-
|
260
|
+
|
373
261
|
$('body').on 'change', '.go-to-selected select', ->
|
374
262
|
val = $(this).val()
|
375
263
|
if val != ''
|
@@ -378,10 +266,10 @@ $(window).ready ->
|
|
378
266
|
|
379
267
|
toggleShade = (shadeSlot) ->
|
380
268
|
shadeSlot.find('.shade-content').slideToggle 1000
|
381
|
-
shadeSlot.find('.glyphicon').toggleClass 'glyphicon-triangle-right glpyphicon-triangle-bottom'
|
269
|
+
shadeSlot.find('.glyphicon').toggleClass 'glyphicon-triangle-right glpyphicon-triangle-bottom'
|
382
270
|
|
383
271
|
permissionsContent = (ed) ->
|
384
|
-
return '_left' if ed.find('#inherit').is(':checked')
|
272
|
+
return '_left' if ed.find('#inherit').is(':checked')
|
385
273
|
groups = ed.find('.perm-group input:checked').map( -> $(this).val() )
|
386
274
|
indivs = ed.find('.perm-indiv input' ).map( -> $(this).val() )
|
387
275
|
pointerContent $.makeArray(groups).concat($.makeArray(indivs))
|
@@ -396,7 +284,7 @@ reqIndex = 0 #prevents race conditions
|
|
396
284
|
navbox_results = (request, response) ->
|
397
285
|
f = this.element.closest 'form'
|
398
286
|
formData = f.serialize() + '&view=complete'
|
399
|
-
|
287
|
+
|
400
288
|
this.xhr = $.ajax {
|
401
289
|
url: wagn.prepUrl wagn.rootPath + '/:search.json'
|
402
290
|
data: formData
|
@@ -444,4 +332,4 @@ navbox_select = (event, ui) ->
|
|
444
332
|
$(this).attr('disabled', 'disabled')
|
445
333
|
|
446
334
|
|
447
|
-
|
335
|
+
|