From 1a3aac00c8f1054fced8174bf4c0b084c736b94d Mon Sep 17 00:00:00 2001 From: Christophe Henry Date: Thu, 3 Oct 2019 15:27:57 +0200 Subject: [PATCH] Solves #145: add project captains to project page --- src/page-project-profile.pug | 11 +- .../project-profile/project-profile.scss | 135 +++++++++--------- src/templates/template-captain.pug | 23 +++ src/templates/template-team.pug | 20 ++- 4 files changed, 112 insertions(+), 77 deletions(-) create mode 100644 src/templates/template-captain.pug diff --git a/src/page-project-profile.pug b/src/page-project-profile.pug index c3aa6d3..9cbbb5f 100644 --- a/src/page-project-profile.pug +++ b/src/page-project-profile.pug @@ -3,9 +3,10 @@ include templates/template-business-provider.pug include templates/template-customer.pug include templates/template-team.pug + include templates/template-captain.pug sib-display( - fields='block-title(const-title1, number, customer.name, const-title2, name, entitled, creationDate), infos(block-description(label-description, description), block-logo(customer.logo)), block-lead, block-fee(label-fee, businessProvider), block-customer(label-customer, customer), block-team(label-team, members)', + fields='block-title(const-title1, number, customer.name, const-title2, name, entitled, creationDate), infos(block-description(label-description, description), block-logo(customer.logo)), block-lead, block-fee(label-fee, businessProvider), block-customer(label-customer, customer), block-captain(label-captain, captain), block-team(label-team, members)', value-const-title1='N°', value-const-title2='-', @@ -19,11 +20,13 @@ value-label-customer='CUSTOMER INFORMATIONS:', widget-customer='customer-template', - + + value-label-captain='CAPTAIN:', + widget-captain='captain-template', + value-label-team='TEAM:', widget-members='team-template', - multiple-members='', + multiple-members, bind-resources ) - diff --git a/src/styles/layout/project-profile/project-profile.scss b/src/styles/layout/project-profile/project-profile.scss index 67adc47..e8b8cdc 100644 --- a/src/styles/layout/project-profile/project-profile.scss +++ b/src/styles/layout/project-profile/project-profile.scss @@ -98,9 +98,7 @@ #clientBox { display: flex; - margin-left: auto; - margin-right: auto; - margin-top: 1.7rem; + margin: 1.7rem auto; max-width: 100%; >* { @@ -166,75 +164,80 @@ } } - [name='block-team'] { + [name='block-team'], [name='block-captain'] { + label { + display: none; + } - >sib-multiple { + sib-display.project-profile-user-avatar { + align-self: center; + grid-column: 1 / span 1; + grid-row: 1 / span 2; - label { - display: none; + div { + background-color: $color-0-0-100; + border-radius: 50%; + height: 7vh; + overflow: hidden; + position: relative; + width: 7vh; + + img { + height: 100%; + left: 0; + object-fit: cover; + position: absolute; + top: 0; + width: 100%; + } + } + } + + team-template[name='members'], captain-template[name='captain'] { + display: grid; + grid-column-gap: 1.6rem; + grid-template-columns: 7vh auto; + grid-template-rows: repeat(2, 5.2vh); + + + > div:nth-child(2) { + align-self: end; + display: flex; + grid-column: 2 / span 1; + grid-row: 1 / span 1; + + span { + align-self: center; + font-weight: 600; + } + + span ~ sib-display { + + > div { + display: flex; + margin-left: 1rem; + + sib-multiple [name='name'] { + @extend %user-role; + } + } + } } - >team-template[name='members'] { - display: grid; - grid-column-gap: 1.6rem; - grid-template-columns: 7vh auto; - grid-template-rows: repeat(2, 5.2vh); - - >sib-display:first-child { - align-self: center; - grid-column: 1 / span 1; - grid-row: 1 / span 2; - - div { - background-color: $color-0-0-100; - border-radius: 50%; - height: 7vh; - overflow: hidden; - position: relative; - width: 7vh; - - img { - height: 100%; - left: 0; - object-fit: cover; - position: absolute; - top: 0; - width: 100%; - } - } - } - - >div:nth-child(2) { - align-self: end; - display: flex; - grid-column: 2 / span 1; - grid-row: 1 / span 1; - - span { - align-self: center; - font-weight: 600; - } - - span~sib-display { - - >div { - display: flex; - margin-left: 1rem; - - sib-multiple [name='name'] { - @extend %user-role; - } - } - } - } - - >span:nth-child(3) { - align-self: start; - grid-column: 2 / span 1; - grid-row: 2 / span 1; - } + > span:nth-child(3) { + align-self: start; + grid-column: 2 / span 1; + grid-row: 2 / span 1; } } } + .project-profile-user-avatar { + display: inline; + + * { + height: 100%; + width: 100%; + } + } } \ No newline at end of file diff --git a/src/templates/template-captain.pug b/src/templates/template-captain.pug new file mode 100644 index 0000000..d1bec42 --- /dev/null +++ b/src/templates/template-captain.pug @@ -0,0 +1,23 @@ +include hd-user-avatar.pug + +sib-widget(name='captain-template') + template + sib-display.project-profile-user-avatar( + data-src="${value ? value['@id'] : ''}" + fields='account.picture', + widget-account.picture='hd-user-avatar' + ) + div(name='user.thumb') + sib-display( + data-src="${value ? value['@id'] : ''}" + fields='name' + ) + sib-display( + data-src="${value ? value['@id'] : ''}", + fields='name' + nested-field="groups" + ) + sib-display( + data-src="${value ? value['@id'] : ''}" + fields='username' + ) diff --git a/src/templates/template-team.pug b/src/templates/template-team.pug index ac3a2ff..f529ecf 100644 --- a/src/templates/template-team.pug +++ b/src/templates/template-team.pug @@ -2,16 +2,22 @@ include hd-user-avatar.pug sib-widget(name='team-template') template - sib-display( - data-src="${value.user['@id']}" + sib-display.project-profile-user-avatar( + data-src="${value.user ? value.user['@id'] : ''}" fields='account.picture', widget-account.picture='hd-user-avatar' ) div(name='user.thumb') - span ${value.user.name} sib-display( - data-src="${value.user.groups['@id']}", - fields='name', - multiple-name + data-src="${value.user ? value.user['@id'] : ''}" + fields='name' ) - span ${value.name} + sib-display( + data-src="${value.user ? value.user['@id'] : ''}", + fields='name' + nested-field="groups" + ) + sib-display( + data-src="${value.user ? value.user['@id'] : ''}" + fields='username' + )