diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index dd4ee5c08..f93848024 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -9,6 +9,10 @@ class StaticController < ApplicationController def error end + def dtext_help + redirect_to wiki_page_path("help:dtext") unless request.format.js? + end + def site_map end @@ -17,5 +21,5 @@ class StaticController < ApplicationController @post_set = PostSets::Popular.new(Date.yesterday.to_s, "week", limit: 200) @posts = @post_set.posts render layout: false - end + end end diff --git a/app/javascript/src/styles/common/dtext.scss b/app/javascript/src/styles/common/dtext.scss index 8137331ba..f93cfea03 100644 --- a/app/javascript/src/styles/common/dtext.scss +++ b/app/javascript/src/styles/common/dtext.scss @@ -135,3 +135,19 @@ div.dtext-preview { margin-left: 1em; } } + +div#dtext-help { + td { + > *, div.spoiler p { + margin: 0; + } + + h1, h6 { + padding: 0; + } + } + + #dtext-help-footnote { + margin: 1em 0 0 0; + } +} diff --git a/app/views/dtext/_form.html.erb b/app/views/dtext/_form.html.erb index 9ec8894ca..8e763fadb 100644 --- a/app/views/dtext/_form.html.erb +++ b/app/views/dtext/_form.html.erb @@ -10,5 +10,5 @@ <% end %>
- All text is formatted using <%= link_to_wiki "DText", "help:dtext" %> + <%= link_to "Formatting help", dtext_help_path, remote: true, method: :get %>. diff --git a/app/views/static/_dtext_help.html.erb b/app/views/static/_dtext_help.html.erb new file mode 100644 index 000000000..d4892b910 --- /dev/null +++ b/app/views/static/_dtext_help.html.erb @@ -0,0 +1,96 @@ +| What you type | +What you get | +
|---|---|
| [b]bold[/b] | +bold | +
| [i]italics[/i] | +italics | +
| [u]underline[/u] | +underline | +
| [s]strikethrough[/s] | +|
| [tn]note[/tn] | +<%= format_text "[tn]note[/tn]" %> | +
| [spoilers]ssh![/spoilers] | +<%= format_text " [spoilers]ssh![/spoilers]" %> | +
| <<%= root_url.chomp("/") %>> | +<%= format_text root_url.chomp("/") %> | +
| "<%= Danbooru.config.app_name %>":[<%= root_url.chomp("/") %>] | +<%= format_text "\"#{Danbooru.config.app_name}\":[#{root_url.chomp("/")}]" %> | +
| [[Kantai Collection]] | +<%= format_text "[[Kantai Collection]]" %> | +
| [[Kantai Collection|Kancolle]] | +<%= format_text "[[Kantai Collection|Kancolle]]" %> | +
| [[Kaga (Kantai Collection)|]] | +<%= format_text "[[Kaga (Kantai Collection)|]]" %> | +
| {{kantai_collection comic}} | +<%= format_text "{{kantai_collection comic}}" %> | +
| @user | +<%= format_text "@user" %> | +
| post #1 | +<%= format_text "post #1" %> | +
| topic #1 | +<%= format_text "topic #1" %> | +
|
+ * one + * two + * three + |
+ <%= format_text "* one\n* two\n* three" %> | +
| h1. Big header | +<%= format_text "h1. Big header" %> | +
| h6. Small header | +<%= format_text "h6. Small header" %> | +
| [quote]Somebody said: hi![/quote] | +<%= format_text "[quote]Somebody said: hi![/quote]" %> | +
+ See <%= link_to_wiki "help:dtext" %> for more formatting help. +
+