Browse Source

Style improvements.

pull/445/head
Sebastian 6 years ago
parent
commit
fd388a9400
  1. 4
      backend/src/Squidex.Domain.Apps.Core.Model/Contents/NoUpdate.cs
  2. 6
      backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowCondition.cs
  3. 4
      backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowStep.cs
  4. 4
      backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowTransition.cs
  5. 2
      backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowDto.cs
  6. 11
      backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowStepDto.cs
  7. 9
      backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowTransitionDto.cs
  8. 2
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DynamicContentWorkflowTests.cs
  9. 16
      frontend/app/features/settings/pages/workflows/workflow-step.component.html
  10. 44
      frontend/app/features/settings/pages/workflows/workflow-step.component.scss
  11. 7
      frontend/app/features/settings/pages/workflows/workflow-transition.component.html

4
backend/src/Squidex.Domain.Apps.Core.Model/Contents/NoUpdate.cs

@ -11,12 +11,12 @@ namespace Squidex.Domain.Apps.Core.Contents
{ {
public static readonly NoUpdate Always = new NoUpdate(null, null); public static readonly NoUpdate Always = new NoUpdate(null, null);
public NoUpdate(string expression, params string[] roles) public NoUpdate(string? expression, params string[]? roles)
: base(expression, roles) : base(expression, roles)
{ {
} }
public static NoUpdate When(string expression, params string[] roles) public static NoUpdate When(string? expression, params string[]? roles)
{ {
return new NoUpdate(expression, roles); return new NoUpdate(expression, roles);
} }

6
backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowCondition.cs

@ -12,11 +12,11 @@ namespace Squidex.Domain.Apps.Core.Contents
{ {
public abstract class WorkflowCondition public abstract class WorkflowCondition
{ {
public string Expression { get; } public string? Expression { get; }
public ReadOnlyCollection<string> Roles { get; } public ReadOnlyCollection<string>? Roles { get; }
protected WorkflowCondition(string expression, params string[] roles) protected WorkflowCondition(string? expression, params string[]? roles)
{ {
Expression = expression; Expression = expression;

4
backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowStep.cs

@ -15,9 +15,9 @@ namespace Squidex.Domain.Apps.Core.Contents
public IReadOnlyDictionary<Status, WorkflowTransition> Transitions { get; } public IReadOnlyDictionary<Status, WorkflowTransition> Transitions { get; }
public string Color { get; } public string? Color { get; }
public NoUpdate NoUpdate { get; } public NoUpdate? NoUpdate { get; }
public WorkflowStep(IReadOnlyDictionary<Status, WorkflowTransition>? transitions = null, string? color = null, NoUpdate? noUpdate = null) public WorkflowStep(IReadOnlyDictionary<Status, WorkflowTransition>? transitions = null, string? color = null, NoUpdate? noUpdate = null)
{ {

4
backend/src/Squidex.Domain.Apps.Core.Model/Contents/WorkflowTransition.cs

@ -11,12 +11,12 @@ namespace Squidex.Domain.Apps.Core.Contents
{ {
public static readonly WorkflowTransition Always = new WorkflowTransition(null, null); public static readonly WorkflowTransition Always = new WorkflowTransition(null, null);
public WorkflowTransition(string expression, params string[] roles) public WorkflowTransition(string? expression, params string[]? roles)
: base(expression, roles) : base(expression, roles)
{ {
} }
public static WorkflowTransition When(string expression, params string[] roles) public static WorkflowTransition When(string? expression, params string[]? roles)
{ {
return new WorkflowTransition(expression, roles); return new WorkflowTransition(expression, roles);
} }

2
backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowDto.cs

@ -50,7 +50,7 @@ namespace Squidex.Areas.Api.Controllers.Apps.Models
{ {
Steps = workflow.Steps.ToDictionary( Steps = workflow.Steps.ToDictionary(
x => x.Key, x => x.Key,
x => WorkflowStepDto.FromWorkflowStep(x.Value)!), x => WorkflowStepDto.FromWorkflowStep(x.Value)),
Id = id Id = id
}); });

11
backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowStepDto.cs

@ -35,20 +35,15 @@ namespace Squidex.Areas.Api.Controllers.Apps.Models
/// <summary> /// <summary>
/// Optional expression that must evaluate to true when you want to prevent updates. /// Optional expression that must evaluate to true when you want to prevent updates.
/// </summary> /// </summary>
public string NoUpdateExpression { get; set; } public string? NoUpdateExpression { get; set; }
/// <summary> /// <summary>
/// Optional list of roles to restrict the updates for users with these roles. /// Optional list of roles to restrict the updates for users with these roles.
/// </summary> /// </summary>
public string[] NoUpdateRoles { get; set; } public string[]? NoUpdateRoles { get; set; }
public static WorkflowStepDto? FromWorkflowStep(WorkflowStep step) public static WorkflowStepDto FromWorkflowStep(WorkflowStep step)
{ {
if (step == null)
{
return null;
}
var response = SimpleMapper.Map(step, new WorkflowStepDto var response = SimpleMapper.Map(step, new WorkflowStepDto
{ {
Transitions = step.Transitions.ToDictionary( Transitions = step.Transitions.ToDictionary(

9
backend/src/Squidex/Areas/Api/Controllers/Apps/Models/WorkflowTransitionDto.cs

@ -15,20 +15,15 @@ namespace Squidex.Areas.Api.Controllers.Apps.Models
/// <summary> /// <summary>
/// The optional expression. /// The optional expression.
/// </summary> /// </summary>
public string Expression { get; set; } public string? Expression { get; set; }
/// <summary> /// <summary>
/// The optional restricted role. /// The optional restricted role.
/// </summary> /// </summary>
public string[] Roles { get; set; } public string[]? Roles { get; set; }
public static WorkflowTransitionDto FromWorkflowTransition(WorkflowTransition transition) public static WorkflowTransitionDto FromWorkflowTransition(WorkflowTransition transition)
{ {
if (transition == null)
{
return null;
}
return new WorkflowTransitionDto { Expression = transition.Expression, Roles = transition.Roles?.ToArray() }; return new WorkflowTransitionDto { Expression = transition.Expression, Roles = transition.Roles?.ToArray() };
} }

2
backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/DynamicContentWorkflowTests.cs

@ -317,7 +317,7 @@ namespace Squidex.Domain.Apps.Entities.Contents
new StatusInfo(Status.Draft, StatusColors.Draft) new StatusInfo(Status.Draft, StatusColors.Draft)
}; };
var result = await sut.GetNextsAsync(content, null); var result = await sut.GetNextsAsync(content, null!);
result.Should().BeEquivalentTo(expected); result.Should().BeEquivalentTo(expected);
} }

16
frontend/app/features/settings/pages/workflows/workflow-step.component.html

@ -45,7 +45,7 @@
</sqx-workflow-transition> </sqx-workflow-transition>
<div class="row transition no-gutters" *ngIf="openSteps.length > 0 && !disabled"> <div class="row transition no-gutters" *ngIf="openSteps.length > 0 && !disabled">
<div class="col-auto"> <div class="col col-arrow">
<i class="icon-corner-down-right text-decent"></i> <i class="icon-corner-down-right text-decent"></i>
</div> </div>
<div class="col col-step"> <div class="col col-step">
@ -62,9 +62,10 @@
</div> </div>
</div> </div>
<div class="row transition-prevent-updates no-guttersw"> <div class="row transition-prevent-updates no-gutters">
<div class="col col-step" style="max-width: 12rem"> <div class="col col-arrow"></div>
<div class="form-check"> <div class="col col-step">
<div class="form-check float-right">
<input class="form-check-input transition-prevent-updates-checkbox" type="checkbox" id="preventUpdates_{{step.name}}" <input class="form-check-input transition-prevent-updates-checkbox" type="checkbox" id="preventUpdates_{{step.name}}"
[disabled]="disabled" [disabled]="disabled"
[ngModel]="step.noUpdate" [ngModel]="step.noUpdate"
@ -90,8 +91,7 @@
<div class="col-auto col-label"> <div class="col-auto col-label">
<span class="text-decent">for</span> <span class="text-decent">for</span>
</div> </div>
<div class="col col-roles">
<div class="col col-step-role">
<sqx-tag-editor [allowDuplicates]="false" <sqx-tag-editor [allowDuplicates]="false"
[dashed]="true" [dashed]="true"
[disabled]="disabled" [disabled]="disabled"
@ -103,10 +103,8 @@
placeholder="Role"> placeholder="Role">
</sqx-tag-editor> </sqx-tag-editor>
</div> </div>
<div class="col col-button"></div>
</ng-container> </ng-container>
</div> </div>
</div> </div>
<div class="col-auto col-div-line">
<hr class="col-line"/>
</div>
</div> </div>

44
frontend/app/features/settings/pages/workflows/workflow-step.component.scss

@ -16,10 +16,24 @@
padding: 0 .5rem; padding: 0 .5rem;
} }
.col-arrow {
min-width: 2rem;
max-width: 2rem;
}
.col-button {
min-width: 3rem;
max-width: 3rem;
}
.col-step { .col-step {
min-width: 10rem; min-width: 10rem;
max-width: 10rem; max-width: 10rem;
padding-left: .5rem; }
.col-roles {
min-width: 18rem;
max-width: 18rem;
} }
.transition { .transition {
@ -40,6 +54,7 @@
.step { .step {
& { & {
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
border-bottom: 1px solid $color-border;
} }
&-inner { &-inner {
@ -74,21 +89,10 @@
} }
} }
.col-step-role {
width: 56px;
padding-left: 0rem;
padding-right: 4rem;
}
.col-step-expression {
padding-left: 0;
padding-right: 0
}
.transition-prevent-updates { .transition-prevent-updates {
& { & {
margin-top: .25rem; margin-top: .25rem;
margin-bottom: .5rem; margin-bottom: 1rem;
line-height: 2.5rem; line-height: 2.5rem;
} }
@ -99,18 +103,6 @@
} }
} }
.col-line {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #e1e4e8;
margin: 1em 0;
}
.col-div-line {
padding-top: 0.5rem
}
.transition-prevent-updates-checkbox { .transition-prevent-updates-checkbox {
margin-top: 0.8rem; margin-top: .8rem;
} }

7
frontend/app/features/settings/pages/workflows/workflow-transition.component.html

@ -1,5 +1,5 @@
<div class="row transition no-gutters"> <div class="row transition no-gutters">
<div class="col-auto"> <div class="col col-arrow">
<i class="icon-corner-down-right text-decent"></i> <i class="icon-corner-down-right text-decent"></i>
</div> </div>
<div class="col col-step"> <div class="col col-step">
@ -21,8 +21,7 @@
<div class="col-auto col-label"> <div class="col-auto col-label">
<span class="text-decent">for</span> <span class="text-decent">for</span>
</div> </div>
<div class="col col-roles">
<div class="col" style="width: 70px">
<sqx-tag-editor <sqx-tag-editor
[allowDuplicates]="false" [allowDuplicates]="false"
[dashed]="true" [dashed]="true"
@ -36,7 +35,7 @@
</sqx-tag-editor> </sqx-tag-editor>
</div> </div>
<div class="col-auto pl-2"> <div class="col col-button pl-2">
<button type="button" class="btn btn-text-danger" (click)="emitRemove()" [disabled]="disabled"> <button type="button" class="btn btn-text-danger" (click)="emitRemove()" [disabled]="disabled">
<i class="icon-bin2"></i> <i class="icon-bin2"></i>
</button> </button>

Loading…
Cancel
Save