para 0.8.5 → 0.8.11
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 +5 -5
- data/app/assets/javascripts/para/admin.coffee +2 -1
- data/app/assets/javascripts/para/admin/table.coffee +3 -5
- data/app/assets/javascripts/para/admin/tree.coffee +68 -16
- data/app/assets/javascripts/para/inputs/multi-select-input.coffee +2 -3
- data/app/assets/javascripts/para/inputs/nested_many.coffee +10 -6
- data/app/assets/stylesheets/para/admin/src/_list.sass +7 -3
- data/app/helpers/para/admin/nested_inputs_helper.rb +17 -0
- data/app/helpers/para/admin/page_helper.rb +30 -3
- data/app/models/application_record.rb +3 -0
- data/app/models/para/application_record.rb +20 -0
- data/app/models/para/cache/item.rb +1 -1
- data/app/models/para/component/base.rb +16 -2
- data/app/models/para/component_resource.rb +1 -1
- data/app/models/para/component_section.rb +1 -1
- data/app/models/para/library/file.rb +1 -1
- data/app/models/para/page/section.rb +3 -10
- data/app/models/para/page/section_resource.rb +1 -1
- data/app/views/para/admin/resources/_navigation.html.haml +10 -0
- data/app/views/para/admin/resources/_tree.html.haml +4 -0
- data/app/views/para/admin/shared/_navigation.html.haml +1 -1
- data/app/views/para/inputs/_nested_many.html.haml +3 -3
- data/app/views/para/inputs/nested_many/_add.html.haml +1 -1
- data/app/views/para/inputs/nested_many/_add_with_subclasses.html.haml +1 -1
- data/app/views/para/inputs/nested_many/_container.html.haml +1 -1
- data/app/views/para/inputs/nested_one/_add_with_subclasses.html.haml +1 -1
- data/db/migrate/20201210152223_add_parent_component_to_para_components.rb +6 -0
- data/lib/generators/para/install/templates/initializer.rb +9 -1
- data/lib/para/components_configuration.rb +64 -13
- data/lib/para/config.rb +3 -0
- data/lib/para/inputs/nested_many_input.rb +7 -2
- data/lib/para/job/base.rb +2 -2
- data/lib/para/version.rb +1 -1
- data/vendor/assets/javascripts/Sortable.js +4144 -0
- data/vendor/assets/javascripts/jquery.sortable.js +76 -0
- metadata +9 -5
- data/vendor/assets/javascripts/html5-sortable.js +0 -142
@@ -0,0 +1,76 @@
|
|
1
|
+
(function (factory) {
|
2
|
+
"use strict";
|
3
|
+
var sortable,
|
4
|
+
jq,
|
5
|
+
_this = this
|
6
|
+
;
|
7
|
+
|
8
|
+
if (typeof define === "function" && define.amd) {
|
9
|
+
try {
|
10
|
+
define(["sortablejs", "jquery"], function(Sortable, $) {
|
11
|
+
sortable = Sortable;
|
12
|
+
jq = $;
|
13
|
+
checkErrors();
|
14
|
+
factory(Sortable, $);
|
15
|
+
});
|
16
|
+
} catch(err) {
|
17
|
+
checkErrors();
|
18
|
+
}
|
19
|
+
return;
|
20
|
+
} else if (typeof exports === 'object') {
|
21
|
+
try {
|
22
|
+
sortable = require('sortablejs');
|
23
|
+
jq = require('jquery');
|
24
|
+
} catch(err) { }
|
25
|
+
}
|
26
|
+
|
27
|
+
if (typeof jQuery === 'function' || typeof $ === 'function') {
|
28
|
+
jq = jQuery || $;
|
29
|
+
}
|
30
|
+
|
31
|
+
if (typeof Sortable !== 'undefined') {
|
32
|
+
sortable = Sortable;
|
33
|
+
}
|
34
|
+
|
35
|
+
function checkErrors() {
|
36
|
+
if (!jq) {
|
37
|
+
throw new Error('jQuery is required for jquery-sortablejs');
|
38
|
+
}
|
39
|
+
|
40
|
+
if (!sortable) {
|
41
|
+
throw new Error('SortableJS is required for jquery-sortablejs (https://github.com/SortableJS/Sortable)');
|
42
|
+
}
|
43
|
+
}
|
44
|
+
checkErrors();
|
45
|
+
factory(sortable, jq);
|
46
|
+
})(function (Sortable, $) {
|
47
|
+
"use strict";
|
48
|
+
|
49
|
+
$.fn.sortable = function (options) {
|
50
|
+
var retVal,
|
51
|
+
args = arguments;
|
52
|
+
|
53
|
+
this.each(function () {
|
54
|
+
var $el = $(this),
|
55
|
+
sortable = $el.data('sortable');
|
56
|
+
|
57
|
+
if (!sortable && (options instanceof Object || !options)) {
|
58
|
+
sortable = new Sortable(this, options);
|
59
|
+
$el.data('sortable', sortable);
|
60
|
+
} else if (sortable) {
|
61
|
+
if (options === 'destroy') {
|
62
|
+
sortable.destroy();
|
63
|
+
$el.removeData('sortable');
|
64
|
+
} else if (options === 'widget') {
|
65
|
+
retVal = sortable;
|
66
|
+
} else if (typeof sortable[options] === 'function') {
|
67
|
+
retVal = sortable[options].apply(sortable, [].slice.call(args, 1));
|
68
|
+
} else if (options in sortable.options) {
|
69
|
+
retVal = sortable.option.apply(sortable, args);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
});
|
73
|
+
|
74
|
+
return (retVal === void 0) ? this : retVal;
|
75
|
+
};
|
76
|
+
});
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: para
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valentin Ballestrino
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -577,6 +577,7 @@ files:
|
|
577
577
|
- app/helpers/para/admin/components_helper.rb
|
578
578
|
- app/helpers/para/admin/decorators_helper.rb
|
579
579
|
- app/helpers/para/admin/history_helper.rb
|
580
|
+
- app/helpers/para/admin/nested_inputs_helper.rb
|
580
581
|
- app/helpers/para/admin/page_helper.rb
|
581
582
|
- app/helpers/para/admin/pagination_helper.rb
|
582
583
|
- app/helpers/para/admin/resources_helper.rb
|
@@ -594,6 +595,7 @@ files:
|
|
594
595
|
- app/helpers/para/tree_helper.rb
|
595
596
|
- app/models/application_record.rb
|
596
597
|
- app/models/para/ability.rb
|
598
|
+
- app/models/para/application_record.rb
|
597
599
|
- app/models/para/cache/item.rb
|
598
600
|
- app/models/para/component/base.rb
|
599
601
|
- app/models/para/component/crud.rb
|
@@ -628,6 +630,7 @@ files:
|
|
628
630
|
- app/views/para/admin/resources/_form.html.haml
|
629
631
|
- app/views/para/admin/resources/_imports_menu.html.haml
|
630
632
|
- app/views/para/admin/resources/_list.html.haml
|
633
|
+
- app/views/para/admin/resources/_navigation.html.haml
|
631
634
|
- app/views/para/admin/resources/_per_page_select.html.haml
|
632
635
|
- app/views/para/admin/resources/_remote_nested_form.html.haml
|
633
636
|
- app/views/para/admin/resources/_subclassable_add_button.html.haml
|
@@ -669,6 +672,7 @@ files:
|
|
669
672
|
- db/migrate/20160905134106_create_para_library_files.rb
|
670
673
|
- db/migrate/20161006105728_create_para_cache_items.rb
|
671
674
|
- db/migrate/20170324125547_create_para_page_section_resources.rb
|
675
|
+
- db/migrate/20201210152223_add_parent_component_to_para_components.rb
|
672
676
|
- lib/generators/para/admin_user/admin_user_generator.rb
|
673
677
|
- lib/generators/para/component/component_generator.rb
|
674
678
|
- lib/generators/para/component/crud/crud_generator.rb
|
@@ -822,11 +826,12 @@ files:
|
|
822
826
|
- lib/rails/relation_length_validator.rb
|
823
827
|
- lib/rails/routing_mapper.rb
|
824
828
|
- lib/tasks/para_tasks.rake
|
825
|
-
- vendor/assets/javascripts/
|
829
|
+
- vendor/assets/javascripts/Sortable.js
|
826
830
|
- vendor/assets/javascripts/jasny-bootstrap.js
|
827
831
|
- vendor/assets/javascripts/jquery.iframe-transport.js
|
828
832
|
- vendor/assets/javascripts/jquery.remote-modal-form.coffee
|
829
833
|
- vendor/assets/javascripts/jquery.scrollto.js
|
834
|
+
- vendor/assets/javascripts/jquery.sortable.js
|
830
835
|
- vendor/assets/stylesheets/animate.css
|
831
836
|
- vendor/assets/stylesheets/hint.css
|
832
837
|
- vendor/assets/stylesheets/jasny-bootstrap.css
|
@@ -849,8 +854,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
849
854
|
- !ruby/object:Gem::Version
|
850
855
|
version: '0'
|
851
856
|
requirements: []
|
852
|
-
|
853
|
-
rubygems_version: 2.6.11
|
857
|
+
rubygems_version: 3.1.4
|
854
858
|
signing_key:
|
855
859
|
specification_version: 4
|
856
860
|
summary: Rails admin engine
|
@@ -1,142 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* HTML5 Sortable jQuery Plugin
|
3
|
-
* https://github.com/voidberg/html5sortable
|
4
|
-
*
|
5
|
-
* Original code copyright 2012 Ali Farhadi.
|
6
|
-
* This version is mantained by Alexandru Badiu <andu@ctrlz.ro>
|
7
|
-
*
|
8
|
-
* Thanks to the following contributors: andyburke, bistoco, daemianmack, drskullster, flying-sheep, OscarGodson, Parikshit N. Samant, rodolfospalenza, ssafejava
|
9
|
-
*
|
10
|
-
* Released under the MIT license.
|
11
|
-
*/
|
12
|
-
'use strict';
|
13
|
-
|
14
|
-
(function ($) {
|
15
|
-
var dragging, draggingHeight, placeholders = $();
|
16
|
-
$.fn.sortable = function (options) {
|
17
|
-
var method = String(options);
|
18
|
-
|
19
|
-
options = $.extend({
|
20
|
-
connectWith: false,
|
21
|
-
placeholder: null,
|
22
|
-
dragImage: null
|
23
|
-
}, options);
|
24
|
-
|
25
|
-
return this.each(function () {
|
26
|
-
|
27
|
-
var index, items = $(this).children(options.items), handles = options.handle ? items.find(options.handle) : items;
|
28
|
-
|
29
|
-
if (method === 'reload') {
|
30
|
-
$(this).children(options.items).off('dragstart.h5s dragend.h5s selectstart.h5s dragover.h5s dragenter.h5s drop.h5s');
|
31
|
-
}
|
32
|
-
if (/^enable|disable|destroy$/.test(method)) {
|
33
|
-
var citems = $(this).children($(this).data('items')).attr('draggable', method === 'enable');
|
34
|
-
if (method === 'destroy') {
|
35
|
-
$(this).off('sortupdate');
|
36
|
-
$(this).removeData('opts');
|
37
|
-
citems.add(this).removeData('connectWith items')
|
38
|
-
.off('dragstart.h5s dragend.h5s dragover.h5s dragenter.h5s drop.h5s').off('sortupdate');
|
39
|
-
handles.off('selectstart.h5s');
|
40
|
-
}
|
41
|
-
return;
|
42
|
-
}
|
43
|
-
|
44
|
-
var soptions = $(this).data('opts');
|
45
|
-
|
46
|
-
if (typeof soptions === 'undefined') {
|
47
|
-
$(this).data('opts', options);
|
48
|
-
}
|
49
|
-
else {
|
50
|
-
options = soptions;
|
51
|
-
}
|
52
|
-
|
53
|
-
var startParent, newParent;
|
54
|
-
var placeholder = ( options.placeholder === null ) ? $('<' + (/^ul|ol$/i.test(this.tagName) ? 'li' : 'div') + ' class="sortable-placeholder"/>') : $(options.placeholder).addClass('sortable-placeholder');
|
55
|
-
|
56
|
-
$(this).data('items', options.items);
|
57
|
-
placeholders = placeholders.add(placeholder);
|
58
|
-
if (options.connectWith) {
|
59
|
-
$(options.connectWith).add(this).data('connectWith', options.connectWith);
|
60
|
-
}
|
61
|
-
|
62
|
-
items.attr('role', 'option');
|
63
|
-
items.attr('aria-grabbed', 'false');
|
64
|
-
|
65
|
-
// Setup drag handles
|
66
|
-
handles.attr('draggable', 'true').not('a[href], img').on('selectstart.h5s', function() {
|
67
|
-
if (this.dragDrop) {
|
68
|
-
this.dragDrop();
|
69
|
-
}
|
70
|
-
return false;
|
71
|
-
}).end();
|
72
|
-
|
73
|
-
// Handle drag events on draggable items
|
74
|
-
items.on('dragstart.h5s', function(e) {
|
75
|
-
e.stopPropagation();
|
76
|
-
|
77
|
-
var dt = e.originalEvent.dataTransfer;
|
78
|
-
dt.effectAllowed = 'move';
|
79
|
-
dt.setData('text', '');
|
80
|
-
|
81
|
-
if (options.dragImage && dt.setDragImage) {
|
82
|
-
dt.setDragImage(options.dragImage, 0, 0);
|
83
|
-
}
|
84
|
-
|
85
|
-
index = (dragging = $(this)).addClass('sortable-dragging').attr('aria-grabbed', 'true').index();
|
86
|
-
draggingHeight = dragging.outerHeight();
|
87
|
-
startParent = $(this).parent();
|
88
|
-
dragging.parent().triggerHandler('sortstart', {item: dragging, startparent: startParent});
|
89
|
-
}).on('dragend.h5s',function () {
|
90
|
-
if (!dragging) {
|
91
|
-
return;
|
92
|
-
}
|
93
|
-
dragging.removeClass('sortable-dragging').attr('aria-grabbed', 'false').show();
|
94
|
-
placeholders.detach();
|
95
|
-
newParent = $(this).parent();
|
96
|
-
if (index !== dragging.index() || startParent.get(0) !== newParent.get(0)) {
|
97
|
-
dragging.parent().triggerHandler('sortupdate', {item: dragging, oldindex: index, startparent: startParent, endparent: newParent});
|
98
|
-
}
|
99
|
-
dragging = null;
|
100
|
-
draggingHeight = null;
|
101
|
-
}).add([this, placeholder]).on('dragover.h5s dragenter.h5s drop.h5s', function(e) {
|
102
|
-
if (!items.is(dragging) && options.connectWith !== $(dragging).parent().data('connectWith')) {
|
103
|
-
return true;
|
104
|
-
}
|
105
|
-
if (e.type === 'drop') {
|
106
|
-
e.stopPropagation();
|
107
|
-
placeholders.filter(':visible').after(dragging);
|
108
|
-
dragging.trigger('dragend.h5s');
|
109
|
-
return false;
|
110
|
-
}
|
111
|
-
e.preventDefault();
|
112
|
-
e.originalEvent.dataTransfer.dropEffect = 'move';
|
113
|
-
if (items.is(this)) {
|
114
|
-
var thisHeight = $(this).outerHeight();
|
115
|
-
if (options.forcePlaceholderSize) {
|
116
|
-
placeholder.height(draggingHeight);
|
117
|
-
}
|
118
|
-
|
119
|
-
// Check if $(this) is bigger than the draggable. If it is, we have to define a dead zone to prevent flickering
|
120
|
-
if (thisHeight > draggingHeight) {
|
121
|
-
// Dead zone?
|
122
|
-
var deadZone = thisHeight - draggingHeight, offsetTop = $(this).offset().top;
|
123
|
-
if (placeholder.index() < $(this).index() && e.originalEvent.pageY < offsetTop + deadZone) {
|
124
|
-
return false;
|
125
|
-
}
|
126
|
-
else if (placeholder.index() > $(this).index() && e.originalEvent.pageY > offsetTop + thisHeight - deadZone) {
|
127
|
-
return false;
|
128
|
-
}
|
129
|
-
}
|
130
|
-
|
131
|
-
dragging.hide();
|
132
|
-
$(this)[placeholder.index() < $(this).index() ? 'after' : 'before'](placeholder);
|
133
|
-
placeholders.not(placeholder).detach();
|
134
|
-
} else if (!placeholders.is(this) && !$(this).children(options.items).length) {
|
135
|
-
placeholders.detach();
|
136
|
-
$(this).append(placeholder);
|
137
|
-
}
|
138
|
-
return false;
|
139
|
-
});
|
140
|
-
});
|
141
|
-
};
|
142
|
-
})(jQuery);
|