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
4a21db82
Commit
4a21db82
authored
Sep 17, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'first-meaningful-line-in-md' of
https://github.com/yglukhov/gitlabhq
into 7-4-pre
parents
8bff9a40
02eca79e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
8 deletions
+9
-8
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+0
-7
app/helpers/events_helper.rb
app/helpers/events_helper.rb
+1
-1
app/helpers/gitlab_markdown_helper.rb
app/helpers/gitlab_markdown_helper.rb
+8
-0
No files found.
app/helpers/application_helper.rb
View file @
4a21db82
...
@@ -187,13 +187,6 @@ module ApplicationHelper
...
@@ -187,13 +187,6 @@ module ApplicationHelper
end
end
end
end
def
first_line
(
str
)
lines
=
str
.
split
(
"
\n
"
)
line
=
lines
.
first
line
+=
"..."
if
lines
.
size
>
1
line
end
def
broadcast_message
def
broadcast_message
BroadcastMessage
.
current
BroadcastMessage
.
current
end
end
...
...
app/helpers/events_helper.rb
View file @
4a21db82
...
@@ -136,7 +136,7 @@ module EventsHelper
...
@@ -136,7 +136,7 @@ module EventsHelper
end
end
def
event_note
(
text
)
def
event_note
(
text
)
text
=
first_line
(
text
)
text
=
first_line
_in_markdown
(
text
)
text
=
truncate
(
text
,
length:
150
)
text
=
truncate
(
text
,
length:
150
)
sanitize
(
markdown
(
text
),
tags:
%w(a img b pre p)
)
sanitize
(
markdown
(
text
),
tags:
%w(a img b pre p)
)
end
end
...
...
app/helpers/gitlab_markdown_helper.rb
View file @
4a21db82
...
@@ -51,6 +51,14 @@ module GitlabMarkdownHelper
...
@@ -51,6 +51,14 @@ module GitlabMarkdownHelper
@markdown
.
render
(
text
).
html_safe
@markdown
.
render
(
text
).
html_safe
end
end
def
first_line_in_markdown
(
text
)
line
=
text
.
split
(
"
\n
"
).
detect
do
|
i
|
i
.
present?
&&
markdown
(
i
).
present?
end
line
+=
'...'
unless
line
.
nil?
line
end
def
render_wiki_content
(
wiki_page
)
def
render_wiki_content
(
wiki_page
)
if
wiki_page
.
format
==
:markdown
if
wiki_page
.
format
==
:markdown
markdown
(
wiki_page
.
content
)
markdown
(
wiki_page
.
content
)
...
...
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