card-mod-script 0.13.1 → 0.13.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/assets/script/decko/autosave.js.coffee +30 -0
  3. data/assets/script/decko/bridge.js.coffee +31 -0
  4. data/assets/script/decko/card_menu.js.coffee +26 -0
  5. data/assets/script/decko/components.js.coffee +46 -0
  6. data/assets/script/decko/decko.js.coffee +97 -0
  7. data/assets/script/decko/doubleclick.js.coffee +30 -0
  8. data/assets/script/decko/editor.js.coffee +55 -0
  9. data/assets/script/decko/filter.js.coffee +176 -0
  10. data/assets/script/decko/filter_items.js.coffee +128 -0
  11. data/assets/script/decko/filter_links.js.coffee +81 -0
  12. data/assets/script/decko/follow.js.coffee +22 -0
  13. data/assets/script/decko/layout.js.coffee +76 -0
  14. data/assets/script/decko/link_editor.js.coffee +61 -0
  15. data/assets/script/decko/mod.js.coffee +85 -0
  16. data/assets/script/decko/modal.js.coffee +113 -0
  17. data/assets/script/decko/name_editor.js.coffee +58 -0
  18. data/assets/script/decko/navbox.js.coffee +74 -0
  19. data/assets/script/decko/nest_editor.js.coffee +166 -0
  20. data/assets/script/decko/nest_editor_name.js.coffee +102 -0
  21. data/assets/script/decko/nest_editor_options.js.coffee +93 -0
  22. data/assets/script/decko/nest_editor_rules.js.coffee +3 -0
  23. data/assets/script/decko/overlay.js.coffee +57 -0
  24. data/assets/script/decko/recaptcha.js.coffee +19 -0
  25. data/assets/script/decko/selectable_filtered_content.js.coffee +12 -0
  26. data/assets/script/decko/slot.js.coffee +182 -0
  27. data/assets/script/decko/slot_ready.js.coffee +11 -0
  28. data/assets/script/decko/slotter.js.coffee +276 -0
  29. data/assets/script/decko/upload.js.coffee +57 -0
  30. data/assets/script/jquery-ui.js +10 -0
  31. data/assets/script/jquery.autosize.js +274 -0
  32. data/assets/script/manifest.yml +44 -0
  33. data/assets/script/script_pointer_config.js.coffee +80 -0
  34. data/assets/script/script_pointer_list_editor.js.coffee +67 -0
  35. metadata +42 -9
