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
1196a073
Commit
1196a073
authored
Dec 21, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed old weight_select.js file
parent
eb03035f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
86 deletions
+0
-86
app/assets/javascripts/weight_select.js
app/assets/javascripts/weight_select.js
+0
-86
No files found.
app/assets/javascripts/weight_select.js
deleted
100644 → 0
View file @
eb03035f
/* eslint-disable space-before-function-paren, wrap-iife, prefer-arrow-callback, max-len, one-var, no-var, one-var-declaration-per-line, object-shorthand, comma-dangle, no-shadow, quotes, no-unused-vars, no-else-return, consistent-return, no-param-reassign, prefer-template, padded-blocks, func-names */
function
WeightSelect
(
els
,
options
=
{})
{
const
$els
=
$
(
els
||
'
.js-weight-select
'
);
$els
.
each
(
function
(
i
,
dropdown
)
{
var
$block
,
$dropdown
,
$loading
,
$selectbox
,
$sidebarCollapsedValue
,
$value
,
abilityName
,
updateUrl
,
updateWeight
;
$dropdown
=
$
(
dropdown
);
updateUrl
=
$dropdown
.
data
(
'
issueUpdate
'
);
$selectbox
=
$dropdown
.
closest
(
'
.selectbox
'
);
$block
=
$selectbox
.
closest
(
'
.block
'
);
$sidebarCollapsedValue
=
$block
.
find
(
'
.sidebar-collapsed-icon span
'
);
$value
=
$block
.
find
(
'
.value
'
);
abilityName
=
$dropdown
.
data
(
'
ability-name
'
);
$loading
=
$block
.
find
(
'
.block-loading
'
).
fadeOut
();
const
fieldName
=
options
.
fieldName
||
$dropdown
.
data
(
"
field-name
"
);
const
inputField
=
$dropdown
.
closest
(
'
.selectbox
'
).
find
(
`input[name='
${
fieldName
}
']`
);
if
(
Object
.
keys
(
options
).
includes
(
'
selected
'
))
{
inputField
.
val
(
options
.
selected
);
}
updateWeight
=
function
(
selected
)
{
var
data
;
data
=
{};
data
[
abilityName
]
=
{};
data
[
abilityName
].
weight
=
selected
!=
null
?
selected
:
null
;
$loading
.
fadeIn
();
$dropdown
.
trigger
(
'
loading.gl.dropdown
'
);
return
$
.
ajax
({
type
:
'
PUT
'
,
dataType
:
'
json
'
,
url
:
updateUrl
,
data
:
data
}).
done
(
function
(
data
)
{
$dropdown
.
trigger
(
'
loaded.gl.dropdown
'
);
$loading
.
fadeOut
();
$selectbox
.
hide
();
if
(
data
.
weight
!=
null
)
{
$value
.
html
(
`<strong>
${
data
.
weight
}
</strong>`
);
}
else
{
$value
.
html
(
'
<span class="no-value">None</span>
'
);
}
return
$sidebarCollapsedValue
.
html
(
data
.
weight
);
});
};
return
$dropdown
.
glDropdown
({
selectable
:
true
,
fieldName
,
toggleLabel
:
function
(
selected
,
el
)
{
return
$
(
el
).
data
(
"
id
"
);
},
hidden
:
function
(
e
)
{
$selectbox
.
hide
();
return
$value
.
css
(
'
display
'
,
''
);
},
id
:
function
(
obj
,
el
)
{
if
(
$
(
el
).
data
(
"
none
"
)
==
null
)
{
return
$
(
el
).
data
(
"
id
"
);
}
else
{
return
''
;
}
},
clicked
:
function
(
glDropdownEvt
)
{
const
e
=
glDropdownEvt
.
e
;
let
selected
=
glDropdownEvt
.
selectedObj
;
const
inputField
=
$dropdown
.
closest
(
'
.selectbox
'
).
find
(
`input[name='
${
fieldName
}
']`
);
if
(
options
.
handleClick
)
{
e
.
preventDefault
();
selected
=
inputField
.
val
();
options
.
handleClick
(
selected
);
}
else
if
(
$
(
dropdown
).
is
(
"
.js-filter-submit
"
))
{
return
$
(
dropdown
).
parents
(
'
form
'
).
submit
();
}
else
if
(
$dropdown
.
is
(
'
.js-issuable-form-weight
'
))
{
e
.
preventDefault
();
}
else
{
selected
=
inputField
.
val
();
return
updateWeight
(
selected
);
}
}
});
});
}
export
default
WeightSelect
;
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