Ajuda da sintaxe
This commit is contained in:
@@ -61,6 +61,17 @@ module ApplicationHelper
|
||||
return image_tag("loading.gif", :id => "spinner_#{name}", :style => "display:none")
|
||||
end
|
||||
|
||||
def markup_enabled_field
|
||||
return "<p class='grey'>Este campo aceita as linguagens Markdown, Latex e HTML. " +
|
||||
link_to('Saiba mais.', '#', :id => 'show_markup_help') + spinner('help') + "</p>"
|
||||
end
|
||||
|
||||
def markup_help
|
||||
return "<div id='markup_help' style='display: none'>" +
|
||||
wiki(File.read("#{RAILS_ROOT}/public/static/markup_help.mkd")) +
|
||||
"</div>"
|
||||
end
|
||||
|
||||
def gravatar_url_for(email, size=80)
|
||||
"http://www.gravatar.com/avatar.php?gravatar_id=#{Digest::MD5.hexdigest(email)}&size=#{size}&default=#{App.default_avatar}"
|
||||
end
|
||||
|
||||
@@ -648,10 +648,14 @@ form dl {
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
||||
.grey {
|
||||
#header_menu .grey {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.content .grey {
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
border: 1px solid #ccc;
|
||||
padding: 2px;
|
||||
@@ -796,6 +800,32 @@ li p, td p {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
form dt p {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
#markup_help {
|
||||
background-color: #f4f4f4;
|
||||
border-bottom: 2px solid #eee;
|
||||
border-right: 2px solid #eee;
|
||||
margin: 9px 0px;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
#markup_help pre {
|
||||
margin: 0px;
|
||||
padding: 0px 9px;
|
||||
margin: 0px 36px;
|
||||
border: 1px dotted #aaa;
|
||||
}
|
||||
|
||||
#markup_help h3 {
|
||||
margin: 18px 0px 9px 0px;
|
||||
}
|
||||
#markup_help ul {
|
||||
margin: 9px 0px;
|
||||
}
|
||||
|
||||
|
||||
xbody { background-image: url(<%= App.base_path %>/prototype/line.png); background-repeat: repeat; }
|
||||
xhtml * { background-color: transparent !important; }
|
||||
|
||||
@@ -13,10 +13,11 @@
|
||||
|
||||
%dt
|
||||
%label{:for => 'user_name'} Nome completo
|
||||
%p.grey= "Atenção: contas com nomes fictícios ou inválidos serão excluídas sem aviso prévio." if defined?(signup) and signup
|
||||
%dd= text_field('user', 'name')
|
||||
|
||||
%dt
|
||||
%label{:for => 'user_display_name'} Nome de exibição
|
||||
%label{:for => 'user_display_name'} Nome de exibição (apelido)
|
||||
%dd= text_field('user', 'display_name')
|
||||
|
||||
%dt
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
%dd= text_field 'wiki_page', 'title'
|
||||
|
||||
%dt
|
||||
%label{:for =>'wiki_page_content'} Conteúdo
|
||||
%label{:for =>'wiki_page_content'}
|
||||
Conteúdo
|
||||
= markup_enabled_field
|
||||
%dd= preserve(text_area('wiki_page', 'content'))
|
||||
|
||||
- unless @wiki_page.new_record?
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
Visualizar
|
||||
= image_tag "loading.gif", :class => "spinner_button", :id => "spinner_preview", :style => "display: none"
|
||||
#wiki_preview{:style => "display: none"}
|
||||
|
||||
= preserve(markup_help)
|
||||
|
||||
@@ -11,3 +11,4 @@
|
||||
Visualizar
|
||||
= image_tag "loading.gif", :class => "spinner_button", :id => "spinner_preview", :style => "display: none"
|
||||
#wiki_preview{:style => "display: none"}
|
||||
= preserve(markup_help)
|
||||
|
||||
@@ -16,6 +16,14 @@ events['#show_preview:click'] = function(element, e)
|
||||
Event.stop(e);
|
||||
};
|
||||
|
||||
events['#show_markup_help:click'] = function(element, e)
|
||||
{
|
||||
Element.show('markup_help');
|
||||
new Effect.ScrollTo('markup_help');
|
||||
Event.stop(e);
|
||||
}
|
||||
|
||||
|
||||
function enumerate_headers()
|
||||
{
|
||||
elems = $('wiki_text').childElements();
|
||||
|
||||
69
public/static/markup_help.mkd
Normal file
69
public/static/markup_help.mkd
Normal file
@@ -0,0 +1,69 @@
|
||||
## Markdown
|
||||
|
||||
### Cabeçalhos
|
||||
- `# Este é um cabeçalho`
|
||||
- `## Este é um cabeçalho menor`
|
||||
- `#### Este é um cabeçalho ainda menor`
|
||||
|
||||
### Ênfase
|
||||
- `Esta _palavra_ será destacada`
|
||||
- `Esta **palavra** será ainda mais destacada`
|
||||
|
||||
### Listas
|
||||
<pre>1. Primeiro item
|
||||
2. Segundo item
|
||||
- Subitem
|
||||
- Subitem
|
||||
3. Terceiro item
|
||||
</pre>
|
||||
|
||||
### Citações
|
||||
<pre>> Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
|
||||
> Etiam ornare nisi quis elit. Donec ac odio. Pellentesque
|
||||
> blandit accumsan ipsum.
|
||||
</pre>
|
||||
|
||||
### Códigos fonte e textos não formatados
|
||||
- `O comando \`printf(x)\` escreve na tela`
|
||||
<pre>Este é um exemplo de código fonte com várias linhas:
|
||||
|
||||
tell application "Foo"
|
||||
beep
|
||||
end tell
|
||||
</pre>
|
||||
|
||||
### Links
|
||||
- `Este é [um exemplo](http://example.com) de link`
|
||||
- `Este é um [link relativo](/dashboad/)`
|
||||
- `Este é um link automatico: <http://example.com>`
|
||||
|
||||
### Links através de referências
|
||||
<pre>I get 10 times more traffic from [Google] [1] than from
|
||||
[Yahoo] [2] or [MSN] [3].
|
||||
|
||||
[1]: http://google.com/ "Google"
|
||||
[2]: http://search.yahoo.com/ "Yahoo Search"
|
||||
[3]: http://search.msn.com/ "MSN Search"</pre>
|
||||
|
||||
### Imagens
|
||||
- ``
|
||||
|
||||
### Mais informações
|
||||
- <http://en.wikipedia.org/wiki/Markdown>
|
||||
- <http://daringfireball.net/projects/markdown/syntax>
|
||||
|
||||
|
||||
## Latex
|
||||
|
||||
### Fórmulas inline
|
||||
<pre>Seja {$ G=(V,E) $} um grafo simples com {$ n $} vértices.</pre>
|
||||
|
||||
### Fórmulas em bloco
|
||||
<pre>{$$
|
||||
\sum_{i=0}^{n} x_{i}
|
||||
$$}</pre>
|
||||
|
||||
### Mais informações
|
||||
- [Guia de refência da Wikipédia sobre a sintaxe LaTeX](http://en.wikipedia.org/wiki/Help:Displaying_a_formula#Subscripts.2C_superscripts.2C_integrals)
|
||||
- [Lista de símbolos matemáticos](http://amath.colorado.edu/documentation/LaTeX/Symbols.pdf)
|
||||
|
||||
Reference in New Issue
Block a user