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
Kazuhiko Shiozaki
gitlab-ce
Commits
82a67170
Commit
82a67170
authored
Jun 23, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show a random Markdown tip in the textarea placeholder
parent
764b5913
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
24 deletions
+35
-24
app/assets/stylesheets/generic/zen.scss
app/assets/stylesheets/generic/zen.scss
+4
-23
app/helpers/gitlab_markdown_helper.rb
app/helpers/gitlab_markdown_helper.rb
+23
-0
app/views/projects/_zen.html.haml
app/views/projects/_zen.html.haml
+1
-1
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+7
-0
No files found.
app/assets/stylesheets/generic/zen.scss
View file @
82a67170
...
@@ -63,43 +63,24 @@
...
@@ -63,43 +63,24 @@
}
}
}
}
// Make the placeholder text in the standard textarea the same color as the
// background, effectively hiding it
.
zen-backdrop
textarea
:
:-
webkit-input-placeholder
{
color
:
white
;
}
.
zen-backdrop
textarea
:
-
moz-placeholder
{
color
:
white
;
}
.
zen-backdrop
textarea
:
:-
moz-placeholder
{
color
:
white
;
}
.
zen-backdrop
textarea
:
-
ms-input-placeholder
{
color
:
white
;
}
// Make the color of the placeholder text in the Zenned-out textarea darker,
// Make the color of the placeholder text in the Zenned-out textarea darker,
// so it becomes visible
// so it becomes visible
input
:checked
~
.zen-backdrop
textarea
::-webkit-input-placeholder
{
input
:checked
~
.zen-backdrop
textarea
::-webkit-input-placeholder
{
color
:
#
999
;
color
:
#
A8A8A8
;
}
}
input
:checked
~
.zen-backdrop
textarea
:-moz-placeholder
{
input
:checked
~
.zen-backdrop
textarea
:-moz-placeholder
{
color
:
#
999
;
color
:
#
A8A8A8
;
opacity
:
1
;
opacity
:
1
;
}
}
input
:checked
~
.zen-backdrop
textarea
::-moz-placeholder
{
input
:checked
~
.zen-backdrop
textarea
::-moz-placeholder
{
color
:
#
999
;
color
:
#
A8A8A8
;
opacity
:
1
;
opacity
:
1
;
}
}
input
:checked
~
.zen-backdrop
textarea
:-ms-input-placeholder
{
input
:checked
~
.zen-backdrop
textarea
:-ms-input-placeholder
{
color
:
#
999
;
color
:
#
A8A8A8
;
}
}
}
}
app/helpers/gitlab_markdown_helper.rb
View file @
82a67170
...
@@ -98,6 +98,29 @@ module GitlabMarkdownHelper
...
@@ -98,6 +98,29 @@ module GitlabMarkdownHelper
end
end
end
end
MARKDOWN_TIPS
=
[
"End a line with two or more spaces for a line-break, or soft-return"
,
"Inline code can be denoted by `surrounding it with backticks`"
,
"Blocks of code can be denoted by three backticks ``` or four leading spaces"
,
"Emoji can be added by :emoji_name:, for example :thumbsup:"
,
"Notify other participants using @user_name"
,
"Notify a specific group using @group_name"
,
"Notify the entire team using @all"
,
"Reference an issue using a hash, for example issue #123"
,
"Reference a merge request using an exclamation point, for example MR !123"
,
"Italicize words or phrases using *asterisks* or _underscores_"
,
"Bold words or phrases using **double asterisks** or __double underscores__"
,
"Strikethrough words or phrases using ~~two tildes~~"
,
"Make a bulleted list using + pluses, - minuses, or * asterisks"
,
"Denote blockquotes using > at the beginning of a line"
,
"Make a horizontal line using three or more hyphens ---, asterisks ***, or underscores ___"
].
freeze
# Returns a random markdown tip for use as a textarea placeholder
def
random_markdown_tip
MARKDOWN_TIPS
.
sample
end
private
private
# Return +text+, truncated to +max_chars+ characters, excluding any HTML
# Return +text+, truncated to +max_chars+ characters, excluding any HTML
...
...
app/views/projects/_zen.html.haml
View file @
82a67170
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
%input
#zen-toggle-comment
.zen-toggle-comment
{
tabindex:
'-1'
,
type:
'checkbox'
}
%input
#zen-toggle-comment
.zen-toggle-comment
{
tabindex:
'-1'
,
type:
'checkbox'
}
.zen-backdrop
.zen-backdrop
-
classes
<<
' js-gfm-input markdown-area'
-
classes
<<
' js-gfm-input markdown-area'
=
f
.
text_area
attr
,
class:
classes
,
placeholder:
'Leave a comment'
=
f
.
text_area
attr
,
class:
classes
,
placeholder:
random_markdown_tip
=
link_to
nil
,
class:
'zen-enter-link'
,
tabindex:
'-1'
do
=
link_to
nil
,
class:
'zen-enter-link'
,
tabindex:
'-1'
do
%i
.fa.fa-expand
%i
.fa.fa-expand
Edit in fullscreen
Edit in fullscreen
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
82a67170
...
@@ -133,4 +133,11 @@ describe GitlabMarkdownHelper do
...
@@ -133,4 +133,11 @@ describe GitlabMarkdownHelper do
helper
.
render_wiki_content
(
@wiki
)
helper
.
render_wiki_content
(
@wiki
)
end
end
end
end
describe
'random_markdown_tip'
do
it
'returns a random Markdown tip'
do
stub_const
(
"
#{
described_class
}
::MARKDOWN_TIPS"
,
[
'Random tip'
])
expect
(
random_markdown_tip
).
to
eq
'Random tip'
end
end
end
end
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