Class: GlossaryTermObject

Inherits:
Object
  • Object
show all
Includes:
DataFactory, Foundry, StringFactory, Workflows
Defined in:
lib/sambal-cle/data_objects/glossary_term.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 = {}) ⇒ GlossaryTermObject

Returns a new instance of GlossaryTermObject.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/sambal-cle/data_objects/glossary_term.rb', line 10

def initialize(browser, opts={})
  @browser = browser
  
  defaults = {
    :term=>random_alphanums,
    :short_description=>random_alphanums,
    :long_description=>random_alphanums
  }
  options = defaults.merge(opts)
  
  set_options(options)
  requires @portfolio
end

Instance Attribute Details

#long_descriptionObject

Returns the value of attribute long_description.



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

def long_description
  @long_description
end

#portfolioObject

Returns the value of attribute portfolio.



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

def portfolio
  @portfolio
end

#short_descriptionObject

Returns the value of attribute short_description.



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

def short_description
  @short_description
end

#termObject

Returns the value of attribute term.



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

def term
  @term
end

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/sambal-cle/data_objects/glossary_term.rb', line 24

def create
  open_my_site_by_name @portfolio
  glossary
  on Glossary do |list|
    list.add
  end
  on AddEditTerm do |term|
    term.term.set @term
    term.short_description.set @short_description
    term.long_description=@long_description
    term.add_term
  end
end

#deleteObject



61
62
63
64
65
66
67
# File 'lib/sambal-cle/data_objects/glossary_term.rb', line 61

def delete
  open_my_site_by_name @portfolio
  glossary
  on Glossary do |list|
    list.delete @term
  end
end

#edit(opts = {}) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/sambal-cle/data_objects/glossary_term.rb', line 38

def edit opts={}
  open_my_site_by_name @portfolio
  glossary
  on Glossary do |list|
    list.edit @term
  end
  on AddEditTerm do |term|
    term.term.fit opts[:term]
    term.short_description.fit opts[:short_description]
    term.long_description=opts[:long_description] unless opts[:long_description]==nil
    term.save_changes
  end
  set_options(opts)
end

#openObject



53
54
55
56
57
58
59
# File 'lib/sambal-cle/data_objects/glossary_term.rb', line 53

def open
  open_my_site_by_name @portfolio
  glossary
  on Glossary do |list|
    list.open @term
  end
end