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
04eaed80
Commit
04eaed80
authored
Apr 12, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Used underscore to template list children to utilize their simple escaped interpolation
parent
a62ae94d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
10 deletions
+12
-10
app/assets/javascripts/droplab/constants.js
app/assets/javascripts/droplab/constants.js
+2
-0
app/assets/javascripts/droplab/drop_down.js
app/assets/javascripts/droplab/drop_down.js
+1
-1
app/assets/javascripts/droplab/utils.js
app/assets/javascripts/droplab/utils.js
+8
-8
app/assets/javascripts/filtered_search/dropdown_hint.js
app/assets/javascripts/filtered_search/dropdown_hint.js
+1
-1
No files found.
app/assets/javascripts/droplab/constants.js
View file @
04eaed80
...
...
@@ -2,10 +2,12 @@ const DATA_TRIGGER = 'data-dropdown-trigger';
const
DATA_DROPDOWN
=
'
data-dropdown
'
;
const
SELECTED_CLASS
=
'
droplab-item-selected
'
;
const
ACTIVE_CLASS
=
'
droplab-item-active
'
;
const
TEMPLATE_REGEX
=
/
\{\{(
.+
?)\}\}
/g
;
export
{
DATA_TRIGGER
,
DATA_DROPDOWN
,
SELECTED_CLASS
,
ACTIVE_CLASS
,
TEMPLATE_REGEX
,
};
app/assets/javascripts/droplab/drop_down.js
View file @
04eaed80
...
...
@@ -93,7 +93,7 @@ Object.assign(DropDown.prototype, {
},
renderChildren
:
function
(
data
)
{
var
html
=
utils
.
t
(
this
.
templateString
,
data
);
var
html
=
utils
.
t
emplate
(
this
.
templateString
,
data
);
var
template
=
document
.
createElement
(
'
div
'
);
template
.
innerHTML
=
html
;
...
...
app/assets/javascripts/droplab/utils.js
View file @
04eaed80
/* eslint-disable */
import
{
DATA_TRIGGER
,
DATA_DROPDOWN
}
from
'
./constants
'
;
import
{
template
as
_template
}
from
'
underscore
'
;
import
{
DATA_TRIGGER
,
DATA_DROPDOWN
,
TEMPLATE_REGEX
}
from
'
./constants
'
;
const
utils
=
{
toCamelCase
(
attr
)
{
return
this
.
camelize
(
attr
.
split
(
'
-
'
).
slice
(
1
).
join
(
'
'
));
},
t
(
s
,
d
)
{
for
(
const
p
in
d
)
{
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
d
,
p
))
{
s
=
s
.
replace
(
new
RegExp
(
`{{
${
p
}
}}`
,
'
g
'
),
d
[
p
]);
}
}
return
s
;
template
(
templateString
,
data
)
{
const
template
=
_template
(
templateString
,
{
escape
:
TEMPLATE_REGEX
,
});
return
template
(
data
);
},
camelize
(
str
)
{
...
...
app/assets/javascripts/filtered_search/dropdown_hint.js
View file @
04eaed80
...
...
@@ -63,7 +63,7 @@ require('./filtered_search_dropdown');
Object
.
assign
({
icon
:
`fa-
${
icon
}
`
,
hint
,
tag
:
`
<
${
tag
}
>
`
,
tag
:
`
<
${
tag
}
>
`
,
},
type
&&
{
type
}),
);
}
...
...
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