bootstrap-table-rails 1.9.1 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -1
  3. data/lib/bootstrap-table-rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/bootstrap-table-locale-all.js +30 -10
  5. data/vendor/assets/javascripts/bootstrap-table.js +157 -53
  6. data/vendor/assets/javascripts/extensions/bootstrap-table-cookie.js +8 -4
  7. data/vendor/assets/javascripts/extensions/bootstrap-table-editable.js +21 -0
  8. data/vendor/assets/javascripts/extensions/bootstrap-table-export.js +9 -2
  9. data/vendor/assets/javascripts/extensions/bootstrap-table-filter-control.js +127 -46
  10. data/vendor/assets/javascripts/extensions/bootstrap-table-group-by 2.js +226 -0
  11. data/vendor/assets/javascripts/extensions/bootstrap-table-mobile.js +5 -0
  12. data/vendor/assets/javascripts/extensions/bootstrap-table-natural-sorting.js +12 -2
  13. data/vendor/assets/javascripts/extensions/bootstrap-table-reorder-rows.js +1 -0
  14. data/vendor/assets/javascripts/extensions/bootstrap-table-sticky-header.js +104 -0
  15. data/vendor/assets/javascripts/locale/bootstrap-table-ca-ES.js +7 -6
  16. data/vendor/assets/javascripts/locale/bootstrap-table-en-US.js +2 -2
  17. data/vendor/assets/javascripts/locale/bootstrap-table-nl-NL.js +16 -1
  18. data/vendor/assets/javascripts/locale/bootstrap-table-ru-RU.js +3 -0
  19. data/vendor/assets/javascripts/locale/bootstrap-table-zh-TW.js +2 -2
  20. data/vendor/assets/stylesheets/bootstrap-table.css +7 -2
  21. data/vendor/assets/stylesheets/extensions/bootstrap-table-group-by 2.css +7 -0
  22. data/vendor/assets/stylesheets/extensions/bootstrap-table-sticky-header.css +22 -0
  23. metadata +6 -2
@@ -98,6 +98,11 @@
98
98
  return;
99
99
  }
100
100
 
101
+ if (this.options.minWidth < 100 && this.options.resizable) {
102
+ console.log("The minWidth when the resizable extension is active should be greater or equal than 100");
103
+ this.options.minWidth = 100;
104
+ }
105
+
101
106
  var that = this,
102
107
  old = {
103
108
  width: $(window).width(),
@@ -2,10 +2,11 @@
2
2
  * @author: Brian Huisman
3
3
  * @webSite: http://www.greywyvern.com
4
4
  * @version: v1.0.0
5
- * JS function to allow natural sorting on bootstrap-table columns
6
- * just add data-sorter="alphanum" to any th
5
+ * JS functions to allow natural sorting on bootstrap-table columns
6
+ * add data-sorter="alphanum" or data-sorter="numericOnly" to any th
7
7
  *
8
8
  * @update Dennis Hernández <http://djhvscf.github.io/Blog>
9
+ * @update Duane May
9
10
  */
10
11
 
11
12
  function alphanum(a, b) {
@@ -44,4 +45,13 @@ function alphanum(a, b) {
44
45
  }
45
46
  }
46
47
  return aa.length - bb.length;
48
+ }
49
+
50
+ function numericOnly(a, b) {
51
+ function stripNonNumber(s) {
52
+ s = s.replace(new RegExp(/[^0-9]/g), "");
53
+ return parseInt(s, 10);
54
+ }
55
+
56
+ return stripNonNumber(a) - stripNonNumber(b);
47
57
  }
