grapple 0.1.1 → 0.1.2

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: eb898f0ef42d496ed7516d5a4d9d1ed8c8ce7154
4
- data.tar.gz: f0dd41b34d249f1efc4b364a690e38b7de696bba
3
+ metadata.gz: 46d51d0d775864d1d0786ad077c385bee0fdc0f4
4
+ data.tar.gz: a023e77771a81ad8d24e3ddcc8c531113b8ff37a
5
5
  SHA512:
6
- metadata.gz: b017511790c0941b9d73af4abd76824f2ec7340cc2a130068268ddae8320b26e7fc4832c64e0f6e11fd4053728c40871a0698ac7169dca492cf6bafb60d4bf0e
7
- data.tar.gz: a5641e696836d0f79ae6fd7afd1c29d61a588e28c3a72adb7f1e599c2fd6ed719e501bba5e2e1af319efee85d9c0ccc65201d18e949ad585356315299913c0b9
6
+ metadata.gz: aa8c2a04a826b5b169bc35555a4a81c46022096b1310b58285b308db8161ce59e29c1450698438782c1e3498b5de517e7962e851f40effcf2d98031b1600b574
7
+ data.tar.gz: a3344fa9aa22a8d5b0171e54e3ec67c7c6b5725c22c4fc362d931d5d2d31718ac234b182efe9cd638c0953ed606d569ed5b07ae7687b02026958b8e45a8e0b4b
@@ -7,12 +7,11 @@ module Grapple
7
7
 
8
8
  def table_for(columns, records, *args, &block)
9
9
  options = args[0] || {}
10
+ # Don't render the container for AJAX requests by default
10
11
  render_container = (options[:container].nil? ? !request.xhr? : options[:container]) rescue false
11
12
  table_html_attributes = options[:html] || {}
12
13
  options[:builder] = options[:builder] || @@builder
13
- # params might not be defined (being called from a mailer)
14
- # HACK: "defined? params" is returning method but when it gets called the method is not defined
15
- request_params = request.params() rescue {}
14
+ request_params = options[:params] ? options[:params] : grapple_request_params
16
15
  builder = options[:builder].new(self, columns, records, request_params, options)
17
16
  output = capture(builder, &block)
18
17
  table_html = (builder.before_table + builder.table(output, table_html_attributes) + builder.after_table)
@@ -22,6 +21,14 @@ module Grapple
22
21
  table_html.html_safe
23
22
  end
24
23
  end
24
+
25
+ def grapple_request_params
26
+ # params might not be defined (being called from a mailer)
27
+ # HACK: "defined? params" is returning method but when it gets called the method is not defined
28
+ params()
29
+ rescue
30
+ request.params() rescue {}
31
+ end
25
32
 
26
33
  def grapple_container(*args, &block)
27
34
  options = args[0] || {}
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edward Potocko
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-08-03 00:00:00.000000000 Z
13
+ date: 2016-08-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: actionpack