C0 code coverage information
Generated on Fri Aug 25 10:11:41 PDT 2006 with rcov 0.7.0
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
1 module ArticlesHelper
2
3 def article_page_tabs( pages, options = {}, read_only = false )
4 html_output = '<div id="page_tab_area">'
5 cols = options[:cols] || 40
6 rows = options[:rows] || 20
7
8 page_index = 1
9 if pages && pages.size > 0
10 pages.each do |page|
11
12 # set up the beginning of the Page tabs HTML
13 html_output << "<div class=\"page_tab\" id=\"page_tab_#{page_index}\""
14 html_output << ' style="display:none;"' unless page_index == 1
15 html_output << '>'
16
17 # create the text area field.
18 unless read_only
19 html_output << "<div sytle=\"float:none; clear:both;\"><label for=\"article_page_custom_title_#{page_index}\" class=\"inline\">Custom Page Title</label><br />"
20 html_output << "<input type=\"checkbox\" id=\"tog_title_#{page_index}\" #{"checked" unless page.custom_title and page.custom_title != ""} "
21 html_output << "onclick=\"Toggle.display('article_page_custom_title_#{page_index}');\" />"
22 html_output << "<input id=\"article_page_custom_title_#{page_index}\"#{ " style=\"display:none;\"" unless page.custom_title and page.custom_title != "" } "
23 html_output << "name=\"article_page[#{page_index}][custom_title]\" size=\"30\" max=\"100\" type=\"text\" value=\"#{page.custom_title}\" /></div><br />"
24 html_output << "<textarea id=\"article_page_body_#{page_index}\" name=\"article_page[#{page_index}][body]\""
25 html_output << "cols=\"#{cols}\" rows=\"#{rows}\">"
26 html_output << sanitize(page.body_with_tags)
27 html_output << "</textarea>\n</div>"
28 else
29 html_output << sanitize(page.body_with_tags)
30 html_output << '</div>'
31 end
32
33 page_index += 1
34 end
35 else
36 html_output << '<div class="page_tab" id="page_tab_1">'
37 unless read_only
38 html_output << "<div sytle=\"float:none; clear:both;\"><label for=\"article_page_custom_title_1\" class=\"inline\">Custom Page Title</label><br />"
39 html_output << "<input type=\"checkbox\" id=\"tog_title_1\" "
40 html_output << "onclick=\"Toggle.display('article_page_custom_title_1');\" />"
41 html_output << "<input id=\"article_page_custom_title_1\" style=\"display:none;\" "
42 html_output << "name=\"article_page[1][custom_title]\" size=\"30\" max=\"100\" type=\"text\" /></div><br />"
43 html_output << '<textarea id="article_page_body_1" name="article_page[1][body]"'
44 html_output << " cols=\"#{cols}\" rows=\"#{rows}\">"
45 html_output << "</textarea>\n</div>"
46 else
47 html_output << 'none'
48 html_output << '</div>'
49 end
50 end
51
52 html_output << '</div>'
53 unless read_only && pages.size < 1
54 html_output << '<div id="page_tab_button_area">'
55
56 page_count = 1
57 if pages.size > 0
58 page_count = pages.size
59 end
60
61 for page_index in 1..page_count
62 html_output << link_to_function("page #{page_index}", "showHideTabs(#{page_index}, numOfPages)",
63 :class => "page_tab#{ '_unselected' unless page_index == 1 }",
64 :id => "page_tab_button_#{page_index}" )
65
66 html_output << link_to_function("X", "removePage(#{page_index})",
67 :class => "page_tab",
68 :id => "page_tab_remove_#{page_index}" ) unless page_index == 1 or read_only
69 end
70 html_output << '</div>'
71 end
72
73 unless read_only
74 html_output << link_to_function("Add Page", 'addPage(++numOfPages)', {:class => 'button'}) << "<br /><br />"
75 end
76 html_output
77 end
78
79 def article_links_editor(links)
80 html_output = '<div id="artcle_links_editor">'
81
82 link_index = 1
83 if links && links.size > 0
84 links.each do |link|
85 html_output << "<div class=\"link_edit_area\" id=\"link_edit_area_#{link_index}\">"
86 html_output << "<label>Url</label> <input type=\"text\" id=\"link_url_#{link_index}\" name=\"link[#{link_index}][url]\""
87 html_output << "value=\"#{link.url}\"" if link.url
88 html_output << "/>#{ link_to_function("Delete", "deleteLink(#{link_index})", {:class => 'button'})}<br />"
89 html_output << "<label>Title</label> <input type=\"text\" id=\"link_title_#{link_index}\" name=\"link[#{link_index}][title]\""
90 html_output << "value=\"#{link.title}\"" if link.title
91 html_output << '/></div>'
92 link_index += 1
93 end
94 else
95 html_output << '<div class="link_edit_area" id="link_edit_area_1">'
96 html_output << '<label>Url</label> <input type="text" id="link_url_1" name="link[1][url]"'
97 html_output << "/>#{ link_to_function("Delete", "deleteLink(1)", {:class => 'button'})}<br />"
98 html_output << '<label>Title</label> <input type="text" id="link_title_1" name="link[1][title]"'
99 html_output << '/></div>'
100 end
101
102 html_output << '</div>' << link_to_function("Add Link", 'addLink(++numOfLinks)', {:class => 'button'}) << "<br /><br />"
103 end
104
105 def article_media_links_editor(links)
106 html_output = '<div id="artcle_media_links_editor">'
107
108 link_index = 1
109 if links && links.size > 0
110 links.each do |link|
111 html_output << "<div class=\"link_edit_area\" id=\"media_link_edit_area_#{link_index}\">"
112 html_output << "<label>Url</label> <input type=\"text\" id=\"media_link_url_#{link_index}\" name=\"media_link[#{link_index}][url]\""
113 html_output << "value=\"#{link.url}\"" if link.url
114 html_output << "/>#{ link_to_function("Delete", "deleteMediaLink(#{link_index})", {:class => 'button'})}<br />"
115 html_output << "<label>Artist</label> <input type=\"text\" id=\"media_link_artist_#{link_index}\" name=\"media_link[#{link_index}][artist]\""
116 html_output << "value=\"#{link.artist}\"" if link.artist
117 html_output << '/><br />'
118 html_output << "<label>Title</label> <input type=\"text\" id=\"media_link_title_#{link_index}\" name=\"media_link[#{link_index}][title]\""
119 html_output << "value=\"#{link.title}\"" if link.title
120 html_output << '/>'
121 html_output << "<select id=\"media_link_media_type_#{link_index}\" name=\"media_link[#{link_index}][media_type]\">"
122 html_output << '<option value="2"'
123 html_output << ' selected="selected"' if link.media_type == MediaLink::MP3
124 html_output << '>MP3</option><option value="3"'
125 html_output << ' selected="selected"' if link.media_type == MediaLink::VIDEO
126 html_output << '>Video</option><option value="4"'
127 html_output << ' selected="selected"' if link.media_type == MediaLink::STREAM
128 html_output << '>Stream</option><option value="1"'
129 html_output << ' selected="selected"' if link.media_type == MediaLink::OTHER
130 html_output << '>Other</option>'
131 html_output << '</select></div>'
132 link_index += 1
133 end
134 else
135 html_output << '<div class="link_edit_area" id="media_link_edit_area_1">'
136 html_output << '<label>Url</label> <input type="text" id="media_link_url_1" name="media_link[1][url]"'
137 html_output << "/>#{ link_to_function("Delete", "deleteMediaLink(1)", {:class => 'button'})}<br />"
138 html_output << '<label>Artist</label> <input type="text" id="media_link_artist_1" name="media_link[1][artist]"/><br />'
139 html_output << '<label>Title</label> <input type="text" id="media_link_title_1" name="media_link[1][title]"'
140 html_output << '/><select id="media_link_media_type_1" name="media_link[1][media_type]">'
141 html_output << '<option value="2">MP3</option><option value="3">Video</option>'
142 html_output << '<option value="4">Stream</option><option value="1">Other</option></select></div>'
143 end
144
145 html_output << '</div>' << link_to_function("Add Link", 'addMediaLink(++numOfMediaLinks)', {:class => 'button'}) << "<br /><br />"
146 end
147
148 end
Generated using the rcov code coverage analysis tool for Ruby version 0.7.0.