mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Further cleanup
This commit is contained in:
parent
702f1d29f3
commit
22a95f07fd
@ -169,12 +169,14 @@ let AclButton = React.createClass({
|
||||
return (
|
||||
<ModalWrapper
|
||||
trigger={
|
||||
<button className={shouldDisplay ? 'btn btn-default btn-sm ' + buttonClassName : 'hidden'}>
|
||||
<button
|
||||
className={'btn btn-default btn-sm ' + buttonClassName}
|
||||
disabled={!shouldDisplay}>
|
||||
{this.sanitizeAction()}
|
||||
</button>
|
||||
}
|
||||
handleSuccess = {aclProps.handleSuccess}
|
||||
title = {aclProps.title}>
|
||||
handleSuccess={aclProps.handleSuccess}
|
||||
title={aclProps.title}>
|
||||
{aclProps.form}
|
||||
</ModalWrapper>
|
||||
);
|
||||
|
@ -43,7 +43,7 @@ let AclButtonList = React.createClass({
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div id='aclbuttonlist' className={this.props.className}>
|
||||
<div className={this.props.className}>
|
||||
<span style={this.props.buttonsStyle}>
|
||||
<AclButton
|
||||
availableAcls={this.props.availableAcls}
|
||||
|
@ -3,8 +3,6 @@
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
|
||||
import Button from 'react-bootstrap/lib/Button';
|
||||
|
||||
import { InformationTexts } from '../../constants/information_text';
|
||||
import { replaceSubstringAtIndex, sanitize } from '../../utils/general_utils';
|
||||
import { intersectAcls } from '../../utils/acl_utils';
|
||||
@ -22,23 +20,6 @@ let AclInformation = React.createClass({
|
||||
return { isVisible: false };
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
this.dropdownButtonStyle = {
|
||||
background: 'none',
|
||||
color: 'black',
|
||||
padding: 0,
|
||||
border: 'none'
|
||||
};
|
||||
|
||||
this.dropdownListStyle = {
|
||||
textAlign: 'justify',
|
||||
width: '80.8%',
|
||||
border: '1px solid #CCC',
|
||||
backgroundColor: 'white',
|
||||
padding: '0.5em'
|
||||
};
|
||||
},
|
||||
|
||||
onOff() {
|
||||
if(!this.state.isVisible) {
|
||||
this.setState({ isVisible: true });
|
||||
@ -49,46 +30,33 @@ let AclInformation = React.createClass({
|
||||
},
|
||||
|
||||
getInfoText(title, info, example){
|
||||
let titleStyle = {
|
||||
color: '#02B6A3',
|
||||
fontSize: '11px',
|
||||
lineHeight: '3px'
|
||||
};
|
||||
|
||||
let infoStyle = {
|
||||
color: '#333333',
|
||||
fontSize: '11px',
|
||||
lineHeight: '3px'
|
||||
};
|
||||
|
||||
let exampleStyle = {
|
||||
color: '#B2B2B2',
|
||||
fontSize: '11px',
|
||||
lineHeight: '3px'
|
||||
};
|
||||
|
||||
let paragraphStyle = {
|
||||
margin: '.5em',
|
||||
lineHeight: '15px',
|
||||
align: 'justify'
|
||||
};
|
||||
|
||||
let aim = this.props.aim;
|
||||
|
||||
if (aim) {
|
||||
if (aim === 'form') {
|
||||
return (
|
||||
<p style={paragraphStyle}>
|
||||
<span style={infoStyle}> {replaceSubstringAtIndex(info.slice(2), 's ', ' ')} <br/> </span>
|
||||
<span style={exampleStyle}> {example} </span>
|
||||
<p>
|
||||
<span className="info">
|
||||
{replaceSubstringAtIndex(info.slice(2), 's ', ' ')} <br/>
|
||||
</span>
|
||||
<span className="example">
|
||||
{example}
|
||||
</span>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
else if (aim === 'button') {
|
||||
return (
|
||||
<p style={paragraphStyle}><span style={titleStyle}> {title} </span>
|
||||
<span style={infoStyle}> {info} <br/> </span>
|
||||
<span style={exampleStyle}> {example} </span>
|
||||
<p>
|
||||
<span className="title">
|
||||
{title}
|
||||
</span>
|
||||
<span className="info">
|
||||
{info} <br/>
|
||||
</span>
|
||||
<span className="example">
|
||||
{example}
|
||||
</span>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
@ -100,7 +68,7 @@ let AclInformation = React.createClass({
|
||||
|
||||
produceInformationBlock() {
|
||||
const { titles, informationSentences, exampleSentences } = InformationTexts;
|
||||
const {verbs, aim } = this.props;
|
||||
const { verbs, aim } = this.props;
|
||||
|
||||
// sorting is not needed, as `this.props.verbs` takes care of sorting already
|
||||
// So we assume a user of `AclInformationButton` puts an ordered version of
|
||||
@ -124,17 +92,21 @@ let AclInformation = React.createClass({
|
||||
|
||||
getButton() {
|
||||
return this.props.aim === 'button' ?
|
||||
<Button style = {this.dropdownButtonStyle} className="glyphicon glyphicon-question-sign" onClick={this.onOff} /> :
|
||||
<button
|
||||
style={{ marginTop: 0 }}
|
||||
className="btn btn-transparent glyphicon glyphicon-question-sign" onClick={this.onOff} /> :
|
||||
null;
|
||||
},
|
||||
|
||||
render() {
|
||||
const { aim } = this.props;
|
||||
const { isVisible } = this.state;
|
||||
|
||||
return (
|
||||
<span>
|
||||
<span >
|
||||
{this.getButton()}
|
||||
<div
|
||||
style={this.dropdownListStyle}
|
||||
className={classnames({'hidden': this.props.aim === 'button' && !this.state.isVisible})}>
|
||||
className={classnames({'acl-information-dropdown-list': true, 'hidden': aim === 'button' && !isVisible})}>
|
||||
<span>{this.produceInformationBlock()}</span>
|
||||
</div>
|
||||
</span>
|
||||
|
@ -17,7 +17,7 @@ let ModalWrapper = React.createClass({
|
||||
children: React.PropTypes.oneOfType([
|
||||
React.PropTypes.arrayOf(React.PropTypes.element),
|
||||
React.PropTypes.element
|
||||
]),
|
||||
])
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
@ -55,19 +55,7 @@ let ModalWrapper = React.createClass({
|
||||
// this adds the onClick method show of modal_wrapper to the trigger component
|
||||
// which is in most cases a button.
|
||||
let trigger = React.cloneElement(this.props.trigger, {onClick: this.show});
|
||||
let modalHeaderAscribe = {
|
||||
paddingTop: '15px',
|
||||
paddingBottom: '0px',
|
||||
borderBottom: 'none',
|
||||
minHeight: '16.42857px'
|
||||
};
|
||||
let modalBodyAscribe = {
|
||||
paddingTop: '5px',
|
||||
paddingBottom: '10px',
|
||||
paddingRight: '15px',
|
||||
paddingLeft: '15px',
|
||||
position: 'relative'
|
||||
};
|
||||
|
||||
return (
|
||||
<span>
|
||||
{trigger}
|
||||
|
28
sass/ascribe_acl_information.scss
Normal file
28
sass/ascribe_acl_information.scss
Normal file
@ -0,0 +1,28 @@
|
||||
.acl-information-dropdown-list {
|
||||
text-align: justify;
|
||||
background-color: white;
|
||||
padding: .5em .5em .5em 0;
|
||||
|
||||
p {
|
||||
margin: .5em .5em .5em 0;
|
||||
line-height: 15px;
|
||||
align: justify;
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 11px;
|
||||
line-height: 3px;
|
||||
}
|
||||
|
||||
.title {
|
||||
color: #02B6A3;
|
||||
}
|
||||
|
||||
.info {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.example {
|
||||
color: #B2B2B2;
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
.btn-transparent {
|
||||
color: black;
|
||||
background-color: transparent;
|
||||
|
||||
&:hover, &:active, &:focus {
|
||||
color:#424242;
|
||||
}
|
||||
}
|
4
sass/lib/modals.scss
Normal file
4
sass/lib/modals.scss
Normal file
@ -0,0 +1,4 @@
|
||||
.modal-header {
|
||||
padding: 15px 15px 0 15px;
|
||||
border-bottom: none;
|
||||
}
|
@ -34,6 +34,9 @@ $BASE_URL: '<%= BASE_URL %>';
|
||||
@import 'ascribe_form';
|
||||
@import 'ascribe_panel';
|
||||
@import 'ascribe_collapsible';
|
||||
@import 'ascribe_acl_information';
|
||||
|
||||
@import 'lib/buttons';
|
||||
|
||||
@import 'whitelabel/index';
|
||||
|
||||
@ -298,10 +301,6 @@ hr {
|
||||
height: 13em !important;
|
||||
}
|
||||
|
||||
.textarea-ascribe-info {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.input-checkbox-ascribe {
|
||||
line-height: 1.6;
|
||||
margin-left: 1.6em;
|
||||
@ -485,11 +484,6 @@ hr {
|
||||
}
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
padding: 15px 15px 0 15px;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.error-wrapper {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
|
Loading…
Reference in New Issue
Block a user