dtext: add dtext cheatsheet popup.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
<% end %>
|
||||
<div id="<%= preview_id %>" class="dtext-preview prose"></div>
|
||||
</div>
|
||||
<span class="hint">All text is formatted using <%= link_to_wiki "DText", "help:dtext" %></span>
|
||||
<span class="hint"><%= link_to "Formatting help", dtext_help_path, remote: true, method: :get %>.</span>
|
||||
</div>
|
||||
|
||||
96
app/views/static/_dtext_help.html.erb
Normal file
96
app/views/static/_dtext_help.html.erb
Normal file
@@ -0,0 +1,96 @@
|
||||
<div id="dtext-help" class="prose">
|
||||
<table class="striped" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="50%">What you type</th>
|
||||
<th width="50%">What you get</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>[b]bold[/b]</td>
|
||||
<td><b>bold</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[i]italics[/i]</td>
|
||||
<td><i>italics</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[u]underline[/u]</td>
|
||||
<td><u>underline</u></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[s]strikethrough[/s]</td>
|
||||
<td><s>strikethrough</s></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[tn]note[/tn]</td>
|
||||
<td><%= format_text "[tn]note[/tn]" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[spoilers]ssh![/spoilers]</td>
|
||||
<td><%= format_text " [spoilers]ssh![/spoilers]" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><<%= root_url.chomp("/") %>></td>
|
||||
<td><%= format_text root_url.chomp("/") %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>"<%= Danbooru.config.app_name %>":[<%= root_url.chomp("/") %>]</td>
|
||||
<td><%= format_text "\"#{Danbooru.config.app_name}\":[#{root_url.chomp("/")}]" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[[Kantai Collection]]</td>
|
||||
<td><%= format_text "[[Kantai Collection]]" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[[Kantai Collection|Kancolle]]</td>
|
||||
<td><%= format_text "[[Kantai Collection|Kancolle]]" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[[Kaga (Kantai Collection)|]]</td>
|
||||
<td><%= format_text "[[Kaga (Kantai Collection)|]]" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{kantai_collection comic}}</td>
|
||||
<td><%= format_text "{{kantai_collection comic}}" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>@user</td>
|
||||
<td><%= format_text "@user" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>post #1</td>
|
||||
<td><%= format_text "post #1" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>topic #1</td>
|
||||
<td><%= format_text "topic #1" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
* one<br>
|
||||
* two<br>
|
||||
* three<br>
|
||||
</td>
|
||||
<td><%= format_text "* one\n* two\n* three" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>h1. Big header</td>
|
||||
<td><%= format_text "h1. Big header" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>h6. Small header</td>
|
||||
<td><%= format_text "h6. Small header" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>[quote]Somebody said: hi![/quote]</td>
|
||||
<td><%= format_text "[quote]Somebody said: hi![/quote]" %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p id="dtext-help-footnote" class="fineprint">
|
||||
See <%= link_to_wiki "help:dtext" %> for more formatting help.
|
||||
</p>
|
||||
</div>
|
||||
10
app/views/static/dtext_help.js.erb
Normal file
10
app/views/static/dtext_help.js.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
$("<%= j render "static/dtext_help" %>").dialog({
|
||||
title: "DText Help",
|
||||
width: 700,
|
||||
modal: true,
|
||||
buttons: {
|
||||
"Close": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -409,6 +409,7 @@ Rails.application.routes.draw do
|
||||
get "/static/site_map" => "static#site_map", :as => "site_map"
|
||||
get "/static/terms_of_service" => "static#terms_of_service", :as => "terms_of_service"
|
||||
get "/static/contact" => "static#contact", :as => "contact"
|
||||
get "/static/dtext_help" => "static#dtext_help", :as => "dtext_help"
|
||||
get "/meta_searches/tags" => "meta_searches#tags", :as => "meta_searches_tags"
|
||||
|
||||
get "/intro" => redirect("/explore/posts/intro")
|
||||
|
||||
Reference in New Issue
Block a user