scrivito_table_widget 0.5.7.rc2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/app/assets/javascripts/scrivito_table_widget/jquery.edit.table.js +55 -50
- data/app/assets/javascripts/scrivito_table_widget/tableEditor.js +19 -30
- data/app/assets/stylesheets/scrivito_table_widget/editing.css +6 -2
- data/app/assets/stylesheets/scrivito_table_widget.css +2 -1
- data/app/views/table_widget/show.html.erb +3 -13
- data/lib/scrivito_table_widget/version.rb +1 -1
- metadata +4 -34
- data/app/assets/stylesheets/scrivito_table_widget/styles.css +0 -5
- data/scrivito/migrate/0_create_table_widget.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad1b6d8a8f9b3da895b9b3fba02b394e580aa5d0
|
4
|
+
data.tar.gz: 852d9095b40fdb8312ba7bb48d7f7ee69c8aeec1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73e719e5a1c8fc49e7ee29b553b2eab09163a2c06dc65f56b862455d8b6faedcc93f7bd35b72652a4160292c7b67e5bdb4af44ae6e5994ac1da7cdedd47964ee
|
7
|
+
data.tar.gz: 7a287d771ebee0272453b886a5b133dd22347db12b4d381e636a16ff1a773a137ab99cacc54e90d86680e2dd446e3e791e77a6a282200030b4a35ebaffe7279e
|
data/README.md
CHANGED
@@ -15,3 +15,11 @@ Add this line to your editing JavaScript manifest:
|
|
15
15
|
Add this line to your application stylesheet manifest:
|
16
16
|
|
17
17
|
*= require scrivito_table_widget
|
18
|
+
|
19
|
+
You have to activate the table editor in your select editor JavaScript:
|
20
|
+
|
21
|
+
```js
|
22
|
+
scrivito.select_editor(function(element, editor) {
|
23
|
+
editor.use("table_editor");
|
24
|
+
});
|
25
|
+
```
|
@@ -9,11 +9,19 @@
|
|
9
9
|
var rows = 0;
|
10
10
|
var cols = 0;
|
11
11
|
|
12
|
-
$.fn.edittable = function(
|
12
|
+
$.fn.edittable = function(event) {
|
13
|
+
var elem = $(event.target);
|
14
|
+
|
15
|
+
// remove and save table if other instanze of table-widget is clicked
|
16
|
+
if(!elem.parents('table').is(activeTable)) {
|
17
|
+
$.fn.edittable.clear();
|
18
|
+
initialized = false;
|
19
|
+
}
|
20
|
+
|
13
21
|
// initialize
|
14
|
-
if(!initialized
|
15
|
-
activeTable =
|
16
|
-
cmsField =
|
22
|
+
if(!initialized) {
|
23
|
+
activeTable = elem.parents('table');
|
24
|
+
cmsField = $(event.target).parents('.scrivito-table-editor');
|
17
25
|
|
18
26
|
initialized = $.fn.edittable.initialize(cmsField, this);
|
19
27
|
rows = $.fn.edittable.getRowCount();
|
@@ -25,19 +33,14 @@
|
|
25
33
|
$.fn.edittable.bindKeys();
|
26
34
|
}
|
27
35
|
|
28
|
-
|
29
|
-
|
30
|
-
if($(this).get(0).tagName != "TD" && $(this).get(0).tagName != "TH") {
|
36
|
+
if($(elem).get(0).tagName != "TD" && $(elem).get(0).tagName != "TH") {
|
31
37
|
elem = elem.parents('td, th');
|
32
38
|
}
|
33
39
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
cmsField.attr('contenteditable', true);
|
39
|
-
$.fn.edittable.setButtonPositions();
|
40
|
-
}
|
40
|
+
activeElement = elem;
|
41
|
+
cmsField.attr('contenteditable', true);
|
42
|
+
if(activeElement) {
|
43
|
+
$.fn.edittable.setButtonPositions();
|
41
44
|
}
|
42
45
|
};
|
43
46
|
|
@@ -62,8 +65,8 @@
|
|
62
65
|
var width = activeElement.outerWidth();
|
63
66
|
var height = activeElement.outerHeight();
|
64
67
|
|
65
|
-
$('.table-buttons.top').css({ top: "-
|
66
|
-
$('.table-buttons.edit').css({ top: (base.top - 12), left: (base.left
|
68
|
+
$('.table-buttons.top').css({ top: "-12px", left: (base.left - 11), width: width + 23});
|
69
|
+
$('.table-buttons.edit').css({ top: (base.top - 12), left: (base.left + 6)});
|
67
70
|
$('.table-buttons.left').css({ top: (base.top - 12), left: -17, height: height + 24});
|
68
71
|
$('.table-buttons.bottom').css({ bottom: "-4px", left: (base.left + width/2 - 12)});
|
69
72
|
$('.table-buttons.right').css({ top: (base.top + height/2 - 11), right: -23});
|
@@ -106,8 +109,10 @@
|
|
106
109
|
}
|
107
110
|
|
108
111
|
$.fn.edittable.save = function() {
|
109
|
-
|
110
|
-
|
112
|
+
if(activeTable) {
|
113
|
+
var text = activeTable.get(0).outerHTML;
|
114
|
+
$(cmsField).scrivito('save', text);
|
115
|
+
}
|
111
116
|
}
|
112
117
|
|
113
118
|
/****
|
@@ -163,38 +168,38 @@
|
|
163
168
|
****/
|
164
169
|
|
165
170
|
$.fn.edittable.bindButtons = function() {
|
166
|
-
$(
|
167
|
-
$(
|
168
|
-
$(
|
169
|
-
$(
|
170
|
-
$(
|
171
|
-
$(
|
172
|
-
$(
|
173
|
-
$(
|
174
|
-
$(
|
175
|
-
$(
|
176
|
-
$(
|
177
|
-
$(
|
178
|
-
$(
|
179
|
-
$(
|
180
|
-
$(
|
181
|
-
$(
|
182
|
-
|
183
|
-
$(
|
184
|
-
$(
|
185
|
-
$(
|
186
|
-
$(
|
187
|
-
|
188
|
-
$(
|
189
|
-
$(
|
190
|
-
|
191
|
-
$(
|
192
|
-
$(
|
193
|
-
|
194
|
-
$(
|
195
|
-
$(
|
196
|
-
|
197
|
-
$(
|
171
|
+
$(cmsField).parent().find('.add-top').on('click', function() { $.fn.edittable.addTop(); });
|
172
|
+
$(cmsField).parent().find('.add-bottom').on('click', function() { $.fn.edittable.addBottom(); });
|
173
|
+
$(cmsField).parent().find('.add-left').on('click', function() { $.fn.edittable.addLeft(); });
|
174
|
+
$(cmsField).parent().find('.add-right').on('click', function() { $.fn.edittable.addRight(); });
|
175
|
+
$(cmsField).parent().find('.table-bold').on('click', function() { $.fn.edittable.bold(); });
|
176
|
+
$(cmsField).parent().find('.table-italic').on('click', function() { $.fn.edittable.italic(); });
|
177
|
+
$(cmsField).parent().find('.delete-row').on('click', function() { $.fn.edittable.removeRow(); });
|
178
|
+
$(cmsField).parent().find('.delete-column').on('click', function() { $.fn.edittable.removeColumn(); });
|
179
|
+
$(cmsField).parent().find('.stripe-table').on('click', function() { $.fn.edittable.tableStriped(); });
|
180
|
+
$(cmsField).parent().find('.condence-table').on('click', function() { $.fn.edittable.tableCondensed(); });
|
181
|
+
$(cmsField).parent().find('.hover-table').on('click', function() { $.fn.edittable.tableHover(); });
|
182
|
+
$(cmsField).parent().find('.border-table').on('click', function() { $.fn.edittable.tableBorder(); });
|
183
|
+
$(cmsField).parent().find('.first-column').on('click', function() { $.fn.edittable.firstColumn(); });
|
184
|
+
$(cmsField).parent().find('.table-left').on('click', function() { $.fn.edittable.tableLeft(); });
|
185
|
+
$(cmsField).parent().find('.table-center').on('click', function() { $.fn.edittable.tableCenter(); });
|
186
|
+
$(cmsField).parent().find('.table-right').on('click', function() { $.fn.edittable.tableRight(); });
|
187
|
+
|
188
|
+
$(cmsField).parent().find('.add-success').on('click', function() { $.fn.edittable.addSuccess(); });
|
189
|
+
$(cmsField).parent().find('.add-info').on('click', function() { $.fn.edittable.addInfo(); });
|
190
|
+
$(cmsField).parent().find('.add-warning').on('click', function() { $.fn.edittable.addWarning(); });
|
191
|
+
$(cmsField).parent().find('.add-danger').on('click', function() { $.fn.edittable.addDanger(); });
|
192
|
+
|
193
|
+
$(cmsField).parent().find('.edit-the-table').on('click', function() { $.fn.edittable.toggleTableOptions('.table-options.main'); });
|
194
|
+
$(cmsField).parent().find('.edit-the-cell').on('click', function() { $.fn.edittable.toggleTableOptions('.table-buttons.edit'); });
|
195
|
+
|
196
|
+
$(cmsField).parent().find('.add-left, .add-right').on('mouseover', function() { $.fn.edittable.addHoverVerticalAdd($(this)); });
|
197
|
+
$(cmsField).parent().find('.add-top, .add-bottom').on('mouseover', function() { $.fn.edittable.addHoverHorizontalAdd($(this)); });
|
198
|
+
|
199
|
+
$(cmsField).parent().find('.delete-column').on('mouseover', function() { $.fn.edittable.deleteHoverColumn($(this)); });
|
200
|
+
$(cmsField).parent().find('.delete-row').on('mouseover', function() { $.fn.edittable.deleteHoverRow($(this)); });
|
201
|
+
|
202
|
+
$(cmsField).parent().find('.add-left, .add-right, .add-top, .add-bottom, .delete-column, .delete-row').on('mouseout', function() { $.fn.edittable.resetHelperLine(); });
|
198
203
|
}
|
199
204
|
|
200
205
|
/****
|
@@ -1,39 +1,28 @@
|
|
1
1
|
(function($, App) {
|
2
2
|
'use strict';
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
},
|
13
|
-
|
14
|
-
blurFunction: function(cmsField) {
|
15
|
-
var response = $.fn.edittable.clear();
|
16
|
-
if(response != undefined) return $(response.cmsField).scrivito('save', response.text);
|
17
|
-
}
|
18
|
-
};
|
19
|
-
|
20
|
-
// Set click event
|
21
|
-
scrivito.on('load', function() {
|
22
|
-
return $('body').on('click', '.table-widget', function(event) {
|
23
|
-
if(scrivito.in_editable_view()) {
|
24
|
-
tableEditor.clickFunction($(event.target));
|
25
|
-
};
|
4
|
+
var table_editor = {
|
5
|
+
can_edit: function(element) {
|
6
|
+
return $(element).is('.scrivito-table-editor');
|
7
|
+
},
|
8
|
+
activate: function(element) {
|
9
|
+
$(element).on('click', function(event) {
|
10
|
+
$(element).edittable(event);
|
11
|
+
scrivito.editors.medium_editor.activate(element);
|
26
12
|
event.stopPropagation();
|
27
13
|
});
|
28
|
-
});
|
29
14
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
}
|
15
|
+
$('body').on('click', function(event) {
|
16
|
+
if(!$(event.target).parents('.table-buttons').length && !$(event.target).parents('.table-options').length) {
|
17
|
+
var response = $.fn.edittable.clear();
|
18
|
+
if(response != undefined) return $(response.cmsField).scrivito('save', response.text);
|
19
|
+
}
|
35
20
|
});
|
36
|
-
}
|
21
|
+
}
|
22
|
+
};
|
23
|
+
|
24
|
+
scrivito.on('content', function() {
|
25
|
+
return scrivito.define_editor('toggle_button_editor', table_editor);
|
37
26
|
});
|
38
27
|
|
39
|
-
})(jQuery, this);
|
28
|
+
})(jQuery, this);
|
@@ -25,11 +25,12 @@
|
|
25
25
|
}
|
26
26
|
|
27
27
|
.table-buttons.edit {
|
28
|
-
width:
|
28
|
+
width: auto;
|
29
|
+
z-index: 111113;
|
29
30
|
}
|
30
31
|
|
31
32
|
.table-options.main {
|
32
|
-
width:
|
33
|
+
width: auto;
|
33
34
|
}
|
34
35
|
|
35
36
|
.table-buttons.edit div.alert-gray,
|
@@ -70,6 +71,7 @@
|
|
70
71
|
|
71
72
|
.table-buttons.top {
|
72
73
|
height: 25px;
|
74
|
+
z-index: 111112;
|
73
75
|
}
|
74
76
|
|
75
77
|
.table-buttons.top .add-left {
|
@@ -84,6 +86,7 @@
|
|
84
86
|
|
85
87
|
.table-buttons.left {
|
86
88
|
width: 25px;
|
89
|
+
z-index: 111112;
|
87
90
|
}
|
88
91
|
|
89
92
|
.table-buttons.left .add-top {
|
@@ -107,6 +110,7 @@
|
|
107
110
|
.helper-line {
|
108
111
|
position: absolute;
|
109
112
|
display: none;
|
113
|
+
z-index: 100000;
|
110
114
|
}
|
111
115
|
|
112
116
|
.delete-marker td,
|
@@ -1,13 +1,3 @@
|
|
1
|
-
|
2
|
-
<%= scrivito_tag(:div, widget, :table,
|
3
|
-
|
4
|
-
<div class="alert alert-info">
|
5
|
-
There is no table present. Click this message to insert a new one.
|
6
|
-
</div>
|
7
|
-
</div>
|
8
|
-
<% end %>
|
9
|
-
<% else %>
|
10
|
-
<div class="table-widget">
|
11
|
-
<%= scrivito_tag(:div, widget, :table, data: {editor: 'table-editor'}, class: 'table-responsive')%>
|
12
|
-
</div>
|
13
|
-
<% end %>
|
1
|
+
<div class="table-widget">
|
2
|
+
<%= scrivito_tag(:div, widget, :table, class: 'table-responsive scrivito-table-editor') %>
|
3
|
+
</div>
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrivito_table_widget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scrivito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: scrivito
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,20 +38,6 @@ dependencies:
|
|
52
38
|
- - ">="
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
41
|
description: Scrivito Widget for a table.
|
70
42
|
email:
|
71
43
|
- support@scrivito.com
|
@@ -83,7 +55,6 @@ files:
|
|
83
55
|
- app/assets/stylesheets/scrivito_table_widget.css
|
84
56
|
- app/assets/stylesheets/scrivito_table_widget/application.css
|
85
57
|
- app/assets/stylesheets/scrivito_table_widget/editing.css
|
86
|
-
- app/assets/stylesheets/scrivito_table_widget/styles.css
|
87
58
|
- app/models/table_widget.rb
|
88
59
|
- app/views/table_widget/show.html.erb
|
89
60
|
- app/views/table_widget/thumbnail.html.erb
|
@@ -91,7 +62,6 @@ files:
|
|
91
62
|
- lib/scrivito_table_widget/engine.rb
|
92
63
|
- lib/scrivito_table_widget/version.rb
|
93
64
|
- lib/tasks/scrivito_table_widget_tasks.rake
|
94
|
-
- scrivito/migrate/0_create_table_widget.rb
|
95
65
|
homepage: https://www.scrivito.com
|
96
66
|
licenses:
|
97
67
|
- LGPL-3.0
|
@@ -107,9 +77,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
77
|
version: '0'
|
108
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
79
|
requirements:
|
110
|
-
- - "
|
80
|
+
- - ">="
|
111
81
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
82
|
+
version: '0'
|
113
83
|
requirements: []
|
114
84
|
rubyforge_project:
|
115
85
|
rubygems_version: 2.4.5
|