mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 18:35:09 +01:00
Integrate new ACLOptions into settings
This commit is contained in:
parent
2a4bc2af89
commit
74e7c9a3d9
@ -89,86 +89,82 @@ let ContractSettings = React.createClass({
|
||||
|
||||
return (
|
||||
<div className="settings-container">
|
||||
<AclProxy
|
||||
aclName="acl_view_settings_contract"
|
||||
aclObject={this.state.currentUser.acl}>
|
||||
<CollapsibleParagraph
|
||||
title={getLangText('Contracts')}
|
||||
show={true}
|
||||
defaultExpanded={true}>
|
||||
<AclProxy
|
||||
aclName="acl_edit_public_contract"
|
||||
aclObject={this.state.currentUser.acl}>
|
||||
<div>
|
||||
{createPublicContractForm}
|
||||
{publicContracts.map((contract, i) => {
|
||||
return (
|
||||
<ActionPanel
|
||||
key={i}
|
||||
title={contract.name}
|
||||
content={contract.name}
|
||||
buttons={
|
||||
<div className="pull-right">
|
||||
<ContractSettingsUpdateButton contract={contract}/>
|
||||
<a
|
||||
className="btn btn-default btn-sm margin-left-2px"
|
||||
href={contract.blob.url_safe}
|
||||
target="_blank">
|
||||
{getLangText('PREVIEW')}
|
||||
</a>
|
||||
<button
|
||||
className="btn btn-danger btn-sm margin-left-2px"
|
||||
onClick={this.removeContract(contract)}>
|
||||
{getLangText('REMOVE')}
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
leftColumnWidth="40%"
|
||||
rightColumnWidth="60%"/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</AclProxy>
|
||||
<AclProxy
|
||||
aclName="acl_edit_private_contract"
|
||||
aclObject={this.state.currentUser.acl}>
|
||||
<div>
|
||||
<CreateContractForm
|
||||
isPublic={false}
|
||||
fileClassToUpload={{
|
||||
singular: getLangText('new contract'),
|
||||
plural: getLangText('new contracts')
|
||||
}}/>
|
||||
{privateContracts.map((contract, i) => {
|
||||
return (
|
||||
<ActionPanel
|
||||
key={i}
|
||||
title={contract.name}
|
||||
content={contract.name}
|
||||
buttons={
|
||||
<div className="pull-right">
|
||||
<ContractSettingsUpdateButton contract={contract} />
|
||||
<a
|
||||
className="btn btn-default btn-sm margin-left-2px"
|
||||
href={contract.blob.url_safe}
|
||||
target="_blank">
|
||||
{getLangText('PREVIEW')}
|
||||
</a>
|
||||
<button
|
||||
className="btn btn-danger btn-sm margin-left-2px"
|
||||
onClick={this.removeContract(contract)}>
|
||||
{getLangText('REMOVE')}
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
leftColumnWidth="40%"
|
||||
rightColumnWidth="60%"/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</AclProxy>
|
||||
</CollapsibleParagraph>
|
||||
</AclProxy>
|
||||
<CollapsibleParagraph
|
||||
title={getLangText('Contracts')}
|
||||
show={true}
|
||||
defaultExpanded={true}>
|
||||
<AclProxy
|
||||
aclName="acl_edit_public_contract"
|
||||
aclObject={this.state.currentUser.acl}>
|
||||
<div>
|
||||
{createPublicContractForm}
|
||||
{publicContracts.map((contract, i) => {
|
||||
return (
|
||||
<ActionPanel
|
||||
key={i}
|
||||
title={contract.name}
|
||||
content={contract.name}
|
||||
buttons={
|
||||
<div className="pull-right">
|
||||
<ContractSettingsUpdateButton contract={contract}/>
|
||||
<a
|
||||
className="btn btn-default btn-sm margin-left-2px"
|
||||
href={contract.blob.url_safe}
|
||||
target="_blank">
|
||||
{getLangText('PREVIEW')}
|
||||
</a>
|
||||
<button
|
||||
className="btn btn-danger btn-sm margin-left-2px"
|
||||
onClick={this.removeContract(contract)}>
|
||||
{getLangText('REMOVE')}
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
leftColumnWidth="40%"
|
||||
rightColumnWidth="60%"/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</AclProxy>
|
||||
<AclProxy
|
||||
aclName="acl_edit_private_contract"
|
||||
aclObject={this.state.currentUser.acl}>
|
||||
<div>
|
||||
<CreateContractForm
|
||||
isPublic={false}
|
||||
fileClassToUpload={{
|
||||
singular: getLangText('new contract'),
|
||||
plural: getLangText('new contracts')
|
||||
}}/>
|
||||
{privateContracts.map((contract, i) => {
|
||||
return (
|
||||
<ActionPanel
|
||||
key={i}
|
||||
title={contract.name}
|
||||
content={contract.name}
|
||||
buttons={
|
||||
<div className="pull-right">
|
||||
<ContractSettingsUpdateButton contract={contract} />
|
||||
<a
|
||||
className="btn btn-default btn-sm margin-left-2px"
|
||||
href={contract.blob.url_safe}
|
||||
target="_blank">
|
||||
{getLangText('PREVIEW')}
|
||||
</a>
|
||||
<button
|
||||
className="btn btn-danger btn-sm margin-left-2px"
|
||||
onClick={this.removeContract(contract)}>
|
||||
{getLangText('REMOVE')}
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
leftColumnWidth="40%"
|
||||
rightColumnWidth="60%"/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</AclProxy>
|
||||
</CollapsibleParagraph>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -6,11 +6,17 @@ import Router from 'react-router';
|
||||
import UserStore from '../../stores/user_store';
|
||||
import UserActions from '../../actions/user_actions';
|
||||
|
||||
import WhitelabelStore from '../../stores/whitelabel_store';
|
||||
import WhitelabelActions from '../../actions/whitelabel_actions';
|
||||
|
||||
import AccountSettings from './account_settings';
|
||||
import BitcoinWalletSettings from './bitcoin_wallet_settings';
|
||||
import ContractSettings from './contract_settings';
|
||||
import APISettings from './api_settings';
|
||||
|
||||
import AclProxy from '../acl_proxy';
|
||||
|
||||
import { mergeOptions } from '../../utils/general_utils';
|
||||
|
||||
|
||||
let SettingsContainer = React.createClass({
|
||||
propTypes: {
|
||||
@ -22,15 +28,22 @@ let SettingsContainer = React.createClass({
|
||||
mixins: [Router.Navigation],
|
||||
|
||||
getInitialState() {
|
||||
return UserStore.getState();
|
||||
return mergeOptions(
|
||||
UserStore.getState(),
|
||||
WhitelabelStore.getState()
|
||||
);
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
UserStore.listen(this.onChange);
|
||||
WhitelabelStore.listen(this.onChange);
|
||||
|
||||
WhitelabelActions.fetchWhitelabel();
|
||||
UserActions.fetchCurrentUser();
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
WhitelabelStore.unlisten(this.onChange);
|
||||
UserStore.unlisten(this.onChange);
|
||||
},
|
||||
|
||||
@ -48,8 +61,16 @@ let SettingsContainer = React.createClass({
|
||||
<div className="settings-container">
|
||||
<AccountSettings currentUser={this.state.currentUser} loadUser={this.loadUser}/>
|
||||
{this.props.children}
|
||||
<APISettings />
|
||||
<BitcoinWalletSettings />
|
||||
<AclProxy
|
||||
aclObject={this.state.whitelabel}
|
||||
aclName="acl_view_settings_api">
|
||||
<APISettings />
|
||||
</AclProxy>
|
||||
<AclProxy
|
||||
aclObject={this.state.whitelabel}
|
||||
aclName="acl_view_settings_bitcoin">
|
||||
<BitcoinWalletSettings />
|
||||
</AclProxy>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ let Header = React.createClass({
|
||||
{getLangText('Account Settings')}
|
||||
</MenuItemLink>
|
||||
<AclProxy
|
||||
aclObject={this.state.whitelabel}
|
||||
aclObject={this.state.currentUser.acl}
|
||||
aclName="acl_view_settings_contract">
|
||||
<MenuItemLink
|
||||
to="contract_settings"
|
||||
|
Loading…
Reference in New Issue
Block a user