para 0.8.3.1 → 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- 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/controllers/para/admin/search_controller.rb +11 -1
- data/app/helpers/para/tag_helper.rb +3 -1
- data/app/views/para/admin/resources/_tree.html.haml +4 -0
- 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/lib/generators/para/install/templates/initializer.rb +9 -1
- data/lib/para/attribute_field/relation.rb +14 -3
- data/lib/para/config.rb +3 -0
- data/lib/para/form_builder/containers.rb +3 -1
- data/lib/para/inputs/nested_many_input.rb +7 -2
- data/lib/para/markup/resources_buttons.rb +6 -2
- data/lib/para/markup/resources_table.rb +3 -3
- 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 +8 -6
- 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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valentin Ballestrino
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -168,14 +168,14 @@ dependencies:
|
|
168
168
|
requirements:
|
169
169
|
- - "~>"
|
170
170
|
- !ruby/object:Gem::Version
|
171
|
-
version: '
|
171
|
+
version: '3.0'
|
172
172
|
type: :runtime
|
173
173
|
prerelease: false
|
174
174
|
version_requirements: !ruby/object:Gem::Requirement
|
175
175
|
requirements:
|
176
176
|
- - "~>"
|
177
177
|
- !ruby/object:Gem::Version
|
178
|
-
version: '
|
178
|
+
version: '3.0'
|
179
179
|
- !ruby/object:Gem::Dependency
|
180
180
|
name: kaminari
|
181
181
|
requirement: !ruby/object:Gem::Requirement
|
@@ -822,11 +822,12 @@ files:
|
|
822
822
|
- lib/rails/relation_length_validator.rb
|
823
823
|
- lib/rails/routing_mapper.rb
|
824
824
|
- lib/tasks/para_tasks.rake
|
825
|
-
- vendor/assets/javascripts/
|
825
|
+
- vendor/assets/javascripts/Sortable.js
|
826
826
|
- vendor/assets/javascripts/jasny-bootstrap.js
|
827
827
|
- vendor/assets/javascripts/jquery.iframe-transport.js
|
828
828
|
- vendor/assets/javascripts/jquery.remote-modal-form.coffee
|
829
829
|
- vendor/assets/javascripts/jquery.scrollto.js
|
830
|
+
- vendor/assets/javascripts/jquery.sortable.js
|
830
831
|
- vendor/assets/stylesheets/animate.css
|
831
832
|
- vendor/assets/stylesheets/hint.css
|
832
833
|
- vendor/assets/stylesheets/jasny-bootstrap.css
|
@@ -849,7 +850,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
849
850
|
- !ruby/object:Gem::Version
|
850
851
|
version: '0'
|
851
852
|
requirements: []
|
852
|
-
|
853
|
+
rubyforge_project:
|
854
|
+
rubygems_version: 2.6.11
|
853
855
|
signing_key:
|
854
856
|
specification_version: 4
|
855
857
|
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);
|