@@ -45,6 +45,7 @@
45
45
  BootstrapTable.prototype.init = function () {
46
46
 
47
47
  if (!this.options.reorderableRows) {
48
+ _init.apply(this, Array.prototype.slice.apply(arguments));
48
49
  return;
49
50
  }
50
51
 
@@ -0,0 +1,104 @@
1
+ /**
2
+ * @author vincent loh <vincent.ml@gmail.com>
3
+ * @version: v1.0.0
4
+ * https://github.com/vinzloh/bootstrap-table/
5
+ * Sticky header for bootstrap-table
6
+ */
7
+
8
+ (function ($) {
9
+ 'use strict';
10
+
11
+ var sprintf = $.fn.bootstrapTable.utils.sprintf;
12
+ $.extend($.fn.bootstrapTable.defaults, {
13
+ stickyHeader: false
14
+ });
15
+
16
+ var BootstrapTable = $.fn.bootstrapTable.Constructor,
17
+ _initHeader = BootstrapTable.prototype.initHeader;
18
+
19
+ BootstrapTable.prototype.initHeader = function () {
20
+ var that = this;
21
+ _initHeader.apply(this, Array.prototype.slice.apply(arguments));
22
+
23
+ if (!this.options.stickyHeader) return;
24
+
25
+ var table = this.$tableBody.find('table');
26
+ var table_id = table.attr('id');
27
+ var header_id = table.attr('id') + '-sticky-header';
28
+ var sticky_header_container_id = header_id +'-sticky-header-container';
29
+ var anchor_begin_id = header_id +'_sticky_anchor_begin';
30
+ var anchor_end_id = header_id +'_sticky_anchor_end';
31
+ // add begin and end anchors to track table position
32
+
33
+ table.before(sprintf('<div id="%s" class="hidden"></div>', sticky_header_container_id));
34
+ table.before(sprintf('<div id="%s"></div>', anchor_begin_id));
35
+ table.after(sprintf('<div id="%s"></div>', anchor_end_id));
36
+
37
+ table.find('thead').attr('id', header_id);
38
+
39
+ // clone header just once, to be used as sticky header
40
+ // deep clone header. using source header affects tbody>td width
41
+ this.$stickyHeader = $($('#'+header_id).clone());
42
+ // avoid id conflict
43
+ this.$stickyHeader.removeAttr('id');
44
+
45
+ // render sticky on window scroll or resize
46
+ $(window).on('resize.'+table_id, table, render_sticky_header);
47
+ $(window).on('scroll.'+table_id, table, render_sticky_header);
48
+ // render sticky when table scroll left-right
49
+ table.closest('.fixed-table-container').find('.fixed-table-body').on('scroll.'+table_id, table, match_position_x);
50
+
51
+ function render_sticky_header(event){
52
+ var table = event.data;
53
+ var table_header_id = table.find('thead').attr('id');
54
+ // console.log('render_sticky_header for > '+table_header_id);
55
+ if (table.length < 1 || $('#'+table_id).length < 1){
56
+ // turn off window listeners
57
+ $(window).off('resize.'+table_id);
58
+ $(window).off('scroll.'+table_id);
59
+ table.closest('.fixed-table-container').find('.fixed-table-body').off('scroll.'+table_id);
60
+ return;
61
+ }
62
+ // get header height
63
+ var header_height = '0';
64
+ if (that.options.stickyHeaderOffsetY) header_height = that.options.stickyHeaderOffsetY.replace('px','');
65
+ // window scroll top
66
+ var t = $(window).scrollTop();
67
+ // top anchor scroll position, minus header height
68
+ var e = $("#"+anchor_begin_id).offset().top - header_height;
69
+ // bottom anchor scroll position, minus header height, minus sticky height
70
+ var e_end = $("#"+anchor_end_id).offset().top - header_height - $('#'+table_header_id).css('height').replace('px','');
71
+ // show sticky when top anchor touches header, and when bottom anchor not exceeded
72
+ if (t > e && t <= e_end) {
73
+ // ensure clone and source column widths are the same
74
+ $.each( that.$stickyHeader.find('tr').eq(0).find('th'), function (index, item) {
75
+ $(item).css('min-width', $('#'+table_header_id+' tr').eq(0).find('th').eq(index).css('width'));
76
+ });
77
+ // match bootstrap table style
78
+ $("#"+sticky_header_container_id).removeClass('hidden').addClass("fix-sticky fixed-table-container") ;
79
+ // stick it in position
80
+ $("#"+sticky_header_container_id).css('top', header_height + 'px');
81
+ // create scrollable container for header
82
+ var scrollable_div = $('<div style="position:absolute;width:100%;overflow-x:hidden;" />');
83
+ // append cloned header to dom
84
+ $("#"+sticky_header_container_id).html(scrollable_div.append(that.$stickyHeader));
85
+ // match clone and source header positions when left-right scroll
86
+ match_position_x(event);
87
+ } else {
88
+ // hide sticky
89
+ $("#"+sticky_header_container_id).removeClass("fix-sticky").addClass('hidden');
90
+ }
91
+
92
+ }
93
+ function match_position_x(event){
94
+ var table = event.data;
95
+ var table_header_id = table.find('thead').attr('id');
96
+ // match clone and source header positions when left-right scroll
97
+ $("#"+sticky_header_container_id).css(
98
+ 'width', +table.closest('.fixed-table-body').css('width').replace('px', '') + 1
99
+ );
100
+ $("#"+sticky_header_container_id+" thead").parent().scrollLeft(Math.abs($('#'+table_header_id).position().left));
101
+ }
102
+ };
103
+
104
+ })(jQuery);
@@ -1,13 +1,14 @@
1
1
  /**
2
2
  * Bootstrap Table Catalan translation
3
- * Author: Marc Pina<iwalkalone69@gmail.com>
3
+ * Authors: Marc Pina<iwalkalone69@gmail.com>
4
+ * Claudi Martinez<claudix.kernel@gmail.com>
4
5
  */
5
6
  (function ($) {
6
7
  'use strict';
7
8
 
8
9
  $.fn.bootstrapTable.locales['ca-ES'] = {
9
10
  formatLoadingMessage: function () {
10
- return 'Si us plau esperi...';
11
+ return 'Espereu, si us plau...';
11
12
  },
12
13
  formatRecordsPerPage: function (pageNumber) {
13
14
  return pageNumber + ' resultats per pàgina';
@@ -16,19 +17,19 @@
16
17
  return 'Mostrant de ' + pageFrom + ' fins ' + pageTo + ' - total ' + totalRows + ' resultats';
17
18
  },
18
19
  formatSearch: function () {
19
- return 'Buscar';
20
+ return 'Cerca';
20
21
  },
21
22
  formatNoMatches: function () {
22
23
  return 'No s\'han trobat resultats';
23
24
  },
24
25
  formatPaginationSwitch: function () {
25
- return 'Amagar/Mostrar paginació';
26
+ return 'Amaga/Mostra paginació';
26
27
  },
27
28
  formatRefresh: function () {
28
- return 'Refrescar';
29
+ return 'Refresca';
29
30
  },
30
31
  formatToggle: function () {
31
- return 'Amagar/Mostrar';
32
+ return 'Alterna formatació';
32
33
  },
33
34
  formatColumns: function () {
34
35
  return 'Columnes';
@@ -10,7 +10,7 @@
10
10
  return 'Loading, please wait...';
11
11
  },
12
12
  formatRecordsPerPage: function (pageNumber) {
13
- return pageNumber + ' records per page';
13
+ return pageNumber + ' rows per page';
14
14
  },
15
15
  formatShowingRows: function (pageFrom, pageTo, totalRows) {
16
16
  return 'Showing ' + pageFrom + ' to ' + pageTo + ' of ' + totalRows + ' rows';
@@ -40,4 +40,4 @@
40
40
 
41
41
  $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['en-US']);
42
42
 
43
- })(jQuery);
43
+ })(jQuery);
@@ -13,13 +13,28 @@
13
13
  return pageNumber + ' records per pagina';
