card-mod-script 0.14.2 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/config/late/extend_ansi.rb +1 -0
  3. data/data/real.yml +50 -0
  4. data/lib/card/mod/script.rb +1 -0
  5. data/lib/cardio/utils/ansi2_html.rb +72 -0
  6. data/set/abstract/00_script.rb +4 -4
  7. data/set/abstract/02_coffee_script.rb +9 -1
  8. data/set/all/head_javascript.rb +13 -22
  9. data/set/right/script.rb +1 -1
  10. data/set/type/coffee_script.rb +6 -0
  11. data/set/type/java_script.rb +6 -0
  12. data/set/type/local_script_folder_group.rb +2 -0
  13. data/set/type/local_script_manifest_group.rb +2 -0
  14. data/set/type_plus_right/mod/script.rb +1 -5
  15. data/set/type_plus_right/set/script.rb +3 -1
  16. metadata +15 -120
  17. data/assets/script/decko/autosave.js.coffee +0 -30
  18. data/assets/script/decko/bridge.js.coffee +0 -31
  19. data/assets/script/decko/card_menu.js.coffee +0 -26
  20. data/assets/script/decko/components.js.coffee +0 -49
  21. data/assets/script/decko/decko.js.coffee +0 -82
  22. data/assets/script/decko/doubleclick.js.coffee +0 -30
  23. data/assets/script/decko/editor.js.coffee +0 -57
  24. data/assets/script/decko/filter.js.coffee +0 -183
  25. data/assets/script/decko/filter_items.js.coffee +0 -128
  26. data/assets/script/decko/filter_links.js.coffee +0 -81
  27. data/assets/script/decko/follow.js.coffee +0 -22
  28. data/assets/script/decko/layout.js.coffee +0 -76
  29. data/assets/script/decko/link_editor.js.coffee +0 -61
  30. data/assets/script/decko/mod.js.coffee +0 -79
  31. data/assets/script/decko/modal.js.coffee +0 -113
  32. data/assets/script/decko/name_editor.js.coffee +0 -40
  33. data/assets/script/decko/navbox.js.coffee +0 -74
  34. data/assets/script/decko/nest_editor.js.coffee +0 -166
  35. data/assets/script/decko/nest_editor_name.js.coffee +0 -102
  36. data/assets/script/decko/nest_editor_options.js.coffee +0 -93
  37. data/assets/script/decko/nest_editor_rules.js.coffee +0 -3
  38. data/assets/script/decko/overlay.js.coffee +0 -54
  39. data/assets/script/decko/pointer_config.js.coffee +0 -79
  40. data/assets/script/decko/pointer_list_editor.js.coffee +0 -67
  41. data/assets/script/decko/recaptcha.js.coffee +0 -19
  42. data/assets/script/decko/selectable_filtered_content.js.coffee +0 -12
  43. data/assets/script/decko/slot.js.coffee +0 -182
  44. data/assets/script/decko/slot_ready.js.coffee +0 -12
  45. data/assets/script/decko/slotter.js.coffee +0 -268
  46. data/assets/script/decko/type_editor.js.coffee +0 -21
  47. data/assets/script/decko/upload.js.coffee +0 -64
  48. data/assets/script/jquery-ui.min.js +0 -13
  49. data/assets/script/jquery.autosize.js +0 -274
  50. data/assets/script/manifest.yml +0 -57
  51. data/db/migrate_core_cards/20200804112348_add_mod_script_assets_type.rb +0 -30
  52. data/vendor/jquery_file_upload/LICENSE.txt +0 -20
  53. data/vendor/jquery_file_upload/README.md +0 -224
  54. data/vendor/jquery_file_upload/SECURITY.md +0 -227
  55. data/vendor/jquery_file_upload/VULNERABILITIES.md +0 -118
  56. data/vendor/jquery_file_upload/cors/postmessage.html +0 -85
  57. data/vendor/jquery_file_upload/cors/result.html +0 -26
  58. data/vendor/jquery_file_upload/css/jquery.fileupload-noscript.css +0 -22
  59. data/vendor/jquery_file_upload/css/jquery.fileupload-ui-noscript.css +0 -17
  60. data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +0 -68
  61. data/vendor/jquery_file_upload/css/jquery.fileupload.css +0 -36
  62. data/vendor/jquery_file_upload/docker-compose.yml +0 -55
  63. data/vendor/jquery_file_upload/img/loading.gif +0 -0
  64. data/vendor/jquery_file_upload/img/progressbar.gif +0 -0
  65. data/vendor/jquery_file_upload/index.html +0 -357
  66. data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +0 -126
  67. data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +0 -97
  68. data/vendor/jquery_file_upload/js/demo.js +0 -75
  69. data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +0 -101
  70. data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +0 -347
  71. data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +0 -170
  72. data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +0 -759
  73. data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +0 -119
  74. data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +0 -101
  75. data/vendor/jquery_file_upload/js/jquery.fileupload.js +0 -1604
  76. data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +0 -227
  77. data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +0 -805
  78. data/vendor/jquery_file_upload/package-lock.json +0 -6853
  79. data/vendor/jquery_file_upload/package.json +0 -116
  80. data/vendor/jquery_file_upload/server/gae-python/app.yaml +0 -18
  81. data/vendor/jquery_file_upload/server/gae-python/main.py +0 -204
  82. data/vendor/jquery_file_upload/server/gae-python/static/favicon.ico +0 -0
  83. data/vendor/jquery_file_upload/server/gae-python/static/robots.txt +0 -2
  84. data/vendor/jquery_file_upload/server/php/Dockerfile +0 -44
  85. data/vendor/jquery_file_upload/server/php/UploadHandler.php +0 -1480
  86. data/vendor/jquery_file_upload/server/php/index.php +0 -15
  87. data/vendor/jquery_file_upload/server/php/php.ini +0 -5
  88. data/vendor/jquery_file_upload/test/index.html +0 -49
  89. data/vendor/jquery_file_upload/test/unit.js +0 -989
  90. data/vendor/jquery_file_upload/test/vendor/chai.js +0 -10854
  91. data/vendor/jquery_file_upload/test/vendor/mocha.css +0 -325
  92. data/vendor/jquery_file_upload/test/vendor/mocha.js +0 -18178
  93. data/vendor/jquery_file_upload/wdio/LICENSE.txt +0 -20
  94. data/vendor/jquery_file_upload/wdio/assets/black+white-3x2.jpg +0 -0
  95. data/vendor/jquery_file_upload/wdio/assets/black+white-60x40.gif +0 -0
  96. data/vendor/jquery_file_upload/wdio/conf/chrome.js +0 -40
  97. data/vendor/jquery_file_upload/wdio/conf/firefox.js +0 -25
  98. data/vendor/jquery_file_upload/wdio/hooks/index.js +0 -36
  99. data/vendor/jquery_file_upload/wdio/test/pages/file-upload.js +0 -79
  100. data/vendor/jquery_file_upload/wdio/test/specs/01-file-upload.js +0 -25
  101. data/vendor/jquery_file_upload/wdio/wdio.conf.js +0 -4
  102. data/vendor/jquery_rails/CHANGELOG.md +0 -359
  103. data/vendor/jquery_rails/CONTRIBUTING.md +0 -132
  104. data/vendor/jquery_rails/Gemfile +0 -22
  105. data/vendor/jquery_rails/MIT-LICENSE +0 -21
  106. data/vendor/jquery_rails/README.md +0 -75
  107. data/vendor/jquery_rails/Rakefile +0 -59
  108. data/vendor/jquery_rails/VERSIONS.md +0 -62
  109. data/vendor/jquery_rails/jquery-rails.gemspec +0 -26
  110. data/vendor/jquery_rails/lib/jquery/assert_select.rb +0 -149
  111. data/vendor/jquery_rails/lib/jquery/rails/engine.rb +0 -6
  112. data/vendor/jquery_rails/lib/jquery/rails/version.rb +0 -9
  113. data/vendor/jquery_rails/lib/jquery/rails.rb +0 -8
  114. data/vendor/jquery_rails/lib/jquery-rails.rb +0 -1
  115. data/vendor/jquery_rails/test/assert_select_jquery_test.rb +0 -85
  116. data/vendor/jquery_rails/test/test_helper.rb +0 -6
  117. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.js +0 -11008
  118. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.js +0 -5
  119. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.map +0 -1
  120. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.js +0 -9814
  121. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.js +0 -4
  122. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.map +0 -1
  123. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.js +0 -10364
  124. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.js +0 -2
  125. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.map +0 -1
  126. data/vendor/jquery_rails/vendor/assets/javascripts/jquery_ujs.js +0 -555
  127. /data/{init → config}/early/init_execjs.rb +0 -0
@@ -1,49 +0,0 @@
1
- submitAfterTyping = null
2
-
3
- $(window).ready ->
4
- $('body').on 'show.bs.tab', 'a.load[data-toggle="tab"][data-url]', (e) ->
5
- tab_id = $(e.target).attr('href')
6
- url = $(e.target).data('url')
7
- $(e.target).removeClass('load')
8
- $.ajax
9
- url: url
10
- type: 'GET'
11
- success: (html) ->
12
- $(tab_id).append(html)
13
- decko.contentLoaded($(tab_id), $(this))
14
-
15
- $('body').on "input", "._submit-after-typing", (event) ->
16
- form = $(event.target).closest('form')
17
- form.slot().find(".autosubmit-success-notification").remove()
18
- clearTimeout(submitAfterTyping) if submitAfterTyping
19
- submitAfterTyping = setTimeout ->
20
- $(event.target).closest('form').submit()
21
- submitAfterTyping = null
22
- , 1000
23
-
24
- $('body').on "keydown", "._submit-after-typing", (event) ->
25
- if event.which == 13
26
- clearTimeout(submitAfterTyping) if submitAfterTyping
27
- submitAfterTyping = null
28
- $(event.target).closest('form').submit()
29
- false
30
-
31
- $('body').on "change", "._submit-on-change", (event) ->
32
- $(event.target).closest('form').submit()
33
- false
34
-
35
- $('body').on "change", "._edit-item", (event) ->
36
- cb = $(event.target)
37
- if cb.is(":checked")
38
- cb.attr("name", "add_item")
39
- else
40
- cb.attr("name", "drop_item")
41
-
42
- $(event.target).closest('form').submit()
43
- false
44
-
45
- $("body").on "click", "._popover_link", (event) ->
46
- event.preventDefault();
47
-
48
-
49
-
@@ -1,82 +0,0 @@
1
- $.extend decko,
2
- # returns absolute path (starting with a slash)
3
- # if rawPath is complete url, this returns the complete url
4
- # if rawPath is relative (no slash), this adds relative root
5
- path: (rawPath) ->
6
- if rawPath.match /^\/|:\/\//
7
- rawPath
8
- else
9
- decko.rootUrl + rawPath
10
-
11
- pingName: (name, success)->
12
- $.getJSON decko.path(''), format: 'json', view: 'status', 'card[name]': name, success
13
-
14
- jQuery.fn.extend {
15
- notify: (message, status) ->
16
- slot = @slot(status)
17
- notice = slot.find '.card-notice'
18
- unless notice[0]
19
- notice = $('<div class="card-notice"></div>')
20
- form = slot.find('.card-form')
21
- if form[0]
22
- $(form[0]).append notice
23
- else
24
- slot.append notice
25
- notice.html message
26
- notice.show 'blind'
27
-
28
- report: (message) ->
29
- report = @slot().find '.card-report'
30
- return false unless report[0]
31
- report.hide()
32
- report.html message
33
- report.show 'drop', 750
34
- setTimeout (->report.hide 'drop', 750), 3000
35
- }
36
-
37
- #~~~~~ ( EVENTS )
38
-
39
- $(window).ready ->
40
- $.ajaxSetup cache: false
41
-
42
- $('body').on 'click', '.submitter', ->
43
- $(this).closest('form').submit()
44
-
45
- $('body').on 'click', 'button.redirecter', ->
46
- window.location = $(this).attr('href')
47
-
48
- $('body').on 'mouseenter', '[hover_content]', ->
49
- $(this).attr 'hover_restore', $(this).html()
50
- $(this).html $(this).attr( 'hover_content' )
51
- $('body').on 'mouseleave', '[hover_content]', ->
52
- $(this).html $(this).attr( 'hover_restore' )
53
-
54
- $('body').on 'click', '.render-error-link', (event) ->
55
- msg = $(this).closest('.render-error').find '.render-error-message'
56
- msg.show()
57
- # msg.dialog()
58
- event.preventDefault()
59
-
60
- decko.slotReady (slot) ->
61
- slot.find('card-view-placeholder').each ->
62
- $place = $(this)
63
- return if $place.data("loading")
64
-
65
- $place.data "loading", true
66
- $.get $place.data("url"), (data, _status) ->
67
- $place.replaceWith data
68
-
69
- # important: this prevents jquery-mobile from taking over everything
70
- # $( document ).on "mobileinit", ->
71
- # $.extend $.mobile , {
72
- # #autoInitializePage: false
73
- # #ajaxEnabled: false
74
- # }
75
-
76
-
77
-
78
- warn = (stuff) -> console.log stuff if console?
79
-
80
-
81
-
82
-
@@ -1,30 +0,0 @@
1
- doubleClickActiveMap = { off: false, on: true, signed_in: decko.currentUserId }
2
-
3
- doubleClickActive = () ->
4
- doubleClickActiveMap[decko.doubleClick]
5
- # else alert "illegal configuration: " + decko.doubleClick
6
-
7
- doubleClickApplies = (el) ->
8
- return false if ['.nodblclick', '.d0-card-header', '.card-editor'].some (klass) ->
9
- el.closest(klass)[0]
10
- # double click inactive inside header, editor, or tag with "nodblclick" class
11
- !el.slot().find('.card-editor')[0]?
12
-
13
-
14
- triggerDoubleClickEditingOn = (el)->
15
- slot = el.slot()
16
- edit_link = decko.slotEditLink(slot)
17
-
18
- if edit_link
19
- edit_link.click()
20
- else
21
- edit_view = decko.slotEditView(slot)
22
- url = decko.path("~#{slot.data('cardId')}?view=#{edit_view}")
23
- slot.reloadSlot url
24
-
25
- $(window).ready ->
26
- if doubleClickActive()
27
- $('body').on 'dblclick', 'div', (_event) ->
28
- if doubleClickApplies $(this)
29
- triggerDoubleClickEditingOn $(this)
30
- false # don't propagate up to next slot
@@ -1,57 +0,0 @@
1
- $.extend decko,
2
- initializeEditors: (range, map) ->
3
- map = decko.editorInitFunctionMap unless map?
4
- $.each map, (selector, fn) ->
5
- $.each range.find(selector), ->
6
- fn.call $(this)
7
-
8
- editorContentFunctionMap: {}
9
-
10
- editorInitFunctionMap:
11
- 'textarea': -> $(this).autosize()
12
- '.file-upload': -> decko.upload_file(this)
13
- '.etherpad-textarea': ->
14
- $(this).closest('form')
15
- .find('.edit-submit-button')
16
- .attr('class', 'etherpad-submit-button')
17
-
18
- addEditor: (selector, init, get_content) ->
19
- decko.editorContentFunctionMap[selector] = get_content
20
- decko.editorInitFunctionMap[selector] = init
21
-
22
- jQuery.fn.extend
23
- setContentFieldsFromMap: (map) ->
24
- map = decko.editorContentFunctionMap unless map?
25
- this_form = $(this)
26
- $.each map, (selector, fn) ->
27
- this_form.setContentFields(selector, fn)
28
- setContentFields: (selector, fn) ->
29
- $.each @find(selector), ->
30
- $(this).setContentField(fn)
31
- contentField: ->
32
- @closest('.card-editor').find '.d0-card-content'
33
- setContentField: (fn) ->
34
- field = @contentField()
35
- init_val = field.val() # tinymce-jquery overrides val();
36
- # that's why we're not using it.
37
- new_val = fn.call this
38
- field.val new_val
39
- field.change() if init_val != new_val
40
-
41
- $(window).ready ->
42
- # decko.initializeEditors $('body > :not(.modal)')
43
- setTimeout (-> decko.initializeEditors $('body > :not(.modal)')), 10
44
- # dislike the timeout, but without this forms with multiple TinyMCE editors
45
- # were failing to load properly
46
- # I couldn't reproduce that problem described above -pk
47
-
48
- $('body').on 'submit', '.card-form', ->
49
- $(this).setContentFieldsFromMap()
50
- $(this).find('.d0-card-content').attr('no-autosave','true')
51
- true
52
-
53
- setInterval (-> $('.card-form').setContentFieldsFromMap()), 20000
54
-
55
-
56
-
57
-
@@ -1,183 +0,0 @@
1
- # filter object that manages dynamic sorting and filtering
2
-
3
- # el can be any element inside widget
4
- decko.filter = (el) ->
5
- closest_widget = $(el).closest "._filter-widget"
6
- @widget =
7
- if closest_widget.length
8
- closest_widget
9
- else
10
- $(el).closest("._filtered-content").find "._filter-widget"
11
-
12
-
13
- # the filter form includes the below
14
- @form = @widget.find "._filter-form"
15
-
16
- # one-click filter links
17
- @quickFilter = @widget.find "._quick-filter"
18
-
19
- # include filters field, more-fields dropdown, and reset button
20
- @activeContainer = @widget.find "._filter-container"
21
-
22
- # the "More Filters" Dropdown
23
- @dropdown = @widget.find "._add-filter-dropdown"
24
- @dropdownItems = @widget.find "._filter-category-select"
25
-
26
- @showWithStatus = (status) ->
27
- f = this
28
- $.each (@dropdownItems), ->
29
- item = $(this)
30
- if item.data status
31
- f.activate item.data("category")
32
-
33
- @reset = () ->
34
- @restrict @form.find("._reset-filter").data("reset")
35
-
36
- @clear = () ->
37
- @dropdownItems.show()
38
- @activeContainer.find(".input-group").remove()
39
-
40
- @activate = (category, value) ->
41
- @activateField category, value
42
- @hideOption category
43
-
44
- @showOption = (category) ->
45
- @dropdown.show()
46
- @option(category).show()
47
-
48
- @hideOption = (category) ->
49
- @option(category).hide()
50
- @dropdown.hide() if @dropdownItems.length <= @activeFields().length
51
-
52
- @activeFields = () ->
53
- @activeContainer.find "._filter-input"
54
-
55
- @option = (category) ->
56
- @dropdownItems.filter("[data-category='#{category}']")
57
-
58
- @findPrototype = (category) ->
59
- @widget.find "._filter-input-field-prototypes ._filter-input-#{category}"
60
-
61
- @activateField = (category, value) ->
62
- field = @findPrototype(category).clone()
63
- @fieldValue field, value
64
- @dropdown.before field
65
- @initField field
66
- field.find("input, select").first().focus()
67
-
68
- @fieldValue = (field, value) ->
69
- if typeof(value) == "object" && !Array.isArray(value)
70
- @compoundFieldValue field, value
71
- else
72
- @simpleFieldValue field, value
73
-
74
- @simpleFieldValue = (field, value) ->
75
- input = field.find("input, select")
76
- input.val value if (typeof value != 'undefined')
77
-
78
- @compoundFieldValue = (field, vals) ->
79
- for key of vals
80
- input = field.find "#filter_value_" + key
81
- input.val vals[key]
82
-
83
- @removeField = (category)->
84
- @activeField(category).remove()
85
- @showOption category
86
-
87
- @initField = (field) ->
88
- @initSelectField field
89
- decko.initAutoCardPlete field.find("input")
90
- # only has effect if there is a data-options-card value
91
-
92
- @initSelectField = (field) ->
93
- field.find("select").select2
94
- containerCssClass: ":all:"
95
- width: "auto"
96
- dropdownAutoWidth: "true"
97
-
98
- @activeField = (category) ->
99
- @activeContainer.find("._filter-input-#{category}")
100
-
101
- @isActive = (category) ->
102
- @activeField(category).length
103
-
104
- # clear filter and use restrictions in data
105
- @restrict = (data) ->
106
- @clear()
107
- for key of data
108
- @activateField key, data[key]
109
- @update()
110
-
111
- @addRestrictions = (hash) ->
112
- for category of hash
113
- @removeField category
114
- @activate category, hash[category]
115
- @update()
116
-
117
- @removeRestrictions = (hash) ->
118
- for category of hash
119
- @removeField category
120
- @update()
121
-
122
- # triggers update
123
- @setInputVal = (field, value) ->
124
- select = field.find "select"
125
- if select.length
126
- @setSelect2Val select, value
127
- else
128
- @setTextInputVal field.find("input"), value
129
-
130
- # this triggers change, which updates form
131
- # if we just use simple "val", the display doesn't update correctly
132
- @setSelect2Val = (select, value) ->
133
- value = [value] if select.attr("multiple") && !Array.isArray(value)
134
- select.select2 "val", value
135
-
136
- @setTextInputVal = (input, value) ->
137
- input.val value
138
- @update()
139
-
140
- @updateLastVals = ()->
141
- @activeFields().find("input, select").each ()->
142
- $(this).data "lastVal", $(this).val()
143
-
144
- @updateUrlBar = () ->
145
- return if @widget.closest('._noFilterUrlUpdates')[0]
146
- window.history.pushState "filter", "filter", '?' + @form.serialize()
147
-
148
- @update = ()->
149
- @updateLastVals()
150
- @updateQuickLinks()
151
- @form.submit()
152
- @updateUrlBar()
153
-
154
- @updateQuickLinks = ()->
155
- widget = this
156
- links = @quickFilter.find "._filter-link"
157
- links.addClass "active"
158
- links.each ->
159
- link = $(this)
160
- opts = link.data "filter"
161
- for key of opts
162
- widget.deactivateQuickLink link, key, opts[key]
163
-
164
- @deactivateQuickLink = (link, key, value) ->
165
- sel = "._filter-input-#{key}"
166
- $.map [@form.find("#{sel} input, #{sel} select").val()], (arr) ->
167
- arr = [arr].flat()
168
- link.removeClass "active" if $.inArray(value, arr) > -1
169
-
170
- @updateIfChanged = ()->
171
- @update() if @changedSinceLastVal()
172
-
173
- @updateIfPresent = (category)->
174
- val = @activeField(category).find("input, select").val()
175
- @update() if val && val.length > 0
176
-
177
- @changedSinceLastVal = () ->
178
- changed = false
179
- @activeFields().find("input, select").each ()->
180
- changed = true if $(this).val() != $(this).data("lastVal")
181
- changed
182
-
183
- this
@@ -1,128 +0,0 @@
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()
@@ -1,81 +0,0 @@
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
-
@@ -1,22 +0,0 @@
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