Includes raw text link into edition bar
| 1 | module WikiHelper | module WikiHelper | 1 |
|---|---|---|---|
| 2 | 2 | ||
def raw_text_link(page) | 3 | ||
'| ' + link_to('View raw text'.t, | 4 | ||
:controller => :wiki, :action => 'raw', | 5 | ||
:page_name => page.name) | 6 | ||
end | 7 | ||
| 8 | |||
| 3 | def page_history_link(page) | def page_history_link(page) | 9 |
| 4 | case page.revisions.size | case page.revisions.size | 10 |
| 5 | when 0 then '' | when 0 then '' | 11 |
| 18 | :action => 'edit', | :action => 'edit', | 18 |
|---|---|---|---|
| 19 | :page_name => @page.name } )%> | :page_name => @page.name } )%> | 19 |
| 20 | <% end %> | <% end %> | 20 |
<%= raw_text_link(@page) -%> | 21 | ||
| 21 | <%= page_history_link(@page) -%> | <%= page_history_link(@page) -%> | 22 |
| 22 | </div> | </div> | 23 |
| 22 | 'Passwords do not match' => 'Senhas não conferem', | 'Passwords do not match' => 'Senhas não conferem', | 22 |
|---|---|---|---|
| 23 | 'Sign out' => 'Sair', | 'Sign out' => 'Sair', | 23 |
| 24 | 'Last update by %s at %s' => 'Última atualização por %s em %s', | 'Last update by %s at %s' => 'Última atualização por %s em %s', | 24 |
| 25 | 'Edit' => 'Editar', | ||
| 26 | '(requires authentication)' => '(identifique-se, por favor)', | ||
| 27 | '(not authorized)' => '(não autorizado)', | ||
| 28 | 'Latest news from %s' => 'Últimas notícias do %s', | 'Latest news from %s' => 'Últimas notícias do %s', | 25 |
| 29 | 'Recently changed suggestions' => 'Últimas sugestões modificadas', | 'Recently changed suggestions' => 'Últimas sugestões modificadas', | 26 |
| 30 | 'Scheduled events' => 'Eventos agendados', | 'Scheduled events' => 'Eventos agendados', | 27 |
| 56 more lines | |||
| 87 | 84 | ||
| 88 | # Older headlines and history pages | # Older headlines and history pages | 85 |
| 89 | 'Author' => 'Autor', | 'Author' => 'Autor', | 86 |
| 90 | 'Page has no history yet' => 'Página ainda sem histórico', | ||
| 91 | 'Page history for %s' => 'Histórico da página %s', | 'Page history for %s' => 'Histórico da página %s', | 87 |
| 92 | 'Page history (%s revisions)' => 'Histórico da página (%s revisões)', | ||
| 93 | 'Page history' => 'Histórico da página', | 'Page history' => 'Histórico da página', | 88 |
| 94 | '(Revision %s)' => '(Revisão %s)', | '(Revision %s)' => '(Revisão %s)', | 89 |
| 95 | 'Compare revisions' => 'Comparar revisões' | 'Compare revisions' => 'Comparar revisões', | 90 |
| 91 | |||
# Page details bar | 92 | ||
'Edit' => 'Editar', | 93 | ||
'(requires authentication)' => '(identifique-se, por favor)', | 94 | ||
'(not authorized)' => '(não autorizado)', | 95 | ||
'View raw text' => 'Mostrar em texto puro', | 96 | ||
'Page has no history yet' => 'Página ainda sem histórico', | 97 | ||
'Page history (%s revisions)' => 'Histórico da página (%s revisões)' | 98 | ||
| 96 | } | } | 99 |
| 493 | assert false, "Refering page expired after text-only edition" | assert false, "Refering page expired after text-only edition" | 493 |
|---|---|---|---|
| 494 | end | end | 494 |
| 495 | 495 | ||
def test_links_to_raw_wiki_text | 496 | ||
get :raw, :page_name => pages('multilanguage_page').name | 497 | ||
assert_xml_element %{//div[@class="toolbar bottombar")]/a[text() = "View raw text")]} | 498 | ||
end | 499 | ||
| 500 | |||
| 496 | def test_shows_raw_wiki_text | def test_shows_raw_wiki_text | 501 |
| 497 | page = pages('multilanguage_page') | page = pages('multilanguage_page') | 502 |
| 498 | get :raw, :page_name => page.name | get :raw, :page_name => page.name | 503 |