From 8b6ae44abd9a64766d44f0aadf962cd8b437e0ce Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Pasquier <contact@jbpasquier.eu>
Date: Tue, 13 Apr 2021 13:31:07 +0200
Subject: [PATCH] fix: community directory

---
 README.md                                     | 23 +++++++++++++++++++
 .../communities/page-community-edit.pug       |  2 +-
 .../communities/page-community-map.pug        |  8 +++----
 .../communities/page-community-profile.pug    |  2 +-
 src/views/partials/menu-left.pug              |  2 +-
 .../hubl-communities-map-fix-url-name.pug     |  8 ++-----
 6 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md
index 5d2b182f..1b59afca 100644
--- a/README.md
+++ b/README.md
@@ -650,6 +650,29 @@ Some module don't need any route to be active, set `route` to `false` so.
 
 Components can get the route of a module with `window.hubl.getRoute('componentName')`.
 
+#### Change the default route
+
+By default, Hubl will take a Dashboard as a default route.
+
+You can enforce a component to be the default one by adding `defaultRoute` to its parameters.
+
+Eg.:
+
+```json
+    {
+      "type": "profileDirectory",
+      "endpoints": {
+        "get": "http://server.url/users/",
+        "skills": "http://server.url/skills/",
+        "uploads": "http://server.url/upload/"
+      },
+      "route": "directory",
+      "defaultRoute": true
+    }
+```
+
+If there is more than one component with this parameter, it'll be ignored.
+
 ## Troubleshooting
 
 ### Circles or Projects are missing the @user list
diff --git a/src/views/partials/communities/page-community-edit.pug b/src/views/partials/communities/page-community-edit.pug
index 8aa9e59a..01337ed8 100644
--- a/src/views/partials/communities/page-community-edit.pug
+++ b/src/views/partials/communities/page-community-edit.pug
@@ -108,7 +108,7 @@ div.bg-color-white
         submit-button=""
         submit-widget="button"
 
-        data-trans="label-addresses.address_line1=communities.edit.labelAddressLine1;label-addresses.address_line2=communities.edit.labelAddressLine2"     
+        data-trans="label-address_line1=communities.edit.labelAddressLine1;label-address_line2=communities.edit.labelAddressLine2"     
       )
 
     solid-ac-checker(no-permission="acl:Write", bind-resources)
diff --git a/src/views/partials/communities/page-community-map.pug b/src/views/partials/communities/page-community-map.pug
index 36d9f62f..e931c692 100644
--- a/src/views/partials/communities/page-community-map.pug
+++ b/src/views/partials/communities/page-community-map.pug
@@ -13,7 +13,7 @@
 
         submit-button=""
         submit-widget="button"
-        data-trans='placeholder-name=communities.list.searchBy;submit-button=communities.list.searchButton'
+        data-trans='placeholder-filter=communities.list.searchBy;submit-button=communities.list.searchButton'
       )
     div.segment.quarter.sm-full.text-right
       solid-link.segment.children-link-rounded.children-icon-grid.children-link-reversed.color-secondary.bordered(next=`${component.route}-directory`)
@@ -26,11 +26,11 @@
 
       class-segment1="segment block margin-medium"
       class-segment2="segment full padding-top-xlarge padding-right-large padding-left-large sm-padding-medium border-top border-color-grey text-center whitespace-normal"
-      class-community.name="title segment block margin-bottom-xsmall text-color-heading text-xlarge text-bold"
+      class-community.name="segment block margin-bottom-xsmall text-color-heading text-xlarge text-bold"
       class-community.profile.shortDescription="segment block description text-medium whitespace-normal two-lines-ellipsis"
       
-      action-circle.name=`${getRoute(`community`, true)}-profile`
-      widget-circle.name='hubl-communities-map-fix-url-name'
+      action-community.name=`${component.route}-profile`
+      widget-community.name='hubl-communities-map-fix-url-name'
       widget-community.logo='hubl-admin-community-logo'
       widget-community.members="hubl-communities-profile-members-counter"
       
diff --git a/src/views/partials/communities/page-community-profile.pug b/src/views/partials/communities/page-community-profile.pug
index 6944bb71..6ff9400b 100644
--- a/src/views/partials/communities/page-community-profile.pug
+++ b/src/views/partials/communities/page-community-profile.pug
@@ -63,7 +63,7 @@ div.community-profile.padding-medium.sm-padding-none
       action-edit="edit"
       widget-edit="hubl-communities-edit-button"
       multiple-addresses
-      multiple-addresses-fields="adress_line1, address_line2"
+      multiple-addresses-fields="address_line1, address_line2"
 
       bind-resources
     )
diff --git a/src/views/partials/menu-left.pug b/src/views/partials/menu-left.pug
index 862bc3e3..b16a1d83 100644
--- a/src/views/partials/menu-left.pug
+++ b/src/views/partials/menu-left.pug
@@ -13,7 +13,7 @@ solid-form-search.icon.children-icon-magnifier(
   submit-widget="button"
 )
 div.divider
-solid-router#navbar-router(default-route='dashboard')
+solid-router#navbar-router(default-route=defaultRoute)
   for component of components
     if component.route
       if component.type == "about"
diff --git a/src/views/partials/widgets/hubl-communities-map-fix-url-name.pug b/src/views/partials/widgets/hubl-communities-map-fix-url-name.pug
index d5a41abd..f46b938c 100644
--- a/src/views/partials/widgets/hubl-communities-map-fix-url-name.pug
+++ b/src/views/partials/widgets/hubl-communities-map-fix-url-name.pug
@@ -2,13 +2,9 @@ if componentSet.has('communities')
   solid-widget(name='hubl-communities-name')
     template
       solid-link(
-        data-src="${src || value}"
+        data-src="${value}"
         next=`${getRoute(`communities`, true)}-profile`
-      )
-        solid-display(
-          data-src="${src || value}"
-          fields="name"
-        )
+      ) ${await value.name}
 
   solid-widget(name='hubl-communities-map-fix-url-name')
     template
-- 
GitLab