rghost 0.7.0 → 0.7.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.
data/History.txt CHANGED
@@ -1,4 +1,4 @@
1
- +++ 0.0.1 2007-06-13
1
+ +++ 0.0.1 2007-06-14
2
2
 
3
3
  + 1 major enhancement:
4
4
  + Initial release
@@ -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{|c| d[c[:field_name]] }
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||=[]
@@ -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
@@ -2,7 +2,7 @@ module Rghost #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 7
5
- TINY = 0
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: rghost
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.7.0
7
- date: 2007-06-13 00:00:00 -03:00
6
+ version: 0.7.2
7
+ date: 2007-06-14 00:00:00 -03:00
8
8
  summary: description of gem
9
9
  require_paths:
10
10
  - lib