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
Jérome Perrin
gitlab-ce
Commits
72c6be2d
Commit
72c6be2d
authored
Aug 07, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1183 from riyad/gitlab-flavored-markdown
Gitlab flavored markdown
parents
c120457a
5443021a
Changes
34
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
634 additions
and
143 deletions
+634
-143
app/controllers/refs_controller.rb
app/controllers/refs_controller.rb
+1
-0
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+81
-1
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+0
-18
app/mailers/notify.rb
app/mailers/notify.rb
+19
-9
app/views/commits/_commit.html.haml
app/views/commits/_commit.html.haml
+1
-1
app/views/commits/_commit_box.html.haml
app/views/commits/_commit_box.html.haml
+2
-2
app/views/commits/index.atom.builder
app/views/commits/index.atom.builder
+1
-1
app/views/dashboard/issues.html.haml
app/views/dashboard/issues.html.haml
+2
-2
app/views/dashboard/merge_requests.html.haml
app/views/dashboard/merge_requests.html.haml
+2
-2
app/views/events/_commit.html.haml
app/views/events/_commit.html.haml
+1
-1
app/views/issues/_show.html.haml
app/views/issues/_show.html.haml
+1
-1
app/views/issues/show.html.haml
app/views/issues/show.html.haml
+2
-2
app/views/merge_requests/_merge_request.html.haml
app/views/merge_requests/_merge_request.html.haml
+1
-1
app/views/merge_requests/show/_mr_box.html.haml
app/views/merge_requests/show/_mr_box.html.haml
+1
-1
app/views/milestones/_milestone.html.haml
app/views/milestones/_milestone.html.haml
+1
-1
app/views/milestones/show.html.haml
app/views/milestones/show.html.haml
+2
-2
app/views/notify/new_issue_email.html.haml
app/views/notify/new_issue_email.html.haml
+2
-3
app/views/notify/new_merge_request_email.html.haml
app/views/notify/new_merge_request_email.html.haml
+2
-2
app/views/notify/note_commit_email.html.haml
app/views/notify/note_commit_email.html.haml
+2
-2
app/views/notify/note_issue_email.html.haml
app/views/notify/note_issue_email.html.haml
+2
-4
app/views/notify/note_merge_request_email.html.haml
app/views/notify/note_merge_request_email.html.haml
+2
-2
app/views/notify/note_wiki_email.html.haml
app/views/notify/note_wiki_email.html.haml
+2
-3
app/views/notify/reassigned_issue_email.html.haml
app/views/notify/reassigned_issue_email.html.haml
+2
-2
app/views/notify/reassigned_merge_request_email.html.haml
app/views/notify/reassigned_merge_request_email.html.haml
+2
-2
app/views/refs/_tree_commit.html.haml
app/views/refs/_tree_commit.html.haml
+1
-1
app/views/refs/blame.html.haml
app/views/refs/blame.html.haml
+1
-1
app/views/repositories/_branch.html.haml
app/views/repositories/_branch.html.haml
+1
-1
app/views/repositories/_feed.html.haml
app/views/repositories/_feed.html.haml
+1
-1
app/views/repositories/tags.html.haml
app/views/repositories/tags.html.haml
+1
-1
lib/redcarpet/render/gitlab_html.rb
lib/redcarpet/render/gitlab_html.rb
+14
-0
spec/helpers/commit_helper_spec.rb
spec/helpers/commit_helper_spec.rb
+0
-67
spec/helpers/gitlab_flavored_markdown_spec.rb
spec/helpers/gitlab_flavored_markdown_spec.rb
+232
-0
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+8
-6
spec/requests/gitlab_flavored_markdown_spec.rb
spec/requests/gitlab_flavored_markdown_spec.rb
+241
-0
No files found.
app/controllers/refs_controller.rb
View file @
72c6be2d
...
@@ -90,6 +90,7 @@ class RefsController < ApplicationController
...
@@ -90,6 +90,7 @@ class RefsController < ApplicationController
@repo
=
project
.
repo
@repo
=
project
.
repo
@commit
=
project
.
commit
(
@ref
)
@commit
=
project
.
commit
(
@ref
)
@commit
=
CommitDecorator
.
decorate
(
@commit
)
@tree
=
Tree
.
new
(
@commit
.
tree
,
project
,
@ref
,
params
[
:path
])
@tree
=
Tree
.
new
(
@commit
.
tree
,
project
,
@ref
,
params
[
:path
])
@tree
=
TreeDecorator
.
new
(
@tree
)
@tree
=
TreeDecorator
.
new
(
@tree
)
@hex_path
=
Digest
::
SHA1
.
hexdigest
(
params
[
:path
]
||
"/"
)
@hex_path
=
Digest
::
SHA1
.
hexdigest
(
params
[
:path
]
||
"/"
)
...
...
app/helpers/application_helper.rb
View file @
72c6be2d
...
@@ -42,8 +42,88 @@ module ApplicationHelper
...
@@ -42,8 +42,88 @@ module ApplicationHelper
grouped_options_for_select
(
options
,
@ref
||
@project
.
default_branch
)
grouped_options_for_select
(
options
,
@ref
||
@project
.
default_branch
)
end
end
def
gfm
(
text
,
html_options
=
{})
return
text
if
text
.
nil?
raise
"@project is not set"
if
@project
.
nil?
# Extract pre blocks
# from http://github.github.com/github-flavored-markdown/
extractions
=
{}
text
.
gsub!
(
%r{<pre>.*?</pre>|<code>.*?</code>}m
)
do
|
match
|
md5
=
Digest
::
MD5
.
hexdigest
(
match
)
extractions
[
md5
]
=
match
"{gfm-extraction-
#{
md5
}
}"
end
# match 1 2 3 4 5 6
text
.
gsub!
(
/(\W)?(@([\w\._]+)|[#!$](\d+)|([\h]{6,40}))(\W)?/
)
do
|
match
|
prefix
=
$1
reference
=
$2
user_name
=
$3
issue_id
=
$4
merge_request_id
=
$4
snippet_id
=
$4
commit_id
=
$5
suffix
=
$6
# TODO: add popups with additional information
ref_link
=
case
reference
# team member: @foo
when
/^@/
user
=
@project
.
users
.
where
(
:name
=>
user_name
).
first
member
=
@project
.
users_projects
.
where
(
:user_id
=>
user
).
first
if
user
link_to
(
"@
#{
user_name
}
"
,
project_team_member_path
(
@project
,
member
),
html_options
.
merge
(
:class
=>
"gfm gfm-team_member
#{
html_options
[
:class
]
}
"
))
if
member
# issue: #123
when
/^#/
# avoid HTML entities
unless
prefix
.
try
(
:end_with?
,
"&"
)
&&
suffix
.
try
(
:start_with?
,
";"
)
issue
=
@project
.
issues
.
where
(
:id
=>
issue_id
).
first
link_to
(
"#
#{
issue_id
}
"
,
project_issue_path
(
@project
,
issue
),
html_options
.
merge
(
:title
=>
"Issue:
#{
issue
.
title
}
"
,
:class
=>
"gfm gfm-issue
#{
html_options
[
:class
]
}
"
))
if
issue
end
# merge request: !123
when
/^!/
merge_request
=
@project
.
merge_requests
.
where
(
:id
=>
merge_request_id
).
first
link_to
(
"!
#{
merge_request_id
}
"
,
project_merge_request_path
(
@project
,
merge_request
),
html_options
.
merge
(
:title
=>
"Merge Request:
#{
merge_request
.
title
}
"
,
:class
=>
"gfm gfm-merge_request
#{
html_options
[
:class
]
}
"
))
if
merge_request
# snippet: $123
when
/^\$/
snippet
=
@project
.
snippets
.
where
(
:id
=>
snippet_id
).
first
link_to
(
"$
#{
snippet_id
}
"
,
project_snippet_path
(
@project
,
snippet
),
html_options
.
merge
(
:title
=>
"Snippet:
#{
snippet
.
title
}
"
,
:class
=>
"gfm gfm-snippet
#{
html_options
[
:class
]
}
"
))
if
snippet
# commit: 123456...
when
/^\h/
commit
=
@project
.
commit
(
commit_id
)
link_to
(
commit_id
,
project_commit_path
(
@project
,
:id
=>
commit
.
id
),
html_options
.
merge
(
:title
=>
"Commit:
#{
commit
.
author_name
}
-
#{
CommitDecorator
.
new
(
commit
).
title
}
"
,
:class
=>
"gfm gfm-commit
#{
html_options
[
:class
]
}
"
))
if
commit
end
# case
ref_link
.
nil?
?
match
:
"
#{
prefix
}#{
ref_link
}#{
suffix
}
"
end
# gsub
# Insert pre block extractions
text
.
gsub!
(
/\{gfm-extraction-(\h{32})\}/
)
do
extractions
[
$1
]
end
text
.
html_safe
end
# circumvents nesting links, which will behave bad in browsers
def
link_to_gfm
(
body
,
url
,
html_options
=
{})
gfm_body
=
gfm
(
body
,
html_options
)
gfm_body
.
gsub!
(
%r{<a.*?>.*?</a>}m
)
do
|
match
|
"</a>
#{
match
}#{
link_to
(
""
,
url
,
html_options
)[
0
..-
5
]
}
"
# "</a>".length +1
end
link_to
(
gfm_body
.
html_safe
,
url
,
html_options
)
end
def
markdown
(
text
)
def
markdown
(
text
)
@__renderer
||=
Redcarpet
::
Markdown
.
new
(
Redcarpet
::
Render
::
GitlabHTML
.
new
(
{
filter_html:
true
,
with_toc_data:
true
}
),
{
@__renderer
||=
Redcarpet
::
Markdown
.
new
(
Redcarpet
::
Render
::
GitlabHTML
.
new
(
self
,
filter_html:
true
,
with_toc_data:
true
),
{
no_intra_emphasis:
true
,
no_intra_emphasis:
true
,
tables:
true
,
tables:
true
,
fenced_code_blocks:
true
,
fenced_code_blocks:
true
,
...
...
app/helpers/commits_helper.rb
View file @
72c6be2d
module
CommitsHelper
module
CommitsHelper
def
commit_msg_with_link_to_issues
(
project
,
message
)
return
''
unless
message
out
=
''
message
.
split
(
/(#[0-9]+)/m
).
each
do
|
m
|
if
m
=~
/(#([0-9]+))/m
begin
issue
=
project
.
issues
.
find
(
$2
)
out
+=
link_to
(
$1
,
project_issue_path
(
project
,
$2
))
rescue
out
+=
$1
end
else
out
+=
m
end
end
preserve
out
end
def
identification_type
(
line
)
def
identification_type
(
line
)
if
line
[
0
]
==
"+"
if
line
[
0
]
==
"+"
"new"
"new"
...
...
app/mailers/notify.rb
View file @
72c6be2d
...
@@ -16,59 +16,69 @@ class Notify < ActionMailer::Base
...
@@ -16,59 +16,69 @@ class Notify < ActionMailer::Base
def
new_issue_email
(
issue_id
)
def
new_issue_email
(
issue_id
)
@issue
=
Issue
.
find
(
issue_id
)
@issue
=
Issue
.
find
(
issue_id
)
mail
(
:to
=>
@issue
.
assignee_email
,
:subject
=>
"gitlab | New Issue was created"
)
@project
=
@issue
.
project
mail
(
:to
=>
@issue
.
assignee_email
,
:subject
=>
"gitlab | new issue #
#{
@issue
.
id
}
|
#{
@issue
.
title
}
|
#{
@project
.
name
}
"
)
end
end
def
note_wall_email
(
recipient_id
,
note_id
)
def
note_wall_email
(
recipient_id
,
note_id
)
recipient
=
User
.
find
(
recipient_id
)
recipient
=
User
.
find
(
recipient_id
)
@note
=
Note
.
find
(
note_id
)
@note
=
Note
.
find
(
note_id
)
mail
(
:to
=>
recipient
.
email
,
:subject
=>
"gitlab |
#{
@note
.
project_name
}
"
)
@project
=
@note
.
project
mail
(
:to
=>
recipient
.
email
,
:subject
=>
"gitlab |
#{
@project
.
name
}
"
)
end
end
def
note_commit_email
(
recipient_id
,
note_id
)
def
note_commit_email
(
recipient_id
,
note_id
)
recipient
=
User
.
find
(
recipient_id
)
recipient
=
User
.
find
(
recipient_id
)
@note
=
Note
.
find
(
note_id
)
@note
=
Note
.
find
(
note_id
)
@commit
=
@note
.
target
@commit
=
@note
.
target
mail
(
:to
=>
recipient
.
email
,
:subject
=>
"gitlab | note for commit |
#{
@note
.
project_name
}
"
)
@commit
=
CommitDecorator
.
decorate
(
@commit
)
@project
=
@note
.
project
mail
(
:to
=>
recipient
.
email
,
:subject
=>
"gitlab | note for commit
#{
@commit
.
short_id
}
|
#{
@commit
.
title
}
|
#{
@project
.
name
}
"
)
end
end
def
note_merge_request_email
(
recipient_id
,
note_id
)
def
note_merge_request_email
(
recipient_id
,
note_id
)
recipient
=
User
.
find
(
recipient_id
)
recipient
=
User
.
find
(
recipient_id
)
@note
=
Note
.
find
(
note_id
)
@note
=
Note
.
find
(
note_id
)
@merge_request
=
@note
.
noteable
@merge_request
=
@note
.
noteable
mail
(
:to
=>
recipient
.
email
,
:subject
=>
"gitlab | note for merge request |
#{
@note
.
project_name
}
"
)
@project
=
@note
.
project
mail
(
:to
=>
recipient
.
email
,
:subject
=>
"gitlab | note for merge request !
#{
@merge_request
.
id
}
|
#{
@project
.
name
}
"
)
end
end
def
note_issue_email
(
recipient_id
,
note_id
)
def
note_issue_email
(
recipient_id
,
note_id
)
recipient
=
User
.
find
(
recipient_id
)
recipient
=
User
.
find
(
recipient_id
)
@note
=
Note
.
find
(
note_id
)
@note
=
Note
.
find
(
note_id
)
@issue
=
@note
.
noteable
@issue
=
@note
.
noteable
mail
(
:to
=>
recipient
.
email
,
:subject
=>
"gitlab | note for issue
#{
@issue
.
id
}
|
#{
@note
.
project_name
}
"
)
@project
=
@note
.
project
mail
(
:to
=>
recipient
.
email
,
:subject
=>
"gitlab | note for issue #
#{
@issue
.
id
}
|
#{
@project
.
name
}
"
)
end
end
def
note_wiki_email
(
recipient_id
,
note_id
)
def
note_wiki_email
(
recipient_id
,
note_id
)
recipient
=
User
.
find
(
recipient_id
)
recipient
=
User
.
find
(
recipient_id
)
@note
=
Note
.
find
(
note_id
)
@note
=
Note
.
find
(
note_id
)
@wiki
=
@note
.
noteable
@wiki
=
@note
.
noteable
mail
(
:to
=>
recipient
.
email
,
:subject
=>
"gitlab | note for wiki |
#{
@note
.
project_name
}
"
)
@project
=
@note
.
project
mail
(
:to
=>
recipient
.
email
,
:subject
=>
"gitlab | note for wiki |
#{
@project
.
name
}
"
)
end
end
def
new_merge_request_email
(
merge_request_id
)
def
new_merge_request_email
(
merge_request_id
)
@merge_request
=
MergeRequest
.
find
(
merge_request_id
)
@merge_request
=
MergeRequest
.
find
(
merge_request_id
)
mail
(
:to
=>
@merge_request
.
assignee_email
,
:subject
=>
"gitlab | new merge request |
#{
@merge_request
.
title
}
"
)
@project
=
@merge_request
.
project
mail
(
:to
=>
@merge_request
.
assignee_email
,
:subject
=>
"gitlab | new merge request !
#{
@merge_request
.
id
}
|
#{
@merge_request
.
title
}
|
#{
@project
.
name
}
"
)
end
end
def
reassigned_merge_request_email
(
recipient_id
,
merge_request_id
,
previous_assignee_id
)
def
reassigned_merge_request_email
(
recipient_id
,
merge_request_id
,
previous_assignee_id
)
recipient
=
User
.
find
(
recipient_id
)
recipient
=
User
.
find
(
recipient_id
)
@merge_request
=
MergeRequest
.
find
(
merge_request_id
)
@merge_request
=
MergeRequest
.
find
(
merge_request_id
)
@previous_assignee
||=
User
.
find
(
previous_assignee_id
)
@previous_assignee
||=
User
.
find
(
previous_assignee_id
)
mail
(
:to
=>
recipient
.
email
,
:subject
=>
"gitlab | merge request changed |
#{
@merge_request
.
title
}
"
)
@project
=
@merge_request
.
project
mail
(
:to
=>
recipient
.
email
,
:subject
=>
"gitlab | changed merge request !
#{
@merge_request
.
id
}
|
#{
@merge_request
.
title
}
|
#{
@project
.
name
}
"
)
end
end
def
reassigned_issue_email
(
recipient_id
,
issue_id
,
previous_assignee_id
)
def
reassigned_issue_email
(
recipient_id
,
issue_id
,
previous_assignee_id
)
recipient
=
User
.
find
(
recipient_id
)
recipient
=
User
.
find
(
recipient_id
)
@issue
=
Issue
.
find
(
issue_id
)
@issue
=
Issue
.
find
(
issue_id
)
@previous_assignee
||=
User
.
find
(
previous_assignee_id
)
@previous_assignee
||=
User
.
find
(
previous_assignee_id
)
mail
(
:to
=>
recipient
.
email
,
:subject
=>
"gitlab | changed issue |
#{
@issue
.
title
}
"
)
@project
=
@issue
.
project
mail
(
:to
=>
recipient
.
email
,
:subject
=>
"gitlab | changed issue #
#{
@issue
.
id
}
|
#{
@issue
.
title
}
|
#{
@project
.
name
}
"
)
end
end
end
end
app/views/commits/_commit.html.haml
View file @
72c6be2d
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
%strong
.cgray
=
commit
.
author_name
%strong
.cgray
=
commit
.
author_name
–
–
=
image_tag
gravatar_icon
(
commit
.
author_email
),
:class
=>
"avatar"
,
:width
=>
16
=
image_tag
gravatar_icon
(
commit
.
author_email
),
:class
=>
"avatar"
,
:width
=>
16
=
link_to
truncate
(
commit
.
title
,
:length
=>
50
),
project_commit_path
(
@project
,
:id
=>
commit
.
id
),
:class
=>
"row_title"
=
link_to
_gfm
truncate
(
commit
.
title
,
:length
=>
50
),
project_commit_path
(
@project
,
:id
=>
commit
.
id
),
:class
=>
"row_title"
%span
.committed_ago
%span
.committed_ago
=
time_ago_in_words
(
commit
.
committed_date
)
=
time_ago_in_words
(
commit
.
committed_date
)
...
...
app/views/commits/_commit_box.html.haml
View file @
72c6be2d
...
@@ -11,10 +11,10 @@
...
@@ -11,10 +11,10 @@
=
link_to
tree_project_ref_path
(
@project
,
@commit
.
id
),
:class
=>
"browse-button primary grouped"
do
=
link_to
tree_project_ref_path
(
@project
,
@commit
.
id
),
:class
=>
"browse-button primary grouped"
do
%strong
Browse Code »
%strong
Browse Code »
%h3
.commit-title.page_title
%h3
.commit-title.page_title
=
commit_msg_with_link_to_issues
(
@project
,
@commit
.
title
)
=
gfm
@commit
.
title
-
if
@commit
.
description
.
present?
-
if
@commit
.
description
.
present?
%pre
.commit-description
%pre
.commit-description
=
commit_msg_with_link_to_issues
(
@project
,
@commit
.
description
)
=
gfm
@commit
.
description
.commit-info
.commit-info
.row
.row
.span4
.span4
...
...
app/views/commits/index.atom.builder
View file @
72c6be2d
...
@@ -17,7 +17,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
...
@@ -17,7 +17,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
xml.name commit.author_name
xml.name commit.author_name
xml.email commit.author_email
xml.email commit.author_email
end
end
xml.summary
commit.description
xml.summary
gfm(commit.description)
end
end
end
end
end
end
app/views/dashboard/issues.html.haml
View file @
72c6be2d
...
@@ -8,8 +8,8 @@
...
@@ -8,8 +8,8 @@
-
if
@issues
.
any?
-
if
@issues
.
any?
-
@issues
.
group_by
(
&
:project
).
each
do
|
group
|
-
@issues
.
group_by
(
&
:project
).
each
do
|
group
|
%div
.ui-box
%div
.ui-box
-
project
=
group
[
0
]
-
@
project
=
group
[
0
]
%h5
=
project
.
name
%h5
=
@
project
.
name
%ul
.unstyled.issues_table
%ul
.unstyled.issues_table
-
group
[
1
].
each
do
|
issue
|
-
group
[
1
].
each
do
|
issue
|
=
render
(
:partial
=>
'issues/show'
,
:locals
=>
{
:issue
=>
issue
})
=
render
(
:partial
=>
'issues/show'
,
:locals
=>
{
:issue
=>
issue
})
...
...
app/views/dashboard/merge_requests.html.haml
View file @
72c6be2d
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
-
if
@merge_requests
.
any?
-
if
@merge_requests
.
any?
-
@merge_requests
.
group_by
(
&
:project
).
each
do
|
group
|
-
@merge_requests
.
group_by
(
&
:project
).
each
do
|
group
|
%ul
.unstyled.ui-box
%ul
.unstyled.ui-box
-
project
=
group
[
0
]
-
@
project
=
group
[
0
]
%h5
=
project
.
name
%h5
=
@
project
.
name
-
group
[
1
].
each
do
|
merge_request
|
-
group
[
1
].
each
do
|
merge_request
|
=
render
(
:partial
=>
'merge_requests/merge_request'
,
:locals
=>
{
:merge_request
=>
merge_request
})
=
render
(
:partial
=>
'merge_requests/merge_request'
,
:locals
=>
{
:merge_request
=>
merge_request
})
%hr
%hr
...
...
app/views/events/_commit.html.haml
View file @
72c6be2d
...
@@ -5,5 +5,5 @@
...
@@ -5,5 +5,5 @@
%strong
.cdark
=
commit
.
author_name
%strong
.cdark
=
commit
.
author_name
–
–
=
image_tag
gravatar_icon
(
commit
.
author_email
),
:class
=>
"avatar"
,
:width
=>
16
=
image_tag
gravatar_icon
(
commit
.
author_email
),
:class
=>
"avatar"
,
:width
=>
16
=
truncate
(
commit
.
title
,
:length
=>
50
)
rescue
"--broken encoding"
=
gfm
truncate
(
commit
.
title
,
:length
=>
50
),
project_commit_path
(
project
,
:id
=>
commit
.
id
)
rescue
"--broken encoding"
app/views/issues/_show.html.haml
View file @
72c6be2d
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
-
else
-
else
=
image_tag
"no_avatar.png"
,
:class
=>
"avatar"
=
image_tag
"no_avatar.png"
,
:class
=>
"avatar"
%p
=
link_to
truncate
(
issue
.
title
,
:length
=>
100
),
project_issue_path
(
issue
.
project
,
issue
),
:class
=>
"row_title"
%p
=
link_to
_gfm
truncate
(
issue
.
title
,
:length
=>
100
),
project_issue_path
(
issue
.
project
,
issue
),
:class
=>
"row_title"
%span
.update-author
%span
.update-author
%small
.cdark
=
"#
#{
issue
.
id
}
"
%small
.cdark
=
"#
#{
issue
.
id
}
"
...
...
app/views/issues/show.html.haml
View file @
72c6be2d
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
.alert-message.error.status_info
Closed
.alert-message.error.status_info
Closed
-
else
-
else
.alert-message.success.status_info
Open
.alert-message.success.status_info
Open
=
@issue
.
title
=
gfm
@issue
.
title
.middle_box_content
.middle_box_content
%cite
.cgray
Created by
%cite
.cgray
Created by
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
-
if
@issue
.
milestone
-
if
@issue
.
milestone
-
milestone
=
@issue
.
milestone
-
milestone
=
@issue
.
milestone
%cite
.cgray
and attached to milestone
%cite
.cgray
and attached to milestone
%strong
=
link_to
truncate
(
milestone
.
title
,
:length
=>
20
),
project_milestone_path
(
milestone
.
project
,
milestone
)
%strong
=
link_to
_gfm
truncate
(
milestone
.
title
,
:length
=>
20
),
project_milestone_path
(
milestone
.
project
,
milestone
)
.right
.right
-
@issue
.
labels
.
each
do
|
label
|
-
@issue
.
labels
.
each
do
|
label
|
...
...
app/views/merge_requests/_merge_request.html.haml
View file @
72c6be2d
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
=
merge_request
.
target_branch
=
merge_request
.
target_branch
=
image_tag
gravatar_icon
(
merge_request
.
author_email
),
:class
=>
"avatar"
=
image_tag
gravatar_icon
(
merge_request
.
author_email
),
:class
=>
"avatar"
%p
=
link_to
truncate
(
merge_request
.
title
,
:length
=>
80
),
project_merge_request_path
(
merge_request
.
project
,
merge_request
),
:class
=>
"row_title"
%p
=
link_to
_gfm
truncate
(
merge_request
.
title
,
:length
=>
80
),
project_merge_request_path
(
merge_request
.
project
,
merge_request
),
:class
=>
"row_title"
%span
.update-author
%span
.update-author
%small
.cdark
=
"#
#{
merge_request
.
id
}
"
%small
.cdark
=
"#
#{
merge_request
.
id
}
"
...
...
app/views/merge_requests/show/_mr_box.html.haml
View file @
72c6be2d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
.alert-message.error.status_info
Closed
.alert-message.error.status_info
Closed
-
else
-
else
.alert-message.success.status_info
Open
.alert-message.success.status_info
Open
=
@merge_request
.
title
=
gfm
@merge_request
.
title
.middle_box_content
.middle_box_content
%div
%div
...
...
app/views/milestones/_milestone.html.haml
View file @
72c6be2d
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
-
if
can?
current_user
,
:admin_milestone
,
milestone
.
project
-
if
can?
current_user
,
:admin_milestone
,
milestone
.
project
=
link_to
'Edit'
,
edit_project_milestone_path
(
milestone
.
project
,
milestone
),
:class
=>
"btn small edit-milestone-link grouped"
=
link_to
'Edit'
,
edit_project_milestone_path
(
milestone
.
project
,
milestone
),
:class
=>
"btn small edit-milestone-link grouped"
%h4
%h4
=
link_to
truncate
(
milestone
.
title
,
:length
=>
100
),
project_milestone_path
(
milestone
.
project
,
milestone
),
:class
=>
"row_title"
=
link_to
_gfm
truncate
(
milestone
.
title
,
:length
=>
100
),
project_milestone_path
(
milestone
.
project
,
milestone
),
:class
=>
"row_title"
%small
%small
=
milestone
.
expires_at
=
milestone
.
expires_at
%br
%br
...
...
app/views/milestones/show.html.haml
View file @
72c6be2d
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
.alert-message.error.status_info
Closed
.alert-message.error.status_info
Closed
-
else
-
else
.alert-message.success.status_info
Open
.alert-message.success.status_info
Open
=
@milestone
.
title
=
gfm
@milestone
.
title
%small
.right
=
@milestone
.
expires_at
%small
.right
=
@milestone
.
expires_at
.middle_box_content
.middle_box_content
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
=
link_to
[
@project
,
issue
]
do
=
link_to
[
@project
,
issue
]
do
%span
.badge.badge-info
##{issue.id}
%span
.badge.badge-info
##{issue.id}
–
–
=
link_to
truncate
(
issue
.
title
,
:length
=>
60
),
[
@project
,
issue
]
=
link_to
_gfm
truncate
(
issue
.
title
,
:length
=>
60
),
[
@project
,
issue
]
%br
%br
=
paginate
@issues
,
:theme
=>
"gitlab"
=
paginate
@issues
,
:theme
=>
"gitlab"
...
...
app/views/notify/new_issue_email.html.haml
View file @
72c6be2d
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
%h2
{
:style
=>
"color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
=
link_to
project_issue_url
(
@issue
.
project
,
@issue
),
:title
=>
@issue
.
title
do
=
"Issue #
#{
@issue
.
id
}
"
=
"Issue #
#{
@issue
.
id
.
to_s
}
"
=
link_to_gfm
truncate
(
@issue
.
title
,
:length
=>
45
),
project_issue_url
(
@issue
.
project
,
@issue
),
:title
=>
@issue
.
title
=
truncate
(
@issue
.
title
,
:length
=>
45
)
%br
%br
app/views/notify/new_merge_request_email.html.haml
View file @
72c6be2d
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
New Merge Request
=
"New Merge Request !
#{
@merge_request
.
id
}
"
=
link_to
truncate
(
@merge_request
.
title
,
:length
=>
16
),
project_merge_request_url
(
@merge_request
.
project
,
@merge_request
)
=
link_to
_gfm
truncate
(
@merge_request
.
title
,
:length
=>
16
),
project_merge_request_url
(
@merge_request
.
project
,
@merge_request
)
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
...
...
app/views/notify/note_commit_email.html.haml
View file @
72c6be2d
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
New comment for commit
=
"New comment for Commit
#{
@commit
.
short_id
}
"
=
link_to
truncate
(
@commit
.
id
.
to_s
,
:length
=>
16
),
project_commit_url
(
@note
.
project
,
:id
=>
@commit
.
id
,
:anchor
=>
"note_
#{
@note
.
id
}
"
)
=
link_to
_gfm
truncate
(
@commit
.
title
,
:length
=>
16
),
project_commit_url
(
@note
.
project
,
:id
=>
@commit
.
id
,
:anchor
=>
"note_
#{
@note
.
id
}
"
)
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
...
...
app/views/notify/note_issue_email.html.haml
View file @
72c6be2d
...
@@ -4,10 +4,8 @@
...
@@ -4,10 +4,8 @@
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
%h2
{
:style
=>
"color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
New comment -
=
"New comment for Issue #
#{
@issue
.
id
}
"
=
link_to
project_issue_url
(
@issue
.
project
,
@issue
,
:anchor
=>
"note_
#{
@note
.
id
}
"
)
do
=
link_to_gfm
truncate
(
@issue
.
title
,
:length
=>
35
),
project_issue_url
(
@issue
.
project
,
@issue
,
:anchor
=>
"note_
#{
@note
.
id
}
"
)
=
"Issue #
#{
@issue
.
id
.
to_s
}
"
=
truncate
(
@issue
.
title
,
:length
=>
35
)
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
...
...
app/views/notify/note_merge_request_email.html.haml
View file @
72c6be2d
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
New comment for Merge Request
=
"New comment for Merge Request !
#{
@merge_request
.
id
}
"
=
link_to
truncate
(
@merge_request
.
title
,
:length
=>
16
),
project_merge_request_url
(
@merge_request
.
project
,
@merge_request
,
:anchor
=>
"note_
#{
@note
.
id
}
"
)
=
link_to
_gfm
truncate
(
@merge_request
.
title
,
:length
=>
16
),
project_merge_request_url
(
@merge_request
.
project
,
@merge_request
,
:anchor
=>
"note_
#{
@note
.
id
}
"
)
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
...
...
app/views/notify/note_wiki_email.html.haml
View file @
72c6be2d
...
@@ -4,9 +4,8 @@
...
@@ -4,9 +4,8 @@
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
%h2
{
:style
=>
"color:#646464 !important; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
New comment -
New comment for Wiki page
=
link_to
project_issue_url
(
@wiki
.
project
,
@wiki
,
:anchor
=>
"note_
#{
@note
.
id
}
"
)
do
=
link_to_gfm
@wiki
.
title
,
project_issue_url
(
@wiki
.
project
,
@wiki
,
:anchor
=>
"note_
#{
@note
.
id
}
"
)
=
"Wiki #
#{
@wiki
.
title
.
to_s
}
"
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
...
...
app/views/notify/reassigned_issue_email.html.haml
View file @
72c6be2d
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
Reassigned Issue
=
"Reassigned Issue #
#{
@issue
.
id
}
"
=
link_to
truncate
(
@issue
.
title
,
:length
=>
16
),
project_issue_url
(
@issue
.
project
,
@issue
)
=
link_to
_gfm
truncate
(
@issue
.
title
,
:length
=>
16
),
project_issue_url
(
@issue
.
project
,
@issue
)
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
...
...
app/views/notify/reassigned_merge_request_email.html.haml
View file @
72c6be2d
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
Reassigned Merge Request
=
"Reassigned Merge Request !
#{
@merge_request
.
id
}
"
=
link_to
truncate
(
@merge_request
.
title
,
:length
=>
16
),
project_merge_request_url
(
@merge_request
.
project
,
@merge_request
)
=
link_to
_gfm
truncate
(
@merge_request
.
title
,
:length
=>
16
),
project_merge_request_url
(
@merge_request
.
project
,
@merge_request
)
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
...
...
app/views/refs/_tree_commit.html.haml
View file @
72c6be2d
-
if
tm
-
if
tm
%strong
=
link_to
"[
#{
tm
.
user_name
}
]"
,
project_team_member_path
(
@project
,
tm
)
%strong
=
link_to
"[
#{
tm
.
user_name
}
]"
,
project_team_member_path
(
@project
,
tm
)
=
link_to
truncate
(
content_commit
.
title
,
:length
=>
tm
?
30
:
50
),
project_commit_path
(
@project
,
content_commit
.
id
),
:class
=>
"tree-commit-link"
=
link_to
_gfm
truncate
(
content_commit
.
title
,
:length
=>
tm
?
30
:
50
),
project_commit_path
(
@project
,
content_commit
.
id
),
:class
=>
"tree-commit-link"
app/views/refs/blame.html.haml
View file @
72c6be2d
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
%td
.blame_commit
%td
.blame_commit
%code
=
link_to
commit
.
short_id
,
project_commit_path
(
@project
,
:id
=>
commit
.
id
)
%code
=
link_to
commit
.
short_id
,
project_commit_path
(
@project
,
:id
=>
commit
.
id
)
=
link_to
truncate
(
commit
.
title
,
:length
=>
30
),
project_commit_path
(
@project
,
:id
=>
commit
.
id
),
:class
=>
"row_title"
rescue
"--broken encoding"
=
link_to
_gfm
truncate
(
commit
.
title
,
:length
=>
30
),
project_commit_path
(
@project
,
:id
=>
commit
.
id
),
:class
=>
"row_title"
rescue
"--broken encoding"
%td
.lines
%td
.lines
=
preserve
do
=
preserve
do
%pre
%pre
...
...
app/views/repositories/_branch.html.haml
View file @
72c6be2d
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
%code
=
commit
.
short_id
%code
=
commit
.
short_id
=
image_tag
gravatar_icon
(
commit
.
author_email
),
:class
=>
""
,
:width
=>
16
=
image_tag
gravatar_icon
(
commit
.
author_email
),
:class
=>
""
,
:width
=>
16
=
truncate
(
commit
.
title
,
:length
=>
40
)
=
gfm
truncate
(
commit
.
title
,
:length
=>
40
)
%td
%td
%span
.update-author.right
%span
.update-author.right
=
time_ago_in_words
(
commit
.
committed_date
)
=
time_ago_in_words
(
commit
.
committed_date
)
...
...
app/views/repositories/_feed.html.haml
View file @
72c6be2d
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
=
link_to
project_commits_path
(
@project
,
commit
.
id
)
do
=
link_to
project_commits_path
(
@project
,
commit
.
id
)
do
%code
=
commit
.
short_id
%code
=
commit
.
short_id
=
image_tag
gravatar_icon
(
commit
.
author_email
),
:class
=>
""
,
:width
=>
16
=
image_tag
gravatar_icon
(
commit
.
author_email
),
:class
=>
""
,
:width
=>
16
=
truncate
(
commit
.
title
,
:length
=>
40
)
=
gfm
truncate
(
commit
.
title
,
:length
=>
40
)
%td
%td
%span
.right.cgray
%span
.right.cgray
=
time_ago_in_words
(
commit
.
committed_date
)
=
time_ago_in_words
(
commit
.
committed_date
)
...
...
app/views/repositories/tags.html.haml
View file @
72c6be2d
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
=
link_to
project_commit_path
(
@project
,
commit
.
id
)
do
=
link_to
project_commit_path
(
@project
,
commit
.
id
)
do
%code
=
commit
.
short_id
%code
=
commit
.
short_id
=
image_tag
gravatar_icon
(
commit
.
author_email
),
:class
=>
""
,
:width
=>
16
=
image_tag
gravatar_icon
(
commit
.
author_email
),
:class
=>
""
,
:width
=>
16
=
truncate
(
commit
.
title
,
:length
=>
40
)
=
gfm
truncate
(
commit
.
title
,
:length
=>
40
)
%td
%td
%span
.update-author.right
%span
.update-author.right
=
time_ago_in_words
(
commit
.
committed_date
)
=
time_ago_in_words
(
commit
.
committed_date
)
...
...
lib/redcarpet/render/gitlab_html.rb
View file @
72c6be2d
class
Redcarpet::Render::GitlabHTML
<
Redcarpet
::
Render
::
HTML
class
Redcarpet::Render::GitlabHTML
<
Redcarpet
::
Render
::
HTML
attr_reader
:template
alias_method
:h
,
:template
def
initialize
(
template
,
options
=
{})
@template
=
template
@project
=
@template
.
instance_variable_get
(
"@project"
)
super
options
end
def
block_code
(
code
,
language
)
def
block_code
(
code
,
language
)
if
Pygments
::
Lexer
.
find
(
language
)
if
Pygments
::
Lexer
.
find
(
language
)
Pygments
.
highlight
(
code
,
:lexer
=>
language
,
:options
=>
{
:encoding
=>
'utf-8'
})
Pygments
.
highlight
(
code
,
:lexer
=>
language
,
:options
=>
{
:encoding
=>
'utf-8'
})
...
@@ -6,4 +16,8 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
...
@@ -6,4 +16,8 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
Pygments
.
highlight
(
code
,
:options
=>
{
:encoding
=>
'utf-8'
})
Pygments
.
highlight
(
code
,
:options
=>
{
:encoding
=>
'utf-8'
})
end
end
end
end
def
postprocess
(
full_document
)
h
.
gfm
(
full_document
)
end
end
end
spec/helpers/commit_helper_spec.rb
deleted
100644 → 0
View file @
c120457a
require
"spec_helper"
include
Haml
::
Helpers
describe
CommitsHelper
do
before
do
@project
=
Factory
:project
@other_project
=
Factory
:project
,
:path
=>
"OtherPath"
,
:code
=>
"OtherCode"
@fake_user
=
Factory
:user
@valid_issue
=
Factory
:issue
,
:assignee
=>
@fake_user
,
:author
=>
@fake_user
,
:project
=>
@project
@invalid_issue
=
Factory
:issue
,
:assignee
=>
@fake_user
,
:author
=>
@fake_user
,
:project
=>
@other_project
end
it
"should provides return message untouched if no issue number present"
do
message
=
"Dummy message without issue number"
commit_msg_with_link_to_issues
(
@project
,
message
).
should
eql
message
end
it
"should returns message handled by preserve"
do
message
=
"My brand new
Commit on multiple
lines !"
#\n are converted to 
 as specified in preserve_rspec
expected
=
"My brand new
 Commit on multiple
 lines !"
commit_msg_with_link_to_issues
(
@project
,
message
).
should
eql
expected
end
it
"should returns empty string if message undefined"
do
commit_msg_with_link_to_issues
(
@project
,
nil
).
should
eql
''
end
it
"should returns link_to issue for one valid issue in message"
do
issue_id
=
@valid_issue
.
id
message
=
"One commit message #
#{
issue_id
}
"
expected
=
"One commit message <a href=
\"
/
#{
@project
.
code
}
/issues/
#{
issue_id
}
\"
>#
#{
issue_id
}
</a>"
commit_msg_with_link_to_issues
(
@project
,
message
).
should
eql
expected
end
it
"should returns message untouched for one invalid issue in message"
do
issue_id
=
@invalid_issue
.
id
message
=
"One commit message #
#{
issue_id
}
"
commit_msg_with_link_to_issues
(
@project
,
message
).
should
eql
message
end
it
"should handle multiple issue references in commit message"
do
issue_id
=
@valid_issue
.
id
invalid_issue_id
=
@invalid_issue
.
id
message
=
"One big commit message with a valid issue #
#{
issue_id
}
and an invalid one #
#{
invalid_issue_id
}
.
We reference valid #
#{
issue_id
}
multiple times (#
#{
issue_id
}
) as the invalid #
#{
invalid_issue_id
}
is also
referenced another time (#
#{
invalid_issue_id
}
)"
expected
=
"One big commit message with a valid issue <a href=
\"
/
#{
@project
.
code
}
/issues/
#{
issue_id
}
\"
>#
#{
issue_id
}
</a>"
+
" and an invalid one #
#{
invalid_issue_id
}
.
 "
+
"We reference valid <a href=
\"
/
#{
@project
.
code
}
/issues/
#{
issue_id
}
\"
>#
#{
issue_id
}
</a> multiple times "
+
"(<a href=
\"
/
#{
@project
.
code
}
/issues/
#{
issue_id
}
\"
>#
#{
issue_id
}
</a>) "
+
"as the invalid #
#{
invalid_issue_id
}
is also
 referenced another time (#
#{
invalid_issue_id
}
)"
commit_msg_with_link_to_issues
(
@project
,
message
).
should
eql
expected
end
end
\ No newline at end of file
spec/helpers/gitlab_flavored_markdown_spec.rb
0 → 100644
View file @
72c6be2d
This diff is collapsed.
Click to expand it.
spec/mailers/notify_spec.rb
View file @
72c6be2d
...
@@ -60,7 +60,7 @@ describe Notify do
...
@@ -60,7 +60,7 @@ describe Notify do
it_behaves_like
'an assignee email'
it_behaves_like
'an assignee email'
it
'has the correct subject'
do
it
'has the correct subject'
do
should
have_subject
/
New Issue was created
/
should
have_subject
/
new issue #
#{
issue
.
id
}
/
end
end
it
'contains a link to the new issue'
do
it
'contains a link to the new issue'
do
...
@@ -102,7 +102,7 @@ describe Notify do
...
@@ -102,7 +102,7 @@ describe Notify do
it_behaves_like
'an assignee email'
it_behaves_like
'an assignee email'
it
'has the correct subject'
do
it
'has the correct subject'
do
should
have_subject
/new merge request/
should
have_subject
/new merge request
!
#{
merge_request
.
id
}
/
end
end
it
'contains a link to the new merge request'
do
it
'contains a link to the new merge request'
do
...
@@ -126,7 +126,7 @@ describe Notify do
...
@@ -126,7 +126,7 @@ describe Notify do
it_behaves_like
'a multiple recipients email'
it_behaves_like
'a multiple recipients email'
it
'has the correct subject'
do
it
'has the correct subject'
do
should
have_subject
/
merge request changed
/
should
have_subject
/
changed merge request !
#{
merge_request
.
id
}
/
end
end
it
'contains the name of the previous assignee'
do
it
'contains the name of the previous assignee'
do
...
@@ -188,6 +188,8 @@ describe Notify do
...
@@ -188,6 +188,8 @@ describe Notify do
mock
(
:commit
).
tap
do
|
commit
|
mock
(
:commit
).
tap
do
|
commit
|
commit
.
stub
(
:id
).
and_return
(
'fauxsha1'
)
commit
.
stub
(
:id
).
and_return
(
'fauxsha1'
)
commit
.
stub
(
:project
).
and_return
(
project
)
commit
.
stub
(
:project
).
and_return
(
project
)
commit
.
stub
(
:short_id
).
and_return
(
'fauxsha1'
)
commit
.
stub
(
:safe_message
).
and_return
(
'some message'
)
end
end
end
end
before
(
:each
)
{
note
.
stub
(
:target
).
and_return
(
commit
)
}
before
(
:each
)
{
note
.
stub
(
:target
).
and_return
(
commit
)
}
...
@@ -197,7 +199,7 @@ describe Notify do
...
@@ -197,7 +199,7 @@ describe Notify do
it_behaves_like
'a note email'
it_behaves_like
'a note email'
it
'has the correct subject'
do
it
'has the correct subject'
do
should
have_subject
/note for commit/
should
have_subject
/note for commit
#{
commit
.
short_id
}
/
end
end
it
'contains a link to the commit'
do
it
'contains a link to the commit'
do
...
@@ -215,7 +217,7 @@ describe Notify do
...
@@ -215,7 +217,7 @@ describe Notify do
it_behaves_like
'a note email'
it_behaves_like
'a note email'
it
'has the correct subject'
do
it
'has the correct subject'
do
should
have_subject
/note for merge request/
should
have_subject
/note for merge request
!
#{
merge_request
.
id
}
/
end
end
it
'contains a link to the merge request note'
do
it
'contains a link to the merge request note'
do
...
@@ -233,7 +235,7 @@ describe Notify do
...
@@ -233,7 +235,7 @@ describe Notify do
it_behaves_like
'a note email'
it_behaves_like
'a note email'
it
'has the correct subject'
do
it
'has the correct subject'
do
should
have_subject
/note for issue
#{
issue
.
id
}
/
should
have_subject
/note for issue #
#
{
issue
.
id
}
/
end
end
it
'contains a link to the issue note'
do
it
'contains a link to the issue note'
do
...
...
spec/requests/gitlab_flavored_markdown_spec.rb
0 → 100644
View file @
72c6be2d
require
'spec_helper'
describe
"Gitlab Flavored Markdown"
do
let
(
:project
)
{
Factory
:project
}
let
(
:issue
)
{
Factory
:issue
,
:project
=>
project
}
let
(
:merge_request
)
{
Factory
:merge_request
,
:project
=>
project
}
let
(
:fred
)
do
u
=
Factory
:user
,
:name
=>
"fred"
project
.
users
<<
u
u
end
before
do
# add test branch
@branch_name
=
"gfm-test"
r
=
project
.
repo
i
=
r
.
index
# add test file
@test_file
=
"gfm_test_file"
i
.
add
(
@test_file
,
"foo
\n
bar
\n
"
)
# add commit with gfm
i
.
commit
(
"fix #
#{
issue
.
id
}
\n\n
ask @
#{
fred
.
name
}
for details"
,
:head
=>
@branch_name
)
# add test tag
@tag_name
=
"gfm-test-tag"
r
.
git
.
native
(
:tag
,
{},
@tag_name
,
commit
.
id
)
end
after
do
# delete test branch and tag
project
.
repo
.
git
.
native
(
:branch
,
{
:D
=>
true
},
@branch_name
)
project
.
repo
.
git
.
native
(
:tag
,
{
:d
=>
true
},
@tag_name
)
project
.
repo
.
gc_auto
end
let
(
:commit
)
{
project
.
commits
(
@branch_name
).
first
}
before
do
login_as
:user
project
.
add_access
(
@user
,
:read
,
:write
)
end
describe
"for commits"
do
it
"should render title in commits#index"
do
visit
project_commits_path
(
project
,
:ref
=>
@branch_name
)
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
it
"should render title in commits#show"
do
visit
project_commit_path
(
project
,
:id
=>
commit
.
id
)
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
it
"should render description in commits#show"
do
visit
project_commit_path
(
project
,
:id
=>
commit
.
id
)
page
.
should
have_link
(
"@
#{
fred
.
name
}
"
)
end
it
"should render title in refs#tree"
,
:js
=>
true
do
visit
tree_project_ref_path
(
project
,
:id
=>
@branch_name
)
within
(
".tree_commit"
)
do
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
end
it
"should render title in refs#blame"
do
visit
blame_file_project_ref_path
(
project
,
:id
=>
@branch_name
,
:path
=>
@test_file
)
within
(
".blame_commit"
)
do
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
end
it
"should render title in repositories#branches"
do
visit
branches_project_repository_path
(
project
)
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
it
"should render title in repositories#tags"
do
visit
tags_project_repository_path
(
project
)
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
end
describe
"for issues"
do
before
do
@other_issue
=
Factory
:issue
,
:author
=>
@user
,
:assignee
=>
@user
,
:project
=>
project
@issue
=
Factory
:issue
,
:author
=>
@user
,
:assignee
=>
@user
,
:project
=>
project
,
:title
=>
"fix #
#{
@other_issue
.
id
}
"
,
:description
=>
"ask @
#{
fred
.
name
}
for details"
end
it
"should render subject in issues#index"
do
visit
project_issues_path
(
project
)
page
.
should
have_link
(
"#
#{
@other_issue
.
id
}
"
)
end
it
"should render subject in issues#show"
do
visit
project_issue_path
(
project
,
@issue
)
page
.
should
have_link
(
"#
#{
@other_issue
.
id
}
"
)
end
it
"should render details in issues#show"
do
visit
project_issue_path
(
project
,
@issue
)
page
.
should
have_link
(
"@
#{
fred
.
name
}
"
)
end
end
describe
"for merge requests"
do
before
do
@merge_request
=
Factory
:merge_request
,
:project
=>
project
,
:title
=>
"fix #
#{
issue
.
id
}
"
end
it
"should render title in merge_requests#index"
do
visit
project_merge_requests_path
(
project
)
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
it
"should render title in merge_requests#show"
do
visit
project_merge_request_path
(
project
,
@merge_request
)
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
end
describe
"for milestones"
do
before
do
@milestone
=
Factory
:milestone
,
:project
=>
project
,
:title
=>
"fix #
#{
issue
.
id
}
"
,
:description
=>
"ask @
#{
fred
.
name
}
for details"
end
it
"should render title in milestones#index"
do
visit
project_milestones_path
(
project
)
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
it
"should render title in milestones#show"
do
visit
project_milestone_path
(
project
,
@milestone
)
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
it
"should render description in milestones#show"
do
visit
project_milestone_path
(
project
,
@milestone
)
page
.
should
have_link
(
"@
#{
fred
.
name
}
"
)
end
end
describe
"for notes"
do
it
"should render in commits#show"
,
:js
=>
true
do
visit
project_commit_path
(
project
,
:id
=>
commit
.
id
)
fill_in
"note_note"
,
:with
=>
"see #
#{
issue
.
id
}
"
click_button
"Add Comment"
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
it
"should render in issue#show"
,
:js
=>
true
do
visit
project_issue_path
(
project
,
issue
)
fill_in
"note_note"
,
:with
=>
"see #
#{
issue
.
id
}
"
click_button
"Add Comment"
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
it
"should render in merge_request#show"
,
:js
=>
true
do
visit
project_merge_request_path
(
project
,
merge_request
)
fill_in
"note_note"
,
:with
=>
"see #
#{
issue
.
id
}
"
click_button
"Add Comment"
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
it
"should render in projects#wall"
,
:js
=>
true
do
visit
wall_project_path
(
project
)
fill_in
"note_note"
,
:with
=>
"see #
#{
issue
.
id
}
"
click_button
"Add Comment"
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
it
"should render in wikis#index"
,
:js
=>
true
do
visit
project_wiki_path
(
project
,
:index
)
fill_in
"Title"
,
:with
=>
'Test title'
fill_in
"Content"
,
:with
=>
'[link test](test)'
click_on
"Save"
fill_in
"note_note"
,
:with
=>
"see #
#{
issue
.
id
}
"
click_button
"Add Comment"
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
end
end
describe
"for wikis"
do
before
do
visit
project_wiki_path
(
project
,
:index
)
fill_in
"Title"
,
:with
=>
"Circumvent #
#{
issue
.
id
}
"
fill_in
"Content"
,
:with
=>
"# Other pages
\n\n
* [Foo](foo)
\n
* [Bar](bar)
\n\n
Also look at #
#{
issue
.
id
}
:-)"
click_on
"Save"
end
it
"should NOT render title in wikis#show"
do
within
(
".content h3"
)
do
# page title
page
.
should
have_content
(
"Circumvent #
#{
issue
.
id
}
"
)
page
.
should_not
have_link
(
"#
#{
issue
.
id
}
"
)
end
end
it
"should render content in wikis#show"
do
page
.
should
have_link
(
"#
#{
issue
.
id
}
"
)
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