grapple 0.0.7 → 0.0.8

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: 1b7fd483b53f3b2dd7f7f0c76f40371b62267a81
4
- data.tar.gz: 50ab6c2c99cfc90bd0e48f87a3bb262d9a9bec79
3
+ metadata.gz: 6581b58b78fc16e21a8f26193ba0c67157cf0c64
4
+ data.tar.gz: 2f997ea175542080b9abc55b1bd48f0028e69775
5
5
  SHA512:
6
- metadata.gz: 861d440a096e2ba0b832a59645699d95b0b9e6a0874dc0580bf41c4a3d59c567c01523afa41d824a7bb098ba2dc2755f0154012912719234fc30430bdd7dd2f4
7
- data.tar.gz: d0999d189c440beea579999f2a679bea7eb1e7bfe073a010f7f5f18348c6f658aac797171960323722957053cec829a01a252e32400d441be49403effdaee722
6
+ metadata.gz: 62dd6f9db28ad6b735e610fa394a098264d08206a1e667707da730dec41ae53870776d1f2241c5a53f08303bf424c07d07de914f4a88ebb5d333c22a51473bcb
7
+ data.tar.gz: f3f74f0266d5a14af60d3fbb2e80069a98d81ae3d8b87e58cebe2a1c8be34b01be2786601b6509bfaf413a51dddb0ded7cc2c3b9ebf7b5888c2a5b30d5a39621
@@ -73,7 +73,6 @@ GrappleTable.prototype = {
73
73
  },
74
74
 
75
75
  onHistoryChange: function(params) {
76
- console.log("HISTORY CHANGE");
77
76
  this._showLoading();
78
77
  this._updateTable($.param(params));
79
78
  },
@@ -82,16 +81,13 @@ GrappleTable.prototype = {
82
81
  *
83
82
  */
84
83
  loadTable: function(params) {
85
- console.log("LOAD TABLE ", params);
86
84
  this._showLoading();
87
85
 
88
86
  if(this.history) {
89
- console.log("ADD History");
90
87
  this.history.unsubscribe();
91
88
  this.history.add(this.namespace, params);
92
89
  }
93
90
 
94
- console.log("Update table");
95
91
  this._updateTable(params);
96
92
  },
97
93
 
@@ -8,6 +8,9 @@ module Grapple
8
8
  # and the returned value will be passed as the options to
9
9
  # the tr tag
10
10
  setting :tr, true
11
+
12
+ # An HTML fragment to render in the body of the table if there are no rows
13
+ setting :no_rows_html, nil
11
14
 
12
15
  def render(*options, &block)
13
16
  options = options[0] || {}
@@ -21,12 +24,16 @@ module Grapple
21
24
  end
22
25
 
23
26
  args = {}
24
- html = records.collect do |data|
25
- if wrap_row
26
- args = wrap_row.call(template) if wrap_row.is_a?(Proc)
27
- builder.row(capture_block { block.call(data) }, args)
28
- else
29
- indent + capture_block { block.call(data) }
27
+ if records.empty? && !options[:no_rows_html].nil?
28
+ html = ["<tr><td colspan=\"#{columns.length}\">#{options[:no_rows_html]}</td></tr>"]
29
+ else
30
+ html = records.collect do |data|
31
+ if wrap_row
32
+ args = wrap_row.call(template) if wrap_row.is_a?(Proc)
33
+ builder.row(capture_block { block.call(data) }, args)
34
+ else
35
+ indent + capture_block { block.call(data) }
36
+ end
30
37
  end
31
38
  end
32
39
  "<tbody>\n#{html.join("\n")}\n</tbody>\n".html_safe
@@ -23,7 +23,7 @@ module Grapple
23
23
  container_attr = builder_class.container_attributes(self, options)
24
24
  html = ''
25
25
  html << builder_class.before_container(self, options)
26
- html << tag('div', container_attr, false) + "\n"
26
+ html << tag('div', container_attr, true) + "\n"
27
27
  html << capture(&block)
28
28
  html << "</div>\n"
29
29
  html << builder_class.after_container(self, options)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grapple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edward Potocko
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-26 00:00:00.000000000 Z
12
+ date: 2016-04-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack