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
src
components/navigation/www
routes.json
views/search

View file

@ -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'})}

View file

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

View file

@ -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: