Please be patient, the video is been encoded
diff --git a/js/components/ascribe_table/table_item.js b/js/components/ascribe_table/table_item.js
index a0e6e852..12232a31 100644
--- a/js/components/ascribe_table/table_item.js
+++ b/js/components/ascribe_table/table_item.js
@@ -12,12 +12,14 @@ let TableItem = React.createClass({
propTypes: {
columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(ColumnModel)),
columnContent: React.PropTypes.object,
- className: React.PropTypes.string
+ className: React.PropTypes.string,
+ onClick: React.PropTypes.func
},
render() {
return (
diff --git a/js/components/ascribe_table/table_item_checkbox.js b/js/components/ascribe_table/table_item_checkbox.js
index cb368369..9ade00f4 100644
--- a/js/components/ascribe_table/table_item_checkbox.js
+++ b/js/components/ascribe_table/table_item_checkbox.js
@@ -7,18 +7,13 @@ let TableItemCheckbox = React.createClass({
propTypes: {
editionId: React.PropTypes.number,
pieceId: React.PropTypes.number,
- selectItem: React.PropTypes.func,
selected: React.PropTypes.bool
},
- selectItem() {
- this.props.selectItem(this.props.pieceId, this.props.editionId);
- },
-
render() {
return (
-
+
);
}
diff --git a/js/components/ascribe_table/table_item_selectable.js b/js/components/ascribe_table/table_item_selectable.js
index cc53c5f0..36144181 100644
--- a/js/components/ascribe_table/table_item_selectable.js
+++ b/js/components/ascribe_table/table_item_selectable.js
@@ -19,7 +19,7 @@ let TableItemSelectable = React.createClass({
},
selectItem() {
- this.props.selectItem(this.props.parentId, this.props.columnContent.edition_number);
+ this.props.selectItem(this.props.parentId, this.props.columnContent.id);
},
render() {
diff --git a/js/components/ascribe_table/table_item_wrapper.js b/js/components/ascribe_table/table_item_wrapper.js
index 35299641..6eb7b3b4 100644
--- a/js/components/ascribe_table/table_item_wrapper.js
+++ b/js/components/ascribe_table/table_item_wrapper.js
@@ -11,14 +11,15 @@ let TableItemWrapper = React.createClass({
propTypes: {
columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(ColumnModel)),
columnContent: React.PropTypes.object,
- columnWidth: React.PropTypes.number.isRequired
+ columnWidth: React.PropTypes.number.isRequired,
+ onClick: React.PropTypes.func
},
mixins: [Router.Navigation],
render() {
return (
-
+
{this.props.columnList.map((column, i) => {
let TypeElement = column.displayType;
diff --git a/js/components/global_notification.js b/js/components/global_notification.js
index 82646976..aefe525a 100644
--- a/js/components/global_notification.js
+++ b/js/components/global_notification.js
@@ -7,66 +7,116 @@ import GlobalNotificationStore from '../stores/global_notification_store';
import Row from 'react-bootstrap/lib/Row';
import Col from 'react-bootstrap/lib/Col';
+import { mergeOptions } from '../utils/general_utils';
+
let GlobalNotification = React.createClass({
+ getInitialState() {
+ return mergeOptions(
+ {
+ containerWidth: 0
+ },
+ this.extractFirstElem(GlobalNotificationStore.getState().notificationQue)
+ );
+ },
+
componentDidMount() {
GlobalNotificationStore.listen(this.onChange);
+
+ // init container width
+ this.handleContainerResize();
+
+ // we're using an event listener on window here,
+ // as it was not possible to listen to the resize events of a dom node
+ window.addEventListener('resize', this.handleContainerResize);
},
componentWillUnmount() {
GlobalNotificationStore.unlisten(this.onChange);
- },
-
- getInititalState() {
- return this.extractFirstElem(GlobalNotificationStore.getState().notificationQue);
+ window.removeEventListener('resize', this.handleContainerResize);
},
extractFirstElem(l) {
- return l.length > 0 ? l[0] : null;
+ if(l.length > 0) {
+ return {
+ show: true,
+ message: l[0]
+ };
+ } else {
+ return {
+ show: false,
+ message: ''
+ };
+ }
},
onChange(state) {
let notification = this.extractFirstElem(state.notificationQue);
- if(notification) {
+ if(notification.show) {
this.setState(notification);
} else {
- this.replaceState(null);
+ this.setState({
+ show: false
+ });
}
},
+ handleContainerResize() {
+ this.setState({
+ containerWidth: this.refs.notificationWrapper.getDOMNode().offsetWidth
+ });
+ },
+
render() {
- let notificationClass = 'ascribe-global-notification ';
- let message = this.state && this.state.message ? this.state.message : null;
+ let notificationClass = 'ascribe-global-notification';
+ let textClass;
- if(message) {
- let colors = {
- warning: '#f0ad4e',
- success: '#5cb85c',
- info: 'rgba(2, 182, 163, 1)',
- danger: '#d9534f'
- };
+ if(this.state.containerWidth > 768) {
+ notificationClass = 'ascribe-global-notification-bubble';
- let text = ({message ? message : null}
);
+ if(this.state.show) {
+ notificationClass += ' ascribe-global-notification-bubble-on';
+ } else {
+ notificationClass += ' ascribe-global-notification-bubble-off';
+ }
- return (
+ } else {
+ notificationClass = 'ascribe-global-notification';
+
+ if(this.state.show) {
+ notificationClass += ' ascribe-global-notification-on';
+ } else {
+ notificationClass += ' ascribe-global-notification-off';
+ }
+
+ }
+
+ if(this.state.message) {
+ switch(this.state.message.type) {
+ case 'success':
+ textClass = 'ascribe-global-notification-success';
+ break;
+ case 'danger':
+ textClass = 'ascribe-global-notification-danger';
+ break;
+ default:
+ console.warn('Could not find a matching type in global_notification.js');
+ }
+ }
+
+
+ return (
+
-
- {text}
+
+
{this.state.message.message}
- );
- } else {
- return (
-
-
-
-
-
- );
- }
+
+ );
}
});
diff --git a/js/components/header.js b/js/components/header.js
index a023068b..ef8566e4 100644
--- a/js/components/header.js
+++ b/js/components/header.js
@@ -19,11 +19,12 @@ import MenuItem from 'react-bootstrap/lib/MenuItem';
import MenuItemLink from 'react-router-bootstrap/lib/MenuItemLink';
import NavItemLink from 'react-router-bootstrap/lib/NavItemLink';
+import HeaderNotificationDebug from './header_notification_debug';
+
import { mergeOptions } from '../utils/general_utils';
import { getLangText } from '../utils/lang_utils';
-let Link = Router.Link;
let Header = React.createClass({
mixins: [Router.Navigation],
@@ -43,11 +44,13 @@ let Header = React.createClass({
UserStore.unlisten(this.onChange);
WhitelabelStore.unlisten(this.onChange);
},
+
handleLogout(){
UserActions.logoutCurrentUser();
Alt.flush();
this.transitionTo('login');
},
+
getLogo(){
let logo = (
@@ -102,15 +105,14 @@ let Header = React.createClass({
- {this.getLogo()}
- }
+ this.getLogo()
+ }
toggleNavKey={0}
fixedTop={true}>
-
+