mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-08-07 11:40:22 -04:00
Changed path of search page to allow for studio tabs
Users and Forum tabs removed
This commit is contained in:
parent
e2a7698cde
commit
eb499c929c
3 changed files with 10 additions and 6 deletions
src
|
@ -214,7 +214,7 @@ var Navigation = React.createClass({
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li className="search">
|
<li className="search">
|
||||||
<form action="/search/results" method="get">
|
<form action="/search/projects" method="get">
|
||||||
<Input type="submit" value="" />
|
<Input type="submit" value="" />
|
||||||
<Input type="text"
|
<Input type="text"
|
||||||
aria-label={formatMessage({id: 'general.search'})}
|
aria-label={formatMessage({id: 'general.search'})}
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "search",
|
"name": "search",
|
||||||
"pattern": "^/search/results?$/?$",
|
"pattern": "^/search/:projects?$/?$",
|
||||||
"view": "search/search",
|
"view": "search/search",
|
||||||
"title": "Search"
|
"title": "Search"
|
||||||
},
|
},
|
||||||
|
|
|
@ -35,6 +35,12 @@ var Search = injectIntl(React.createClass({
|
||||||
if (q!=-1) {
|
if (q!=-1) {
|
||||||
searchTerm = pathname.substring(q+2,pathname.length).toLowerCase();
|
searchTerm = pathname.substring(q+2,pathname.length).toLowerCase();
|
||||||
};
|
};
|
||||||
|
while (searchTerm.indexOf("/")>-1) {
|
||||||
|
searchTerm = searchTerm.substring(0,searchTerm.indexOf("/"));
|
||||||
|
}
|
||||||
|
while (searchTerm.indexOf("&")>-1) {
|
||||||
|
searchTerm = searchTerm.substring(0,searchTerm.indexOf("&"));
|
||||||
|
}
|
||||||
searchTerm = searchTerm.split('+').join(' ');
|
searchTerm = searchTerm.split('+').join(' ');
|
||||||
this.getSearchResults(0);
|
this.getSearchResults(0);
|
||||||
},
|
},
|
||||||
|
@ -90,7 +96,7 @@ var Search = injectIntl(React.createClass({
|
||||||
return rows;
|
return rows;
|
||||||
},
|
},
|
||||||
getTab: function(type) {
|
getTab: function(type) {
|
||||||
var allTab = <a href={"/explore/projects/"+type+"/"}>
|
var allTab = <a href={"/search/"+type+"?q="+searchTerm+"/"}>
|
||||||
<li>
|
<li>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id={'explore.'+type}
|
id={'explore.'+type}
|
||||||
|
@ -98,7 +104,7 @@ var Search = injectIntl(React.createClass({
|
||||||
</li>
|
</li>
|
||||||
</a>;
|
</a>;
|
||||||
if (tab==type) {
|
if (tab==type) {
|
||||||
allTab = <a href={"/explore/projects/"+type+"/"}>
|
allTab = <a href={"/search/"+type+"?q="+searchTerm+"/"}>
|
||||||
<li className="active">
|
<li className="active">
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id={'explore.'+type}
|
id={'explore.'+type}
|
||||||
|
@ -125,8 +131,6 @@ var Search = injectIntl(React.createClass({
|
||||||
{this.getTab("all")}
|
{this.getTab("all")}
|
||||||
{this.getTab("projects")}
|
{this.getTab("projects")}
|
||||||
{this.getTab("studios")}
|
{this.getTab("studios")}
|
||||||
{this.getTab("forums")}
|
|
||||||
{this.getTab("users")}
|
|
||||||
{/*<div id="sorter">
|
{/*<div id="sorter">
|
||||||
<div id="sortText">
|
<div id="sortText">
|
||||||
Sort by:
|
Sort by:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue