Class: ForumObject

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

Overview

Note that this class is for icon-sakai-forums. NOT jforums.

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 = {}) ⇒ ForumObject

Returns a new instance of ForumObject.



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

def initialize(browser, opts={})
  @browser = browser
  
  defaults = {
    :title=>random_alphanums
  }
  options = defaults.merge(opts)
  
  set_options(options)
  requires @site
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



9
10
11
# File 'lib/sambal-cle/data_objects/forum.rb', line 9

def description
  @description
end

#description_htmlObject

Returns the value of attribute description_html.



9
10
11
# File 'lib/sambal-cle/data_objects/forum.rb', line 9

def description_html
  @description_html
end

Returns the value of attribute direct_link.



9
10
11
# File 'lib/sambal-cle/data_objects/forum.rb', line 9

def direct_link
  @direct_link
end

#short_descriptionObject

Returns the value of attribute short_description.



9
10
11
# File 'lib/sambal-cle/data_objects/forum.rb', line 9

def short_description
  @short_description
end

#siteObject

Returns the value of attribute site.



9
10
11
# File 'lib/sambal-cle/data_objects/forum.rb', line 9

def site
  @site
end

#titleObject Also known as: name

Returns the value of attribute title.



9
10
11
# File 'lib/sambal-cle/data_objects/forum.rb', line 9

def title
  @title
end

Instance Method Details

#createObject



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

def create
  open_my_site_by_name @site
  forums
  on Forums do |forums|
    forums.new_forum
  end
  on EditForum do |edit|
    edit.title.set @title
    edit.short_description.fit @short_description
    edit.enter_source_text(edit.editor, @description) unless @description==nil
    edit.save
  end
end

#deleteObject



70
71
72
# File 'lib/sambal-cle/data_objects/forum.rb', line 70

def delete
  
end

#edit(opts = {}) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/sambal-cle/data_objects/forum.rb', line 40

def edit opts={}
  open_my_site_by_name @site
  forums unless @browser.title=~/Forums$/
  on Forums do |forum|
    forum.forum_settings @title
  end
  on EditForum do |edit|
    edit.title.fit opts[:title]
    edit.short_description.fit opts[:short_description]
    unless opts[:description] == nil
      edit.enter_source_text edit.editor, opts[:description]
    end
    edit.save
  end
  set_options(opts)
end

#get_entity_infoObject



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/sambal-cle/data_objects/forum.rb', line 74

def get_entity_info
  open_my_site_by_name @site
  forums
  # TODO: Something will probably be needed here, in case we're currently
  # on a Forum page already.
  on Forums do |forum|
    forum.forum_settings @title
  end
  on EditForum do |edit|
    edit.entity_picker edit.editor
  end
  on EntityPicker do |pick|
    pick.view_forum_details @title
    @direct_link = pick.direct_link
    # TODO: put more entity info stuff here!!
    pick.close_picker
  end
  on EditForum do |edit|
    edit.cancel
  end
end

#viewObject



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/sambal-cle/data_objects/forum.rb', line 57

def view
  open_my_site_by_name @site
  forums
  on Forums do |forum|
    forum.open_forum @title
  end
  on ForumView do |view|
    @short_description = view.short_description
    view.view_full_description
    @description_html = view.description_html
  end
end