Changed path of search page to allow for studio tabs

Users and Forum tabs removed
This commit is contained in:
Rachel Thornton 2016-04-30 16:03:11 -04:00
parent e2a7698cde
commit eb499c929c
3 changed files with 10 additions and 6 deletions

View file

@ -214,7 +214,7 @@ var Navigation = React.createClass({
</li>
<li className="search">
<form action="/search/results" method="get">
<form action="/search/projects" method="get">
<Input type="submit" value="" />
<Input type="text"
aria-label={formatMessage({id: 'general.search'})}

View file

@ -31,7 +31,7 @@
},
{
"name": "search",
"pattern": "^/search/results?$/?$",
"pattern": "^/search/:projects?$/?$",
"view": "search/search",
"title": "Search"
},

View file

@ -35,6 +35,12 @@ var Search = injectIntl(React.createClass({
if (q!=-1) {
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(' ');
this.getSearchResults(0);
},
@ -90,7 +96,7 @@ var Search = injectIntl(React.createClass({
return rows;
},
getTab: function(type) {
var allTab = <a href={"/explore/projects/"+type+"/"}>
var allTab = <a href={"/search/"+type+"?q="+searchTerm+"/"}>
<li>
<FormattedMessage
id={'explore.'+type}
@ -98,7 +104,7 @@ var Search = injectIntl(React.createClass({
</li>
</a>;
if (tab==type) {
allTab = <a href={"/explore/projects/"+type+"/"}>
allTab = <a href={"/search/"+type+"?q="+searchTerm+"/"}>
<li className="active">
<FormattedMessage
id={'explore.'+type}
@ -125,8 +131,6 @@ var Search = injectIntl(React.createClass({
{this.getTab("all")}
{this.getTab("projects")}
{this.getTab("studios")}
{this.getTab("forums")}
{this.getTab("users")}
{/*<div id="sorter">
<div id="sortText">
Sort by: