Class: TopicObject

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

Returns a new instance of TopicObject.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/sambal-cle/data_objects/forum.rb', line 109

def initialize(browser, opts={})
  @browser = browser
  
  defaults = {
    :title=>random_alphanums,
    :short_description=>random_alphanums,
    :description=>random_alphanums,

  }
  options = defaults.merge(opts)
  
  set_options(options)
  requires @site, @forum
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



105
106
107
# File 'lib/sambal-cle/data_objects/forum.rb', line 105

def author
  @author
end

#date_createdObject

Returns the value of attribute date_created.



105
106
107
# File 'lib/sambal-cle/data_objects/forum.rb', line 105

def date_created
  @date_created
end

#date_modifiedObject

Returns the value of attribute date_modified.



105
106
107
# File 'lib/sambal-cle/data_objects/forum.rb', line 105

def date_modified
  @date_modified
end

#descriptionObject

Returns the value of attribute description.



105
106
107
# File 'lib/sambal-cle/data_objects/forum.rb', line 105

def description
  @description
end

#description_htmlObject

Returns the value of attribute description_html.



105
106
107
# File 'lib/sambal-cle/data_objects/forum.rb', line 105

def description_html
  @description_html
end

Returns the value of attribute direct_link.



105
106
107
# File 'lib/sambal-cle/data_objects/forum.rb', line 105

def direct_link
  @direct_link
end

#forumObject

Returns the value of attribute forum.



105
106
107
# File 'lib/sambal-cle/data_objects/forum.rb', line 105

def forum
  @forum
end

#moderatedObject

Returns the value of attribute moderated.



105
106
107
# File 'lib/sambal-cle/data_objects/forum.rb', line 105

def moderated
  @moderated
end

#modified_byObject

Returns the value of attribute modified_by.



105
106
107
# File 'lib/sambal-cle/data_objects/forum.rb', line 105

def modified_by
  @modified_by
end

#short_descriptionObject

Returns the value of attribute short_description.



105
106
107
# File 'lib/sambal-cle/data_objects/forum.rb', line 105

def short_description
  @short_description
end

#siteObject

Returns the value of attribute site.



105
106
107
# File 'lib/sambal-cle/data_objects/forum.rb', line 105

def site
  @site
end

#titleObject Also known as: name

Returns the value of attribute title.



105
106
107
# File 'lib/sambal-cle/data_objects/forum.rb', line 105

def title
  @title
end

Instance Method Details

#createObject



126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/sambal-cle/data_objects/forum.rb', line 126

def create
  open_my_site_by_name @site
  forums
  on Forums do |forums|
    forums.new_topic_for_forum @forum
  end
  on AddEditTopic do |add|
    add.title.set @title
    add.short_description.set @short_description
    add.enter_source_text add.editor, @description
    add.save
  end
end

#deleteObject



172
173
174
# File 'lib/sambal-cle/data_objects/forum.rb', line 172

def delete
  
end

#edit(opts = {}) ⇒ Object



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/sambal-cle/data_objects/forum.rb', line 140

def edit opts={}
  open_my_site_by_name @site
  forums
  on Forums do |forum|
    reset
    forum.topic_settings @title
  end
  on AddEditTopic 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



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/sambal-cle/data_objects/forum.rb', line 176

def get_entity_info
  open_my_site_by_name @site
  forums
  on Forums do |forums|
    forums.topic_settings @title
  end
  on AddEditTopic do |topic|
    topic.entity_picker topic.editor
  end
  on EntityPicker do |picker|
    picker.view_topic_details @forum, @title
    @author = picker.author
    @moderated = picker.moderated
    @modified_by = picker.modified_by
    @date_modified = picker.date_modified
    @date_created = picker.date_created
    @direct_link = picker.direct_link
    picker.close_picker
  end
  on AddEditTopic do |topic|
    topic.cancel
  end
end

#viewObject



158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/sambal-cle/data_objects/forum.rb', line 158

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