-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
8,233 additions
and
8,909 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,12 +1,24 @@ | ||
import { | ||
SET_SECTION_TABS, | ||
GET_PARENT_FOLDER_DATA, | ||
GET_NAV_ITEMS | ||
} from '~/constants/ActionTypes'; | ||
|
||
|
||
export function setSectionTabs(payload) { | ||
console.log('in action', payload) | ||
return { | ||
type: SET_SECTION_TABS, | ||
payload: payload, | ||
}; | ||
} | ||
return { | ||
type: SET_SECTION_TABS, | ||
payload: payload, | ||
}; | ||
} | ||
|
||
|
||
export function getParentFolderData(url) { | ||
return { | ||
type: GET_PARENT_FOLDER_DATA, | ||
request: { | ||
op: 'get', | ||
path: `/${url}?fullobjects`, | ||
}, | ||
}; | ||
} |
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,98 @@ | ||
import React, { Component } from 'react'; | ||
import { injectIntl } from 'react-intl'; | ||
import PropTypes from 'prop-types'; | ||
import { Grid } from 'semantic-ui-react'; | ||
import AddLinkForm from '../DetailedLink/AddLinkForm'; | ||
import { compose } from 'redux'; | ||
import { connect } from 'react-redux'; | ||
import { getParentFolderData } from '~/actions'; | ||
import { Link } from 'react-router-dom'; | ||
import _ from 'lodash' | ||
|
||
|
||
class Edit extends Component { | ||
/** | ||
* Property types. | ||
* @property {Object} propTypes Property types. | ||
* @static | ||
*/ | ||
static propTypes = { | ||
selected: PropTypes.bool.isRequired, | ||
block: PropTypes.string.isRequired, | ||
index: PropTypes.number.isRequired, | ||
data: PropTypes.objectOf(PropTypes.any).isRequired, | ||
pathname: PropTypes.string.isRequired, | ||
onChangeBlock: PropTypes.func.isRequired, | ||
onSelectBlock: PropTypes.func.isRequired, | ||
onDeleteBlock: PropTypes.func.isRequired, | ||
onFocusPreviousBlock: PropTypes.func.isRequired, | ||
onFocusNextBlock: PropTypes.func.isRequired, | ||
}; | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
}; | ||
} | ||
|
||
componentDidUpdate(prevProps) { | ||
if (prevProps.childrenLinks !== this.props.childrenLinks) { | ||
this.onEditData() | ||
} | ||
} | ||
|
||
handleLinkData = (link) => { | ||
this.props.getParentFolderData(link.value) | ||
|
||
} | ||
|
||
onEditData() { | ||
const childrenLinks = this.props.childrenLinks; | ||
this.props.onChangeBlock(this.props.block, { | ||
...this.props.data, | ||
links: childrenLinks, | ||
}); | ||
} | ||
|
||
render() { | ||
|
||
const childrenLinks = this.props.data.links; | ||
|
||
return ( | ||
<Grid columns={1}> | ||
<Grid.Row> | ||
{childrenLinks && | ||
childrenLinks.map(child => | ||
<div className="child-container"> | ||
<Link target="_blank" className="child-link" to={child.url}> | ||
{_.capitalize(child.title)} | ||
</Link> | ||
</div> | ||
) | ||
} | ||
</Grid.Row> | ||
<Grid.Column> | ||
<p className="search-text">Search page</p> | ||
<AddLinkForm onAddLink={this.handleLinkData} /> | ||
</Grid.Column> | ||
</Grid> | ||
); | ||
} | ||
} | ||
|
||
|
||
|
||
const mapDispatchToProps = { | ||
getParentFolderData, | ||
} | ||
|
||
export default compose( | ||
injectIntl, | ||
connect( | ||
state => ({ | ||
state, | ||
childrenLinks: state.parent_folder_data.items | ||
}), | ||
mapDispatchToProps, | ||
) | ||
)(Edit) |
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,47 @@ | ||
/** | ||
* Edit map block. | ||
* @module components/manage/Blocks/Maps/Edit | ||
*/ | ||
|
||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { injectIntl } from 'react-intl'; | ||
import { Grid } from 'semantic-ui-react'; | ||
import { Link } from 'react-router-dom'; | ||
import _ from 'lodash' | ||
|
||
class View extends Component { | ||
/** | ||
* Property types. | ||
* @property {Object} propTypes Property types. | ||
* @static | ||
*/ | ||
static propTypes = { | ||
data: PropTypes.objectOf(PropTypes.any).isRequired, | ||
// pathname: PropTypes.string.isRequired, | ||
}; | ||
|
||
render() { | ||
|
||
const childrenLinks = this.props.data.links | ||
return ( | ||
<div style={{marginBottom:"40px",marginTop:"40px"}}> | ||
<Grid columns={1}> | ||
{childrenLinks && | ||
childrenLinks.map(child => | ||
<div className="child-container"> | ||
<Link target="_blank" className="child-link" to={child.url}> | ||
{_.capitalize(child.title)} | ||
|
||
</Link> | ||
</div> | ||
|
||
) | ||
} | ||
</Grid> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default injectIntl(View); |
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 |
---|---|---|
@@ -1 +1,5 @@ | ||
export const SET_SECTION_TABS = 'SET_SECTION_TABS'; | ||
export const SET_SECTION_TABS = 'SET_SECTION_TABS'; | ||
export const GET_PARENT_FOLDER_DATA = 'GET_PARENT_FOLDER_DATA'; | ||
export const GET_NAV_ITEMS = 'GET_NAV_ITEMS'; | ||
|
||
|
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,62 @@ | ||
/** | ||
* Navigation reducer. | ||
* @module reducers/frontpage_slides | ||
*/ | ||
|
||
import { map } from 'lodash'; | ||
import { settings } from '~/config'; | ||
|
||
import { GET_PARENT_FOLDER_DATA } from '~/constants/ActionTypes'; | ||
|
||
const initialState = { | ||
error: null, | ||
items: [], | ||
loaded: false, | ||
loading: false, | ||
}; | ||
|
||
/** | ||
* Navigation reducer. | ||
* @function navigation | ||
* @param {Object} state Current state. | ||
* @param {Object} action Action to be handled. | ||
* @returns {Object} New state. | ||
*/ | ||
export default function parent_folder_data(state = initialState, action = {}) { | ||
|
||
|
||
switch (action.type) { | ||
case `${GET_PARENT_FOLDER_DATA}_PENDING`: | ||
return { | ||
...state, | ||
error: null, | ||
loaded: false, | ||
loading: true, | ||
}; | ||
case `${GET_PARENT_FOLDER_DATA}_SUCCESS`: | ||
const parent = action.result.id | ||
const routedLinks = action.result.items.map(item => { | ||
return { | ||
...item, | ||
url: `${parent}/${item.id}` | ||
} | ||
}) | ||
return { | ||
...state, | ||
error: null, | ||
items: routedLinks, | ||
loaded: true, | ||
loading: false, | ||
}; | ||
case `${GET_PARENT_FOLDER_DATA}_FAIL`: | ||
return { | ||
...state, | ||
error: action.error, | ||
items: [], | ||
loaded: false, | ||
loading: false, | ||
}; | ||
default: | ||
return state; | ||
} | ||
} |
Oops, something went wrong.