diff --git a/frontend/src/main/web/lib/components/SystemGlossary.jsx b/frontend/src/main/web/lib/components/SystemGlossary.jsx index 158764b878..fc797639e8 100644 --- a/frontend/src/main/web/lib/components/SystemGlossary.jsx +++ b/frontend/src/main/web/lib/components/SystemGlossary.jsx @@ -15,6 +15,8 @@ import StringUtils from '../utils/StringUtils' var SystemGlossary = React.createClass({ mixins: [PureRenderMixin], + filterTimeout: null, + _init: function() { return GlossaryStore.init(); }, @@ -48,11 +50,12 @@ var SystemGlossary = React.createClass({ _handleFilterChange: function(event) { this.setState({filter: event.target.value}); - if(this.state.filterTimeout !== null) { - clearTimeout(this.state.filterTimeout); + + if(this.filterTimeout !== null) { + clearTimeout(this.filterTimeout); } if(!StringUtils.isEmptyOrNull(event.target.value)) { - this.state.filterTimeout = setTimeout(() => { + this.filterTimeout = setTimeout(() => { Actions.updateFilter(this.state.filter); }, 500); } diff --git a/frontend/src/main/web/lib/components/glossary/ActionCell.jsx b/frontend/src/main/web/lib/components/glossary/ActionCell.jsx index 16e2e1db9a..c9a89c1192 100644 --- a/frontend/src/main/web/lib/components/glossary/ActionCell.jsx +++ b/frontend/src/main/web/lib/components/glossary/ActionCell.jsx @@ -55,16 +55,14 @@ var ActionCell = React.createClass({ }, render: function () { - var self = this; - - if (self.props.contentHash === null || self.state.entry === null) { + if (this.props.contentHash === null || this.state.entry === null) { return (); } else { - var isTransModified = self.state.entry.status.isTransModified; - var canUpdateComment = self.state.entry.status.canUpdateTransComment; - var isSaving = self.state.entry.status.isSaving; + var isTransModified = this.state.entry.status.isTransModified; + var canUpdateComment = this.state.entry.status.canUpdateTransComment; + var isSaving = this.state.entry.status.isSaving; - var infoTooltip = {self.props.info}; + var infoTooltip = {this.props.info}; var info = ( @@ -75,9 +73,9 @@ var ActionCell = React.createClass({ comment = ( + readOnly={!this.props.canUpdateEntry || !canUpdateComment || isSaving} + value={this.state.entry.transTerm.comment} + onUpdateCommentCallback={this._onUpdateComment}/> ); if(isSaving) { @@ -91,12 +89,12 @@ var ActionCell = React.createClass({ if(isTransModified) { updateButton = ( - ); cancelButton = ( - ); diff --git a/frontend/src/main/web/lib/components/glossary/DataTable.jsx b/frontend/src/main/web/lib/components/glossary/DataTable.jsx index a6cd7756db..cab13cb970 100644 --- a/frontend/src/main/web/lib/components/glossary/DataTable.jsx +++ b/frontend/src/main/web/lib/components/glossary/DataTable.jsx @@ -16,6 +16,8 @@ var DataTable = React.createClass({ CONTENT_HASH_INDEX: 0, + loadTimeout: null, + ENTRY: { SRC: { col: 1, @@ -87,13 +89,15 @@ var DataTable = React.createClass({ }, /** + * if top is undefined, table height will be calculated based on DOM height. * - * @param fixedTop - gets the height from the DOM if this is not specified + * @param top - Number value of top height */ - _getHeight: function(fixedTop) { + _getHeight: function(top) { var footer = window.document.getElementById("footer"); var footerHeight = footer ? footer.clientHeight : 91; - var top = _.isUndefined(fixedTop) ? React.findDOMNode(this).offsetTop: fixedTop; + + top = _.isUndefined(top) ? React.findDOMNode(this).offsetTop: top; var newHeight = window.innerHeight - footerHeight - top; //minimum height 250px @@ -438,14 +442,12 @@ var DataTable = React.createClass({ _rowGetter: function(rowIndex) { var row = this.props.glossaryHash[rowIndex]; if(_.isUndefined(row) || row === null) { - if(this.state.timeout !== null) { - clearTimeout(this.state.timeout); + if(this.loadTimeout !== null) { + clearTimeout(this.loadTimeout); } - - this.state.timeout = setTimeout(() => { + this.loadTimeout = setTimeout(() => { Actions.loadGlossary(rowIndex); }, this.TIMEOUT); - return [null]; } else { return row; diff --git a/frontend/src/main/web/lib/components/glossary/InputCell.jsx b/frontend/src/main/web/lib/components/glossary/InputCell.jsx index 34e91f63ea..645ee0ec68 100644 --- a/frontend/src/main/web/lib/components/glossary/InputCell.jsx +++ b/frontend/src/main/web/lib/components/glossary/InputCell.jsx @@ -16,7 +16,9 @@ var InputCell = React.createClass({ onBlurCallback: React.PropTypes.func }, - TIMEOUT: 100, + TIMEOUT: 150, + + updateTimeout: null, getInitialState: function() { return this._getState(); @@ -30,8 +32,7 @@ var InputCell = React.createClass({ return { value: value, - isFocused : isFocused, - timeout: null + isFocused : isFocused } }, @@ -50,13 +51,13 @@ var InputCell = React.createClass({ }, _onValueChange : function(event) { - var self = this, - value = event.target.value; + var value = event.target.value; this.setState({value: value}); - if(this.state.timeout !== null) { - clearTimeout(this.state.timeout); + if(this.updateTimeout !== null) { + clearTimeout(this.updateTimeout); } - this.state.timeout = setTimeout(() => { + this.updateTimeout = setTimeout(() => { + console.info('update'); Actions.updateEntryField(this.props.contentHash, this.props.field, value); }, this.TIMEOUT); }, diff --git a/frontend/src/main/web/lib/stores/GlossaryStore.js b/frontend/src/main/web/lib/stores/GlossaryStore.js index 267c47b8b2..04a10e43d9 100644 --- a/frontend/src/main/web/lib/stores/GlossaryStore.js +++ b/frontend/src/main/web/lib/stores/GlossaryStore.js @@ -300,7 +300,7 @@ var GlossaryStore = assign({}, EventEmitter.prototype, { break; case GlossaryActionTypes.UPDATE_FILTER: console.debug('Update filter', action.data); - if(_state.filter !== action.data) { + if(_state.filter !== action.data) { _state.filter = action.data; refreshGlossaryEntries(); } diff --git a/zanata-war/src/main/webapp/WEB-INF/template/template_ui.xhtml b/zanata-war/src/main/webapp/WEB-INF/template/template_ui.xhtml index 2813a43a98..4db47d3e1d 100755 --- a/zanata-war/src/main/webapp/WEB-INF/template/template_ui.xhtml +++ b/zanata-war/src/main/webapp/WEB-INF/template/template_ui.xhtml @@ -43,7 +43,7 @@ }; (function() { var wf = document.createElement('script'); - wf.src = ('https:' === document.location.protocol ? 'https' : 'http') + + wf.src = (document.location.protocol === 'https:' ? 'https' : 'http') + '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'; wf.type = 'text/javascript'; wf.async = 'true';