Render title from 'collection' link in EntitiesView
authorFrank Bessou <frank.bessou@logilab.fr>
Tue, 04 Apr 2017 16:31:05 +0200
changeset 77 956d78e0d931
parent 76 0aff36e8062a
child 78 9463a36b693b
Render title from 'collection' link in EntitiesView
src/components/Entities.js
--- a/src/components/Entities.js	Tue Apr 04 16:30:12 2017 +0200
+++ b/src/components/Entities.js	Tue Apr 04 16:31:05 2017 +0200
@@ -32,12 +32,24 @@
 };
 
 function EntitiesView(props) {
-    if (!isEmpty(props.entities)) {
-        return <ListView entities={props.entities} />;
+    function renderTitle() {
+        return props.entities.data.links('collection')[0].title;
     }
+
+    function renderEntities() {
+        if (!isEmpty(props.entities)) {
+            return <ListView entities={props.entities} />;
+        }
+
+        return <div className="text-mutted">
+            no {props.entities.etype} entity yet
+        </div>
+    }
+
     return (
-        <div className="text-mutted">
-            no {props.entities.etype} entity yet
+        <div>
+            <h3>{ renderTitle() }</h3>
+            { renderEntities() }
         </div>
     );
 }