diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b09b765..f4af114 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -61,6 +61,17 @@ module ApplicationHelper return image_tag("loading.gif", :id => "spinner_#{name}", :style => "display:none") end + def markup_enabled_field + return "

Este campo aceita as linguagens Markdown, Latex e HTML. " + + link_to('Saiba mais.', '#', :id => 'show_markup_help') + spinner('help') + "

" + end + + def markup_help + return "" + 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 diff --git a/app/views/stylesheets/wiki.css.erb b/app/views/stylesheets/wiki.css.erb index b34f9c5..d42669c 100644 --- a/app/views/stylesheets/wiki.css.erb +++ b/app/views/stylesheets/wiki.css.erb @@ -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; } diff --git a/app/views/users/_form_settings.html.haml b/app/views/users/_form_settings.html.haml index 9565046..670e182 100644 --- a/app/views/users/_form_settings.html.haml +++ b/app/views/users/_form_settings.html.haml @@ -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 diff --git a/app/views/wiki/_form.html.haml b/app/views/wiki/_form.html.haml index 4ed51dc..d7fa767 100644 --- a/app/views/wiki/_form.html.haml +++ b/app/views/wiki/_form.html.haml @@ -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? diff --git a/app/views/wiki/edit.html.haml b/app/views/wiki/edit.html.haml index f74f06f..56b3340 100644 --- a/app/views/wiki/edit.html.haml +++ b/app/views/wiki/edit.html.haml @@ -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) diff --git a/app/views/wiki/new.html.haml b/app/views/wiki/new.html.haml index 4d826fe..524403e 100644 --- a/app/views/wiki/new.html.haml +++ b/app/views/wiki/new.html.haml @@ -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) diff --git a/public/javascripts/wiki.js b/public/javascripts/wiki.js index 6872c9f..d8cd434 100644 --- a/public/javascripts/wiki.js +++ b/public/javascripts/wiki.js @@ -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(); diff --git a/public/static/markup_help.mkd b/public/static/markup_help.mkd new file mode 100644 index 0000000..d51df47 --- /dev/null +++ b/public/static/markup_help.mkd @@ -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 +
1. Primeiro item
+2. Segundo item
+   - Subitem
+   - Subitem
+3. Terceiro item
+
+ +### Citações +
>  Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+>  Etiam ornare nisi quis elit. Donec ac odio. Pellentesque
+>  blandit accumsan ipsum.
+
+ +### Códigos fonte e textos não formatados +- `O comando \`printf(x)\` escreve na tela` +
Este é um exemplo de código fonte com várias linhas:
+
+    tell application "Foo"
+        beep
+    end tell
+
+ +### Links +- `Este é [um exemplo](http://example.com) de link` +- `Este é um [link relativo](/dashboad/)` +- `Este é um link automatico: ` + +### Links através de referências +
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"
+ +### Imagens +- `![Descricao da imagem](http://example.com/imagem.jpg)` + +### Mais informações +- +- + + +## Latex + +### Fórmulas inline +
Seja {$ G=(V,E) $} um grafo simples com {$ n $} vértices.
+ +### Fórmulas em bloco +
{$$
+  \sum_{i=0}^{n} x_{i}
+$$}
+ +### 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) +