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
0d3a9a6d
Commit
0d3a9a6d
authored
Aug 18, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make input name to be a function
parent
72503666
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
app/assets/javascripts/gl_dropdown.js
app/assets/javascripts/gl_dropdown.js
+11
-8
No files found.
app/assets/javascripts/gl_dropdown.js
View file @
0d3a9a6d
...
@@ -470,7 +470,8 @@
...
@@ -470,7 +470,8 @@
}
else
{
}
else
{
if
(
!
selected
)
{
if
(
!
selected
)
{
value
=
this
.
options
.
id
?
this
.
options
.
id
(
data
)
:
data
.
id
;
value
=
this
.
options
.
id
?
this
.
options
.
id
(
data
)
:
data
.
id
;
fieldName
=
this
.
options
.
fieldName
;
fieldName
=
_
.
isFunction
(
this
.
options
.
fieldName
)
?
this
.
options
.
fieldName
()
:
this
.
options
.
fieldName
;
field
=
this
.
dropdown
.
parent
().
find
(
"
input[name='
"
+
fieldName
+
"
'][value='
"
+
value
+
"
']
"
);
field
=
this
.
dropdown
.
parent
().
find
(
"
input[name='
"
+
fieldName
+
"
'][value='
"
+
value
+
"
']
"
);
if
(
field
.
length
)
{
if
(
field
.
length
)
{
selected
=
true
;
selected
=
true
;
...
@@ -533,7 +534,6 @@
...
@@ -533,7 +534,6 @@
GitLabDropdown
.
prototype
.
rowClicked
=
function
(
el
)
{
GitLabDropdown
.
prototype
.
rowClicked
=
function
(
el
)
{
var
field
,
fieldName
,
groupName
,
isInput
,
selectedIndex
,
selectedObject
,
value
;
var
field
,
fieldName
,
groupName
,
isInput
,
selectedIndex
,
selectedObject
,
value
;
fieldName
=
this
.
options
.
fieldName
;
isInput
=
$
(
this
.
el
).
is
(
'
input
'
);
isInput
=
$
(
this
.
el
).
is
(
'
input
'
);
if
(
this
.
renderedData
)
{
if
(
this
.
renderedData
)
{
groupName
=
el
.
data
(
'
group
'
);
groupName
=
el
.
data
(
'
group
'
);
...
@@ -545,6 +545,7 @@
...
@@ -545,6 +545,7 @@
selectedObject
=
this
.
renderedData
[
selectedIndex
];
selectedObject
=
this
.
renderedData
[
selectedIndex
];
}
}
}
}
fieldName
=
_
.
isFunction
(
this
.
options
.
fieldName
)
?
this
.
options
.
fieldName
(
selectedObject
)
:
this
.
options
.
fieldName
;
value
=
this
.
options
.
id
?
this
.
options
.
id
(
selectedObject
,
el
)
:
selectedObject
.
id
;
value
=
this
.
options
.
id
?
this
.
options
.
id
(
selectedObject
,
el
)
:
selectedObject
.
id
;
if
(
isInput
)
{
if
(
isInput
)
{
field
=
$
(
this
.
el
);
field
=
$
(
this
.
el
);
...
@@ -559,10 +560,9 @@
...
@@ -559,10 +560,9 @@
field
.
remove
();
field
.
remove
();
}
}
if
(
this
.
options
.
toggleLabel
)
{
if
(
this
.
options
.
toggleLabel
)
{
return
this
.
updateLabel
(
selectedObject
,
el
,
this
);
this
.
updateLabel
(
selectedObject
,
el
,
this
);
}
else
{
return
selectedObject
;
}
}
return
selectedObject
;
}
else
if
(
el
.
hasClass
(
INDETERMINATE_CLASS
))
{
}
else
if
(
el
.
hasClass
(
INDETERMINATE_CLASS
))
{
el
.
addClass
(
ACTIVE_CLASS
);
el
.
addClass
(
ACTIVE_CLASS
);
el
.
removeClass
(
INDETERMINATE_CLASS
);
el
.
removeClass
(
INDETERMINATE_CLASS
);
...
@@ -570,7 +570,7 @@
...
@@ -570,7 +570,7 @@
field
.
remove
();
field
.
remove
();
}
}
if
(
!
field
.
length
&&
fieldName
)
{
if
(
!
field
.
length
&&
fieldName
)
{
this
.
addInput
(
fieldName
,
value
);
this
.
addInput
(
fieldName
,
value
,
selectedObject
);
}
}
return
selectedObject
;
return
selectedObject
;
}
else
{
}
else
{
...
@@ -589,7 +589,7 @@
...
@@ -589,7 +589,7 @@
}
}
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
if
(
!
field
.
length
&&
fieldName
)
{
if
(
!
field
.
length
&&
fieldName
)
{
this
.
addInput
(
fieldName
,
value
);
this
.
addInput
(
fieldName
,
value
,
selectedObject
);
}
else
{
}
else
{
field
.
val
(
value
).
trigger
(
'
change
'
);
field
.
val
(
value
).
trigger
(
'
change
'
);
}
}
...
@@ -598,12 +598,15 @@
...
@@ -598,12 +598,15 @@
}
}
};
};
GitLabDropdown
.
prototype
.
addInput
=
function
(
fieldName
,
value
)
{
GitLabDropdown
.
prototype
.
addInput
=
function
(
fieldName
,
value
,
selectedObject
)
{
var
$input
;
var
$input
;
$input
=
$
(
'
<input>
'
).
attr
(
'
type
'
,
'
hidden
'
).
attr
(
'
name
'
,
fieldName
).
val
(
value
);
$input
=
$
(
'
<input>
'
).
attr
(
'
type
'
,
'
hidden
'
).
attr
(
'
name
'
,
fieldName
).
val
(
value
);
if
(
this
.
options
.
inputId
!=
null
)
{
if
(
this
.
options
.
inputId
!=
null
)
{
$input
.
attr
(
'
id
'
,
this
.
options
.
inputId
);
$input
.
attr
(
'
id
'
,
this
.
options
.
inputId
);
}
}
if
(
selectedObject
.
type
)
{
$input
.
attr
(
'
data-type
'
,
selectedObject
.
type
);
}
return
this
.
dropdown
.
before
(
$input
);
return
this
.
dropdown
.
before
(
$input
);
};
};
...
...
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