Browse Source

Prerender action and fixes.

pull/320/head
Sebastian Stehle 8 years ago
parent
commit
24c9d86714
  1. 4
      extensions/Squidex.Extensions/Actions/Prerender/PrerenderAction.cs
  2. 4
      extensions/Squidex.Extensions/Actions/RuleElementRegistry.cs
  3. 1
      src/Squidex/app/features/rules/declarations.ts
  4. 2
      src/Squidex/app/features/rules/module.ts
  5. 29
      src/Squidex/app/features/rules/pages/rules/actions/prerender-action.component.html
  6. 2
      src/Squidex/app/features/rules/pages/rules/actions/prerender-action.component.scss
  7. 37
      src/Squidex/app/features/rules/pages/rules/actions/prerender-action.component.ts
  8. 24
      src/Squidex/app/features/rules/pages/rules/rule-element.component.html
  9. 128
      src/Squidex/app/features/rules/pages/rules/rule-element.component.scss
  10. 7
      src/Squidex/app/features/rules/pages/rules/rule-wizard.component.html
  11. 2
      src/Squidex/app/shell/pages/internal/apps-menu.component.scss
  12. 3
      src/Squidex/tslint.json

4
extensions/Squidex.Extensions/Actions/Prerender/PrerenderAction.cs

@ -12,10 +12,10 @@ namespace Squidex.Extensions.Actions.Prerender
{
[RuleActionHandler(typeof(PrerenderActionHandler))]
[RuleAction(
IconImage = "<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><path d='M2.073 17.984l8.646-5.36v-1.787L.356 17.325v1.318l10.363 6.488v-1.787zM29.927 17.984l-8.646-5.36v-1.787l10.363 6.488v1.318l-10.363 6.488v-1.787zM18.228 6.693l-6.276 19.426 1.656.548 6.276-19.426z'/></svg>",
IconImage = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path d='M2.073 17.984l8.646-5.36v-1.787L.356 17.325v1.318l10.363 6.488v-1.787zM29.927 17.984l-8.646-5.36v-1.787l10.363 6.488v1.318l-10.363 6.488v-1.787zM18.228 6.693l-6.276 19.426 1.656.548 6.276-19.426z'/></svg>",
IconColor = "#2c3e50",
Display = "Recache URL",
Description = "Create a status update at Tweet to a your user account.",
Description = "Recache a certain URL or cache a URL for the first time.",
ReadMore = "https://prerender.io")]
public sealed class PrerenderAction : RuleAction
{

4
extensions/Squidex.Extensions/Actions/RuleElementRegistry.cs

@ -26,7 +26,7 @@ namespace Squidex.Extensions.Actions
IconImage = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'><path d='M21.875 28H6.125A6.087 6.087 0 0 1 0 21.875V6.125A6.087 6.087 0 0 1 6.125 0h15.75A6.087 6.087 0 0 1 28 6.125v15.75A6.088 6.088 0 0 1 21.875 28zM6.125 1.75A4.333 4.333 0 0 0 1.75 6.125v15.75a4.333 4.333 0 0 0 4.375 4.375h15.75a4.333 4.333 0 0 0 4.375-4.375V6.125a4.333 4.333 0 0 0-4.375-4.375H6.125z'/><path d='M13.125 12.25H7.35c-1.575 0-2.888-1.313-2.888-2.888V7.349c0-1.575 1.313-2.888 2.888-2.888h5.775c1.575 0 2.887 1.313 2.887 2.888v2.013c0 1.575-1.312 2.888-2.887 2.888zM7.35 6.212c-.613 0-1.138.525-1.138 1.138v2.012A1.16 1.16 0 0 0 7.35 10.5h5.775a1.16 1.16 0 0 0 1.138-1.138V7.349a1.16 1.16 0 0 0-1.138-1.138H7.35zM22.662 16.713H5.337c-.525 0-.875-.35-.875-.875s.35-.875.875-.875h17.237c.525 0 .875.35.875.875s-.35.875-.787.875zM15.138 21.262h-9.8c-.525 0-.875-.35-.875-.875s.35-.875.875-.875h9.713c.525 0 .875.35.875.875s-.35.875-.787.875z'/></svg>",
IconColor = "#3389ff",
Display = "Content changed",
Description = "Content changed like created, updated, published, unpublished..."
Description = "For content changes like created, updated, published, unpublished..."
},
["AssetChanged"] = new RuleElement
@ -34,7 +34,7 @@ namespace Squidex.Extensions.Actions
IconImage = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'><path d='M21.875 28H6.125A6.087 6.087 0 0 1 0 21.875V6.125A6.087 6.087 0 0 1 6.125 0h15.75A6.087 6.087 0 0 1 28 6.125v15.75A6.088 6.088 0 0 1 21.875 28zM6.125 1.75A4.333 4.333 0 0 0 1.75 6.125v15.75a4.333 4.333 0 0 0 4.375 4.375h15.75a4.333 4.333 0 0 0 4.375-4.375V6.125a4.333 4.333 0 0 0-4.375-4.375H6.125z'/><path d='M21.088 23.537H9.1c-.35 0-.612-.175-.787-.525s-.088-.7.088-.962l8.225-9.713c.175-.175.438-.35.7-.35s.525.175.7.35l5.25 7.525c.088.087.088.175.088.262.438 1.225.087 2.012-.175 2.45-.613.875-1.925.963-2.1.963zm-10.063-1.75h10.15c.175 0 .612-.088.7-.262.088-.088.088-.35 0-.7l-4.55-6.475-6.3 7.438zM9.1 13.737c-2.1 0-3.85-1.75-3.85-3.85S7 6.037 9.1 6.037s3.85 1.75 3.85 3.85-1.663 3.85-3.85 3.85zm0-5.949c-1.138 0-2.1.875-2.1 2.1s.962 2.1 2.1 2.1 2.1-.962 2.1-2.1-.875-2.1-2.1-2.1z'/></svg>",
IconColor = "#3389ff",
Display = "Asset changed",
Description = "Asset changed like created, updated, renamed..."
Description = "For asset changes like uploaded, updated, renamed, deleted..."
}
};

