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
Boxiang Sun
gitlab-ce
Commits
959f65a0
Commit
959f65a0
authored
Jan 16, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct documentation for `data_attribute` method
Also break up a long line, just 'cause.
parent
142be72a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
lib/banzai/filter/reference_filter.rb
lib/banzai/filter/reference_filter.rb
+5
-3
No files found.
lib/banzai/filter/reference_filter.rb
View file @
959f65a0
...
@@ -20,10 +20,10 @@ module Banzai
...
@@ -20,10 +20,10 @@ module Banzai
# Examples:
# Examples:
#
#
# data_attribute(project: 1, issue: 2)
# data_attribute(project: 1, issue: 2)
# # => "data-reference-
filter
=\"SomeReferenceFilter\" data-project=\"1\" data-issue=\"2\""
# # => "data-reference-
type
=\"SomeReferenceFilter\" data-project=\"1\" data-issue=\"2\""
#
#
# data_attribute(project: 3, merge_request: 4)
# data_attribute(project: 3, merge_request: 4)
# # => "data-reference-
filter
=\"SomeReferenceFilter\" data-project=\"3\" data-merge-request=\"4\""
# # => "data-reference-
type
=\"SomeReferenceFilter\" data-project=\"3\" data-merge-request=\"4\""
#
#
# Returns a String
# Returns a String
def
data_attribute
(
attributes
=
{})
def
data_attribute
(
attributes
=
{})
...
@@ -31,7 +31,9 @@ module Banzai
...
@@ -31,7 +31,9 @@ module Banzai
attributes
[
:reference_type
]
||=
self
.
class
.
reference_type
attributes
[
:reference_type
]
||=
self
.
class
.
reference_type
attributes
.
delete
(
:original
)
if
context
[
:no_original_data
]
attributes
.
delete
(
:original
)
if
context
[
:no_original_data
]
attributes
.
map
{
|
key
,
value
|
%Q(data-
#{
key
.
to_s
.
dasherize
}
="
#{
escape_once
(
value
)
}
")
}.
join
(
" "
)
attributes
.
map
do
|
key
,
value
|
%Q(data-
#{
key
.
to_s
.
dasherize
}
="
#{
escape_once
(
value
)
}
")
end
.
join
(
' '
)
end
end
def
escape_once
(
html
)
def
escape_once
(
html
)
...
...
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