rghost 0.7.0 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +1 -1
- data/lib/rghost/data_grid/rails_grid.rb +26 -1
- data/lib/rghost/ps/cursor.ps +1 -0
- data/lib/rghost/version.rb +1 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -4,7 +4,13 @@ class DataGrid::RailsGrid < DataGrid::BasicGrid
|
|
4
4
|
#Adiciona um Array de objetos ActiveRecord::Base
|
5
5
|
def data(_data)
|
6
6
|
_data.collect do |d|
|
7
|
-
line=@rails_cols.collect
|
7
|
+
line=@rails_cols.collect do |c|
|
8
|
+
case c[:field_name]
|
9
|
+
when Symbol: d[c[:field_name]]
|
10
|
+
when String: d.instance_eval c[:field_name]
|
11
|
+
when Proc: d.instance_eval(&c[:field_name])
|
12
|
+
end
|
13
|
+
end
|
8
14
|
proc_line(line)
|
9
15
|
end
|
10
16
|
end
|
@@ -21,6 +27,25 @@ class DataGrid::RailsGrid < DataGrid::BasicGrid
|
|
21
27
|
# Carregamento dos dados
|
22
28
|
# calls = Calls.find(:all, :limit => 5000)
|
23
29
|
# rails_grid.data(calls)
|
30
|
+
#Para relacionamentos use um Proc ou uma String no lugar do nome do atributo(Symbol). Exemplo
|
31
|
+
# class Contas < ActiveRecord::Base
|
32
|
+
# belongs_to :clientes
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# class Clientes < ActiveRecord::Base
|
36
|
+
# has_many :contas
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# c=Clientes.find(:all, :include => :clientes )
|
40
|
+
#Usando um bloco
|
41
|
+
# g=DataGrid::RailsGrid.new :width => 4
|
42
|
+
# g.col :id, :title => "Clientes id"
|
43
|
+
# g.col :created_on, :title => "Data ", :format => :eurodate
|
44
|
+
# g.col :login, :title => "Login"
|
45
|
+
# g.col lambda { pessoas.nome }, :title => "Nome do cliente"
|
46
|
+
# g.data(c)
|
47
|
+
#ou uma String
|
48
|
+
# g.col 'pessoas.nome', :title => "Nome do cliente"
|
24
49
|
def col(field_name, options={})
|
25
50
|
super(options[:title],options)
|
26
51
|
@rails_cols||=[]
|
data/lib/rghost/ps/cursor.ps
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
odd_or_even callback
|
16
16
|
current_page count_pages eq { last_page } if
|
17
17
|
new_current_row_point
|
18
|
+
default_point
|
18
19
|
} def
|
19
20
|
/default_point { limit_left current_row moveto} def
|
20
21
|
/new_current_row_point{ /current_row limit_top row row_height row_padding add mul sub def }def
|
data/lib/rghost/version.rb
CHANGED
metadata
CHANGED