Skip to content

Commit

Permalink
feat(edit-contentlet): Implement new design in the edit content scree…
Browse files Browse the repository at this point in the history
…n sidebar #27908 (#28175)

* styles: update content sidebar style v1

* chore: code cleanup

* chore: update placeholders with real data

* chore: apply i18n

* dev: show right tooltips

* dev: i18n and lazyload for workflow status

* refactor

* test v1

* fix tests

* test DotContentAsideWorkflow Component

* feat: add loading state

* fix tests

* chore: code cleanup

* feedback

* Style: improve  message in

* chore: code cleanup
  • Loading branch information
rjvelazco authored Apr 22, 2024
1 parent 3888ce3 commit 78b1866
Show file tree
Hide file tree
Showing 37 changed files with 1,065 additions and 286 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ export class DotRouterService {
this.router.navigate([`/c/content/new/${variableName}`]);
}

/**
* Redirect to edit the content type
*
* @param {string} id
* @param {string} portlet
* @memberof DotRouterService
*/
goToEditContentType(id: string, portlet: string): void {
this.router.navigate([`/${portlet}/edit/${id}`]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ export class DotWorkflowService {
);
}

/**
* Get the Workflow Schema for a ContentType given its inode
*
* @param {string} contentTypeId
* @return {*}
* @memberof DotWorkflowService
*/
getSchemaContentType(contentTypeId: string): Observable<{
contentTypeSchemes: DotCMSWorkflow[];
schemes: DotCMSWorkflow[];
}> {
return this.httpClient
.get(`${this.WORKFLOW_URL}/schemes/schemescontenttypes/${contentTypeId}`)
.pipe(pluck('entity'));
}

/**
* Get the current workflow status for Contentlet given its inode
*
Expand Down
1 change: 1 addition & 0 deletions core-web/libs/dotcms-scss/angular/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ $info: $color-palette-secondary;
$field-tiny-height: 28px;
$field-disabled-opacity: 0.38;
$line-height: 1.5em;
$line-height-relative: 140%;

// ICONS
$md-icon-size-normal: 18px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ p-chip .p-chip {
color: $color-accessible-text-fuchsia;
}

&.p-chip-blue {
background-color: $color-accessible-text-blue-bg;
color: $color-accessible-text-blue;
}

&.p-chip-sm {
gap: $spacing-0;
padding: 0 $spacing-1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@use "variables" as *;

.p-skeleton {
background-color: $color-palette-gray-100;
background-color: $color-palette-gray-300;
border-radius: 3px;
}
.p-skeleton:after {
background: linear-gradient(90deg, $white, $color-palette-white-op-40, $white);
background: linear-gradient(90deg, $white, $color-palette-white-op-60, $white);
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
@use "variables" as *;

.p-tooltip .p-tooltip-text {
background: $color-palette-gray-900;
color: $white;
padding: $spacing-2 $spacing-3;
font-size: 1rem;
box-shadow: none;
border-radius: $border-radius-xs;
background: $white;
box-shadow: $shadow-m;
padding: $spacing-1 $spacing-3;
font-size: $font-size-sm;
line-height: 140%;
border-radius: $border-radius-md;
}

.p-tooltip.p-tooltip-right .p-tooltip-arrow {
border-right-color: $color-palette-gray-900;
border-right-color: $white;
}
.p-tooltip.p-tooltip-left .p-tooltip-arrow {
border-left-color: $color-palette-gray-900;
border-left-color: $white;
}
.p-tooltip.p-tooltip-top .p-tooltip-arrow {
border-top-color: $color-palette-gray-900;
border-top-color: $white;
}
.p-tooltip.p-tooltip-bottom .p-tooltip-arrow {
border-bottom-color: $color-palette-gray-900;
border-bottom-color: $white;
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}

.p-message {
margin: $spacing-2 0;
margin: 0;
border-radius: $border-radius-xs;
}
.p-message .p-message-wrapper {
Expand Down Expand Up @@ -86,17 +86,31 @@
color: #01579b;
}
.p-message.p-message-success {
background: #c8e6c9;
background: rgba(245, 253, 248, 1);
border: solid transparent;
border-width: 0 0 0 0;
color: #1b5e20;
color: $black;

.pi {
color: rgba(62, 217, 122, 1);
}
}
.p-message.p-message-success {
border: solid rgba(62, 217, 122, 1);
border-width: 0 0 0 0;
}
.p-message.p-message-success .p-message-icon {
color: #1b5e20;
color: rgba(62, 217, 122, 1);
}
.p-message.p-message-success .p-message-close {
color: #1b5e20;
color: rgba(62, 217, 122, 1);
}
.p-messages.p-message-border-y:has(.p-message.p-message-success) {
border: 0 solid rgba(62, 217, 122, 1);
border-top-width: 1px;
border-bottom-width: 1px;
}

.p-message.p-message-warn {
background: #ffecb3;
border: solid transparent;
Expand Down
2 changes: 2 additions & 0 deletions core-web/libs/dotcms-scss/shared/_fonts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ $font-size-xxxl: 3rem; // 48px
$font-size-xxl: 1.75rem; // 28px
$font-size-xl: 1.5rem; // 24px
$font-size-lg: 1.25rem; // 20px
$font-size-lmd: 1.125rem; // 18px
$font-size-md: $font-size-default; // 16px
$font-size-smd: 0.875rem; // 14px
$font-size-sm: 0.813rem; // 13px
Expand All @@ -24,4 +25,5 @@ $font-size-xs: 0.625rem; // 10px

$font-weight-regular-bold: 400;
$font-weight-semi-bold: 500;
$font-weight-medium-bold: 600;
$font-weight-bold: 700;
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<div class="content-aside__information">
<div class="content-aside__status">
<p-chip
*ngIf="contentlet | contentletStatus as status"
[styleClass]="'p-chip-sm ' + status.classes"
[label]="status.label" />
<dot-copy-button
*ngIf="contentlet?.inode as inode"
[copy]="inode"
[tooltipText]="'ID: ' + inode"
[label]="'ID: ' + (inode | slice : -10)"
data-testId="inode"
aria-label="Copy ID" />
</div>
<div class="content-aside__metadata">
<div
class="sidebar-card"
[routerLink]="'/content-types-angular/edit/' + contentTypeName"
data-testId="content-type-link">
<div class="sidebar-card__header">
<span>{{ 'Content-Type' | dm }}</span>
</div>
<label class="sidebar-card__label">{{ contentTypeName }}</label>
</div>
<div class="sidebar-card" data-testId="references-button">
<div class="sidebar-card__header">
<span>{{ 'References' | dm }}</span>
<i class="pi pi-eye"></i>
</div>
</div>
<div class="content-history__container" data-testId="history-container">
@if(loading) { @for(title of ['Published','Modified','Created'] ; track $index) {
<div class="content-history">
<label class="content-history__title">{{ title | dm }}</label>
<p-skeleton class="content-history__author" width="89.33px" height="14px" />
<p-skeleton class="content-history__date" width="89.33px" height="14px" />
</div>
} } @else { @if(contentlet?.publishDate) {
<div
class="content-history"
[pTooltip]="contentlet?.publishDate | date : 'MMM dd, yyyy'"
tooltipPosition="bottom"
data-testId="publish-history">
<label class="content-history__title">{{ 'Published' | dm }}</label>
<label class="content-history__author" *ngIf="contentlet?.publishUserName">{{
contentlet?.publishUserName
}}</label>
<label class="content-history__date">{{
contentlet?.publishDate | dotRelativeDate : 'MM/dd/yyyy' : null
}}</label>
</div>
} @if(contentlet?.modDate) {
<div
class="content-history"
[pTooltip]="contentlet?.modDate | date : 'MMM dd, yyyy'"
tooltipPosition="bottom"
data-testId="mod-history">
<label class="content-history__title">{{ 'Modified' | dm }}</label>
<label class="content-history__author">{{ contentlet?.modUserName }}</label>
<label class="content-history__date">{{
contentlet?.modDate | dotRelativeDate : 'MM/dd/yyyy' : null
}}</label>
</div>
}
<div
class="content-history"
[pTooltip]="contentlet?.createDate | date : 'MMM dd, yyyy'"
tooltipPosition="bottom"
data-testId="create-history">
<label class="content-history__title">{{ 'Created' | dm }}</label>
<label class="content-history__author">{{ contentlet?.ownerName || 'You' }}</label>
<label class="content-history__date">{{
contentlet?.createDate | dotRelativeDate : 'MM/dd/yyyy' : null
}}</label>
</div>
}
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
@use "variables" as *;
@import "mixins";

.content-aside__information {
display: flex;
padding: $spacing-3;
flex-direction: column;
justify-content: center;
align-items: flex-start;
gap: $spacing-1;

.content-aside__status {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
}

.content-aside__metadata {
display: flex;
flex-direction: column;
justify-content: center;
gap: $spacing-1;
width: 100%;

.sidebar-card {
display: flex;
flex-direction: column;
background: $white;
padding: $spacing-1;
border-radius: $border-radius-lg;
gap: $spacing-0;

&,
label {
user-select: none;
cursor: pointer;
}

&:hover {
background: $color-palette-primary-100;
}
}

.sidebar-card__header {
display: flex;
justify-content: space-between;
color: $black;
font-size: $font-size-smd;
font-weight: $font-weight-medium-bold;
line-height: $line-height-relative;

i {
color: $color-palette-primary-500;
}
}

.sidebar-card__label {
color: $color-palette-gray-800;
font-size: $font-size-smd;
font-weight: $font-weight-regular-bold;
line-height: $line-height-relative;
}
}

.content-history__container {
display: flex;
align-items: center;
flex: 1 0 0;
align-self: stretch;
border-radius: $border-radius-lg;
background: $white;

.content-history {
display: flex;
height: 100%;
padding: $spacing-1;
flex-direction: column;
align-items: flex-start;
gap: $spacing-0;
flex: 1 0 0;
position: relative;
user-select: none;
min-height: 5rem;
@include truncate-text;

&,
& > * {
cursor: pointer;
}

&:hover {
background: $color-palette-primary-100;
}

label {
width: 100%;
}

&:not(:first-child)::before {
content: "";
position: absolute;
height: 39px;
border-left: 1px solid $color-palette-gray-300;
left: 0;
top: 0;
bottom: 0;
margin: auto;
}
}

.content-history__title {
color: $black;
font-size: $font-size-smd;
font-weight: $font-weight-medium-bold;
line-height: $line-height-relative;
}

.content-history__author {
color: $color-palette-gray-800;
font-size: $font-size-smd;
font-weight: $font-weight-regular-bold;
line-height: $line-height-relative;
}

.content-history__date {
color: $color-palette-gray-700;
font-size: $font-size-xsm;
font-weight: $font-weight-regular-bold;
line-height: $line-height-relative;
}
}
Loading

0 comments on commit 78b1866

Please sign in to comment.