datagrid 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "datagrid"
8
- s.version = "1.0.2"
8
+ s.version = "1.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bogdan Gusiev"]
12
- s.date = "2013-11-25"
12
+ s.date = "2013-11-27"
13
13
  s.description = "This allows you to easily build datagrid aka data tables with sortable columns and filters"
14
14
  s.email = "agresso@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -29,14 +29,14 @@ module Datagrid
29
29
  def form_for(grid, options = {})
30
30
  options[:method] ||= :get
31
31
  options[:html] ||= {}
32
- options[:html][:class] ||= "datagrid-form #{html_class(grid)}"
32
+ options[:html][:class] ||= "datagrid-form #{@template.dom_class(grid)}"
33
33
  @template.render :partial => "datagrid/form", :locals => {:grid => grid, :options => options}
34
34
  end
35
35
 
36
36
  def table(grid, *args)
37
37
  options = args.extract_options!
38
38
  options[:html] ||= {}
39
- options[:html][:class] ||= "datagrid #{html_class(grid)}"
39
+ options[:html][:class] ||= "datagrid #{@template.dom_class(grid)}"
40
40
  if options[:cycle]
41
41
  ::Datagrid::Utils.warn_once("datagrid_table cycle option is deprecated. Use css to style odd/even rows instead.")
42
42
  end
@@ -68,10 +68,6 @@ module Datagrid
68
68
  @template.render :partial => "datagrid/order_for", :locals => { :grid => grid, :column => column }
69
69
  end
70
70
 
71
- def html_class(grid)
72
- grid.class.to_s.underscore.demodulize
73
- end
74
-
75
71
  def _safe(string)
76
72
  string.respond_to?(:html_safe) ? string.html_safe : string
77
73
  end
@@ -50,6 +50,17 @@ describe Datagrid::Helper do
50
50
  "table.datagrid.simple_report" => 1
51
51
  )
52
52
  end
53
+ it "should have namespaced grid class as html class on table" do
54
+ module ::Ns23
55
+ class TestGrid
56
+ include Datagrid
57
+ scope { Entry }
58
+ end
59
+ end
60
+ subject.datagrid_table(::Ns23::TestGrid.new).should match_css_pattern(
61
+ "table.datagrid.ns23_test_grid" => 1
62
+ )
63
+ end
53
64
  it "should return data table html" do
54
65
  datagrid_table = subject.datagrid_table(grid)
55
66
 
@@ -317,7 +328,7 @@ describe Datagrid::Helper do
317
328
  end
318
329
  end
319
330
  describe ".datagrid_form_for" do
320
- it "should render ordering layout" do
331
+ it "should render form and filter inputs" do
321
332
  class FormForGrid
322
333
  include Datagrid
323
334
  scope { Entry }
@@ -332,8 +343,20 @@ describe Datagrid::Helper do
332
343
  "form input[name=commit][value=Search]" => 1
333
344
  )
334
345
  end
346
+ it "should support html classes for grid class with namespace" do
347
+ module ::Ns22
348
+ class TestGrid
349
+ include Datagrid
350
+ scope { Entry }
351
+ end
352
+ end
353
+ subject.datagrid_form_for(::Ns22::TestGrid.new, :url => "grid").should match_css_pattern(
354
+ "form.datagrid-form.ns22_test_grid" => 1,
355
+ )
356
+ end
335
357
  end
336
358
 
359
+
337
360
  describe ".datagrid_row" do
338
361
  let(:grid) do
339
362
  test_report do
@@ -9,6 +9,9 @@ def test_report_class(&block)
9
9
  Class.new.tap do |klass|
10
10
  klass.class_eval do
11
11
  include Datagrid
12
+ def self.name
13
+ "TestGrid"
14
+ end
12
15
  end
13
16
  if block
14
17
  klass.class_eval(&block)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datagrid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-25 00:00:00.000000000 Z
12
+ date: 2013-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -328,7 +328,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
328
328
  version: '0'
329
329
  segments:
330
330
  - 0
331
- hash: -4547966346096518826
331
+ hash: 356271283638718851
332
332
  required_rubygems_version: !ruby/object:Gem::Requirement
333
333
  none: false
334
334
  requirements: