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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
0d835297
Commit
0d835297
authored
Jul 17, 2016
by
winniehell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use JavaScript tooltips for mentions (!5301)
parent
177cc4e4
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
28 additions
and
56 deletions
+28
-56
CHANGELOG
CHANGELOG
+1
-0
app/models/commit.rb
app/models/commit.rb
+0
-9
app/models/commit_range.rb
app/models/commit_range.rb
+0
-7
lib/banzai/filter/abstract_reference_filter.rb
lib/banzai/filter/abstract_reference_filter.rb
+1
-9
lib/banzai/filter/commit_range_reference_filter.rb
lib/banzai/filter/commit_range_reference_filter.rb
+1
-1
lib/banzai/filter/commit_reference_filter.rb
lib/banzai/filter/commit_reference_filter.rb
+0
-4
lib/banzai/filter/label_reference_filter.rb
lib/banzai/filter/label_reference_filter.rb
+5
-0
lib/banzai/filter/milestone_reference_filter.rb
lib/banzai/filter/milestone_reference_filter.rb
+4
-0
lib/banzai/filter/reference_filter.rb
lib/banzai/filter/reference_filter.rb
+1
-1
spec/lib/banzai/filter/commit_range_reference_filter_spec.rb
spec/lib/banzai/filter/commit_range_reference_filter_spec.rb
+3
-3
spec/lib/banzai/filter/commit_reference_filter_spec.rb
spec/lib/banzai/filter/commit_reference_filter_spec.rb
+2
-2
spec/lib/banzai/filter/external_issue_reference_filter_spec.rb
...lib/banzai/filter/external_issue_reference_filter_spec.rb
+1
-1
spec/lib/banzai/filter/issue_reference_filter_spec.rb
spec/lib/banzai/filter/issue_reference_filter_spec.rb
+2
-2
spec/lib/banzai/filter/label_reference_filter_spec.rb
spec/lib/banzai/filter/label_reference_filter_spec.rb
+1
-1
spec/lib/banzai/filter/merge_request_reference_filter_spec.rb
.../lib/banzai/filter/merge_request_reference_filter_spec.rb
+2
-2
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
+1
-1
spec/lib/banzai/filter/snippet_reference_filter_spec.rb
spec/lib/banzai/filter/snippet_reference_filter_spec.rb
+2
-2
spec/lib/banzai/filter/user_reference_filter_spec.rb
spec/lib/banzai/filter/user_reference_filter_spec.rb
+1
-1
spec/models/commit_range_spec.rb
spec/models/commit_range_spec.rb
+0
-10
No files found.
CHANGELOG
View file @
0d835297
...
@@ -29,6 +29,7 @@ v 8.12.0 (unreleased)
...
@@ -29,6 +29,7 @@ v 8.12.0 (unreleased)
- Add search to all issue board lists
- Add search to all issue board lists
- Fix groups sort dropdown alignment (ClemMakesApps)
- Fix groups sort dropdown alignment (ClemMakesApps)
- Add horizontal scrolling to all sub-navs on mobile viewports (ClemMakesApps)
- Add horizontal scrolling to all sub-navs on mobile viewports (ClemMakesApps)
- Use JavaScript tooltips for mentions !5301 (winniehell)
- Fix markdown help references (ClemMakesApps)
- Fix markdown help references (ClemMakesApps)
- Add last commit time to repo view (ClemMakesApps)
- Add last commit time to repo view (ClemMakesApps)
- Added project specific enable/disable setting for LFS !5997
- Added project specific enable/disable setting for LFS !5997
...
...
app/models/commit.rb
View file @
0d835297
...
@@ -108,15 +108,6 @@ class Commit
...
@@ -108,15 +108,6 @@ class Commit
@diff_line_count
@diff_line_count
end
end
# Returns a string describing the commit for use in a link title
#
# Example
#
# "Commit: Alex Denisov - Project git clone panel"
def
link_title
"Commit:
#{
author_name
}
-
#{
title
}
"
end
# Returns the commits title.
# Returns the commits title.
#
#
# Usually, the commit title is the first line of the commit message.
# Usually, the commit title is the first line of the commit message.
...
...
app/models/commit_range.rb
View file @
0d835297
...
@@ -4,12 +4,10 @@
...
@@ -4,12 +4,10 @@
#
#
# range = CommitRange.new('f3f85602...e86e1013', project)
# range = CommitRange.new('f3f85602...e86e1013', project)
# range.exclude_start? # => false
# range.exclude_start? # => false
# range.reference_title # => "Commits f3f85602 through e86e1013"
# range.to_s # => "f3f85602...e86e1013"
# range.to_s # => "f3f85602...e86e1013"
#
#
# range = CommitRange.new('f3f856029bc5f966c5a7ee24cf7efefdd20e6019..e86e1013709735be5bb767e2b228930c543f25ae', project)
# range = CommitRange.new('f3f856029bc5f966c5a7ee24cf7efefdd20e6019..e86e1013709735be5bb767e2b228930c543f25ae', project)
# range.exclude_start? # => true
# range.exclude_start? # => true
# range.reference_title # => "Commits f3f85602^ through e86e1013"
# range.to_param # => {from: "f3f856029bc5f966c5a7ee24cf7efefdd20e6019^", to: "e86e1013709735be5bb767e2b228930c543f25ae"}
# range.to_param # => {from: "f3f856029bc5f966c5a7ee24cf7efefdd20e6019^", to: "e86e1013709735be5bb767e2b228930c543f25ae"}
# range.to_s # => "f3f85602..e86e1013"
# range.to_s # => "f3f85602..e86e1013"
#
#
...
@@ -109,11 +107,6 @@ class CommitRange
...
@@ -109,11 +107,6 @@ class CommitRange
reference
reference
end
end
# Returns a String for use in a link's title attribute
def
reference_title
"Commits
#{
sha_start
}
through
#{
sha_to
}
"
end
# Return a Hash of parameters for passing to a URL helper
# Return a Hash of parameters for passing to a URL helper
#
#
# See `namespace_project_compare_url`
# See `namespace_project_compare_url`
...
...
lib/banzai/filter/abstract_reference_filter.rb
View file @
0d835297
...
@@ -18,10 +18,6 @@ module Banzai
...
@@ -18,10 +18,6 @@ module Banzai
@object_sym
||=
object_name
.
to_sym
@object_sym
||=
object_name
.
to_sym
end
end
def
self
.
object_class_title
@object_title
||=
object_class
.
name
.
titleize
end
# Public: Find references in text (like `!123` for merge requests)
# Public: Find references in text (like `!123` for merge requests)
#
#
# AnyReferenceFilter.references_in(text) do |match, id, project_ref, matches|
# AnyReferenceFilter.references_in(text) do |match, id, project_ref, matches|
...
@@ -49,10 +45,6 @@ module Banzai
...
@@ -49,10 +45,6 @@ module Banzai
self
.
class
.
object_sym
self
.
class
.
object_sym
end
end
def
object_class_title
self
.
class
.
object_class_title
end
def
references_in
(
*
args
,
&
block
)
def
references_in
(
*
args
,
&
block
)
self
.
class
.
references_in
(
*
args
,
&
block
)
self
.
class
.
references_in
(
*
args
,
&
block
)
end
end
...
@@ -198,7 +190,7 @@ module Banzai
...
@@ -198,7 +190,7 @@ module Banzai
end
end
def
object_link_title
(
object
)
def
object_link_title
(
object
)
"
#{
object_class_title
}
:
#{
object
.
title
}
"
object
.
title
end
end
def
object_link_text
(
object
,
matches
)
def
object_link_text
(
object
,
matches
)
...
...
lib/banzai/filter/commit_range_reference_filter.rb
View file @
0d835297
...
@@ -35,7 +35,7 @@ module Banzai
...
@@ -35,7 +35,7 @@ module Banzai
end
end
def
object_link_title
(
range
)
def
object_link_title
(
range
)
range
.
reference_title
nil
end
end
end
end
end
end
...
...
lib/banzai/filter/commit_reference_filter.rb
View file @
0d835297
...
@@ -28,10 +28,6 @@ module Banzai
...
@@ -28,10 +28,6 @@ module Banzai
only_path:
context
[
:only_path
])
only_path:
context
[
:only_path
])
end
end
def
object_link_title
(
commit
)
commit
.
link_title
end
def
object_link_text_extras
(
object
,
matches
)
def
object_link_text_extras
(
object
,
matches
)
extras
=
super
extras
=
super
...
...
lib/banzai/filter/label_reference_filter.rb
View file @
0d835297
...
@@ -70,6 +70,11 @@ module Banzai
...
@@ -70,6 +70,11 @@ module Banzai
def
unescape_html_entities
(
text
)
def
unescape_html_entities
(
text
)
CGI
.
unescapeHTML
(
text
.
to_s
)
CGI
.
unescapeHTML
(
text
.
to_s
)
end
end
def
object_link_title
(
object
)
# use title of wrapped element instead
nil
end
end
end
end
end
end
end
lib/banzai/filter/milestone_reference_filter.rb
View file @
0d835297
...
@@ -59,6 +59,10 @@ module Banzai
...
@@ -59,6 +59,10 @@ module Banzai
html_safe
html_safe
end
end
end
end
def
object_link_title
(
object
)
nil
end
end
end
end
end
end
end
lib/banzai/filter/reference_filter.rb
View file @
0d835297
...
@@ -52,7 +52,7 @@ module Banzai
...
@@ -52,7 +52,7 @@ module Banzai
end
end
def
reference_class
(
type
)
def
reference_class
(
type
)
"gfm gfm-
#{
type
}
"
"gfm gfm-
#{
type
}
has-tooltip
"
end
end
# Ensure that a :project key exists in context
# Ensure that a :project key exists in context
...
...
spec/lib/banzai/filter/commit_range_reference_filter_spec.rb
View file @
0d835297
...
@@ -65,14 +65,14 @@ describe Banzai::Filter::CommitRangeReferenceFilter, lib: true do
...
@@ -65,14 +65,14 @@ describe Banzai::Filter::CommitRangeReferenceFilter, lib: true do
expect
(
reference_filter
(
act
).
to_html
).
to
eq
exp
expect
(
reference_filter
(
act
).
to_html
).
to
eq
exp
end
end
it
'includes
a
title attribute'
do
it
'includes
no
title attribute'
do
doc
=
reference_filter
(
"See
#{
reference
}
"
)
doc
=
reference_filter
(
"See
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'title'
)).
to
eq
range
.
reference_title
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'title'
)).
to
eq
""
end
end
it
'includes default classes'
do
it
'includes default classes'
do
doc
=
reference_filter
(
"See
#{
reference
}
"
)
doc
=
reference_filter
(
"See
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-commit_range'
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-commit_range
has-tooltip
'
end
end
it
'includes a data-project attribute'
do
it
'includes a data-project attribute'
do
...
...
spec/lib/banzai/filter/commit_reference_filter_spec.rb
View file @
0d835297
...
@@ -55,7 +55,7 @@ describe Banzai::Filter::CommitReferenceFilter, lib: true do
...
@@ -55,7 +55,7 @@ describe Banzai::Filter::CommitReferenceFilter, lib: true do
it
'includes a title attribute'
do
it
'includes a title attribute'
do
doc
=
reference_filter
(
"See
#{
reference
}
"
)
doc
=
reference_filter
(
"See
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'title'
)).
to
eq
commit
.
link_
title
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'title'
)).
to
eq
commit
.
title
end
end
it
'escapes the title attribute'
do
it
'escapes the title attribute'
do
...
@@ -67,7 +67,7 @@ describe Banzai::Filter::CommitReferenceFilter, lib: true do
...
@@ -67,7 +67,7 @@ describe Banzai::Filter::CommitReferenceFilter, lib: true do
it
'includes default classes'
do
it
'includes default classes'
do
doc
=
reference_filter
(
"See
#{
reference
}
"
)
doc
=
reference_filter
(
"See
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-commit'
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-commit
has-tooltip
'
end
end
it
'includes a data-project attribute'
do
it
'includes a data-project attribute'
do
...
...
spec/lib/banzai/filter/external_issue_reference_filter_spec.rb
View file @
0d835297
...
@@ -64,7 +64,7 @@ describe Banzai::Filter::ExternalIssueReferenceFilter, lib: true do
...
@@ -64,7 +64,7 @@ describe Banzai::Filter::ExternalIssueReferenceFilter, lib: true do
it
'includes default classes'
do
it
'includes default classes'
do
doc
=
filter
(
"Issue
#{
reference
}
"
)
doc
=
filter
(
"Issue
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-issue'
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-issue
has-tooltip
'
end
end
it
'supports an :only_path context'
do
it
'supports an :only_path context'
do
...
...
spec/lib/banzai/filter/issue_reference_filter_spec.rb
View file @
0d835297
...
@@ -54,7 +54,7 @@ describe Banzai::Filter::IssueReferenceFilter, lib: true do
...
@@ -54,7 +54,7 @@ describe Banzai::Filter::IssueReferenceFilter, lib: true do
it
'includes a title attribute'
do
it
'includes a title attribute'
do
doc
=
reference_filter
(
"Issue
#{
reference
}
"
)
doc
=
reference_filter
(
"Issue
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'title'
)).
to
eq
"Issue:
#{
issue
.
title
}
"
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'title'
)).
to
eq
issue
.
title
end
end
it
'escapes the title attribute'
do
it
'escapes the title attribute'
do
...
@@ -66,7 +66,7 @@ describe Banzai::Filter::IssueReferenceFilter, lib: true do
...
@@ -66,7 +66,7 @@ describe Banzai::Filter::IssueReferenceFilter, lib: true do
it
'includes default classes'
do
it
'includes default classes'
do
doc
=
reference_filter
(
"Issue
#{
reference
}
"
)
doc
=
reference_filter
(
"Issue
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-issue'
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-issue
has-tooltip
'
end
end
it
'includes a data-project attribute'
do
it
'includes a data-project attribute'
do
...
...
spec/lib/banzai/filter/label_reference_filter_spec.rb
View file @
0d835297
...
@@ -21,7 +21,7 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
...
@@ -21,7 +21,7 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
it
'includes default classes'
do
it
'includes default classes'
do
doc
=
reference_filter
(
"Label
#{
reference
}
"
)
doc
=
reference_filter
(
"Label
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-label'
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-label
has-tooltip
'
end
end
it
'includes a data-project attribute'
do
it
'includes a data-project attribute'
do
...
...
spec/lib/banzai/filter/merge_request_reference_filter_spec.rb
View file @
0d835297
...
@@ -46,7 +46,7 @@ describe Banzai::Filter::MergeRequestReferenceFilter, lib: true do
...
@@ -46,7 +46,7 @@ describe Banzai::Filter::MergeRequestReferenceFilter, lib: true do
it
'includes a title attribute'
do
it
'includes a title attribute'
do
doc
=
reference_filter
(
"Merge
#{
reference
}
"
)
doc
=
reference_filter
(
"Merge
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'title'
)).
to
eq
"Merge Request:
#{
merge
.
title
}
"
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'title'
)).
to
eq
merge
.
title
end
end
it
'escapes the title attribute'
do
it
'escapes the title attribute'
do
...
@@ -58,7 +58,7 @@ describe Banzai::Filter::MergeRequestReferenceFilter, lib: true do
...
@@ -58,7 +58,7 @@ describe Banzai::Filter::MergeRequestReferenceFilter, lib: true do
it
'includes default classes'
do
it
'includes default classes'
do
doc
=
reference_filter
(
"Merge
#{
reference
}
"
)
doc
=
reference_filter
(
"Merge
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-merge_request'
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-merge_request
has-tooltip
'
end
end
it
'includes a data-project attribute'
do
it
'includes a data-project attribute'
do
...
...
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
View file @
0d835297
...
@@ -20,7 +20,7 @@ describe Banzai::Filter::MilestoneReferenceFilter, lib: true do
...
@@ -20,7 +20,7 @@ describe Banzai::Filter::MilestoneReferenceFilter, lib: true do
it
'includes default classes'
do
it
'includes default classes'
do
doc
=
reference_filter
(
"Milestone
#{
reference
}
"
)
doc
=
reference_filter
(
"Milestone
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-milestone'
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-milestone
has-tooltip
'
end
end
it
'includes a data-project attribute'
do
it
'includes a data-project attribute'
do
...
...
spec/lib/banzai/filter/snippet_reference_filter_spec.rb
View file @
0d835297
...
@@ -39,7 +39,7 @@ describe Banzai::Filter::SnippetReferenceFilter, lib: true do
...
@@ -39,7 +39,7 @@ describe Banzai::Filter::SnippetReferenceFilter, lib: true do
it
'includes a title attribute'
do
it
'includes a title attribute'
do
doc
=
reference_filter
(
"Snippet
#{
reference
}
"
)
doc
=
reference_filter
(
"Snippet
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'title'
)).
to
eq
"Snippet:
#{
snippet
.
title
}
"
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'title'
)).
to
eq
snippet
.
title
end
end
it
'escapes the title attribute'
do
it
'escapes the title attribute'
do
...
@@ -51,7 +51,7 @@ describe Banzai::Filter::SnippetReferenceFilter, lib: true do
...
@@ -51,7 +51,7 @@ describe Banzai::Filter::SnippetReferenceFilter, lib: true do
it
'includes default classes'
do
it
'includes default classes'
do
doc
=
reference_filter
(
"Snippet
#{
reference
}
"
)
doc
=
reference_filter
(
"Snippet
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-snippet'
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-snippet
has-tooltip
'
end
end
it
'includes a data-project attribute'
do
it
'includes a data-project attribute'
do
...
...
spec/lib/banzai/filter/user_reference_filter_spec.rb
View file @
0d835297
...
@@ -104,7 +104,7 @@ describe Banzai::Filter::UserReferenceFilter, lib: true do
...
@@ -104,7 +104,7 @@ describe Banzai::Filter::UserReferenceFilter, lib: true do
it
'includes default classes'
do
it
'includes default classes'
do
doc
=
reference_filter
(
"Hey
#{
reference
}
"
)
doc
=
reference_filter
(
"Hey
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-project_member'
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'class'
)).
to
eq
'gfm gfm-project_member
has-tooltip
'
end
end
it
'supports an :only_path context'
do
it
'supports an :only_path context'
do
...
...
spec/models/commit_range_spec.rb
View file @
0d835297
...
@@ -76,16 +76,6 @@ describe CommitRange, models: true do
...
@@ -76,16 +76,6 @@ describe CommitRange, models: true do
end
end
end
end
describe
'#reference_title'
do
it
'returns the correct String for three-dot ranges'
do
expect
(
range
.
reference_title
).
to
eq
"Commits
#{
full_sha_from
}
through
#{
full_sha_to
}
"
end
it
'returns the correct String for two-dot ranges'
do
expect
(
range2
.
reference_title
).
to
eq
"Commits
#{
full_sha_from
}
^ through
#{
full_sha_to
}
"
end
end
describe
'#to_param'
do
describe
'#to_param'
do
it
'includes the correct keys'
do
it
'includes the correct keys'
do
expect
(
range
.
to_param
.
keys
).
to
eq
%i(from to)
expect
(
range
.
to_param
.
keys
).
to
eq
%i(from to)
...
...
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