scrivito_table_widget 0.5.5 → 0.5.7.rc1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c70e749b527d4ef71950e3c9d0ea49907db61679
4
- data.tar.gz: b1e12788f67b8c2118154bbf12c9ba5e869cf87d
3
+ metadata.gz: ac7e97c84969651d68eb80e1b4d57910a1f43ac4
4
+ data.tar.gz: 9315694e6064f2fb58218f9639f6db497201d171
5
5
  SHA512:
6
- metadata.gz: 48a9e0adcd59f1e429c6f2f57887c9279df26f53a3218923c1cab703dfb11ae1a7a8eb24649b02750c8ec2162b21af8fd5676bca56a2bae97f0cd9392dd75280
7
- data.tar.gz: ae02fbd51ae3dc46ff6c9829819f2d8600fc4a7b41b704530e7f38a4790db22a34e144d6d37082a44aa76dd7ab1581b1ab16cb18dad1dc87c4362c07dfa7824f
6
+ metadata.gz: 0aa5922c14c96be32e897d5aa99ef65a2aa3939bbd4fab61c5d0472f47cfec703db6817ca3f4b8a3168a8c161b2dfd02ea89ccafb649cd38fb03234f64963dcc
7
+ data.tar.gz: f1cc1c05a5f9cd4d5d187b20822cbed038d0bfed0fef9ce390e61dfadd9dacbfea505dd7069bc43ba1cbdb6ccb725fb2548aef177b61392ac2473e1391276107
data/README.md CHANGED
@@ -1,10 +1,6 @@
1
- scrivito_table_widget
2
- =====================
1
+ # ScrivitoTableWidget
3
2
 
