Class: MatrixObject

Inherits:
Object
  • Object
show all
Includes:
DataFactory, Foundry, StringFactory, Workflows
Defined in:
lib/sambal-cle/data_objects/matrix.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Workflows

menu_link, #open_my_site_by_name, #reset

Constructor Details

#initialize(browser, opts = {}) ⇒ MatrixObject

Returns a new instance of MatrixObject.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/sambal-cle/data_objects/matrix.rb', line 10

def initialize(browser, opts={})
  @browser = browser
  
  defaults = {
    :title=>random_alphanums,
    :description=>random_alphanums,
    :columns=>[
        {:name=>random_alphanums, :bg_color=>random_hex_color, :font_color=>random_hex_color},
        {:name=>random_alphanums, :bg_color=>random_hex_color, :font_color=>random_hex_color},
        {:name=>random_alphanums, :bg_color=>random_hex_color, :font_color=>random_hex_color}
    ],
    :rows=>[
        {:name=>random_alphanums, :bg_color=>random_hex_color, :font_color=>random_hex_color},
        {:name=>random_alphanums, :bg_color=>random_hex_color, :font_color=>random_hex_color},
        {:name=>random_alphanums, :bg_color=>random_hex_color, :font_color=>random_hex_color}
    ],
    :cells=>[]
  }
  options = defaults.merge(opts)
  set_options(options)
  requires @portfolio

end

Instance Attribute Details

#cellsObject

Returns the value of attribute cells.



8
9
10
# File 'lib/sambal-cle/data_objects/matrix.rb', line 8

def cells
  @cells
end

#columnsObject

Returns the value of attribute columns.



8
9
10
# File 'lib/sambal-cle/data_objects/matrix.rb', line 8

def columns
  @columns
end

#descriptionObject

Returns the value of attribute description.



8
9
10
# File 'lib/sambal-cle/data_objects/matrix.rb', line 8

def description
  @description
end

#portfolioObject

Returns the value of attribute portfolio.



8
9
10
# File 'lib/sambal-cle/data_objects/matrix.rb', line 8

def portfolio
  @portfolio
end

#rowsObject

Returns the value of attribute rows.



8
9
10
# File 'lib/sambal-cle/data_objects/matrix.rb', line 8

def rows
  @rows
end

#statusObject

Returns the value of attribute status.



8
9
10
# File 'lib/sambal-cle/data_objects/matrix.rb', line 8

def status
  @status
end

#titleObject

Returns the value of attribute title.



8
9
10
# File 'lib/sambal-cle/data_objects/matrix.rb', line 8

def title
  @title
end

Instance Method Details

#createObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/sambal-cle/data_objects/matrix.rb', line 34

def create
  open_my_site_by_name @portfolio
  matrices
  on Matrices do |list|
    list.add
  end
  on AddEditMatrix do |add|
    add.title.set @title

    # TODO Add filling in the non-essential fields.

  end
  @columns.each do |column|
    on AddEditMatrix do |add|
      add.add_column
    end
    on AddEditColumn do |add|
      add.name.set column[:name]
      add.background_color.set column[:bg_color]
      add.font_color.set column[:font_color]
      add.update
    end
  end
  @rows.each do |row|
    on AddEditMatrix do |add|
      add.add_row
    end
    on AddEditRow do |add|
      add.name.set row[:name]
      add.background_color.set row[:bg_color]
      add.font_color.set row[:font_color]
      add.update
    end
  end
  on AddEditMatrix do |add|
    add.save_changes
  end
  on EditMatrixCells do |matrix|
    matrix.return_to_list
  end
end

#deleteObject



85
86
87
# File 'lib/sambal-cle/data_objects/matrix.rb', line 85

def delete
  
end

#edit(opts = {}) ⇒ Object



76
77
78
79
# File 'lib/sambal-cle/data_objects/matrix.rb', line 76

def edit opts={}
  
  set_options(opts)
end

#exportObject



93
94
95
# File 'lib/sambal-cle/data_objects/matrix.rb', line 93

def export

end

#publishObject



89
90
91
# File 'lib/sambal-cle/data_objects/matrix.rb', line 89

def publish

end

#viewObject



81
82
83
# File 'lib/sambal-cle/data_objects/matrix.rb', line 81

def view
  
end