14
14
  },
15
15
  formatShowingRows: function (pageFrom, pageTo, totalRows) {
16
- return 'Toon ' + pageFrom + ' tot ' + pageTo + ' van ' + totalRows + ' records';
16
+ return 'Toon ' + pageFrom + ' tot ' + pageTo + ' van ' + totalRows + ' record' + ((totalRows > 1) ? 's' : '');
17
+ },
18
+ formatDetailPagination: function (totalRows) {
19
+ return 'Toon ' + totalRows + ' record' + ((totalRows > 1) ? 's' : '');
17
20
  },
18
21
  formatSearch: function () {
19
22
  return 'Zoeken';
20
23
  },
21
24
  formatNoMatches: function () {
22
25
  return 'Geen resultaten gevonden';
26
+ },
27
+ formatRefresh: function () {
28
+ return 'Vernieuwen';
29
+ },
30
+ formatToggle: function () {
31
+ return 'Omschakelen';
32
+ },
33
+ formatColumns: function () {
34
+ return 'Kolommen';
35
+ },
36
+ formatAllRows: function () {
37
+ return 'Alle';
23
38
  }
24
39
  };
25
40
 
@@ -28,6 +28,9 @@
28
28
  },
29
29
  formatColumns: function () {
30
30
  return 'Колонки';
31
+ },
32
+ formatClearFilters: function () {
33
+ return 'Очистить фильтры';
31
34
  }
32
35
  };
33
36
 
@@ -19,13 +19,13 @@
19
19
  return '搜尋';
20
20
  },
21
21
  formatNoMatches: function () {
22
- return '沒有找符合的結果';
22
+ return '沒有找到符合的結果';
23
23
  },
24
24
  formatPaginationSwitch: function () {
25
25
  return '隱藏/顯示分頁';
26
26
  },
27
27
  formatRefresh: function () {
28
- return '刷新';
28
+ return '重新整理';
29
29
  },