@@ -0,0 +1,128 @@
1
+ # FILTERED LIST / ITEMS INTERFACE
2
+ # (fancy pointer ui)
3
+
4
+ $(window).ready ->
5
+ # add all selected items
6
+ $("body").on "click", "._filter-items ._add-selected", ->
7
+ btn = $(this)
8
+ content = newFilteredListContent btn
9
+ btn.attr "href", addSelectedButtonUrl(btn, content)
10
+
11
+ # select all visible filtered items
12
+ $("body").on "click", "._select-all", ->
13
+ filterBox($(this)).find("._unselected input._checkbox-list-checkbox").each ->
14
+ selectFilteredItem $(this)
15
+ $(this).prop "checked", false
16
+ updateAfterSelection $(this)
17
+
18
+ # deselect all selected items
19
+ $("body").on "click", "._deselect-all", ->
20
+ filterBox($(this)).find("._selected input._checkbox-list-checkbox").each ->
21
+ $(this).slot().remove()
22
+ $(this).prop "checked", true
23
+ updateAfterSelection $(this)
24
+
25
+ $("body").on "click", "._filter-items ._unselected input._checkbox-list-checkbox", ->
26
+ selectFilteredItem $(this)
27
+ updateAfterSelection $(this)
28
+
29
+ $("body").on "click", "._filter-items ._selected input._checkbox-list-checkbox", ->
30
+ bin = selectedBin $(this)
31
+ $(this).slot().remove()
32
+ updateAfterSelection bin
33
+
34
+ $('body').on 'click', '._filtered-list-item-delete', ->
35
+ $(this).closest('li').remove()
36
+
37
+ # TODO: make this object oriented!
38
+
39
+ newFilteredListContent = (el) ->
40
+ $.map(prefilteredIds(el).concat(selectedIds el), (id) -> "~" + id).join "\n"
41
+
42
+ addSelectedButtonUrl = (btn, content) ->
43
+ view = btn.slot().data("slot")["view"]
44
+ card_args = { content: content, type: "Pointer" }
45
+ query = { assign: true, view: view, card: card_args }
46
+ path_base = btn.attr("href") + "&" + $.param(query)
47
+ decko.slotPath path_base, btn.slot()
48
+
49
+ updateAfterSelection = (el) ->
50
+ trackSelectedIds el
51
+ f = new decko.filter(filterBox(el).find('._filter-widget'))
52
+ f.update()
53
+ updateSelectedCount el
54
+ updateUnselectedCount el
55
+
56
+ updateSelectedCount = (el) ->
57
+ count = selectedBin(el).children().length
58
+ filterBox(el).find("._selected-items").html count
59
+ deselectAllLink(el).attr "disabled", count == 0
60
+ if count > 0
61
+ addSelectedButton(el).removeClass("disabled")
62
+ else
63
+ addSelectedButton(el).addClass("disabled")
64
+
65
+ updateSelectedSectionVisibility el, count > 0
66
+
67
+ updateSelectedSectionVisibility = (el, items_present) ->
68
+ box = filterBox el
69
+ selected_items = box.find "._selected-item-list"
70
+ help_text = box.find "._filter-help"
71
+ if items_present
72
+ selected_items.show()
73
+ help_text.hide()
74
+ else
75
+ selected_items.hide()
76
+ help_text.show()
77
+
78
+ updateUnselectedCount = (el) ->
79
+ box = filterBox(el)
80
+ count = box.find("._search-checkbox-list").children().length
81
+ box.find("._unselected-items").html count
82
+ box.find("._select-all").attr "disabled", count > 0
83
+
84
+ selectFilteredItem = (checkbox) ->
85
+ checkbox.prop "checked", true
86
+ selectedBin(checkbox).append checkbox.slot()
87
+
88
+ selectedBin = (el) ->
89
+ filterBox(el).find "._selected-bin"
90
+
91
+ filterBox = (el) ->
92
+ el.closest "._filter-items"
93
+
94
+ # this button contains the data about the form that opened the filter-items interface.
95
+ # the itemSelector
96
+ addSelectedButton = (el) ->
97
+ filterBox(el).find("._add-selected")
98
+
99
+ deselectAllLink = (el) ->
100
+ filterBox(el).find("._deselect-all")
101
+
102
+ selectedIds = (el) ->
103
+ selectedData el, "cardId"
104
+
105
+ prefilteredIds = (el) ->
106
+ prefilteredData el, "cardId"
107
+
108
+ prefilteredNames = (el) ->
109
+ prefilteredData el, "cardName"
110
+
111
+ prefilteredData = (el, field) ->
112
+ btn = addSelectedButton el
113
+ selector = btn.data "itemSelector"
114
+ arrayFromField btn.slot().find(selector), field
115
+
116
+ selectedNames = (el) ->
117
+ selectedData el, "cardName"
118
+
119
+ selectedData = (el, field) ->
120
+ arrayFromField selectedBin(el).children(), field
121
+
122
+ arrayFromField = (rows, field) ->
123
+ rows.map( -> $(this).data field ).toArray()
124
+
125
+ trackSelectedIds = (el) ->
126
+ ids = prefilteredIds(el).concat selectedIds(el)
127
+ box = filterBox el
128
+ box.find("._not-ids").val ids.toString()
@@ -0,0 +1,81 @@
1
+ decko.slotReady (slot) ->
2
+ slot.find("._filter-widget").each ->
3
+ if slot[0] == $(this).slot()[0]
4
+ filter = new decko.filter this
5
+ filter.showWithStatus "active"
6
+ filter.updateLastVals()
7
+ filter.updateQuickLinks()
8
+
9
+ $(window).ready ->
10
+ filterFor = (el) ->
11
+ new decko.filter el
12
+
13
+ # sometimes this element shows up as changed and breaks the filter.
14
+ weirdoSelect2FilterBreaker = (el) ->
15
+ $(el).hasClass "select2-search__field"
16
+
17
+ filterableData = (filterable) ->
18
+ f = $(filterable)
19
+ f.data("filter") || f.find("._filterable").data("filter")
20
+
21
+ targetFilter = (filterable) ->
22
+ selector = $(filterable).closest("._filtering").data("filter-selector")
23
+ filterFor (selector || this)
24
+
25
+ # Add Filter
26
+ $("body").on "click", "._filter-category-select", (e) ->
27
+ e.preventDefault()
28
+ # e.stopPropagation()
29
+ f = filterFor(this)
30
+ category = $(this).data("category")
31
+ f.activate category
32
+ f.updateIfPresent category
33
+
34
+ # Update filter results based on filter value changes
35
+ onchangers =
36
+ "._filter-input input:not(.simple-text), ._filter-input select, ._filter-sort"
37
+ $("body").on "change", onchangers, ->
38
+ return if weirdoSelect2FilterBreaker this
39
+ filterFor(this).update()
40
+
41
+ # update filter result after typing in text box
42
+ keyupTimeout = null
43
+ $("body").on "keyup", "._filter-input input.simple-text", ->
44
+ clearTimeout keyupTimeout
45
+ filter = filterFor this
46
+ keyupTimeout = setTimeout ( -> filter.updateIfChanged() ), 333
47
+
48
+ # remove filter
49
+ $("body").on "click", "._delete-filter-input", ->
50
+ filter = filterFor this
51
+ filter.removeField $(this).closest("._filter-input").data("category")
52
+ filter.update()
53
+
54
+ # reset all filters
55
+ $('body').on 'click', '._reset-filter', () ->
56
+ f = filterFor(this)
57
+ f.reset()
58
+ f.update()
59
+
60
+ $('body').on 'click', '._filtering ._filterable', (e) ->
61
+ f = targetFilter this
62
+ if f.widget.length
63
+ f.restrict filterableData(this)
64
+ e.preventDefault()
65
+ e.stopPropagation()
66
+
67
+ $('body').on 'click', '._filter-link', (e) ->
68
+ f = filterFor this
69
+ link = $(this)
70
+ filter_data = link.data "filter"
71
+ if inactiveQuickfilter link
72
+ f.removeRestrictions filter_data
73
+ else
74
+ f.addRestrictions filter_data
75
+
76
+ e.preventDefault()
77
+ e.stopPropagation()
78
+
79
+ inactiveQuickfilter = (link) ->
80
+ !link.hasClass("active") && link.closest(".quick-filter").length > 0
81
+
@@ -0,0 +1,22 @@
1
+ $(window).ready ->
2
+ $('body').on 'click', '.btn-item', ->
3
+ $(this).find('i').html('hourglass_full')
4
+
5
+ $('body').on 'mouseenter', '.btn-item-delete', ->
6
+ $(this).find('i').html('remove')
7
+ $(this).addClass("btn-danger").removeClass("btn-primary")
8
+
9
+ $('body').on 'mouseleave', '.btn-item-delete', ->
10
+ $(this).find('i').html('check')
11
+ $(this).addClass("btn-primary").removeClass("btn-danger")
12
+
13
+ $('body').on 'click', '.follow-updater', ->
14
+ $(this).closest('form').find('#card_update_all_users').val 'true'
15
+
16
+ $('body').on 'submit', '.edit-view.SELF-Xfollow_default .card-form', ->
17
+ confirmer = $(this).find '.confirm_update_all-view'
18
+ if confirmer.is ':hidden'
19
+ $(this).find('.follow-updater').show()
20
+
21
+ confirmer.show 'blind'
22
+ false
@@ -0,0 +1,76 @@
1
+ wrapDeckoLayout = ->
2
+ $footer = $('body > footer').first()
3
+ $('body > article, body > aside').wrapAll("<div class='#{containerClass()}'/>")
4
+ $('body > div > article, body > div > aside')
5
+ .wrapAll('<div class="row row-offcanvas">')
6
+ if $footer
7
+ $('body').append $footer
8
+
9
+ wrapSidebarToggle = (toggle, flex) ->
10
+ "<div class='container'><div class='row #{flex}'>#{toggle}</div></div>"
11
+
12
+ containerClass = ->
13
+ if $('body').hasClass('fluid') then "container-fluid" else "container"
14
+
15
+ toggleButton = (side) ->
16
+ icon_dir = if side == 'left' then 'right' else 'left'
17
+ "<button class='offcanvas-toggle btn btn-secondary "+
18
+ "d-sm-none' data-toggle='offcanvas-#{side}'>" +
19
+ "<i class='material-icons'>chevron_#{icon_dir}</i></button>"
20
+
21
+ sidebarToggle = (side) ->
22
+ if side == "both"
23
+ wrapSidebarToggle(toggleButton("left") + toggleButton("right"), "flex-row justify-content-between")
24
+ else if side == "left"
25
+ wrapSidebarToggle(toggleButton("left"), "flex-row")
26
+ else
27
+ wrapSidebarToggle(toggleButton("right"), "flex-row-reverse")
28
+
29
+ singleSidebar = (side) ->
30
+ $article = $('body > article').first()
31
+ $aside = $('body > aside').first()
32
+ $article.addClass("col-xs-12 col-sm-9")
33
+ $aside.addClass(
34
+ "col-xs-6 col-sm-3 sidebar-offcanvas sidebar-offcanvas-#{side}"
35
+ )
36
+ if side == 'left'
37
+ $('body').append($aside).append($article)
38
+ else
39
+ $('body').append($article).append($aside)
40
+ wrapDeckoLayout()
41
+ $article.prepend(sidebarToggle(side))
42
+
43
+ doubleSidebar = ->
44
+ $article = $('body > article').first()
45
+ $asideLeft = $('body > aside').first()
46
+ $asideRight = $($('body > aside')[1])
47
+ $article.addClass("col-xs-12 col-sm-6")
48
+ sideClass = "col-xs-6 col-sm-3 sidebar-offcanvas"
49
+ $asideLeft.addClass("#{sideClass} sidebar-offcanvas-left")
50
+ $asideRight.addClass("#{sideClass} sidebar-offcanvas-right")
51
+ $('body').append($asideLeft).append($article).append($asideRight)
52
+ wrapDeckoLayout()
53
+ toggles = sidebarToggle('both')
54
+ $article.prepend(toggles)
55
+
56
+ $.fn.extend toggleText: (a, b) ->
57
+ @text(if @text() == b then a else b)
58
+
59
+ this
60
+ $(window).ready ->
61
+ switch
62
+ when $('body').hasClass('right-sidebar')
63
+ singleSidebar('right')
64
+ when $('body').hasClass('left-sidebar')
65
+ singleSidebar('left')
66
+ when $('body').hasClass('two-sidebar')
67
+ doubleSidebar()
68
+
69
+ $('[data-toggle="offcanvas-left"]').click ->
70
+ $('.row-offcanvas').removeClass('right-active').toggleClass('left-active')
71
+ $(this).find('i.material-icons')
72
+ .toggleText('chevron_left', 'chevron_right')
73
+ $('[data-toggle="offcanvas-right"]').click ->
74
+ $('.row-offcanvas').removeClass('left-active').toggleClass('right-active')
75
+ $(this).find('i.material-icons')
76
+ .toggleText('chevron_left', 'chevron_right')
@@ -0,0 +1,61 @@
1
+ $(document).ready ->
2
+ $('body').on 'click', 'button._link-apply', () ->
3
+ link.applyLink($(this).data("tinymce-id"), $(this).data("tm-snippet-start"), $(this).data("tm-snippet-size"))
4
+
5
+ window.link ||= {}
6
+
7
+ $(document).ready ->
8
+ $('body').on 'click', '._link-field-toggle', () ->
9
+ if $(this).is(':checked')
10
+ link.addPlus()
11
+ else
12
+ link.removePlus()
13
+
14
+ $('body').on 'input', 'input._link-target', (event) ->
15
+ link.targetChanged()
16
+
17
+ $('body').on 'input', 'input._link-title', (event) ->
18
+ link.titleChanged()
19
+
20
+ $.extend link,
21
+ # called by TinyMCE
22
+ openLinkEditor: (tm) ->
23
+ params = nest.editParams(tm, "[[", "]]") unless params?
24
+ nest.openEditorForTm(tm, params, "link_editor", "modal_link_editor")
25
+
26
+ applyLink: (tinymce_id, link_start, link_size) ->
27
+ nest.applySnippet("link", tinymce_id, link_start, link_size)
28
+
29
+ target: () ->
30
+ link.evalFieldOption $('input._link-target').val()
31
+
32
+ title: () ->
33
+ $('input._link-title').val()
34
+
35
+ titleChanged: () ->
36
+ new_val = $("._link-preview").val().replace(/^\[\[[^\]]*/, "[[" + link.target() + "|" + link.title())
37
+ link.updatePreview new_val
38
+
39
+ targetChanged: () ->
40
+ new_val = $("._link-preview").val().replace(/^\[\[[^\]|]*/, "[[" + link.target())
41
+ link.updatePreview new_val
42
+
43
+ evalFieldOption: (name) ->
44
+ if link.isField() then "+#{name}" else name
45
+
46
+ isField: ->
47
+ $('._link-field-toggle').is(":checked")
48
+
49
+ addPlus: () ->
50
+ new_val = $("._link-preview").val().replace(/^\[\[\+?/, "[[+")
51
+ link.updatePreview new_val
52
+ $(".input-group.hide-prefix").removeClass("hide-prefix").addClass("show-prefix")
53
+
54
+ removePlus: () ->
55
+ new_val = $("._link-preview").val().replace(/^\[\[\+?/, "[[")
56
+ link.updatePreview new_val
57
+ $(".input-group.show-prefix").removeClass("show-prefix").addClass("hide-prefix")
58
+
59
+ updatePreview: (new_val) ->
60
+ new_val = "[[#{link.target()}|#{link.title()}]]" unless new_val?
61
+ $("._link-preview").val new_val
@@ -0,0 +1,85 @@
1
+
2
+ window.decko ||= {} #needed to run w/o *head. eg. jasmine
3
+
4
+ # $.extend decko,
5
+ # Can't get this to work yet. Intent was to tighten up head tag.
6
+ # initGoogleAnalytics: (key) ->
7
+ # window._gaq.push ['_setAccount', key]
8
+ # window._gaq.push ['_trackPageview']
9
+ #
10
+ # initfunc = ()->
11
+ # ga = document.createElement 'script'
12
+ # ga.type = 'text/javascript'
13
+ # ga.async = true
14
+ # ga.src = `('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'`
15
+ # s = document.getElementsByTagName('script')[0]
16
+ # s.parentNode.insertBefore ga, s
17
+ # initfunc()
18
+
19
+ $(window).ready ->
20
+ $('body').on 'click', '._stop_propagation', (event)->
21
+ event.stopPropagation()
22
+
23
+ $('body').on 'click', '._prevent_default', (event)->
24
+ event.preventDefault()
25
+
26
+ $('body').on 'mouseenter', 'a[data-hover-text]', ->
27
+ text = $(this).text()
28
+ $(this).data("original-text", text)
29
+ $(this).text($(this).data("hover-text"))
30
+
31
+ $('body').on 'mouseleave', 'a[data-hover-text]', ->
32
+ $(this).text($(this).data("original-text"))
33
+
34
+ #decko_org mod (for now)
35
+ $('body').on 'click', '.shade-view h1', ->
36
+ toggleThis = $(this).slot().find('.shade-content').is ':hidden'
37
+ decko.toggleShade $(this).closest('.pointer-list').find('.shade-content:visible').parent()
38
+ if toggleThis
39
+ decko.toggleShade $(this).slot()
40
+
41
+ if firstShade = $('.shade-view h1')[0]
42
+ $(firstShade).trigger 'click'
43
+
44
+ # performance log mod
45
+ $('body').on 'click', '.open-slow-items', ->
46
+ panel = $(this).closest('.panel-group')
47
+ panel.find('.open-slow-items').removeClass('open-slow-items').addClass('close-slow-items')
48
+ panel.find('.toggle-fast-items').text("show < 100ms")
49
+ panel.find('.duration-ok').hide()
50
+ panel.find('.panel-danger > .panel-collapse').collapse('show').find('a > span').addClass('show-fast-items')
51
+
52
+ $('body').on 'click', '.close-slow-items', ->
53
+ panel = $(this).closest('.panel-group')
54
+ panel.find('.close-slow-items').removeClass('close-slow-items').addClass('open-slow-items')
55
+ panel.find('.toggle-fast-items').text("hide < 100ms")
56
+ panel.find('.panel-danger > .panel-collapse').collapse('hide').removeClass('show-fast-items')
57
+ panel.find('.duration-ok').show()
58
+
59
+ $('body').on 'click', '.toggle-fast-items', ->
60
+ panel = $(this).closest('.panel-group')
61
+ if $(this).text() == 'hide < 100ms'
62
+ panel.find('.duration-ok').hide()
63
+ $(this).text("show < 100ms")
64
+ else
65
+ panel.find('.duration-ok').show()
66
+ $(this).text("hide < 100ms")
67
+
68
+ $('body').on 'click', '.show-fast-items', (event) ->
69
+ $(this).removeClass('show-fast-items')
70
+ panel = $(this).closest('.panel-group')
71
+ panel.find('.duration-ok').show()
72
+ panel.find('.show-fast-items').removeClass('show-fast-items')
73
+ panel.find('.panel-collapse').collapse('show')
74
+ event.stopPropagation()
75
+
76
+ $.extend decko,
77
+ toggleShade: (shadeSlot) ->
78
+ shadeSlot.find('.shade-content').slideToggle 1000
79
+ shadeSlot.find('.glyphicon').toggleClass 'glyphicon-triangle-right glpyphicon-triangle-bottom'
80
+
81
+
82
+
83
+
84
+
85
+