Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Rex Dri
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Julien Jerphanion
Rex Dri
Commits
ebac59c4
Commit
ebac59c4
authored
Sep 03, 2018
by
Florent Chehab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Search => filter for coherence
parent
9e91cba3
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
56 additions
and
27 deletions
+56
-27
frontend/src/actions/action-types.js
frontend/src/actions/action-types.js
+1
-1
frontend/src/actions/filter.js
frontend/src/actions/filter.js
+20
-0
frontend/src/actions/search.js
frontend/src/actions/search.js
+3
-3
frontend/src/components/App.js
frontend/src/components/App.js
+2
-2
frontend/src/components/filter/DownshiftMultiple.js
frontend/src/components/filter/DownshiftMultiple.js
+3
-3
frontend/src/components/filter/Filter.js
frontend/src/components/filter/Filter.js
+5
-5
frontend/src/components/pages/PageFilter.js
frontend/src/components/pages/PageFilter.js
+3
-3
frontend/src/components/template/listItems.js
frontend/src/components/template/listItems.js
+13
-4
frontend/src/reducers/filter.js
frontend/src/reducers/filter.js
+3
-3
frontend/src/reducers/index.js
frontend/src/reducers/index.js
+3
-3
No files found.
frontend/src/actions/action-types.js
View file @
ebac59c4
export
const
SAVE_MAIN_MAP_POSITION
=
'
SAVE_MAIN_MAP_POSITION
'
;
export
const
SAVE_SELECTED_UNIVERSITIES
=
'
SAVE_SELECTED_UNIVERSITIES
'
;
export
const
SAVE_
SEARCH_CONFIG
=
'
SAVE_SEARCH
_CONFIG
'
;
export
const
SAVE_
FILTER_CONFIG
=
'
SAVE_FILTER
_CONFIG
'
;
frontend/src/actions/filter.js
0 → 100644
View file @
ebac59c4
import
{
SAVE_SELECTED_UNIVERSITIES
,
SAVE_FILTER_CONFIG
}
from
"
./action-types
"
;
export
function
saveSelectedUniversities
(
new_selection
)
{
return
{
type
:
SAVE_SELECTED_UNIVERSITIES
,
new_selection
};
}
export
function
saveFilterConfig
(
config
)
{
return
{
type
:
SAVE_FILTER_CONFIG
,
config
};
}
frontend/src/actions/search.js
View file @
ebac59c4
import
{
SAVE_SELECTED_UNIVERSITIES
,
SAVE_
SEARCH
_CONFIG
SAVE_
FILTER
_CONFIG
}
from
"
./action-types
"
;
...
...
@@ -12,9 +12,9 @@ export function saveSelectedUniversities(new_selection) {
};
}
export
function
save
Search
Config
(
config
)
{
export
function
save
Filter
Config
(
config
)
{
return
{
type
:
SAVE_
SEARCH
_CONFIG
,
type
:
SAVE_
FILTER
_CONFIG
,
config
};
}
frontend/src/components/App.js
View file @
ebac59c4
...
...
@@ -33,7 +33,7 @@ import {
import
PageMap
from
'
./pages/PageMap
'
;
import
PageHome
from
'
./pages/PageHome
'
;
import
Page
Search
from
'
./pages/PageSearch
'
;
import
Page
Filter
from
'
./pages/PageFilter
'
;
const
drawerWidth
=
240
;
...
...
@@ -159,7 +159,7 @@ class App extends MyComponent {
<
Route
path
=
"
/app/
"
exact
=
{
true
}
component
=
{
PageHome
}
/
>
<
Route
path
=
"
/app/map
"
component
=
{
PageMap
}
/
>
<
Route
path
=
"
/app/
search
"
component
=
{
PageSearch
}
/
>
<
Route
path
=
"
/app/
filter
"
component
=
{
PageFilter
}
/
>
<
/main
>
<
/div
>
...
...
frontend/src/components/
search
/DownshiftMultiple.js
→
frontend/src/components/
filter
/DownshiftMultiple.js
View file @
ebac59c4
...
...
@@ -82,9 +82,9 @@ class DownshiftMultiple extends React.Component {
const
{
options
}
=
this
.
props
;
const
{
selectedItems
}
=
this
.
state
;
let
possible
=
_
.
difference
(
options
,
selectedItems
);
const
search
=
fuzzysort
.
go
(
value
,
possible
,
{
limit
:
5
,
key
:
'
label
'
});
if
(
search
.
length
>
0
){
return
_
.
map
(
search
,
(
item
)
=>
item
.
obj
)
const
filter
=
fuzzysort
.
go
(
value
,
possible
,
{
limit
:
5
,
key
:
'
label
'
});
if
(
filter
.
length
>
0
){
return
_
.
map
(
filter
,
(
item
)
=>
item
.
obj
)
}
else
{
return
possible
.
slice
(
0
,
4
)
}
...
...
frontend/src/components/
search/Search
.js
→
frontend/src/components/
filter/Filter
.js
View file @
ebac59c4
...
...
@@ -4,7 +4,7 @@ import DownshiftMultiple from './DownshiftMultiple';
import
MyComponent
from
'
../MyComponent
'
import
{
connect
}
from
"
react-redux
"
;
import
_
from
'
underscore
'
;
import
{
saveSelectedUniversities
,
save
SearchConfig
}
from
'
../../actions/search
'
;
import
{
saveSelectedUniversities
,
save
FilterConfig
}
from
'
../../actions/filter
'
;
import
{
universitiesFetchData
,
...
...
@@ -13,7 +13,7 @@ import {
countriesFetchData
}
from
'
../../generated/actions
'
;
class
Search
extends
MyComponent
{
class
Filter
extends
MyComponent
{
joinCampus
(
campus
)
{
const
{
universities
,
countries
,
cities
}
=
this
.
getAllFetchedData
();
...
...
@@ -91,7 +91,7 @@ const mapStateToProps = (state) => {
mainCampuses
:
state
.
mainCampuses
,
cities
:
state
.
cities
,
countries
:
state
.
countries
,
contriesFilterConfig
:
state
.
app
.
search
.
contriesFilter
contriesFilterConfig
:
state
.
app
.
filter
.
contriesFilter
};
};
...
...
@@ -104,9 +104,9 @@ const mapDispatchToProps = (dispatch) => {
countries
:
()
=>
dispatch
(
countriesFetchData
())
},
saveSelection
:
(
selectedUniversities
)
=>
dispatch
(
saveSelectedUniversities
(
selectedUniversities
)),
saveConfig
:
(
config
)
=>
dispatch
(
save
Search
Config
(
config
))
saveConfig
:
(
config
)
=>
dispatch
(
save
Filter
Config
(
config
))
};
};
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
Search
);
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
Filter
);
frontend/src/components/pages/Page
Search
.js
→
frontend/src/components/pages/Page
Filter
.js
View file @
ebac59c4
...
...
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import
{
withStyles
}
from
'
@material-ui/core/styles
'
;
import
Grid
from
'
@material-ui/core/Grid
'
;
import
Typography
from
'
@material-ui/core/Typography
'
;
import
Search
from
'
../search/Search
'
;
import
Filter
from
'
../filter/Filter
'
;
import
Paper
from
'
@material-ui/core/Paper
'
;
const
styles
=
theme
=>
({
...
...
@@ -20,14 +20,14 @@ class PageMap extends React.Component {
<
Grid
container
spacing
=
{
24
}
>
<
Grid
item
xs
=
{
11
}
>
<
Typography
variant
=
"
display1
"
gutterBottom
>
Recherche
Filtrer
<
/Typography
>
<
/Grid
>
{
/* <Grid item xs={1}>
<UnivMapReloadButton />
</Grid> */
}
<
/Grid
>
<
Search
/>
<
Filter
/>
<
/Paper
>
);
}
...
...
frontend/src/components/template/listItems.js
View file @
ebac59c4
...
...
@@ -9,6 +9,7 @@ import PeopleIcon from '@material-ui/icons/People';
import
BarChartIcon
from
'
@material-ui/icons/BarChart
'
;
import
HomeIcon
from
'
@material-ui/icons/Home
'
;
import
SearchIcon
from
'
@material-ui/icons/Search
'
;
import
FilterIcon
from
'
@material-ui/icons/FilterList
'
;
import
AssignmentIcon
from
'
@material-ui/icons/Assignment
'
;
import
{
NavLink
}
from
'
react-router-dom
'
...
...
@@ -24,6 +25,15 @@ export const mainListItems = (
<
/ListItem
>
<
/NavLink
>
<
NavLink
to
=
{
'
/app/search/
'
}
>
<
ListItem
button
>
<
ListItemIcon
>
<
SearchIcon
/>
<
/ListItemIcon
>
<
ListItemText
primary
=
"
Rechercher
"
/>
<
/ListItem
>
<
/NavLink
>
<
NavLink
to
=
{
'
/app/map/
'
}
>
<
ListItem
button
>
<
ListItemIcon
>
...
...
@@ -33,16 +43,15 @@ export const mainListItems = (
<
/ListItem
>
<
/NavLink
>
<
NavLink
to
=
{
'
/app/
search
/
'
}
>
<
NavLink
to
=
{
'
/app/
filter
/
'
}
>
<
ListItem
button
>
<
ListItemIcon
>
<
Search
Icon
/>
<
Filter
Icon
/>
<
/ListItemIcon
>
<
ListItemText
primary
=
"
Recherche
"
/>
<
ListItemText
primary
=
"
Filtrer
"
/>
<
/ListItem
>
<
/NavLink
>
<
ListItem
button
>
<
ListItemIcon
>
<
LocationCityIcon
/>
...
...
frontend/src/reducers/
search
.js
→
frontend/src/reducers/
filter
.js
View file @
ebac59c4
import
{
SAVE_SELECTED_UNIVERSITIES
,
SAVE_
SEARCH
_CONFIG
}
from
'
../actions/action-types
'
import
{
SAVE_SELECTED_UNIVERSITIES
,
SAVE_
FILTER
_CONFIG
}
from
'
../actions/action-types
'
export
function
saveSelectedUniversities
(
state
=
[],
action
)
{
switch
(
action
.
type
)
{
...
...
@@ -12,9 +12,9 @@ export function saveSelectedUniversities(state = [], action) {
}
}
export
function
save
Search
Config
(
state
=
{
contriesFilter
:
{
selectedItems
:
[],
inputValue
:
''
}
},
action
)
{
export
function
save
Filter
Config
(
state
=
{
contriesFilter
:
{
selectedItems
:
[],
inputValue
:
''
}
},
action
)
{
switch
(
action
.
type
)
{
case
SAVE_
SEARCH
_CONFIG
:
case
SAVE_
FILTER
_CONFIG
:
return
Object
.
assign
(
state
,
action
.
config
)
default
:
...
...
frontend/src/reducers/index.js
View file @
ebac59c4
...
...
@@ -11,13 +11,13 @@ import {
}
from
'
../generated/combinedReducers
'
;
import
{
saveMainMapPosition
}
from
'
./map
'
;
import
{
saveSelectedUniversities
}
from
'
./
search
'
;
import
{
save
SearchConfig
}
from
'
./search
'
;
import
{
saveSelectedUniversities
}
from
'
./
filter
'
;
import
{
save
FilterConfig
}
from
'
./filter
'
;
const
appReducers
=
combineReducers
({
mainMap
:
saveMainMapPosition
,
selectedUniversities
:
saveSelectedUniversities
,
search
:
saveSearch
Config
,
filter
:
saveFilter
Config
,
})
const
rootReducer
=
combineReducers
({
...
...
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