Rename CollectionItemLink 'entity' props to 'item'
authorFrank Bessou <frank.bessou@logilab.fr>
Fri, 28 Apr 2017 15:47:26 +0200
changeset 157 7e86687bd6f7
parent 156 7989ac4a50d3
child 158 293122812d40
Rename CollectionItemLink 'entity' props to 'item'
src/components/BaseViews.js
src/components/Entity.js
test/index.js
--- a/src/components/BaseViews.js	Fri Apr 28 15:25:56 2017 +0200
+++ b/src/components/BaseViews.js	Fri Apr 28 15:47:26 2017 +0200
@@ -6,18 +6,18 @@
 import {PropTypeJsonaryWrapper} from '../jsonaryutils';
 import {appendPath} from '../utils';
 
-export function CollectionItemLink({entity}) {
+export function CollectionItemLink({item}) {
     // XXX Use schema link when it becomes available
-    const itemRoute = entity.getLink('item').href;
+    const itemRoute = item.getLink('item').href;
     return (
         <Link to={`${itemRoute}`}>
-            {entity.get('/title')}
+            {item.get('/title')}
         </Link>
     );
 }
 
 CollectionItemLink.propTypes = {
-    entity: PropTypeJsonaryWrapper.isRequired,
+    item: PropTypeJsonaryWrapper.isRequired,
 };
 
 export function CollectionView(props) {
@@ -27,7 +27,7 @@
                 props.entities.data.mapItems(
                     entity => (
                         <li className="list-group-item" key={entity.getLink('item').href}>
-                            <CollectionItemLink entity={entity} etype={props.entities.etype} />
+                            <CollectionItemLink item={entity} etype={props.entities.etype} />
                         </li>
                         )
                 )
--- a/src/components/Entity.js	Fri Apr 28 15:25:56 2017 +0200
+++ b/src/components/Entity.js	Fri Apr 28 15:47:26 2017 +0200
@@ -118,9 +118,9 @@
             );
         } else {
             relatedItems = this.state.related.data.mapItems(
-                (entity) => (
-                    <li className="list-group-item" key={entity.uniqueId}>
-                        <CollectionItemLink entity={entity} />
+                (item) => (
+                    <li className="list-group-item" key={item.uniqueId}>
+                        <CollectionItemLink item={item} />
                     </li>
                 )
             );
--- a/test/index.js	Fri Apr 28 15:25:56 2017 +0200
+++ b/test/index.js	Fri Apr 28 15:47:26 2017 +0200
@@ -138,7 +138,7 @@
         const item = {title: 'bob', id:'123'};
         const itemSchema = {links: [{rel: 'item', href: '/user/{id}'}]};
         const wrappedItem = wrapEntityData(item, itemSchema);
-        const component = <CollectionItemLink entity={wrappedItem}/>;
+        const component = <CollectionItemLink item={wrappedItem}/>;
 
         const wrapper = shallow(component);
         const link = render(component, renderOptions);