mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Merge pull request #212 from ascribe/custom-button-for-bokk
Custom bokk ACL button
This commit is contained in:
commit
869f39bb06
@ -42,6 +42,7 @@ export default function AclButton({ action, displayName, title, tooltip }) {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { availableAcls,
|
const { availableAcls,
|
||||||
|
buttonAcceptName,
|
||||||
buttonAcceptClassName,
|
buttonAcceptClassName,
|
||||||
currentUser,
|
currentUser,
|
||||||
email,
|
email,
|
||||||
@ -63,6 +64,7 @@ export default function AclButton({ action, displayName, title, tooltip }) {
|
|||||||
title={title}>
|
title={title}>
|
||||||
<AclFormFactory
|
<AclFormFactory
|
||||||
action={action}
|
action={action}
|
||||||
|
acceptName={buttonAcceptName}
|
||||||
currentUser={currentUser}
|
currentUser={currentUser}
|
||||||
email={email}
|
email={email}
|
||||||
pieceOrEditions={pieceOrEditions}
|
pieceOrEditions={pieceOrEditions}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
import Button from 'react-bootstrap/lib/Button';
|
||||||
|
|
||||||
import ConsignForm from '../ascribe_forms/form_consign';
|
import ConsignForm from '../ascribe_forms/form_consign';
|
||||||
import UnConsignForm from '../ascribe_forms/form_unconsign';
|
import UnConsignForm from '../ascribe_forms/form_unconsign';
|
||||||
import TransferForm from '../ascribe_forms/form_transfer';
|
import TransferForm from '../ascribe_forms/form_transfer';
|
||||||
@ -16,10 +18,13 @@ import GlobalNotificationModel from '../../models/global_notification_model';
|
|||||||
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
||||||
|
|
||||||
import { getAclFormMessage, getAclFormDataId } from '../../utils/form_utils';
|
import { getAclFormMessage, getAclFormDataId } from '../../utils/form_utils';
|
||||||
|
import { getLangText } from '../../utils/lang_utils';
|
||||||
|
|
||||||
|
|
||||||
let AclFormFactory = React.createClass({
|
let AclFormFactory = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
action: React.PropTypes.oneOf(AppConstants.aclList).isRequired,
|
action: React.PropTypes.oneOf(AppConstants.aclList).isRequired,
|
||||||
|
acceptName: React.PropTypes.string,
|
||||||
pieceOrEditions: React.PropTypes.oneOfType([
|
pieceOrEditions: React.PropTypes.oneOfType([
|
||||||
React.PropTypes.object,
|
React.PropTypes.object,
|
||||||
React.PropTypes.array
|
React.PropTypes.array
|
||||||
@ -63,6 +68,7 @@ let AclFormFactory = React.createClass({
|
|||||||
labels,
|
labels,
|
||||||
handleSuccess,
|
handleSuccess,
|
||||||
showNotification } = this.props;
|
showNotification } = this.props;
|
||||||
|
let acceptButton;
|
||||||
|
|
||||||
const formMessage = message || getAclFormMessage({
|
const formMessage = message || getAclFormMessage({
|
||||||
aclName: action,
|
aclName: action,
|
||||||
@ -71,9 +77,24 @@ let AclFormFactory = React.createClass({
|
|||||||
senderName: currentUser && currentUser.username
|
senderName: currentUser && currentUser.username
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.props.acceptName) {
|
||||||
|
acceptButton = (
|
||||||
|
<div className="modal-footer">
|
||||||
|
<p className="pull-right">
|
||||||
|
<Button
|
||||||
|
className="btn btn-default btn-sm ascribe-margin-1px"
|
||||||
|
type="submit">
|
||||||
|
{getLangText(this.props.acceptName)}
|
||||||
|
</Button>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (action === 'acl_consign') {
|
if (action === 'acl_consign') {
|
||||||
return (
|
return (
|
||||||
<ConsignForm
|
<ConsignForm
|
||||||
|
buttons={acceptButton}
|
||||||
autoFocusProperty={autoFocusProperty}
|
autoFocusProperty={autoFocusProperty}
|
||||||
email={email}
|
email={email}
|
||||||
message={formMessage}
|
message={formMessage}
|
||||||
@ -85,6 +106,7 @@ let AclFormFactory = React.createClass({
|
|||||||
} else if (action === 'acl_unconsign') {
|
} else if (action === 'acl_unconsign') {
|
||||||
return (
|
return (
|
||||||
<UnConsignForm
|
<UnConsignForm
|
||||||
|
buttons={acceptButton}
|
||||||
message={formMessage}
|
message={formMessage}
|
||||||
id={this.getFormDataId()}
|
id={this.getFormDataId()}
|
||||||
url={ApiUrls.ownership_unconsigns}
|
url={ApiUrls.ownership_unconsigns}
|
||||||
@ -93,6 +115,7 @@ let AclFormFactory = React.createClass({
|
|||||||
} else if (action === 'acl_transfer') {
|
} else if (action === 'acl_transfer') {
|
||||||
return (
|
return (
|
||||||
<TransferForm
|
<TransferForm
|
||||||
|
buttons={acceptButton}
|
||||||
message={formMessage}
|
message={formMessage}
|
||||||
id={this.getFormDataId()}
|
id={this.getFormDataId()}
|
||||||
url={ApiUrls.ownership_transfers}
|
url={ApiUrls.ownership_transfers}
|
||||||
@ -101,6 +124,7 @@ let AclFormFactory = React.createClass({
|
|||||||
} else if (action === 'acl_loan') {
|
} else if (action === 'acl_loan') {
|
||||||
return (
|
return (
|
||||||
<LoanForm
|
<LoanForm
|
||||||
|
buttons={acceptButton}
|
||||||
email={email}
|
email={email}
|
||||||
message={formMessage}
|
message={formMessage}
|
||||||
id={this.getFormDataId()}
|
id={this.getFormDataId()}
|
||||||
@ -119,6 +143,7 @@ let AclFormFactory = React.createClass({
|
|||||||
} else if (action === 'acl_share') {
|
} else if (action === 'acl_share') {
|
||||||
return (
|
return (
|
||||||
<ShareForm
|
<ShareForm
|
||||||
|
buttons={acceptButton}
|
||||||
message={formMessage}
|
message={formMessage}
|
||||||
id={this.getFormDataId()}
|
id={this.getFormDataId()}
|
||||||
url={this.isPiece() ? ApiUrls.ownership_shares_pieces
|
url={this.isPiece() ? ApiUrls.ownership_shares_pieces
|
||||||
|
@ -0,0 +1,61 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import AclButton from '../../../../ascribe_buttons/acls/acl_button';
|
||||||
|
import DeleteButton from '../../../../ascribe_buttons/delete_button';
|
||||||
|
import EmailButton from '../../../../ascribe_buttons/acls/email_button';
|
||||||
|
|
||||||
|
import { selectFromObject } from '../../../../../utils/general_utils';
|
||||||
|
import { getLangText } from '../../../../../utils/lang_utils';
|
||||||
|
|
||||||
|
|
||||||
|
let BokkAclButtonList = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
availableAcls: React.PropTypes.object.isRequired,
|
||||||
|
currentUser: React.PropTypes.object.isRequired,
|
||||||
|
handleSuccess: React.PropTypes.func.isRequired,
|
||||||
|
pieceOrEditions: React.PropTypes.array.isRequired,
|
||||||
|
whitelabel: React.PropTypes.object.isRequired,
|
||||||
|
|
||||||
|
children: React.PropTypes.oneOfType([
|
||||||
|
React.PropTypes.arrayOf(React.PropTypes.element),
|
||||||
|
React.PropTypes.element
|
||||||
|
]),
|
||||||
|
className: React.PropTypes.string
|
||||||
|
},
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { availableAcls,
|
||||||
|
children,
|
||||||
|
className,
|
||||||
|
currentUser,
|
||||||
|
handleSuccess,
|
||||||
|
pieceOrEditions,
|
||||||
|
whitelabel } = this.props;
|
||||||
|
|
||||||
|
const buttonProps = selectFromObject(this.props, [
|
||||||
|
'availableAcls',
|
||||||
|
'currentUser',
|
||||||
|
'handleSuccess',
|
||||||
|
'pieceOrEditions'
|
||||||
|
]);
|
||||||
|
|
||||||
|
let BokkButton = AclButton({
|
||||||
|
action: 'acl_loan',
|
||||||
|
displayName: 'LoanButton',
|
||||||
|
title: getLangText('Partager avec Bokk')
|
||||||
|
})
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={className}>
|
||||||
|
<EmailButton {...buttonProps} />
|
||||||
|
<DeleteButton {...buttonProps} />
|
||||||
|
<BokkButton buttonAcceptName='PARTAGER AVEC BOKK' {...buttonProps} />
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default BokkAclButtonList;
|
@ -0,0 +1,22 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import BokkAclButtonList from './bokk_acl_button_list';
|
||||||
|
|
||||||
|
import EditionContainer from '../../../../ascribe_detail/edition_container';
|
||||||
|
|
||||||
|
|
||||||
|
let BokkEditionContainer = React.createClass({
|
||||||
|
propTypes: EditionContainer.propTypes,
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<EditionContainer
|
||||||
|
{...this.props}
|
||||||
|
actionPanelButtonListType={BokkAclButtonList} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default BokkEditionContainer;
|
@ -0,0 +1,34 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import PieceList from '../../../../piece_list';
|
||||||
|
import BokkAclButtonList from './bokk_acl_button_list.js';
|
||||||
|
|
||||||
|
|
||||||
|
let BokkPieceList = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
// Provided from PrizeApp
|
||||||
|
currentUser: React.PropTypes.object,
|
||||||
|
whitelabel: React.PropTypes.object,
|
||||||
|
|
||||||
|
// Provided from router
|
||||||
|
location: React.PropTypes.object
|
||||||
|
},
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<PieceList
|
||||||
|
{...this.props}
|
||||||
|
redirectTo={{
|
||||||
|
pathname: '/register_piece',
|
||||||
|
query: {
|
||||||
|
'slide_num': 0
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
bulkModalButtonListType={BokkAclButtonList} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default BokkPieceList;
|
@ -20,7 +20,10 @@ import ErrorNotFoundPage from '../../../components/error_not_found_page';
|
|||||||
import Footer from '../../../components/footer.js';
|
import Footer from '../../../components/footer.js';
|
||||||
|
|
||||||
import CCRegisterPiece from './components/cc/cc_register_piece';
|
import CCRegisterPiece from './components/cc/cc_register_piece';
|
||||||
|
|
||||||
import BokkRegisterPiece from './components/bokk/bokk_register_piece';
|
import BokkRegisterPiece from './components/bokk/bokk_register_piece';
|
||||||
|
import BokkPieceList from './components/bokk/bokk_piece_list';
|
||||||
|
import BokkEditionContainer from './components/bokk/bokk_edition_container';
|
||||||
|
|
||||||
import CylandLanding from './components/cyland/cyland_landing';
|
import CylandLanding from './components/cyland/cyland_landing';
|
||||||
import CylandPieceContainer from './components/cyland/cyland_detail/cyland_piece_container';
|
import CylandPieceContainer from './components/cyland/cyland_detail/cyland_piece_container';
|
||||||
@ -476,7 +479,7 @@ let ROUTES = {
|
|||||||
headerTitle={getLangText('+ NEW WORK')} />
|
headerTitle={getLangText('+ NEW WORK')} />
|
||||||
<Route
|
<Route
|
||||||
path='collection'
|
path='collection'
|
||||||
component={ProxyHandler(AuthRedirect({to: '/login', when: 'loggedOut'}))(PieceList)}
|
component={ProxyHandler(AuthRedirect({to: '/login', when: 'loggedOut'}))(BokkPieceList)}
|
||||||
headerTitle={getLangText('COLLECTION')}
|
headerTitle={getLangText('COLLECTION')}
|
||||||
disableOn='noPieces' />
|
disableOn='noPieces' />
|
||||||
<Route
|
<Route
|
||||||
@ -484,7 +487,7 @@ let ROUTES = {
|
|||||||
component={PieceContainer} />
|
component={PieceContainer} />
|
||||||
<Route
|
<Route
|
||||||
path='editions/:editionId'
|
path='editions/:editionId'
|
||||||
component={EditionContainer} />
|
component={BokkEditionContainer} />
|
||||||
<Route
|
<Route
|
||||||
path='coa_verify'
|
path='coa_verify'
|
||||||
component={CoaVerifyContainer} />
|
component={CoaVerifyContainer} />
|
||||||
|
@ -2,6 +2,7 @@ $bokk--nav-bg-color: #4d2e80;
|
|||||||
$bokk--nav-fg-prim-color: #1E1E1E;
|
$bokk--nav-fg-prim-color: #1E1E1E;
|
||||||
$bokk--button-color: #ab52bd;
|
$bokk--button-color: #ab52bd;
|
||||||
$bokk--hover-color: ;
|
$bokk--hover-color: ;
|
||||||
|
$bokk--nav-bt:#FFFFFF;
|
||||||
|
|
||||||
.client--bokk {
|
.client--bokk {
|
||||||
.navbar-default {
|
.navbar-default {
|
||||||
@ -14,17 +15,19 @@ $bokk--hover-color: ;
|
|||||||
}
|
}
|
||||||
.navbar-nav > li > a,
|
.navbar-nav > li > a,
|
||||||
.navbar-nav > li > .active a {
|
.navbar-nav > li > .active a {
|
||||||
color: $bokk--nav-fg-prim-color;
|
color: $bokk--nav-bt;
|
||||||
background-color: $bokk--nav-bg-color;
|
background-color: $bokk--nav-bg-color;
|
||||||
}
|
}
|
||||||
.navbar-nav > li > a:hover {
|
.navbar-nav > li > a:hover {
|
||||||
color: lighten($bokk--nav-fg-prim-color, 40%);
|
color: lighten($bokk--nav-fg-prim-color, 40%);
|
||||||
|
padding-bottom:5px;
|
||||||
|
border-bottom: 1px solid $bokk--button-color;
|
||||||
}
|
}
|
||||||
.navbar-nav > .active a,
|
.navbar-nav > .active a,
|
||||||
.navbar-nav > .active a:hover,
|
.navbar-nav > .active a:hover,
|
||||||
.navbar-nav > .active a:focus {
|
.navbar-nav > .active a:focus {
|
||||||
color: $bokk--nav-fg-prim-color;
|
color: $bokk--nav-bt;
|
||||||
border-bottom-color: $bokk--nav-fg-prim-color;
|
border-bottom-color: $bokk--button-color;
|
||||||
background-color: $bokk--nav-bg-color;
|
background-color: $bokk--nav-bg-color;
|
||||||
}
|
}
|
||||||
.dropdown-menu > li > a:hover,
|
.dropdown-menu > li > a:hover,
|
||||||
@ -46,7 +49,7 @@ $bokk--hover-color: ;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-menu > li > a {
|
.dropdown-menu > li > a {
|
||||||
color: $bokk--nav-fg-prim-color;
|
color: $bokk--nav-bt;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-toggle .icon-bar {
|
.navbar-toggle .icon-bar {
|
||||||
@ -93,7 +96,7 @@ $bokk--hover-color: ;
|
|||||||
.btn-secondary {
|
.btn-secondary {
|
||||||
background-color: $bokk--nav-bg-color;
|
background-color: $bokk--nav-bg-color;
|
||||||
border-color: $bokk--nav-fg-prim-color;
|
border-color: $bokk--nav-fg-prim-color;
|
||||||
color: $bokk--nav-fg-prim-color;
|
color: $bokk--nav-bt;
|
||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
&:active,
|
&:active,
|
||||||
@ -104,8 +107,8 @@ $bokk--hover-color: ;
|
|||||||
&.active:hover,
|
&.active:hover,
|
||||||
&.active:focus,
|
&.active:focus,
|
||||||
&.active.focus {
|
&.active.focus {
|
||||||
background-color: $bokk--nav-fg-prim-color;
|
background-color: $bokk--nav-bt;
|
||||||
border-color: $bokk--nav-fg-prim-color;
|
border-color: $bokk--nav-bg-color;
|
||||||
color: $bokk--nav-bg-color;
|
color: $bokk--nav-bg-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,4 +222,4 @@ $bokk--hover-color: ;
|
|||||||
|
|
||||||
.client--bokk .upload-button-wrapper > span {
|
.client--bokk .upload-button-wrapper > span {
|
||||||
color: $bokk--button-color;
|
color: $bokk--button-color;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user