Module: ForumsMethods
- Defined in:
- lib/kuali-sakai-common-lib/forums.rb
Overview
The forums page in a particular Site
Instance Method Summary collapse
- #delete_forum(name) ⇒ Object
- #delete_topic(name) ⇒ Object
-
#draft?(title) ⇒ Boolean
Pass this method a string that matches the title of a Forum on the page, it returns True if the specified forum row has “DRAFT” in it.
- #forum_settings(name) ⇒ Object
- #forum_titles ⇒ Object
- #forums_table ⇒ Object
- #new_forum ⇒ Object
- #new_topic_for_forum(name) ⇒ Object
- #open_forum(forum_title) ⇒ Object
- #open_topic(topic_title) ⇒ Object
- #organize ⇒ Object
- #template_settings ⇒ Object
- #topic_settings(name) ⇒ Object
- #topic_titles ⇒ Object
Instance Method Details
#delete_forum(name) ⇒ Object
67 68 69 70 71 |
# File 'lib/kuali-sakai-common-lib/forums.rb', line 67 def delete_forum(name) index = forum_titles.index(name) frm.link(:id=>/msgForum:forums:\d+:delete/,:text=>"Delete", :index=>index).click EditForum.new(@browser) end |
#delete_topic(name) ⇒ Object
73 74 75 76 77 |
# File 'lib/kuali-sakai-common-lib/forums.rb', line 73 def delete_topic(name) index = topic_titles.index(name) frm.link(:id=>/topics:\d+:delete_confirm/, :text=>"Delete", :index=>index).click AddEditTopic.new(@browser) end |
#draft?(title) ⇒ Boolean
Pass this method a string that matches the title of a Forum on the page, it returns True if the specified forum row has “DRAFT” in it.
12 13 14 |
# File 'lib/kuali-sakai-common-lib/forums.rb', line 12 def draft?(title) frm.table(:id=>"msgForum:forums").row(:text=>/#{Regexp.escape(title)}/).span(:text=>"DRAFT").exist? end |
#forum_settings(name) ⇒ Object
55 56 57 58 59 |
# File 'lib/kuali-sakai-common-lib/forums.rb', line 55 def forum_settings(name) index = forum_titles.index(name) frm.link(:text=>"Forum Settings", :index=>index).click EditForum.new(@browser) end |
#forum_titles ⇒ Object
41 42 43 44 45 46 |
# File 'lib/kuali-sakai-common-lib/forums.rb', line 41 def forum_titles titles = [] title_links = frm.div(:class=>"portletBody").links.find_all { |link| link.class_name=="title" && link.id=="" } title_links.each { |link| titles << link.text } return titles end |
#forums_table ⇒ Object
37 38 39 |
# File 'lib/kuali-sakai-common-lib/forums.rb', line 37 def forums_table frm.div(:class=>"portletBody").table(:id=>"msgForum:forums") end |
#new_forum ⇒ Object
16 17 18 19 |
# File 'lib/kuali-sakai-common-lib/forums.rb', line 16 def new_forum frm.link(:text=>"New Forum").click EditForum.new(@browser) end |
#new_topic_for_forum(name) ⇒ Object
21 22 23 24 25 |
# File 'lib/kuali-sakai-common-lib/forums.rb', line 21 def new_topic_for_forum(name) index = forum_titles.index(name) frm.link(:text=>"New Topic", :index=>index).click AddEditTopic.new(@browser) end |
#open_forum(forum_title) ⇒ Object
79 80 81 82 |
# File 'lib/kuali-sakai-common-lib/forums.rb', line 79 def open_forum(forum_title) frm.link(:text=>forum_title).click # New Class def goes here. end |
#open_topic(topic_title) ⇒ Object
84 85 86 87 |
# File 'lib/kuali-sakai-common-lib/forums.rb', line 84 def open_topic(topic_title) frm.link(:text=>topic_title).click TopicPage.new(@browser) end |
#organize ⇒ Object
27 28 29 30 |
# File 'lib/kuali-sakai-common-lib/forums.rb', line 27 def organize frm.link(:text=>"Organize").click OrganizeForums.new(@browser) end |
#template_settings ⇒ Object
32 33 34 35 |
# File 'lib/kuali-sakai-common-lib/forums.rb', line 32 def template_settings frm.link(:text=>"Template Settings").click ForumTemplateSettings.new(@browser) end |
#topic_settings(name) ⇒ Object
61 62 63 64 65 |
# File 'lib/kuali-sakai-common-lib/forums.rb', line 61 def topic_settings(name) index = topic_titles.index(name) frm.link(:text=>"Topic Settings", :index=>index).click AddEditTopic.new(@browser) end |
#topic_titles ⇒ Object
48 49 50 51 52 53 |
# File 'lib/kuali-sakai-common-lib/forums.rb', line 48 def topic_titles titles = [] title_links = frm.div(:class=>"portletBody").links.find_all { |link| link.class_name == "title" && link.id != "" } title_links.each { |link| titles << link.text } return titles end |