Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
1ec3bd3f
Commit
1ec3bd3f
authored
Aug 07, 2012
by
Nihad Abbasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ability to preview notes
parent
34ba4e13
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1356 additions
and
4 deletions
+1356
-4
app/assets/javascripts/application.js
app/assets/javascripts/application.js
+21
-3
app/views/notes/_form.html.haml
app/views/notes/_form.html.haml
+3
-1
vendor/assets/javascripts/Markdown.Converter.js
vendor/assets/javascripts/Markdown.Converter.js
+1332
-0
No files found.
app/assets/javascripts/application.js
View file @
1ec3bd3f
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
//= require chosen-jquery
//= require chosen-jquery
//= require raphael
//= require raphael
//= require branch-graph
//= require branch-graph
//= require Markdown.Converter
//= require_tree .
//= require_tree .
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
(){
...
@@ -26,7 +27,6 @@ $(document).ready(function(){
...
@@ -26,7 +27,6 @@ $(document).ready(function(){
$
(
this
).
select
();
$
(
this
).
select
();
});
});
$
(
'
body
'
).
on
(
'
ajax:complete, ajax:beforeSend, submit
'
,
'
form
'
,
function
(
e
){
$
(
'
body
'
).
on
(
'
ajax:complete, ajax:beforeSend, submit
'
,
'
form
'
,
function
(
e
){
var
buttons
=
$
(
'
[type="submit"]
'
,
this
);
var
buttons
=
$
(
'
[type="submit"]
'
,
this
);
switch
(
e
.
type
){
switch
(
e
.
type
){
...
@@ -70,6 +70,24 @@ $(document).ready(function(){
...
@@ -70,6 +70,24 @@ $(document).ready(function(){
$
(
"
.supp_diff_link
"
).
bind
(
"
click
"
,
function
()
{
$
(
"
.supp_diff_link
"
).
bind
(
"
click
"
,
function
()
{
showDiff
(
this
);
showDiff
(
this
);
});
});
/**
* Note markdown preview
*
*/
$
(
'
#preview-link
'
).
on
(
'
click
'
,
function
(
e
)
{
var
note
=
$
(
'
#note_note
'
).
val
();
if
(
note
.
trim
().
length
===
0
)
{
note
=
'
Nothing to preview
'
;
}
var
converter
=
new
Markdown
.
Converter
();
var
md_preview
=
converter
.
makeHtml
(
note
);
$
(
'
#preview-note
'
).
html
(
md_preview
);
var
previewLinkText
=
(
$
(
this
).
text
()
==
'
Preview
'
?
'
Edit
'
:
'
Preview
'
);
$
(
this
).
text
(
previewLinkText
);
$
(
'
#preview-note, #note_note
'
).
toggle
();
e
.
preventDefault
();
});
});
});
function
focusSearch
()
{
function
focusSearch
()
{
...
...
app/views/notes/_form.html.haml
View file @
1ec3bd3f
...
@@ -8,9 +8,11 @@
...
@@ -8,9 +8,11 @@
=
f
.
hidden_field
:noteable_id
=
f
.
hidden_field
:noteable_id
=
f
.
hidden_field
:noteable_type
=
f
.
hidden_field
:noteable_type
=
f
.
text_area
:note
,
:size
=>
255
=
f
.
text_area
:note
,
:size
=>
255
#preview-note
.well.hide
%p
.hint
%p
.hint
=
link_to
"Gitlab Markdown"
,
help_markdown_path
,
:target
=>
'_blank'
=
link_to
"Gitlab Markdown"
,
help_markdown_path
,
:target
=>
'_blank'
is enabled.
is enabled.
=
link_to
'Preview'
,
'#'
,
:id
=>
'preview-link'
.row.note_advanced_opts.hide
.row.note_advanced_opts.hide
.span4
.span4
...
...
vendor/assets/javascripts/Markdown.Converter.js
0 → 100644
View file @
1ec3bd3f
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment