Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
45817039
Unverified
Commit
45817039
authored
Aug 22, 2018
by
kyleplo
Committed by
GitHub
Aug 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix acceptableModes
parent
4435408c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
src/views/search/search.jsx
src/views/search/search.jsx
+4
-4
No files found.
src/views/search/search.jsx
View file @
45817039
...
...
@@ -18,6 +18,8 @@ const Tabs = require('../../components/tabs/tabs.jsx');
const
Page
=
require
(
'
../../components/page/www/page.jsx
'
);
const
render
=
require
(
'
../../lib/render.jsx
'
);
const
ACCEPTABLE_MODES
=
[
'
trending
'
,
'
popular
'
,
''
];
require
(
'
./search.scss
'
);
class
Search
extends
React
.
Component
{
...
...
@@ -64,7 +66,7 @@ class Search extends React.Component {
mode
=
mode
.
substring
(
0
,
term
.
indexOf
(
'
&
'
));
}
mode
=
decodeURIComponent
(
mode
.
split
(
'
+
'
).
join
(
'
'
));
this
.
props
.
dispatch
(
navigationActions
.
setMode
(
mode
)
);
this
.
setState
({
mode
:
mode
}
);
}
componentDidUpdate
(
prevProps
)
{
if
(
this
.
props
.
searchTerm
!==
prevProps
.
searchTerm
)
{
...
...
@@ -78,15 +80,13 @@ class Search extends React.Component {
}
const
start
=
pathname
.
lastIndexOf
(
'
/
'
);
const
type
=
pathname
.
substring
(
start
+
1
,
pathname
.
length
);
const
modeOptions
=
[
'
trending
'
,
'
popular
'
,
''
];
return
{
acceptableModes
:
modeOptions
,
tab
:
type
,
loadNumber
:
16
};
}
handleChangeSortMode
(
name
,
value
)
{
if
(
this
.
state
.
acceptableModes
.
indexOf
(
value
)
!==
-
1
)
{
if
(
ACCEPTABLE_MODES
.
indexOf
(
value
)
!==
-
1
)
{
const
term
=
this
.
props
.
searchTerm
.
split
(
'
'
).
join
(
'
+
'
);
window
.
location
=
`
${
window
.
location
.
origin
}
/search/
${
this
.
state
.
tab
}
?q=
${
term
}
&mode=
${
value
}
`
;
...
...
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