1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Small code style changes

This commit is contained in:
Brett Sun 2016-01-11 17:57:35 +01:00
parent 8531b77633
commit eafa675760
2 changed files with 23 additions and 25 deletions

View File

@ -23,9 +23,10 @@ const EMBED_IFRAME_HEIGHT = {
let MediaContainer = React.createClass({
propTypes: {
content: React.PropTypes.object,
currentUser: React.PropTypes.object,
refreshObject: React.PropTypes.func
content: React.PropTypes.object.isRequired,
refreshObject: React.PropTypes.func.isRequired,
currentUser: React.PropTypes.object
},
getInitialState() {
@ -35,13 +36,14 @@ let MediaContainer = React.createClass({
},
componentDidMount() {
if (!this.props.content.digital_work) {
const { content, refreshObject } = this.props;
if (!content.digital_work) {
return;
}
const isEncoding = this.props.content.digital_work.isEncoding;
if (this.props.content.digital_work.mime === 'video' && typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
let timerId = window.setInterval(this.props.refreshObject, 10000);
const isEncoding = content.digital_work.isEncoding;
if (content.digital_work.mime === 'video' && typeof isEncoding === 'number' && isEncoding !== 100 && !this.state.timerId) {
const timerId = window.setInterval(refreshObject, 10000);
this.setState({timerId: timerId});
}
},
@ -93,7 +95,7 @@ let MediaContainer = React.createClass({
{'<iframe width="560" height="' + height + '" src="https://embed.ascribe.io/content/'
+ content.bitcoin_id + '" frameborder="0" allowfullscreen></iframe>'}
</pre>
}/>
} />
);
}
return (
@ -120,7 +122,7 @@ let MediaContainer = React.createClass({
className="ascribe-margin-1px"
href={content.digital_work.url}
target="_blank">
{getLangText('Download')} .{mimetype} <Glyphicon glyph="cloud-download"/>
{getLangText('Download')} .{mimetype} <Glyphicon glyph="cloud-download" />
</Button>
</AclProxy>
{embed}

View File

@ -7,39 +7,35 @@ import Moment from 'moment';
import ReactError from '../../mixins/react_error';
import { ResourceNotFoundError } from '../../models/errors';
import EditionListActions from '../../actions/edition_list_actions';
import GlobalNotificationModel from '../../models/global_notification_model';
import GlobalNotificationActions from '../../actions/global_notification_actions';
import PieceActions from '../../actions/piece_actions';
import PieceStore from '../../stores/piece_store';
import PieceListActions from '../../actions/piece_list_actions';
import PieceListStore from '../../stores/piece_list_store';
import UserActions from '../../actions/user_actions';
import UserStore from '../../stores/user_store';
import EditionListActions from '../../actions/edition_list_actions';
import Piece from './piece';
import CollapsibleParagraph from './../ascribe_collapsible/collapsible_paragraph';
import FurtherDetails from './further_details';
import DetailProperty from './detail_property';
import LicenseDetail from './license_detail';
import HistoryIterator from './history_iterator';
import LicenseDetail from './license_detail';
import Note from './note';
import Piece from './piece';
import AclButtonList from './../ascribe_buttons/acl_button_list';
import CreateEditionsForm from '../ascribe_forms/create_editions_form';
import AclInformation from '../ascribe_buttons/acl_information';
import CreateEditionsButton from '../ascribe_buttons/create_editions_button';
import DeleteButton from '../ascribe_buttons/delete_button';
import AclInformation from '../ascribe_buttons/acl_information';
import AclProxy from '../acl_proxy';
import CollapsibleParagraph from './../ascribe_collapsible/collapsible_paragraph';
import CreateEditionsForm from '../ascribe_forms/create_editions_form';
import ListRequestActions from '../ascribe_forms/list_form_request_actions';
import GlobalNotificationModel from '../../models/global_notification_model';
import GlobalNotificationActions from '../../actions/global_notification_actions';
import Note from './note';
import AclProxy from '../acl_proxy';
import ApiUrls from '../../constants/api_urls';
import AscribeSpinner from '../ascribe_spinner';