From 6d72352580bbe0db3b292f346b94e336174ba7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Wed, 8 Jul 2015 10:15:58 +0200 Subject: [PATCH] some minor corrections --- .../accordion_list_item_table_toggle.js | 1 - js/components/ascribe_buttons/acl_button.js | 1 - .../ascribe_uploader/file_drag_and_drop.js | 3 +-- .../ascribe_uploader/react_s3_fine_uploader.js | 13 +++++++------ js/components/coa_verify_container.js | 5 ++--- js/components/edition.js | 7 ++++--- 6 files changed, 14 insertions(+), 16 deletions(-) diff --git a/js/components/ascribe_accordion_list/accordion_list_item_table_toggle.js b/js/components/ascribe_accordion_list/accordion_list_item_table_toggle.js index 435eb54e..c6017b5b 100644 --- a/js/components/ascribe_accordion_list/accordion_list_item_table_toggle.js +++ b/js/components/ascribe_accordion_list/accordion_list_item_table_toggle.js @@ -1,7 +1,6 @@ 'use strict'; import React from 'react'; -import { getLangText } from '../../utils/lang_utils.js'; let AccordionListItemTableToggle = React.createClass({ diff --git a/js/components/ascribe_buttons/acl_button.js b/js/components/ascribe_buttons/acl_button.js index 99c3f754..c1a63265 100644 --- a/js/components/ascribe_buttons/acl_button.js +++ b/js/components/ascribe_buttons/acl_button.js @@ -78,7 +78,6 @@ let AclButton = React.createClass({ return ( {this.props.action.toUpperCase()} diff --git a/js/components/ascribe_uploader/file_drag_and_drop.js b/js/components/ascribe_uploader/file_drag_and_drop.js index a0dde9a7..fc7a9d27 100644 --- a/js/components/ascribe_uploader/file_drag_and_drop.js +++ b/js/components/ascribe_uploader/file_drag_and_drop.js @@ -4,7 +4,6 @@ import React from 'react'; import FileDragAndDropDialog from './file_drag_and_drop_dialog'; import FileDragAndDropPreviewIterator from './file_drag_and_drop_preview_iterator'; -import { getLangText } from '../../utils/lang_utils.js'; // Taken from: https://github.com/fedosejev/react-file-drag-and-drop @@ -150,7 +149,7 @@ let FileDragAndDrop = React.createClass({ onDragOver={this.handleDragOver} onDrop={this.handleDrop} onDragEnd={this.handleDragEnd}> - diff --git a/js/components/ascribe_uploader/react_s3_fine_uploader.js b/js/components/ascribe_uploader/react_s3_fine_uploader.js index aa090ed9..ca63f169 100644 --- a/js/components/ascribe_uploader/react_s3_fine_uploader.js +++ b/js/components/ascribe_uploader/react_s3_fine_uploader.js @@ -6,9 +6,10 @@ import promise from 'es6-promise'; promise.polyfill(); import fetch from 'isomorphic-fetch'; -import AppConstants from '../../constants/application_constants'; import { getCookie } from '../../utils/fetch_api_utils'; +import { getLangText } from '../../utils/lang_utils'; + import S3Fetcher from '../../fetchers/s3_fetcher'; import fineUploader from 'fineUploader'; @@ -144,9 +145,9 @@ var ReactS3FineUploader = React.createClass({ }, // since the csrf header is defined in this component's props, - // everytime the csrf cookie is changed we'll need to reinitalize + // everytime the csrf cookie is changed we'll need to reinitalize // fineuploader and update the actual csrf token - componentWillUpdate(nextProps, nextState) { + componentWillUpdate() { let potentiallyNewCSRFToken = getCookie('csrftoken'); if(this.state.csrfToken !== potentiallyNewCSRFToken) { this.setState({ @@ -376,12 +377,12 @@ var ReactS3FineUploader = React.createClass({ onDeleteComplete(id, xhr, isError) { if(isError) { - let notification = new GlobalNotificationModel('Couldn\'t delete file', 'danger', 10000); + let notification = new GlobalNotificationModel(getLangText('Couldn\'t delete file'), 'danger', 10000); GlobalNotificationActions.appendGlobalNotification(notification); } else { this.removeFileWithIdFromFilesToUpload(id); - let notification = new GlobalNotificationModel('File deleted', 'success', 5000); + let notification = new GlobalNotificationModel(getLangText('File deleted'), 'success', 5000); GlobalNotificationActions.appendGlobalNotification(notification); } @@ -464,7 +465,7 @@ var ReactS3FineUploader = React.createClass({ // replace filelist with first-element file list files = tempFilesList; // TOOD translate? - let notification = new GlobalNotificationModel('Only one file allowed (took first one)', 'danger', 10000); + let notification = new GlobalNotificationModel(getLangText('Only one file allowed (took first one)'), 'danger', 10000); GlobalNotificationActions.appendGlobalNotification(notification); } diff --git a/js/components/coa_verify_container.js b/js/components/coa_verify_container.js index 3cc5b056..6afbdfa5 100644 --- a/js/components/coa_verify_container.js +++ b/js/components/coa_verify_container.js @@ -49,9 +49,8 @@ let CoaVerifyForm = React.createClass({ handleSuccess(response){ let notification = null; - if (response.verdict){ - // TODO translate? - notification = new GlobalNotificationModel('Certificate of Authenticity successfully verified', 'success'); + if (response.verdict) { + notification = new GlobalNotificationModel(getLangText('Certificate of Authenticity successfully verified'), 'success'); GlobalNotificationActions.appendGlobalNotification(notification); } }, diff --git a/js/components/edition.js b/js/components/edition.js index 4e9037f5..a2efe3b1 100644 --- a/js/components/edition.js +++ b/js/components/edition.js @@ -35,7 +35,6 @@ import GlobalNotificationActions from '../actions/global_notification_actions'; import apiUrls from '../constants/api_urls'; import AppConstants from '../constants/application_constants'; -import classNames from 'classnames'; import { getCookie } from '../utils/fetch_api_utils'; import { getLangText } from '../utils/lang_utils'; @@ -210,7 +209,7 @@ const CollapsibleButton = React.createClass({ this.setState({expanded: !this.state.expanded}); }, render() { - let isVisible = (this.state.expanded) ? '' : getLangText('invisible'); + let isVisible = (this.state.expanded) ? '' : 'invisible'; return ( @@ -438,7 +437,9 @@ let EditionPublicEditionNote = React.createClass({ handleSuccess: React.PropTypes.func }, showNotification(){ - this.props.handleSuccess();EnterndGlobalNotification(notification); + this.props.handleSuccess(); + let notification = new GlobalNotificationModel(getLangText('Public note saved'), 'success'); + GlobalNotificationActions.appendGlobalNotification(notification); }, render() { let isEditable = this.props.edition.acl.indexOf('edit') > -1;