From bcf8756cd3706718409437b76c1f12a4d0e9342c Mon Sep 17 00:00:00 2001 From: ddejongh Date: Tue, 26 May 2015 13:48:46 +0200 Subject: [PATCH] edition --- js/actions/edition_actions.js | 14 +++++++------- js/components/edition.js | 26 +++++++++++++------------- js/components/edition_container.js | 22 +++++++++++----------- js/fetchers/edition_fetcher.js | 4 ++-- js/fetchers/piece_fetcher.js | 2 +- js/routes.js | 4 ++-- js/stores/edition_store.js | 14 +++++++------- 7 files changed, 43 insertions(+), 43 deletions(-) diff --git a/js/actions/edition_actions.js b/js/actions/edition_actions.js index d657539b..f8d43ccc 100644 --- a/js/actions/edition_actions.js +++ b/js/actions/edition_actions.js @@ -1,18 +1,18 @@ import alt from '../alt'; -import PieceFetcher from '../fetchers/piece_fetcher'; +import EditionFetcher from '../fetchers/edition_fetcher'; -class PieceActions { +class EditionActions { constructor() { this.generateActions( - 'updatePiece' + 'updateEdition' ); } - fetchOne(pieceId) { - PieceFetcher.fetchOne(pieceId) + fetchOne(editionId) { + EditionFetcher.fetchOne(editionId) .then((res) => { - this.actions.updatePiece(res.piece); + this.actions.updateEdition(res.edition); }) .catch((err) => { console.log(err); @@ -20,4 +20,4 @@ class PieceActions { } } -export default alt.createActions(PieceActions); +export default alt.createActions(EditionActions); diff --git a/js/components/edition.js b/js/components/edition.js index 44e6b52a..1dfa2c02 100644 --- a/js/components/edition.js +++ b/js/components/edition.js @@ -4,7 +4,7 @@ import ImageViewer from './ascribe_media/image_viewer'; /** * This is the component that implements display-specific functionality */ -let Piece = React.createClass({ +let Edition = React.createClass({ //propTypes: { // title: React.PropTypes.string.isRequired //}, @@ -13,18 +13,18 @@ let Piece = React.createClass({ return (
- +
- - + +
); } }); -let PieceHeader = React.createClass({ +let EditionHeader = React.createClass({ //propTypes: { // title: React.PropTypes.string.isRequired //}, @@ -38,7 +38,7 @@ let PieceHeader = React.createClass({
TITLE:
-
{this.props.piece.title}
+
{this.props.edition.title}
@@ -47,7 +47,7 @@ let PieceHeader = React.createClass({
BY:
-
{this.props.piece.artist_name}
+
{this.props.edition.artist_name}
@@ -55,7 +55,7 @@ let PieceHeader = React.createClass({
DATE:
-
{ this.props.piece.date_created.slice(0,4) }
+
{ this.props.edition.date_created.slice(0,4) }

@@ -64,7 +64,7 @@ let PieceHeader = React.createClass({ } }); -let PieceEdition = React.createClass({ +let EditionDetails = React.createClass({ //propTypes: { // title: React.PropTypes.string.isRequired //}, @@ -77,7 +77,7 @@ let PieceEdition = React.createClass({
EDITION:
-
{ this.props.piece.edition_number } of {this.props.piece.num_editions}
+
{ this.props.edition.edition_number } of {this.props.edition.num_editions}
@@ -85,7 +85,7 @@ let PieceEdition = React.createClass({
ID:
-
{ this.props.piece.bitcoin_id }
+
{ this.props.edition.bitcoin_id }
@@ -93,7 +93,7 @@ let PieceEdition = React.createClass({
OWNER:
-
{ this.props.piece.owner }
+
{ this.props.edition.owner }

@@ -103,4 +103,4 @@ let PieceEdition = React.createClass({ }); -export default Piece; \ No newline at end of file +export default Edition; \ No newline at end of file diff --git a/js/components/edition_container.js b/js/components/edition_container.js index 82374494..83a8579b 100644 --- a/js/components/edition_container.js +++ b/js/components/edition_container.js @@ -1,17 +1,17 @@ import React from 'react'; -import PieceActions from '../actions/piece_actions'; -import PieceStore from '../stores/piece_store'; +import EditionActions from '../actions/edition_actions'; +import EditionStore from '../stores/edition_store'; -import Piece from './piece'; +import Edition from './edition'; /** * This is the component that implements resource/data specific functionality */ -let PieceContainer = React.createClass({ +let EditionContainer = React.createClass({ getInitialState() { - return PieceStore.getState(); + return EditionStore.getState(); }, onChange(state) { @@ -19,19 +19,19 @@ let PieceContainer = React.createClass({ }, componentDidMount() { - PieceActions.fetchOne(this.props.params.pieceId); - PieceStore.listen(this.onChange); + EditionActions.fetchOne(this.props.params.editionId); + EditionStore.listen(this.onChange); }, componentDidUnmount() { - PieceStore.unlisten(this.onChange); + EditionStore.unlisten(this.onChange); }, render() { - if('title' in this.state.piece) { + if('title' in this.state.edition) { return ( - + ); } else { return ( @@ -43,4 +43,4 @@ let PieceContainer = React.createClass({ } }); -export default PieceContainer; +export default EditionContainer; diff --git a/js/fetchers/edition_fetcher.js b/js/fetchers/edition_fetcher.js index 1f70edbf..675d8682 100644 --- a/js/fetchers/edition_fetcher.js +++ b/js/fetchers/edition_fetcher.js @@ -4,7 +4,7 @@ import AppConstants from '../constants/application_constants'; import FetchApiUtils from '../utils/fetch_api_utils'; -let PieceFetcher = { +let EditionFetcher = { /** * Fetch one user from the API. * If no arg is supplied, load the current user @@ -19,4 +19,4 @@ let PieceFetcher = { } }; -export default PieceFetcher; +export default EditionFetcher; diff --git a/js/fetchers/piece_fetcher.js b/js/fetchers/piece_fetcher.js index 1f70edbf..4aaecda5 100644 --- a/js/fetchers/piece_fetcher.js +++ b/js/fetchers/piece_fetcher.js @@ -11,7 +11,7 @@ let PieceFetcher = { * */ fetchOne(pieceId) { - return fetch(AppConstants.baseUrl + 'editions/' + pieceId + '/', { + return fetch(AppConstants.baseUrl + 'pieces/' + pieceId + '/', { headers: { 'Authorization': 'Basic ' + AppConstants.debugCredentialBase64 } diff --git a/js/routes.js b/js/routes.js index ce480e80..0fccc60a 100644 --- a/js/routes.js +++ b/js/routes.js @@ -3,7 +3,7 @@ import Router from 'react-router'; import AscribeApp from './components/ascribe_app'; import PieceList from './components/piece_list'; -import PieceContainer from './components/piece_container'; +import EditionContainer from './components/edition_container'; let Route = Router.Route; @@ -13,7 +13,7 @@ let routes = ( - + ); diff --git a/js/stores/edition_store.js b/js/stores/edition_store.js index 35e8c229..9859ec7c 100644 --- a/js/stores/edition_store.js +++ b/js/stores/edition_store.js @@ -1,16 +1,16 @@ import alt from '../alt'; -import PieceAction from '../actions/piece_actions'; +import EditionAction from '../actions/edition_actions'; -class PieceStore { +class EditionStore { constructor() { - this.piece = {}; - this.bindActions(PieceAction); + this.edition = {}; + this.bindActions(EditionAction); } - onUpdatePiece(piece) { - this.piece = piece; + onUpdateEdition(edition) { + this.edition = edition; } } -export default alt.createStore(PieceStore); +export default alt.createStore(EditionStore);