1
src/Squidex/app/features/rules/declarations.ts

@ -11,6 +11,7 @@ export * from './pages/rules/actions/discourse-action.component';
export * from './pages/rules/actions/elastic-search-action.component';
export * from './pages/rules/actions/fastly-action.component';
export * from './pages/rules/actions/medium-action.component';
export * from './pages/rules/actions/prerender-action.component';
export * from './pages/rules/actions/slack-action.component';
export * from './pages/rules/actions/tweet-action.component';
export * from './pages/rules/actions/webhook-action.component';

2
src/Squidex/app/features/rules/module.ts

@ -23,6 +23,7 @@ import {
ElasticSearchActionComponent,
FastlyActionComponent,
MediumActionComponent,
PrerenderActionComponent,
RuleElementComponent,
RuleEventBadgeClassPipe,
RuleEventsPageComponent,
@ -68,6 +69,7 @@ const routes: Routes = [
ElasticSearchActionComponent,
FastlyActionComponent,
MediumActionComponent,
PrerenderActionComponent,
RuleElementComponent,
RuleEventBadgeClassPipe,
RuleEventsPageComponent,

29
src/Squidex/app/features/rules/pages/rules/actions/prerender-action.component.html

@ -0,0 +1,29 @@
<div [formGroup]="actionForm" class="form-horizontal">
<div class="form-group row">
<label class="col col-3 col-form-label" for="token">Token</label>
<div class="col col-9">
<sqx-control-errors for="token" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="text" class="form-control" id="token" formControlName="token" />
<small class="form-text text-muted">
The prerender token from your account.
</small>
</div>
</div>
<div class="form-group row">
<label class="col col-3 col-form-label" for="url">Url</label>
<div class="col col-9">
<sqx-control-errors for="url" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="url" class="form-control" id="url" formControlName="url" />
<small class="form-text text-muted">
The url to recache. Read the <a routerLink="help">help</a> section for information about advanced formatting.
</small>
</div>
</div>
</div>

2
src/Squidex/app/features/rules/pages/rules/actions/prerender-action.component.scss

@ -0,0 +1,2 @@
@import '_vars';
@import '_mixins';

37
src/Squidex/app/features/rules/pages/rules/actions/prerender-action.component.ts

@ -0,0 +1,37 @@
/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { Component, Input, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
@Component({
selector: 'sqx-prerender-action',
styleUrls: ['./prerender-action.component.scss'],
templateUrl: './prerender-action.component.html'
})
export class PrerenderActionComponent implements OnInit {
@Input()
public action: any;
@Input()
public actionForm: FormGroup;
@Input()
public actionFormSubmitted = false;
public ngOnInit() {
this.actionForm.setControl('token',
new FormControl(this.action.token || '', [
Validators.required
]));
this.actionForm.setControl('url',
new FormControl(this.action.url || '', [
Validators.required
]));
}
}

24
src/Squidex/app/features/rules/pages/rules/rule-element.component.html

@ -1,28 +1,30 @@
<ng-container *ngIf="isSmall; else large">
<div class="rule-element-small" *ngIf="element" [style.background]="element.iconColor" [sqxHoverBackground]="element.iconColor | sqxDarken:5">
<span class="rule-element-small-icon" [style.background]="element.iconColor | sqxDarken:5">
<div class="row no-gutters align-items-center small" *ngIf="element" [style.background]="element.iconColor" [sqxHoverBackground]="element.iconColor | sqxDarken:5">
<div class="col col-auto small-icon" [style.background]="element.iconColor | sqxDarken:5">
<i class="svg-icon" [innerHtml]="element.iconImage | sqxSafeHtml"></i>
</span>
<span class="rule-element-small-text">
{{element.display}}
</span>
</div>
<div class="col align-items-center">
<div class="small-text">
{{element.display}}
</div>
</div>
</div>
</ng-container>
<ng-template #large>
<div class="row no-gutters rule-element-large">
<div class="row no-gutters large">
<div class="col col-auto">
<div class="rule-element-large-icon" [style.background]="element.iconColor | sqxDarken:5">
<div class="large-icon" [style.background]="element.iconColor | sqxDarken:5">
<div class="svg-icon" [innerHtml]="element.iconImage | sqxSafeHtml"></div>
</div>
</div>
<div class="col">
<div class="rule-element-large-title">{{type}}</div>
<div class="large-title">{{type}}</div>
<div class="rule-element-large-text text-muted">
<div class="large-text text-muted">
{{element.description}}
</div>
<div class="rule-element-large-link" *ngIf="element.readMore">
<div class="large-link" *ngIf="element.readMore">
<a [href]="element.readMore" target="_blank">Read More</a>
</div>
</div>

128
src/Squidex/app/features/rules/pages/rules/rule-element.component.scss

@ -1,78 +1,78 @@
@import '_vars';
@import '_mixins';
.rule-element {
&-small {
& {
@include truncate;
@include transition(background-color .4s ease);
color: $color-dark-foreground;
cursor: pointer;
line-height: 2.8rem;
font-size: 1rem;
font-weight: normal;
padding-right: .8rem;
}
.small {
& {
@include transition(background-color .4s ease);
cursor: pointer;
}
&-icon {
height: 3rem;
display: inline-block;
line-height: 3rem;
font-size: 1.2rem;
font-weight: normal;
margin: 0;
margin-right: .5rem;
padding: 0 .8rem;
}
&-text {
@include truncate;
color: $color-dark-foreground;
line-height: 3rem;
font-size: 1rem;
font-weight: normal;
padding: 0 .8rem;
}
.svg-icon {
display: inline-block;
min-width: 20px;
max-width: 20px;
min-height: 20px;
max-height: 20px;
fill: $color-dark-foreground;
}
&-icon {
line-height: 3.2rem;
font-size: 1.2rem;
font-weight: normal;
padding: 0 .8rem;
}
&-large {
& {
cursor: pointer;
min-height: 100px;
max-height: 100px;
}
.col {
height: 3rem;
}
&-link {
font-size: .8rem;
}
.svg-icon {
width: 20px;
}
}
&-title {
font-weight: bold;
font-size: 1rem;
line-height: 1;
}
.large {
& {
cursor: pointer;
min-height: 100px;
max-height: 100px;
}
&-text {
font-size: .8rem;
margin-top: .25rem;
margin-bottom: .25rem;
}
&-link {
font-size: .8rem;
}
&-icon {
display: inline-block;
margin-right: .5rem;
position: relative;
padding: 1rem;
line-height: 1px;
}
&-title {
font-weight: bold;
font-size: 1rem;
line-height: 1;
}
.svg-icon {
display: inline-block;
min-width: 30px;
max-width: 30px;
min-height: 30px;
max-height: 30px;
fill: $color-dark-foreground;
}
&-text {
font-size: .8rem;
margin-top: .25rem;
margin-bottom: .25rem;
}
&-icon {
display: inline-block;
margin-right: .5rem;
position: relative;
padding: 1rem;
line-height: 1px;
}
.svg-icon {
width: 30px;
}
}
.svg-icon {
display: inline-block;
}
/deep/ svg {
fill: $color-dark-foreground;
display: block;
}

7
src/Squidex/app/features/rules/pages/rules/rule-wizard.component.html

@ -108,6 +108,13 @@
[actionFormSubmitted]="actionForm.submitted | async">
</sqx-medium-action>
</ng-container>
<ng-container *ngSwitchCase="'Prerender'">
<sqx-prerender-action
[action]="action"
[actionForm]="actionForm.form"
[actionFormSubmitted]="actionForm.submitted | async">
</sqx-prerender-action>
</ng-container>
<ng-container *ngSwitchCase="'Slack'">
<sqx-slack-action
[action]="action"

2
src/Squidex/app/shell/pages/internal/apps-menu.component.scss

@ -37,7 +37,7 @@ $color-apps-border: #65a6ff;
}
}
.drodown-button {
.dropdown-button {
padding: 1rem 1.5rem;
}

3
src/Squidex/tslint.json

@ -87,9 +87,8 @@
"ordered-imports": [
true
],
"pipe-naming": [
"pipe-prefix": [
true,
"camelCase",
"sqx"
],
"prefer-for-of": true,

Loading…
Cancel
Save