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
db8836ca
Commit
db8836ca
authored
Apr 02, 2016
by
Arinde Eniola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attach the utitlity function to the global scope with some changes
parent
261c8e76
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
35 deletions
+33
-35
app/assets/javascripts/issues.js.coffee
app/assets/javascripts/issues.js.coffee
+2
-2
app/assets/javascripts/lib/url_utility.js
app/assets/javascripts/lib/url_utility.js
+0
-33
app/assets/javascripts/lib/url_utility.js.coffee
app/assets/javascripts/lib/url_utility.js.coffee
+31
-0
No files found.
app/assets/javascripts/issues.js.coffee
View file @
db8836ca
...
...
@@ -33,12 +33,12 @@
paramKeys
=
[
'author_id'
,
'label_name'
,
'milestone_title'
,
'assignee_id'
,
'issue_search'
]
for
paramKey
in
paramKeys
newParams
[
paramKey
]
=
getUrlParameter
(
paramKey
)
or
''
newParams
[
paramKey
]
=
g
l
.
utils
.
g
etUrlParameter
(
paramKey
)
or
''
if
stateFilters
.
length
stateFilters
.
find
(
'a'
).
each
->
initialUrl
=
$
(
this
).
attr
'href'
$
(
this
).
attr
'href'
,
mergeUrlParams
(
newParams
,
initialUrl
)
$
(
this
).
attr
'href'
,
gl
.
utils
.
mergeUrlParams
(
newParams
,
initialUrl
)
# Make sure we trigger ajax request only after user stop typing
initSearch
:
->
...
...
app/assets/javascripts/lib/url_utility.js
deleted
100644 → 0
View file @
261c8e76
function
getUrlParameter
(
sParam
)
{
var
sPageURL
=
decodeURIComponent
(
window
.
location
.
search
.
substring
(
1
)),
sURLVariables
=
sPageURL
.
split
(
'
&
'
),
sParameterName
,
i
;
for
(
i
=
0
;
i
<
sURLVariables
.
length
;
i
++
)
{
sParameterName
=
sURLVariables
[
i
].
split
(
'
=
'
);
if
(
sParameterName
[
0
]
===
sParam
)
{
return
sParameterName
[
1
]
===
undefined
?
true
:
sParameterName
[
1
];
}
}
}
/**
* @param {Object} params - url keys and value to merge
* @param {String} url
*/
function
mergeUrlParams
(
params
,
url
){
var
newUrl
=
decodeURIComponent
(
url
);
Object
.
keys
(
params
).
forEach
(
function
(
paramName
)
{
var
pattern
=
new
RegExp
(
'
\\
b(
'
+
paramName
+
'
=).*?(&|$)
'
)
if
(
url
.
search
(
pattern
)
>=
0
){
newUrl
=
newUrl
.
replace
(
pattern
,
'
$1
'
+
params
[
paramName
]
+
'
$2
'
);
}
else
{
newUrl
=
newUrl
+
(
newUrl
.
indexOf
(
'
?
'
)
>
0
?
'
&
'
:
'
?
'
)
+
paramName
+
'
=
'
+
params
[
paramName
]
}
});
return
newUrl
;
}
\ No newline at end of file
app/assets/javascripts/lib/url_utility.js.coffee
0 → 100644
View file @
db8836ca
((
w
)
->
w
.
gl
?=
{}
w
.
gl
.
utils
?=
{}
w
.
gl
.
utils
.
getUrlParameter
=
(
sParam
)
->
sPageURL
=
decodeURIComponent
(
window
.
location
.
search
.
substring
(
1
))
sURLVariables
=
sPageURL
.
split
(
'&'
)
sParameterName
=
undefined
i
=
0
while
i
<
sURLVariables
.
length
sParameterName
=
sURLVariables
[
i
].
split
(
'='
)
if
sParameterName
[
0
]
is
sParam
return
if
sParameterName
[
1
]
is
undefined
then
true
else
sParameterName
[
1
]
i
++
# #
# @param {Object} params - url keys and value to merge
# @param {String} url
# #
w
.
gl
.
utils
.
mergeUrlParams
=
(
params
,
url
)
->
newUrl
=
decodeURIComponent
(
url
)
for
paramName
,
paramValue
of
params
pattern
=
new
RegExp
"
\\
b(
#{
paramName
}
=).*?(&|$)"
if
url
.
search
(
pattern
)
>=
0
newUrl
=
newUrl
.
replace
pattern
,
"$1
#{
paramValue
}
$2"
else
newUrl
=
"
#{
newUrl
}#{
(
if
newUrl
.
indexOf
(
'?'
)
>
0
then
'&'
else
'?'
)
}#{
paramName
}
=
#{
paramValue
}
"
newUrl
)
window
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