4
- [![Gem Version](https://badge.fury.io/rb/scrivito_table_widget.svg)](http://badge.fury.io/rb/scrivito_table_widget)
5
- [![Code Climate](https://codeclimate.com/github/Scrivito/scrivito_table_widget/badges/gpa.svg)](https://codeclimate.com/github/Scrivito/scrivito_table_widget)
6
-
7
- A Widget for Scrivito for a table. It is using Bootstrap 3.
3
+ A Scrivito widget representing a table you can place onto your pages. Lets you edit table cells comfortably, add and remove rows and columns, apply different styles and more.
8
4
 
9
5
  ## Installation
10
6
 
@@ -12,22 +8,10 @@ Add this line to your application's `Gemfile`:
12
8
 
13
9
  gem 'scrivito_table_widget'
14
10
 
15
- Add this line to your editing javascript manifest:
11
+ Add this line to your editing JavaScript manifest:
16
12
 
17
13
  //= require scrivito_table_widget
18
14
 
19
15
  Add this line to your application stylesheet manifest:
20
16
 
21
17
  *= require scrivito_table_widget
22
-
23
- ## Changelog
24
- See [Changelog](https://github.com/Scrivito/scrivito_table_widget/blob/master/CHANGELOG.md) for more
25
- details.
26
-
27
- ## Contributing
28
-
29
- 1. Fork it ( https://github.com/Scrivito/scrivito_table_widget/fork )
30
- 2. Create your feature branch (`git checkout -b my-new-feature`)
31
- 3. Commit your changes (`git commit -am 'Add some feature'`)
32
- 4. Push to the branch (`git push origin my-new-feature`)
33
- 5. Create a new Pull Request
@@ -19,25 +19,32 @@
19
19
  rows = $.fn.edittable.getRowCount();
20
20
  cols = $.fn.edittable.getColCount();
21
21
  $.fn.edittable.bindButtons();
22
- } else if(activeElement.get(0) != this.get(0)) {
23
- //$.fn.edittable.save(cmsField);
24
22
  }
25
23
 
26
24
  if(!keysBound) {
27
25
  $.fn.edittable.bindKeys();
28
26
  }
29
27
 
28
+ var elem = this;
29
+
30
+ if($(this).get(0).tagName != "TD" && $(this).get(0).tagName != "TH") {
31
+ elem = elem.parents('td, th');
32
+ }
33
+
30
34
  // edit
31
- if($(this).get(0).tagName == "TD" || $(this).get(0).tagName == "TH") {
32
- activeElement = this;
33
- cmsField.attr('contenteditable', true);
34
- $.fn.edittable.setButtonPositions();
35
+ if($(elem).get(0) != undefined) {
36
+ if($(elem).get(0).tagName == "TD" || $(elem).get(0).tagName == "TH") {
37
+ activeElement = elem;
38
+ cmsField.attr('contenteditable', true);
39
+ $.fn.edittable.setButtonPositions();
40
+ }
35
41
  }
36
42
  };
37
43
 
38
44
  $.fn.edittable.bindKeys = function() {
39
45
  $('body').keyup(function(e) {
40
46
  var code = e.keyCode || e.which;
47
+ $.fn.edittable.save();
41
48
  if(initialized) {
42
49
  $.fn.edittable.setButtonPositions();
43
50
  }
@@ -73,7 +80,7 @@
73
80
  }
74
81
  }
75
82
 
76
- $.fn.edittable.initialize = function(cmsField, element) {
83
+ $.fn.edittable.initialize = function(cmsField, element) {
77
84
  var buttons_top = "<div class='table-buttons top'>"+ $.fn.edittable.buttonsTop() +"</div>";
78
85
  var buttons_bottom = "<div class='table-buttons bottom'>"+ $.fn.edittable.buttonsBottom() +"</div>";
79
86
  var buttons_left = "<div class='table-buttons left'>"+ $.fn.edittable.buttonsLeft() +"</div>";
@@ -117,11 +124,6 @@
117
124
 
118
125
  $.fn.edittable.buttonsEdit = function() {
119
126
  return $.fn.edittable.button("pencil", "", "edit-the-cell alert-gray") +
120
- $.fn.edittable.button("bold", "", "table-bold alert-gray") +
121
- $.fn.edittable.button("italic", "", "table-italic alert-gray") +
122
- $.fn.edittable.button("align-left", "", "table-left alert-gray") +
123
- $.fn.edittable.button("align-center", "", "table-center alert-gray") +
124
- $.fn.edittable.button("align-right", "", "table-right alert-gray") +
125
127
  $.fn.edittable.button("crosshairs", "", "add-success alert-success") +
126
128
  $.fn.edittable.button("crosshairs", "", "add-info alert-info") +
127
129
  $.fn.edittable.button("crosshairs", "", "add-warning alert-warning") +
@@ -178,9 +180,6 @@
178
180
  $('.table-widget').find('.add-info').on('click', function() { $.fn.edittable.addInfo(); });
179
181
  $('.table-widget').find('.add-warning').on('click', function() { $.fn.edittable.addWarning(); });
180
182
  $('.table-widget').find('.add-danger').on('click', function() { $.fn.edittable.addDanger(); });
181
- $('.table-widget').find('.table-left').on('click', function() { $.fn.edittable.tableLeft(); });
182
- $('.table-widget').find('.table-center').on('click', function() { $.fn.edittable.tableCenter(); });
183
- $('.table-widget').find('.table-right').on('click', function() { $.fn.edittable.tableRight(); });
184
183
 
185
184
  $('.table-widget').find('.edit-the-table').on('click', function() { $.fn.edittable.toggleTableOptions('.table-options.main'); });
186
185
  $('.table-widget').find('.edit-the-cell').on('click', function() { $.fn.edittable.toggleTableOptions('.table-buttons.edit'); });
@@ -188,7 +187,6 @@
188
187
  $('.table-widget').find('.add-left, .add-right').on('mouseover', function() { $.fn.edittable.addHoverVerticalAdd($(this)); });
189
188
  $('.table-widget').find('.add-top, .add-bottom').on('mouseover', function() { $.fn.edittable.addHoverHorizontalAdd($(this)); });
190
189
 
191
-
192
190
  $('.table-widget').find('.delete-column').on('mouseover', function() { $.fn.edittable.deleteHoverColumn($(this)); });
193
191
  $('.table-widget').find('.delete-row').on('mouseover', function() { $.fn.edittable.deleteHoverRow($(this)); });
194
192
 
@@ -261,18 +259,8 @@
261
259
  }
262
260
  }
263
261
 
264
- $.fn.edittable.bold = function() {
265
- activeElement.toggleClass('bold');
266
- $.fn.edittable.save(cmsField);
267
- }
268
-
269
- $.fn.edittable.italic = function() {
270
- activeElement.toggleClass('italic');
271
- $.fn.edittable.save(cmsField);
272
- }
273
-
274
262
  $.fn.edittable.addTop = function() {
275
- var newRow = activeElement.parents('tr').get(0).outerHTML;
263
+ var newRow = "<tr>"+ new Array(cols + 1).join("<td>Content</td>"); +"</tr>";
276
264
 
277
265
  $(newRow).insertBefore( activeElement.parents('tr') );
278
266
  rows += 1;
@@ -283,12 +271,7 @@
283
271
  $.fn.edittable.addBottom = function() {
284
272
  var newRow = "<tr>"+ new Array(cols + 1).join("<td>Content</td>"); +"</tr>";
285
273
 
286
- if(activeElement.get(0).tagName == 'TD') {
287
- $(newRow).insertAfter( activeElement.parents('tr') );
288
- } else {
289
- $(newRow).insertBefore( activeTable.find('tbody tr').first() );
290
- }
291
-
274
+ $(newRow).insertAfter( activeElement.parents('tr') );
292
275
  rows += 1;
293
276
  $.fn.edittable.setButtonPositions();
294
277
  $.fn.edittable.save(cmsField);
@@ -5,7 +5,7 @@
5
5
  App.tableEditor = {
6
6
  // set selector for Editor
7
7
  selector: '[data-editor=table-editor]',
8
-
8
+
9
9
  // set function triggert on click
10
10
  clickFunction: function(cmsField) {
11
11
  cmsField.edittable();
@@ -131,4 +131,9 @@ td.active-field {
131
131
  .table-options.main div:first-child,
132
132
  .table-buttons.edit div:first-child {
133
133
  display: block;
134
- }
134
+ }
135
+
136
+ [data-scrivito-display-mode='editing'] table td:focus,
137
+ [data-scrivito-display-mode='editing'] table th:focus {
138
+ outline: 2px dotted #439439 !important;
139
+ }
@@ -1,3 +1,3 @@
1
1
  class TableWidget < Widget
2
- attribute :table, :html
2
+ attribute :table, :html, default: "<table class='table'><thead><tr><th>Headline</th><th>Headline</th></tr></thead><tbod><tr><td>Content</td><td>Content</td></tr><tr><td>Content</td><td>Content</td></tr></tbody></table>"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module ScrivitoTableWidget
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.7.rc1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivito_table_widget
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.7.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scrivito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-15 00:00:00.000000000 Z
11
+ date: 2016-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,9 +78,7 @@ files:
78
78
  - Rakefile
79
79
  - app/assets/images/table.png
80
80
  - app/assets/javascripts/scrivito_table_widget.js
81
- - app/assets/javascripts/scrivito_table_widget/createTable.js
82
81
  - app/assets/javascripts/scrivito_table_widget/jquery.edit.table.js
83
- - app/assets/javascripts/scrivito_table_widget/scripts.js
84
82
  - app/assets/javascripts/scrivito_table_widget/tableEditor.js
85
83
  - app/assets/stylesheets/scrivito_table_widget.css
86
84
  - app/assets/stylesheets/scrivito_table_widget/application.css
@@ -109,12 +107,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
107
  version: '0'
110
108
  required_rubygems_version: !ruby/object:Gem::Requirement
111
109
  requirements:
112
- - - ">="
110
+ - - ">"
113
111
  - !ruby/object:Gem::Version
114
- version: '0'
112
+ version: 1.3.1
115
113
  requirements: []
116
114
  rubyforge_project:
117
- rubygems_version: 2.2.2
115
+ rubygems_version: 2.4.5
118
116
  signing_key:
119
117
  specification_version: 4
120
118
  summary: Scrivito Widget for a table.
@@ -1,21 +0,0 @@
1
- (function($, App) {
2
- 'use strict';
3
-
4
- $(function() {
5
- var tableString = '<table class="table"><thead><tr><th>New Table</th></tr></thead><tbody><tr><td>With Content</td></tr></body></table>';
6
-
7
- if(scrivito.in_editable_view()) {
8
- $('body').on('click', '.create-new-table', function(e) {
9
- $(this).removeClass('create-new-table');
10
- $(this).addClass('table');
11
-
12
- $(this).html(tableString);
13
-
14
- $(this).parent().scrivito('save', tableString);
15
-
16
- $(this).parent().scrivito('reload');
17
- });
18
- } // end if
19
- });
20
-
21
- })(jQuery, this);
@@ -1,13 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require_tree ./