[refs #616] markdown cheat sheet
This commit is contained in:
parent
4fc9ba7aeb
commit
a85a95d18a
|
@ -1519,6 +1519,11 @@ table.tablesorter.platform-maintainers.static-search thead tr.search th input[ty
|
|||
margin: 0 2px;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
border-left: 4px solid #EDEDED;
|
||||
padding: 0 15px;
|
||||
}
|
||||
}
|
||||
|
||||
#md_tabs {
|
||||
|
@ -1553,3 +1558,36 @@ table.tablesorter.platform-maintainers.static-search thead tr.search th input[ty
|
|||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
#md_help {
|
||||
width: 800px;
|
||||
top: 30%;
|
||||
left: 42%;
|
||||
|
||||
.modal-body {
|
||||
max-height: 560px;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.col {
|
||||
width: 245px;
|
||||
float: left;
|
||||
padding: 0;
|
||||
margin-right: 10px;
|
||||
|
||||
h3 {
|
||||
margin: 6px 0 0 0;
|
||||
}
|
||||
pre {
|
||||
background: none repeat scroll 0 0 #EDEDED;
|
||||
box-shadow: 0 3px 3px -1px rgba(18, 86, 135, 0.2);
|
||||
border: 1px solid #EDEDED;
|
||||
padding: 5px;
|
||||
margin-top: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,9 +41,11 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def markdown(text)
|
||||
html_options = {filter_html: true, hard_wrap: true, with_toc_data: true}
|
||||
options = {no_intraemphasis: true, tables: true, fenced_code_blocks: true, autolink: true, strikethrough: true, lax_html_blocks: true}
|
||||
@redcarpet ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(html_options), options)
|
||||
unless @redcarpet
|
||||
html_options = {filter_html: true, hard_wrap: true, with_toc_data: true}
|
||||
options = {no_intraemphasis: true, tables: true, fenced_code_blocks: true, autolink: true, strikethrough: true, lax_html_blocks: true}
|
||||
@redcarpet = Redcarpet::Markdown.new(Redcarpet::Render::HTML.new(html_options), options)
|
||||
end
|
||||
@redcarpet.render(text).html_safe
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,8 @@ class CommentPresenter < ApplicationPresenter
|
|||
|
||||
res = []
|
||||
if controller.can? :update, @comment
|
||||
res << link_to(t("layout.edit"), ep, html_options = {:id => "comment-#{comment.id}", :class => "edit_comment"}).html_safe
|
||||
res << link_to(t('layout.comments.markdown_cheatsheet'), '#md_help', 'data-toggle' => 'modal')
|
||||
res << link_to(t("layout.edit"), ep, :id => "comment-#{comment.id}", :class => "edit_comment").html_safe
|
||||
end
|
||||
if controller.can? :delete, @comment
|
||||
res << link_to(t("layout.delete"), dp, :method => "delete",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#open-comment.comment.view
|
||||
=link_to t('layout.comments.markdown_cheatsheet'), '#md_help', 'data-toggle' => 'modal', :style => 'float:right;'
|
||||
%h3.tmargin0= t("layout.comments.new_header")
|
||||
- if Comment.issue_comment?(commentable.class)
|
||||
- new_path = project_issue_comments_path(project, commentable)
|
||||
|
|
|
@ -11,3 +11,4 @@
|
|||
.comment-left{:style => 'margin-top: 0;'}
|
||||
=link_to t('layout.cancel'), '#', :id => "comment-#{comment.id}", :class => 'cancel_edit_comment button'
|
||||
.both
|
||||
= render "projects/comments/markdown_help"
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
#md_help.modal.hidden
|
||||
.modal-header
|
||||
%button.close{"aria-hidden" => "true", "data-dismiss" => "modal", :type => "button"} ×
|
||||
%h3#myModalLabel=t('layout.comments.markdown_cheatsheet')
|
||||
.modal-body
|
||||
.mod
|
||||
.col
|
||||
%h3 Format Text
|
||||
%p Headers
|
||||
%pre
|
||||
-[1, 3, 6].each do |i|
|
||||
="#{'#'*i} This is an <h#{i}> tag"
|
||||
%p Text styles
|
||||
%pre
|
||||
:preserve
|
||||
*This text will be italic*
|
||||
_This will also be italic_
|
||||
**This text will be bold**
|
||||
__This will also be bold__
|
||||
.col
|
||||
%h3 Lists
|
||||
%p Unordered
|
||||
%pre
|
||||
:preserve
|
||||
* Item 1
|
||||
* Item 2
|
||||
* Item 2a
|
||||
* Item 2b
|
||||
%p Ordered
|
||||
%pre
|
||||
:preserve
|
||||
1. Item 1
|
||||
2. Item 2
|
||||
3. Item 3
|
||||
* Item 3a
|
||||
* Item 3b
|
||||
.col
|
||||
%h3 Miscellaneous
|
||||
%p Images
|
||||
%pre
|
||||
:preserve
|
||||
![GitHub Logo](/images/logo.png)
|
||||
Format: ![Alt Text](url)
|
||||
%p Links
|
||||
%pre
|
||||
:preserve
|
||||
http://github.com - automatic!
|
||||
[GitHub](http://github.com)
|
||||
%p Blockquotes
|
||||
%pre
|
||||
:preserve
|
||||
As Kanye West said:
|
||||
|
||||
> We're living the future so
|
||||
> the present is our past.
|
||||
.both
|
||||
%hr.bootstrap
|
||||
%h3 Code Examples in Markdown
|
||||
.col
|
||||
%p
|
||||
Syntax highlighting
|
||||
%pre
|
||||
:preserve
|
||||
```javascript
|
||||
function fancyAlert(arg) {
|
||||
if(arg) {
|
||||
$.facebox({div:'#foo'})
|
||||
}
|
||||
}
|
||||
```
|
||||
.col
|
||||
%p Or, indent your code 4 spaces
|
||||
%pre
|
||||
:preserve
|
||||
Here is a Python code example
|
||||
without syntax highlighting:
|
||||
|
||||
def foo:
|
||||
if not bar:
|
||||
return true
|
||||
.col
|
||||
%p Inline code for comments
|
||||
%pre
|
||||
:preserve
|
||||
I think you should use an
|
||||
`[addr]` element here instead.
|
|
@ -2,6 +2,7 @@
|
|||
%h3.tmargin0{:style => 'margin-bottom: 0;'}= t 'activerecord.attributes.issue.title'
|
||||
.wrapper= f.text_area :title, :cols => 80, :rows => 1, :style => 'height: 16px; margin: 0 0 10px;'
|
||||
#open-comment.comment.view
|
||||
=link_to t('layout.comments.markdown_cheatsheet'), '#md_help', 'data-toggle' => 'modal', :style => 'float:right;'
|
||||
%h3.tmargin0= t 'activerecord.attributes.issue.body'
|
||||
=render 'projects/comments/body', :f => f, :id => 'new'
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
%h3.tmargin0{:style => 'margin-bottom: 0;'}= t 'activerecord.attributes.issue.title'
|
||||
.wrapper= f.text_area :title, :cols => 80, :rows => 1, :style => 'height: 16px; margin: 0 0 10px;'
|
||||
#open-comment.comment.view
|
||||
=link_to t('layout.comments.markdown_cheatsheet'), '#md_help', 'data-toggle' => 'modal', :style => 'float:right;'
|
||||
%h3.tmargin0= t 'activerecord.attributes.issue.body'
|
||||
=render 'projects/comments/body', :f => f, :id => 'update'
|
||||
.both
|
||||
|
|
|
@ -4,10 +4,11 @@ en:
|
|||
confirm_delete: Are you sure you want to delete the comment?
|
||||
new_header: New comment
|
||||
edit_header: Editing a comment
|
||||
has_commented: "added a note"
|
||||
notifications_are: "Notifications for new comments are"
|
||||
comments_header: "Comments"
|
||||
back: 'Back'
|
||||
has_commented: added a note
|
||||
notifications_are: Notifications for new comments are
|
||||
comments_header: Comments
|
||||
back: Back
|
||||
markdown_cheatsheet: Markdown Cheat Sheet
|
||||
|
||||
flash:
|
||||
comment:
|
||||
|
|
|
@ -4,17 +4,18 @@ ru:
|
|||
confirm_delete: Вы уверены, что хотите удалить комментарий?
|
||||
new_header: Новый комментарий
|
||||
edit_header: Редактирование комментария
|
||||
has_commented: "оставил комментарий"
|
||||
notifications_are: "Уведомления о последующих комментариях"
|
||||
comments_header: "Комментарии"
|
||||
back: 'Назад'
|
||||
has_commented: оставил комментарий
|
||||
notifications_are: Уведомления о последующих комментариях
|
||||
comments_header: Комментарии
|
||||
back: Назад
|
||||
markdown_cheatsheet: Шпаргалка по Markdown
|
||||
|
||||
flash:
|
||||
comment:
|
||||
saved: Комментарий успешно сохранен
|
||||
save_error: Ошибка сохранения комментария
|
||||
destroyed: Комментарий удален
|
||||
|
||||
|
||||
activerecord:
|
||||
attributes:
|
||||
comment:
|
||||
|
|
Loading…
Reference in New Issue