rails-tables 0.6.5 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -12,7 +12,7 @@ A clean jQuery datatables DSL
12
12
  [jqd-railscast]: http://railscasts.com/episodes/340-datatables (Episode #340: Datatables)
13
13
  [squeel]: https://github.com/ernie/squeel (Squeel: ActiveRecord 3, improved)
14
14
 
15
- Version: 0.6.5
15
+ Version: 0.6.6
16
16
 
17
17
  Please refer to the [RailsTables Wiki][wiki] for:
18
18
 
@@ -50,6 +50,7 @@ private
50
50
  property = object.try(:send, self.method)
51
51
  property if not property.nil?
52
52
  end
53
+
53
54
  def self_referential_link(view, object)
54
55
  property = object.try(:send, self.method)
55
56
  view.link_to property, object if not property.nil?
@@ -61,6 +62,7 @@ private
61
62
  def related_link_list(view, objects)
62
63
  objects.reject(&:blank?).map{ |object| related_link(view, object).strip }.join(', ') if not objects.nil?
63
64
  end
65
+
64
66
  def time(view, object)
65
67
  property = object.try(:send, self.method)
66
68
  property.strftime("%I:%M%p") if not property.nil?
@@ -74,4 +76,18 @@ private
74
76
  property.strftime("%m/%d/%Y at %I:%M%p") if not property.nil?
75
77
  end
76
78
 
79
+ def currency(view, object)
80
+ property = object.try(:send, self.method)
81
+ view.number_to_currency(property.to_f) if not property.nil?
82
+ end
83
+ def phone(view, object)
84
+ property = object.try(:send, self.method)
85
+ view.number_to_phone(property.to_f) if not property.nil?
86
+ end
87
+
88
+ def truncate(view, object)
89
+ property = object.try(:send, self.method)
90
+ view.truncate(property, 50) if not property.nil?
91
+ end
92
+
77
93
  end
@@ -24,11 +24,11 @@ module RailsTables::ModelAdditions
24
24
  cattr_accessor :datatables unless self.respond_to? :datatables
25
25
  self.datatables ||= {}
26
26
 
27
- if self.has_datatable? name
28
- raise RailsTables::NameError,
29
- "#{self.name} already has a datatable with the name '#{name}'. "\
30
- "Please supply a :name parameter to has_datatable other than: #{self.datatables.keys.join(', ')}"
31
- else
27
+ # if self.has_datatable? name
28
+ # raise RailsTables::NameError,
29
+ # "#{self.name} already has a datatable with the name '#{name}'. "\
30
+ # "Please supply a :name parameter to has_datatable other than: #{self.datatables.keys.join(', ')}"
31
+ # else
32
32
  self.datatables[name] = klass
33
33
  cattr_writer name
34
34
  self.send("#{name}=", klass.new(name, self))
@@ -37,7 +37,7 @@ module RailsTables::ModelAdditions
37
37
  self.class_variable_get("@@#{name}").set_root(self)
38
38
  end
39
39
  end
40
- end
40
+ # end
41
41
  end
42
42
 
43
43
  def has_datatable?(table_name=:datatable)
@@ -1,3 +1,3 @@
1
1
  module RailsTables
2
- VERSION = "0.6.5"
2
+ VERSION = "0.6.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-tables
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: