mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Merge branch 'master' of github.com:ascribe/onion
This commit is contained in:
commit
24f5d4de2b
@ -5,11 +5,33 @@ import React from 'react';
|
||||
import Form from '../ascribe_forms/form';
|
||||
import Property from '../ascribe_forms/property';
|
||||
|
||||
import { replaceSubstringAtIndex } from '../../utils/general_utils';
|
||||
|
||||
|
||||
let HistoryIterator = React.createClass({
|
||||
propTypes: {
|
||||
history: React.PropTypes.array
|
||||
},
|
||||
|
||||
composeHistoryDescription(historicalEvent) {
|
||||
if(historicalEvent.length === 3) {
|
||||
// We want to get the capturing group without the quotes,
|
||||
// which is why we access the match list at index 1 and not 0
|
||||
const contractName = historicalEvent[1].match(/\"(.*)\"/)[1];
|
||||
const historicalEventDescription = replaceSubstringAtIndex(historicalEvent[1], `"${contractName}"`, '');
|
||||
return (
|
||||
<span>
|
||||
{historicalEventDescription}
|
||||
<a href={historicalEvent[2]} target="_blank">{contractName}</a>
|
||||
</span>
|
||||
);
|
||||
} else if(historicalEvent.length === 2) {
|
||||
return historicalEvent[1];
|
||||
} else {
|
||||
throw new Error('Expected an historical event list with either 3 or 2 items. Got less or more.');
|
||||
}
|
||||
},
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Form>
|
||||
@ -20,7 +42,7 @@ let HistoryIterator = React.createClass({
|
||||
key={i}
|
||||
label={ historicalEvent[0] }
|
||||
editable={false}>
|
||||
<pre className="ascribe-pre">{ historicalEvent[1] }</pre>
|
||||
<pre className="ascribe-pre">{this.composeHistoryDescription(historicalEvent)}</pre>
|
||||
</Property>
|
||||
);
|
||||
})}
|
||||
|
@ -11,7 +11,7 @@ let Footer = React.createClass({
|
||||
<p className="ascribe-sub-sub-statement">
|
||||
<br />
|
||||
<a href="http://docs.ascribe.apiary.io/" target="_blank">api</a> |
|
||||
<a href="https://www.ascribe.io/impressum/" target="_blank"> impressum</a> |
|
||||
<a href="https://www.ascribe.io/imprint/" target="_blank"> {getLangText('imprint')}</a> |
|
||||
<a href="https://www.ascribe.io/terms/" target="_blank"> {getLangText('terms of service')}</a> |
|
||||
<a href="https://www.ascribe.io/privacy/" target="_blank"> {getLangText('privacy')}</a>
|
||||
</p>
|
||||
|
Loading…
Reference in New Issue
Block a user