30
30
  formatToggle: function () {
31
31
  return '切換';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @author zhixin wen <wenzhixin2010@gmail.com>
3
- * version: 1.8.1
3
+ * version: 1.10.0
4
4
  * https://github.com/wenzhixin/bootstrap-table/
5
5
  */
6
6
 
@@ -17,7 +17,7 @@
17
17
  .bootstrap-table .table:not(.table-condensed) > thead > tr > td,
18
18
  .bootstrap-table .table:not(.table-condensed) > tbody > tr > td,
19
19
  .bootstrap-table .table:not(.table-condensed) > tfoot > tr > td {
20
- padding: 8px !important;
20
+ padding: 8px;
21
21
  }
22
22
 
23
23
  .bootstrap-table .table.table-no-bordered > thead > tr > th,
@@ -64,6 +64,10 @@
64
64
  border-left: 1px solid #dddddd;
65
65
  }
66
66
 
67
+ .fixed-table-container thead th:focus {
68
+ outline: 0 solid transparent;
69
+ }
70
+
67
71
  .fixed-table-container thead th:first-child {
68
72
  border-left: none;
69
73
  border-top-left-radius: 4px;
@@ -274,6 +278,7 @@
274
278
  .bootstrap-table .fixed-table-footer .table {
275
279
  border-bottom: none;
276
280
  border-radius: 0;
281
+ padding: 0 !important;
277
282
  }
278
283
 
279
284
  .pull-right .dropdown-menu {
@@ -0,0 +1,7 @@
1
+ .bootstrap-table .table > tbody > tr.groupBy {
2
+ cursor: pointer;
3
+ }
4
+
5
+ .bootstrap-table .table > tbody > tr.groupBy.expanded {
6
+
7
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @author vincent loh <vincent.ml@gmail.com>
3
+ * @version: v1.0.0
4
+ * https://github.com/vinzloh/bootstrap-table/
5
+ * Sticky header for bootstrap-table
6
+ */
7
+
8
+ .fix-sticky {
9
+ position: fixed;
10
+ z-index: 100;
11
+ }
12
+ .fix-sticky thead {
13
+ background: #fff;
14
+ }
15
+
16
+ .fix-sticky thead th,
17
+ .fix-sticky thead th:first-child {
18
+ border-left: 0;
19
+ border-right: 0;
20
+ border-bottom: 1px solid #eee;
21
+ border-radius: 0;
22
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-table-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Chiu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-27 00:00:00.000000000 Z
11
+ date: 2016-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,6 +67,7 @@ files:
67
67
  - vendor/assets/javascripts/extensions/bootstrap-table-filter-control.js
68
68
  - vendor/assets/javascripts/extensions/bootstrap-table-filter.js
69
69
  - vendor/assets/javascripts/extensions/bootstrap-table-flat-json.js
70
+ - vendor/assets/javascripts/extensions/bootstrap-table-group-by 2.js
70
71
  - vendor/assets/javascripts/extensions/bootstrap-table-group-by.js
71
72
  - vendor/assets/javascripts/extensions/bootstrap-table-key-events.js
72
73
  - vendor/assets/javascripts/extensions/bootstrap-table-mobile.js
@@ -76,6 +77,7 @@ files:
76
77
  - vendor/assets/javascripts/extensions/bootstrap-table-reorder-columns.js
77
78
  - vendor/assets/javascripts/extensions/bootstrap-table-reorder-rows.js
78
79
  - vendor/assets/javascripts/extensions/bootstrap-table-resizable.js
80
+ - vendor/assets/javascripts/extensions/bootstrap-table-sticky-header.js
79
81
  - vendor/assets/javascripts/extensions/bootstrap-table-toolbar.js
80
82
  - vendor/assets/javascripts/locale/bootstrap-table-af-ZA.js
81
83
  - vendor/assets/javascripts/locale/bootstrap-table-ar-SA.js
@@ -119,8 +121,10 @@ files:
119
121
  - vendor/assets/javascripts/locale/bootstrap-table-zh-CN.js
120
122
  - vendor/assets/javascripts/locale/bootstrap-table-zh-TW.js
121
123
  - vendor/assets/stylesheets/bootstrap-table.css
124
+ - vendor/assets/stylesheets/extensions/bootstrap-table-group-by 2.css
122
125
  - vendor/assets/stylesheets/extensions/bootstrap-table-group-by.css
123
126
  - vendor/assets/stylesheets/extensions/bootstrap-table-reorder-rows.css
127
+ - vendor/assets/stylesheets/extensions/bootstrap-table-sticky-header.css
124
128
  homepage: https://github.com/bjevanchiu/bootstrap-table-rails
125
129
  licenses:
126
130
  - MIT