This repository has been archived by the owner on Oct 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge origin/feature/all-posts-page into stable
- Loading branch information
Showing
28 changed files
with
690 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
This file is a part of libertysoil.org website | ||
Copyright (C) 2016 Loki Education (Social Enterprise) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
export const ADD_POSTS_TO_ALL_POSTS = 'ADD_POSTS_TO_ALL_POSTS'; | ||
export const SET_ALL_POSTS = 'SET_ALL_POSTS'; | ||
|
||
export function addPosts(posts) { | ||
return { | ||
type: ADD_POSTS_TO_ALL_POSTS, | ||
payload: { | ||
posts | ||
} | ||
}; | ||
} | ||
|
||
export function setPosts(posts) { | ||
return { | ||
type: SET_ALL_POSTS, | ||
payload: { | ||
posts | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
This file is a part of libertysoil.org website | ||
Copyright (C) 2016 Loki Education (Social Enterprise) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import React from 'react'; | ||
import CONTINENTS from '../../consts/continents'; | ||
import FilterLink from './filter-link'; | ||
|
||
|
||
export default function ContinentFilter({ location }) { | ||
const continents = Object.keys(CONTINENTS).map(code => ( | ||
<FilterLink | ||
key={code} | ||
location={location} | ||
query={{ continent: code }} | ||
title={CONTINENTS[code].name} | ||
/> | ||
)); | ||
|
||
return ( | ||
<div className="aux-nav"> | ||
{continents} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
This file is a part of libertysoil.org website | ||
Copyright (C) 2016 Loki Education (Social Enterprise) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import React from 'react'; | ||
import { Link } from 'react-router'; | ||
import { intersection } from 'lodash'; | ||
|
||
|
||
function getNewUrl(query, location) { | ||
return { | ||
...location, | ||
query: { | ||
...location.query, | ||
...query | ||
} | ||
}; | ||
} | ||
|
||
export default function FilterLink({ isDefault, title, query, location }) { | ||
const urlFunction = getNewUrl.bind(null, query); | ||
let activeClassName = 'aux-nav__link--active'; | ||
let className = 'aux-nav__link'; | ||
const isFilterSet = intersection( | ||
Object.keys(query), | ||
Object.keys(location.query) | ||
).length > 0; | ||
|
||
// force active state | ||
if (isDefault && !isFilterSet) { | ||
className = `${className} ${activeClassName}`; | ||
activeClassName = null; | ||
} | ||
|
||
return ( | ||
<div className="aux-nav__item"> | ||
<Link | ||
activeClassName={activeClassName} | ||
className={className} | ||
to={urlFunction} | ||
> | ||
{title} | ||
</Link> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
This file is a part of libertysoil.org website | ||
Copyright (C) 2016 Loki Education (Social Enterprise) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import React from 'react'; | ||
import FilterLink from './filter-link'; | ||
|
||
|
||
export default function SortingFilter({ location, sortingTypes }) { | ||
const continents = sortingTypes.map((item, i) => ( | ||
<FilterLink | ||
isDefault={item.isDefault} | ||
key={i} | ||
location={location} | ||
query={{ sort: item.value }} | ||
title={item.name} | ||
/> | ||
)); | ||
|
||
return ( | ||
<div className="aux-nav"> | ||
{continents} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
This file is a part of libertysoil.org website | ||
Copyright (C) 2016 Loki Education (Social Enterprise) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
export const POST_SORTING_TYPES = [ | ||
{ name: 'Newest', value: '-created_at', isDefault: true }, | ||
{ name: 'Last modified', value: '-updated_at' } | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
This file is a part of libertysoil.org website | ||
Copyright (C) 2015 Loki Education (Social Enterprise) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
.aux-nav { | ||
@active-icon: #6AB7EA; | ||
@active-text: #1078B4; | ||
|
||
margin-bottom: @doubleSpace; | ||
|
||
&__item { | ||
position: relative; | ||
} | ||
|
||
&__link { | ||
display: block; | ||
min-height: 42px; | ||
margin-bottom: 2px; | ||
padding: 10px 24px 10px 20px; | ||
background-color: #FAFAFA; | ||
} | ||
|
||
&__link--active { | ||
background-color: white; | ||
color: @active-text; | ||
|
||
&:after { | ||
@height: 14px; | ||
|
||
content: ''; | ||
|
||
display: block; | ||
position: absolute; | ||
top: calc(50% - @height); | ||
right: 10px; | ||
width: 4px; | ||
height: @height; | ||
|
||
background-color: @active-icon; | ||
border-radius: 2px; | ||
} | ||
} | ||
} |
Oops, something went wrong.