effective_ckeditor 1.4.0 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 634f6c4a4c54685130e76c8a6cf45de59cd7970f
|
4
|
+
data.tar.gz: 09a062e6c4cded2883bbcf0b3f7732c829db8b03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 816ddb4a2b57a75aafcc523446c0e44338af7d2850c662a2611f3323626875114937eb6ab666292e0312396f1f7f26932545156d42129e2fe48f0be5e114f2f5
|
7
|
+
data.tar.gz: a3a749cddf4e0b48005fc42efcb490a61c04b99befb60c124af063e78732148d51130dda9a7dd66403f0bb043b0096727df1f36f2e90c32dd8f9791b29fb5ee2
|
@@ -35,6 +35,7 @@
|
|
35
35
|
@menu.on 'click', 'li.dropdown.open,.dropdown-menu > li.dropdown,li:not(.dropdown)', (event) =>
|
36
36
|
event.stopPropagation()
|
37
37
|
@menu.find('.open').removeClass('open')
|
38
|
+
@menu.data('dirty', true)
|
38
39
|
# Open the CKEDITOR dialog and pass the source effective_menu_item $('li') to the dialog
|
39
40
|
CKEDITOR.instances[Object.keys(CKEDITOR.instances)[0]].openDialog 'effectiveMenusDialog', (dialog) ->
|
40
41
|
dialog.effective_menu_item = $(event.currentTarget)
|
@@ -51,6 +52,7 @@
|
|
51
52
|
item = $(@menu.data('effective-menu-new-html').replace(/:new/g, "#{unique_id}"))
|
52
53
|
|
53
54
|
@menu.children('.actions').before(item)
|
55
|
+
@menu.data('dirty', true)
|
54
56
|
|
55
57
|
CKEDITOR.instances[Object.keys(CKEDITOR.instances)[0]].openDialog 'effectiveMenusDialog', (dialog) ->
|
56
58
|
dialog.effective_menu_item = item
|
@@ -165,6 +167,8 @@
|
|
165
167
|
# so we delete it here
|
166
168
|
@menu.find('meta,li.effective-menu-expand').remove()
|
167
169
|
|
170
|
+
@menu.data('dirty', true)
|
171
|
+
|
168
172
|
# Collapse any empty dropdowns we may have expanded back to leafs
|
169
173
|
@menu.find('.dropdown-menu:empty').each (index, item) ->
|
170
174
|
item = $(item).closest('.dropdown')
|
@@ -192,14 +196,7 @@
|
|
192
196
|
# The first dropdowns all have Depth of 1
|
193
197
|
depthOf: (item) -> item.parentsUntil(@menu, 'li').length
|
194
198
|
|
195
|
-
|
196
|
-
# Rails seems to disregard new items set to the new Date.now() values anyhow
|
197
|
-
# Put all deleted items after the .actions div just to be tidy
|
198
|
-
markDestroyed: (item) ->
|
199
|
-
item.hide().addClass('destroyed')
|
200
|
-
item.find('li').addClass('destroyed')
|
201
|
-
item.find("input[name$='[_destroy]']").val(1)
|
202
|
-
@menu.children('.actions').after(item.remove())
|
199
|
+
markDestroyed: (item) -> item.remove()
|
203
200
|
|
204
201
|
# This method is called with a Hash value
|
205
202
|
# that is called by reference from the parent function
|
@@ -209,6 +206,8 @@
|
|
209
206
|
# This way the saves happen all at once
|
210
207
|
|
211
208
|
serialize: (retval) ->
|
209
|
+
return if @menu.data('dirty') != true
|
210
|
+
|
212
211
|
# console.log "============ BEFORE =============="
|
213
212
|
# @menu.find('li').each (index, item) =>
|
214
213
|
# item = $(item)
|
@@ -246,16 +245,15 @@
|
|
246
245
|
# This retVal has to account for multiple effective-menus on one page
|
247
246
|
retval[@menu.data('effective-menu-id')] = items
|
248
247
|
|
249
|
-
saveComplete: ->
|
250
|
-
@menu.find('.destroyed').remove()
|
248
|
+
saveComplete: (data) -> @menu.data('dirty', false)
|
251
249
|
|
252
250
|
assignLftRgt: (parent, lft) ->
|
253
251
|
rgt = lft + 1
|
254
252
|
|
255
|
-
parent.children('.dropdown-menu').children('li
|
253
|
+
parent.children('.dropdown-menu').children('li').each (_, child) =>
|
256
254
|
rgt = @assignLftRgt($(child), rgt)
|
257
255
|
|
258
|
-
parent.children('li
|
256
|
+
parent.children('li').each (_, child) =>
|
259
257
|
rgt = @assignLftRgt($(child), rgt)
|
260
258
|
|
261
259
|
parent.children('.menu-item').children("input[name$='[lft]']").val(lft)
|
@@ -55,10 +55,10 @@ SaveAll = {
|
|
55
55
|
dataType: 'json'
|
56
56
|
data: { effective_regions: regionData, effective_menus: menuData }
|
57
57
|
async: false
|
58
|
-
complete: (
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
complete: (response) ->
|
59
|
+
data = response['responseJSON'] || {}
|
60
|
+
$('.effective-menu').effectiveMenuEditor('saveComplete', data['effective_menus'])
|
61
|
+
location.reload(true) if data['refresh'] == true
|
62
62
|
}
|
63
63
|
|
64
64
|
Exit = {
|