Class: AnnouncementObject
- Inherits:
-
Object
- Object
- AnnouncementObject
- Includes:
- DataFactory, DateFactory, Foundry, StringFactory, Workflows
- Defined in:
- lib/sambal-cle/data_objects/announcement.rb
Instance Attribute Summary collapse
-
#access ⇒ Object
Returns the value of attribute access.
-
#availability ⇒ Object
Returns the value of attribute availability.
-
#body ⇒ Object
Returns the value of attribute body.
-
#creation_date ⇒ Object
Returns the value of attribute creation_date.
-
#date ⇒ Object
Returns the value of attribute date.
-
#groups ⇒ Object
Returns the value of attribute groups.
-
#id ⇒ Object
Returns the value of attribute id.
-
#link ⇒ Object
Returns the value of attribute link.
-
#message ⇒ Object
Returns the value of attribute message.
-
#message_html ⇒ Object
Returns the value of attribute message_html.
-
#saved_by ⇒ Object
Returns the value of attribute saved_by.
-
#site ⇒ Object
Returns the value of attribute site.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#title ⇒ Object
(also: #name)
Returns the value of attribute title.
Instance Method Summary collapse
- #create ⇒ Object
- #edit(opts = {}) ⇒ Object
-
#initialize(browser, opts = {}) ⇒ AnnouncementObject
constructor
A new instance of AnnouncementObject.
- #view ⇒ Object
Methods included from Workflows
menu_link, #open_my_site_by_name, #reset
Constructor Details
#initialize(browser, opts = {}) ⇒ AnnouncementObject
Returns a new instance of AnnouncementObject.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 13 def initialize(browser, opts={}) @browser = browser defaults = { :title=>random_alphanums, :body=>random_multiline(500, 10, :alpha) } = defaults.merge(opts) () requires @site end |
Instance Attribute Details
#access ⇒ Object
Returns the value of attribute access.
9 10 11 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 9 def access @access end |
#availability ⇒ Object
Returns the value of attribute availability.
9 10 11 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 9 def availability @availability end |
#body ⇒ Object
Returns the value of attribute body.
9 10 11 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 9 def body @body end |
#creation_date ⇒ Object
Returns the value of attribute creation_date.
9 10 11 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 9 def creation_date @creation_date end |
#date ⇒ Object
Returns the value of attribute date.
9 10 11 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 9 def date @date end |
#groups ⇒ Object
Returns the value of attribute groups.
9 10 11 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 9 def groups @groups end |
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 9 def id @id end |
#link ⇒ Object
Returns the value of attribute link.
9 10 11 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 9 def link @link end |
#message ⇒ Object
Returns the value of attribute message.
9 10 11 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 9 def @message end |
#message_html ⇒ Object
Returns the value of attribute message_html.
9 10 11 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 9 def @message_html end |
#saved_by ⇒ Object
Returns the value of attribute saved_by.
9 10 11 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 9 def saved_by @saved_by end |
#site ⇒ Object
Returns the value of attribute site.
9 10 11 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 9 def site @site end |
#subject ⇒ Object
Returns the value of attribute subject.
9 10 11 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 9 def subject @subject end |
#title ⇒ Object Also known as: name
Returns the value of attribute title.
9 10 11 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 9 def title @title end |
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 27 def create open_my_site_by_name @site announcements on_page Announcements do |page| page.add end on_page AddEditAnnouncements do |page| page.title.set @title page.enter_source_text page.editor, @body page.add_announcement @creation_date=make_date Time.now end on_page Announcements do |page| @link = page.href(@title) @id = @link[/(?<=msg\/).+(?=\/main\/)/] end end |
#edit(opts = {}) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 45 def edit opts={} open_my_site_by_name @site announcements on_page Announcements do |list| list.edit @title end on AddEditAnnouncements do |edit| edit.title.fit opts[:title] edit.send(opts[:access]) unless opts[:access]==nil edit.send(opts[:availability]) unless opts[:availability]==nil unless opts[:body]==nil edit.enter_source_text edit.editor, opts[:body] end edit.save_changes end (opts) end |
#view ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/sambal-cle/data_objects/announcement.rb', line 63 def view open_my_site_by_name @site announcements on Announcements do |list| list.view @title end on ViewAnnouncement do |view| @subject=view.subject @saved_by=view.saved_by @date=view.date @groups=view.groups @message=view. @message_html=view. end end |