1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

Merge remote-tracking branch 'remotes/origin/AD-885-convert-roles-to-acls' into AD-924-apply-contractagreements-to-loan-

Conflicts:
	ownership/serializers.py
This commit is contained in:
diminator 2015-09-10 18:54:25 +02:00
parent 1106cebf98
commit b45c68b2dc
3 changed files with 15 additions and 9 deletions

View File

@ -20,21 +20,28 @@ let AclProxy = React.createClass({
show: React.PropTypes.bool show: React.PropTypes.bool
}, },
render() { getChildren() {
if(this.props.show) { if (this.props.children.length && this.props.children.length > 1){
/*
This might ruin styles for header items in the navbar etc
*/
return ( return (
<span> <span>
{this.props.children} {this.props.children}
</span> </span>
); );
}
/* can only do this when there is only 1 child, but will preserve styles */
return this.props.children;
},
render() {
if(this.props.show) {
return this.getChildren();
} else { } else {
if(this.props.aclObject) { if(this.props.aclObject) {
if(this.props.aclObject[this.props.aclName]) { if(this.props.aclObject[this.props.aclName]) {
return ( return this.getChildren();
<span>
{this.props.children}
</span>
);
} else { } else {
/* if(typeof this.props.aclObject[this.props.aclName] === 'undefined') { /* if(typeof this.props.aclObject[this.props.aclName] === 'undefined') {
console.warn('The aclName you\'re filtering for was not present (or undefined) in the aclObject.'); console.warn('The aclName you\'re filtering for was not present (or undefined) in the aclObject.');

View File

@ -48,7 +48,6 @@ let NavRoutesLinks = React.createClass({
// We validate if the user has set the title correctly, // We validate if the user has set the title correctly,
// otherwise we're not going to render his route // otherwise we're not going to render his route
if(headerTitle && typeof headerTitle === 'string') { if(headerTitle && typeof headerTitle === 'string') {
// if there is an aclName present on the route definition, // if there is an aclName present on the route definition,
// we evaluate it against the user's acl // we evaluate it against the user's acl
if(aclName && typeof aclName !== 'undefined') { if(aclName && typeof aclName !== 'undefined') {

View File

@ -72,7 +72,7 @@ let ROUTES = {
<Route name="logout" path="logout" handler={LogoutContainer} /> <Route name="logout" path="logout" handler={LogoutContainer} />
<Route name="signup" path="signup" handler={SignupContainer} /> <Route name="signup" path="signup" handler={SignupContainer} />
<Route name="password_reset" path="password_reset" handler={PasswordResetContainer} /> <Route name="password_reset" path="password_reset" handler={PasswordResetContainer} />
<Route name="request_loan" path="request_loan" handler={IkonotvRequestLoan} headerTitle="SEND NEW CONTRACT" aclName="acl_create_contract" /> <Route name="request_loan" path="request_loan" handler={IkonotvRequestLoan} headerTitle="SEND NEW CONTRACT" aclName="acl_send_contract" />
<Route name="register_piece" path="register_piece" handler={RegisterPiece} headerTitle="+ NEW WORK"/> <Route name="register_piece" path="register_piece" handler={RegisterPiece} headerTitle="+ NEW WORK"/>
<Route name="pieces" path="collection" handler={IkonotvPieceList} headerTitle="COLLECTION"/> <Route name="pieces" path="collection" handler={IkonotvPieceList} headerTitle="COLLECTION"/>
<Route name="piece" path="pieces/:pieceId" handler={IkonotvPieceContainer} /> <Route name="piece" path="pieces/:pieceId" handler={IkonotvPieceContainer} />