Class: HTMLPageObject
- Inherits:
-
Object
- Object
- HTMLPageObject
- Includes:
- DataFactory, Foundry, StringFactory, Workflows
- Defined in:
- lib/sambal-cle/data_objects/resource.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#folder ⇒ Object
Returns the value of attribute folder.
-
#html ⇒ Object
(also: #content)
Returns the value of attribute html.
-
#name ⇒ Object
(also: #title)
Returns the value of attribute name.
-
#site ⇒ Object
Returns the value of attribute site.
-
#url ⇒ Object
(also: #href)
Returns the value of attribute url.
Instance Method Summary collapse
- #create ⇒ Object
- #edit_content(html_source) ⇒ Object
-
#initialize(browser, opts = {}) ⇒ HTMLPageObject
constructor
A new instance of HTMLPageObject.
Methods included from Workflows
menu_link, #open_my_site_by_name, #reset
Constructor Details
#initialize(browser, opts = {}) ⇒ HTMLPageObject
Returns a new instance of HTMLPageObject.
103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/sambal-cle/data_objects/resource.rb', line 103 def initialize(browser, opts={}) @browser = browser defaults = { :name=>random_alphanums, :description=>random_multiline(100, 15, :alpha), :html=>"<body>Body</body>" } = defaults.merge(opts) () requires @site end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
101 102 103 |
# File 'lib/sambal-cle/data_objects/resource.rb', line 101 def description @description end |
#folder ⇒ Object
Returns the value of attribute folder.
101 102 103 |
# File 'lib/sambal-cle/data_objects/resource.rb', line 101 def folder @folder end |
#html ⇒ Object Also known as: content
Returns the value of attribute html.
101 102 103 |
# File 'lib/sambal-cle/data_objects/resource.rb', line 101 def html @html end |
#name ⇒ Object Also known as: title
Returns the value of attribute name.
101 102 103 |
# File 'lib/sambal-cle/data_objects/resource.rb', line 101 def name @name end |
#site ⇒ Object
Returns the value of attribute site.
101 102 103 |
# File 'lib/sambal-cle/data_objects/resource.rb', line 101 def site @site end |
#url ⇒ Object Also known as: href
Returns the value of attribute url.
101 102 103 |
# File 'lib/sambal-cle/data_objects/resource.rb', line 101 def url @url end |
Instance Method Details
#create ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/sambal-cle/data_objects/resource.rb', line 121 def create open_my_site_by_name @site resources on_page Resources do |page| page.create_html_page_in @folder end on_page EditHTMLPageContent do |page| page.enter_source_text page.editor, @html page.continue end on_page EditHTMLPageProperties do |page| page.name.set @name page.description.set @description # Put more here as needed later page.finish end on_page Resources do |page| @url = page.href(@name) end end |
#edit_content(html_source) ⇒ Object
142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/sambal-cle/data_objects/resource.rb', line 142 def edit_content(html_source) open_my_site_by_name @site resources on Resources do |fileslist| fileslist.open_folder @folder unless fileslist.item(@name).present? || @folder==nil fileslist.edit_content @name end on EditHTMLPageContent do |edit| edit.enter_source_text edit.editor, html_source edit.continue end @html=html_source end |