BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
0fd56975
Commit
0fd56975
authored
May 26, 2016
by
Jacob Schatz
Committed by
Phil Hughes
Jun 17, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial markdown ez buttons
parent
faee4763
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
0 deletions
+95
-0
text_utility.js.coffee
app/assets/javascripts/lib/text_utility.js.coffee
+75
-0
note_form.scss
app/assets/stylesheets/pages/note_form.scss
+4
-0
_discussion.html.haml
app/views/projects/merge_requests/_discussion.html.haml
+6
-0
_hints.html.haml
app/views/projects/notes/_hints.html.haml
+10
-0
No files found.
app/assets/javascripts/lib/text_utility.js.coffee
0 → 100644
View file @
0fd56975
((
w
)
->
w
.
gl
?=
{}
w
.
gl
.
text
?=
{}
w
.
gl
.
text
.
undoManager
?=
{}
gl
.
text
.
replaceRange
=
(
s
,
start
,
end
,
substitute
)
->
s
.
substring
(
0
,
start
)
+
substitute
+
s
.
substring
(
end
);
gl
.
text
.
wrap
=
(
textArea
,
tag
)
->
$textArea
=
$
(
textArea
)
$textArea
.
focus
()
textArea
=
$textArea
.
get
(
0
)
selObj
=
window
.
getSelection
()
selRange
=
selObj
.
getRangeAt
(
0
)
text
=
$textArea
.
val
()
replaceWith
=
@
replaceRange
(
text
,
textArea
.
selectionStart
,
textArea
.
selectionEnd
,
(
tag
+
selObj
.
toString
()
+
tag
))
$textArea
.
data
(
'old-val'
,
text
).
val
(
replaceWith
);
gl
.
text
.
prepend
=
(
textArea
,
tag
)
->
$textArea
=
$
(
textArea
)
$textArea
.
focus
()
textArea
=
$textArea
.
get
(
0
)
selObj
=
window
.
getSelection
()
selRange
=
selObj
.
getRangeAt
(
0
)
text
=
$textArea
.
val
()
lineBreak
=
'
\n
'
if
textArea
.
selectionStart
>
0
console
.
log
(
textArea
.
selectionStart
,
lineBreak
)
replaceWith
=
@
replaceRange
(
text
,
textArea
.
selectionStart
,
textArea
.
selectionEnd
,
(
"
#{
lineBreak
}#{
tag
}
#{
selObj
.
toString
()
}
\n
"
)
)
$textArea
.
data
(
'old-val'
,
text
).
val
(
replaceWith
);
# $textArea.val(replaceWith)
gl
.
text
.
undoManager
.
undo
=
()
->
gl
.
text
.
addListeners
=
()
->
self
=
@
$
(
'.js-md'
).
on
'click'
,
->
$this
=
$
(
@
)
if
$this
.
data
(
'md-wrap'
)
?
self
.
wrap
(
$this
.
closest
(
'.md-area'
).
find
(
'textarea'
),
$this
.
data
(
'md-tag'
)
)
else
if
$this
.
data
(
'md-prepend'
)
?
self
.
prepend
(
$this
.
closest
(
'.md-area'
).
find
(
'textarea'
),
$this
.
data
(
'md-tag'
)
)
else
self
.
wrap
(
$this
.
closest
(
'.md-area'
).
find
(
'textarea'
),
$this
.
data
(
'md-tag'
)
)
$
(
window
).
on
'keydown'
,
(
e
)
->
if
e
.
ctrlKey
or
e
.
metaKey
if
String
.
fromCharCode
(
e
.
which
).
toLowerCase
()
is
'z'
and
!
e
.
shiftKey
e
.
preventDefault
()
else
if
((
String
.
fromCharCode
(
e
.
which
).
toLowerCase
()
is
'z'
and
e
.
shiftKey
)
or
(
String
.
fromCharCode
(
e
.
which
).
toLowerCase
()
is
'y'
))
e
.
preventDefault
()
gl
.
text
.
removeListeners
=
()
->
$
(
'js-md.btn-bold'
).
off
()
)
window
\ No newline at end of file
app/assets/stylesheets/pages/note_form.scss
View file @
0fd56975
...
...
@@ -179,6 +179,10 @@
border-top
:
1px
solid
$border-color
;
}
.md-helper
{
padding-top
:
10px
;
}
.toolbar-button
{
padding
:
0
;
background
:
none
;
...
...
app/views/projects/merge_requests/_discussion.html.haml
View file @
0fd56975
...
...
@@ -6,3 +6,9 @@
=
link_to
'Reopen merge request'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :reopen
}),
method: :put
,
class:
"btn btn-nr btn-comment btn-grouped btn-reopen reopen-mr-link js-note-target-reopen"
,
title:
"Reopen merge request"
,
data:
{
original_text:
"Reopen merge request"
,
alternative_text:
"Comment & reopen merge request"
}
#notes
=
render
"projects/notes/notes_with_form"
:javascript
$
(
function
(){
gl
.
text
.
removeListeners
();
gl
.
text
.
addListeners
();
})
app/views/projects/notes/_hints.html.haml
View file @
0fd56975
...
...
@@ -6,3 +6,12 @@
%button
.toolbar-button.markdown-selector
{
type:
'button'
,
tabindex:
'-1'
}
=
icon
(
'file-image-o'
,
class:
'toolbar-button-icon'
)
Attach a file
.md-helper
%a
.btn.btn-xs.js-md
{
'data-md-tag'
=>
'**'
}
=
icon
(
'bold fw'
)
%a
.btn.btn-xs.js-md
{
'data-md-tag'
=>
'*'
}
=
icon
(
'italic fw'
)
%a
.btn.btn-xs.js-md.js-list
{
'data-md-tag'
=>
'*'
,
'data-md-prepend'
=>
true
}
=
icon
(
'list-ul fw'
)
%a
.btn.btn-xs.js-md.js-list
{
'data-md-tag'
=>
'1.'
,
'data-md-prepend'
=>
true
}
=
icon
(
'list-ol fw'
)
\ No newline at end of file
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