| 143 | | p do |
| 144 | | small do |
| 145 | | span "welcome to " ; a 'tepee', :href => "http://code.whytheluckystiff.net/svn/camping/trunk/examples/tepee.rb" |
| 146 | | span '. go ' ; a 'home', :href => R(Show, 'home') |
| 147 | | span '. list all ' ; a 'pages', :href => R(List) |
| | 153 | div :id=>'doc' do |
| | 154 | p do |
| | 155 | small do |
| | 156 | span "welcome to " ; a 'tepee', :href => "http://code.whytheluckystiff.net/svn/camping/trunk/examples/tepee.rb" |
| | 157 | span '. go ' ; a 'home', :href => R(Show, 'home') |
| | 158 | span '. list all ' ; a 'pages', :href => R(List) |
| | 159 | end |
| | 160 | end |
| | 161 | div.content do |
| | 162 | self << yield |
| | 169 | end |
| | 170 | end |
| | 171 | |
| | 172 | def _show_error(box) |
| | 173 | if @boxx |
| | 174 | line_no = (@boxx.to_s.scan(/(\d+)/).flatten[1] || "1").to_i - @line_zero - 1 |
| | 175 | b { div.error! @boxx } #.to_s.gsub(/.eval.:\d+:/, '') |
| | 176 | pre.plain do |
| | 177 | @version.body.split("\n").each_with_index do |line, index| |
| | 178 | n = index+1 |
| | 179 | text = n.to_s + ': ' + CGI::escapeHTML(line) |
| | 180 | self << div.highlight { text } if (n == line_no) |
| | 181 | self << text if (n != line_no) |
| | 182 | end |
| | 183 | end |
| | 184 | end |
| | 185 | end |
| | 186 | |
| | 187 | def _show_actions |
| | 188 | small do |
| | 189 | span.actions do |
| | 190 | text "Version #{@version.version} " |
| | 191 | text "(current) " if @version.version == @page.version |
| | 192 | a '«older', :href => R(Show, @version.title, @version.version-1) unless @version.version == 1 |
| | 193 | a 'newer»', :href => R(Show, @version.title, @version.version+1) unless @version.version == @page.version |
| | 194 | a 'current', :href => R(Show, @version.title) unless @version.version == @page.version |
| | 195 | a 'versions', :href => R(Versions, @page.title) |
| | 196 | end |
| 165 | | if @boxx |
| 166 | | line_no = (@boxx.to_s.scan(/(\d+)/).flatten[1] || "1").to_i - @line_zero - 1 |
| 167 | | b { div.error! @boxx } #.to_s.gsub(/.eval.:\d+:/, '') |
| 168 | | pre.plain do |
| 169 | | @version.body.split("\n").each_with_index do |line, index| |
| 170 | | n = index+1 |
| 171 | | text = n.to_s + ': ' + CGI::escapeHTML(line) |
| 172 | | self << div.highlight { text } if (n == line_no) |
| 173 | | self << text if (n != line_no) |
| 174 | | end |
| 175 | | end |
| 176 | | end |
| 177 | | p.actions do |
| 178 | | _button 'edit', :href => R(Edit, @version.title, @version.version) |
| 179 | | _button 'back', :href => R(Show, @version.title, @version.version-1) unless @version.version == 1 |
| 180 | | _button 'next', :href => R(Show, @version.title, @version.version+1) unless @version.version == @page.version |
| 181 | | _button 'current', :href => R(Show, @version.title) unless @version.version == @page.version |
| 182 | | _button 'versions', :href => R(Versions, @page.title) |
| 183 | | end |
| | 207 | |
| | 208 | _show_error(@boxx) |
| | 209 | _button 'edit', R(Edit, @version.title, @version.version), { :style=>'float: right; margin: 5px 0 0 5px;' } if (@version.version == @page.version && @version.body && @version.body.size > 20) |
| | 210 | p { _show_actions } |
| 214 | | _button 'show', :href => R(Show, page.title, page.version) |
| 215 | | _button 'edit', :href => R(Edit, page.title, page.version) |
| | 242 | _button 'show', R(Show, page.title, page.version) |
| | 243 | _button 'edit', R(Edit, page.title, page.version) |
| 221 | | def _button(text, options={}) |
| 222 | | form :method=>:get, :action=>options[:href] do |
| 223 | | input :type=>'submit', :name=>'submit', :value=>text |
| | 249 | def _button(text, href, options={}) |
| | 250 | form :method=>:get, :action=>href do |
| | 251 | opts = {:type=>'submit', :name=>'submit', :value=>text}.merge(options) |
| | 252 | input.button opts |