matrix-dimension/web/app/configs/widget/custom/custom.widget.component.html

59 lines
2.5 KiB
HTML
Raw Normal View History

2017-12-23 04:52:24 +00:00
<ng-template #widgetParams let-widget="widget">
<label class="label-block">
Widget Name
<input type="text" class="form-control"
placeholder="{{ defaultName }}"
[(ngModel)]="widget.dimension.newName" name="widget-name-{{widget.id}}"
[disabled]="isUpdating"/>
</label>
<label class="label-block">
Widget URL
<input type="text" class="form-control"
placeholder="https://matrix.org"
[(ngModel)]="widget.dimension.newUrl" name="widget-url-{{widget.id}}"
[disabled]="isUpdating"/>
</label>
</ng-template>
2017-12-23 04:54:00 +00:00
<!-- Annoyingly, this has to be copy/pasted to all the integration configs -->
<div *ngIf="isLoading">
<my-spinner></my-spinner>
</div>
2017-12-23 04:42:43 +00:00
<div *ngIf="!isLoading">
2017-12-23 06:19:30 +00:00
<my-ibox [isCollapsible]="true" [defaultCollapsed]="defaultExpandedWidgetId">
<h5 class="my-ibox-title">
<i class="far fa-plus-square"></i> Add {{ defaultName }}
</h5>
2017-12-23 04:42:43 +00:00
<div class="my-ibox-content">
<form (submit)="addWidget()" novalidate name="addForm">
2017-12-23 04:52:24 +00:00
<ng-container *ngTemplateOutlet="widgetParams;context:{widget:newWidget}"></ng-container>
2017-12-23 04:33:37 +00:00
2017-12-23 04:52:24 +00:00
<div style="margin-top: 25px">
<button type="submit" class="btn btn-sm btn-success" [disabled]="isUpdating">
<i class="fa fa-plus"></i> Add Widget
</button>
</div>
2017-12-23 04:42:43 +00:00
</form>
</div>
</my-ibox>
2017-12-23 04:33:37 +00:00
2017-12-23 06:19:30 +00:00
<my-ibox *ngFor="let widget of widgets trackById" [isCollapsible]="true" [defaultCollapsed]="widget.id !== defaultExpandedWidgetId">
<h5 class="my-ibox-title">
<i class="far fa-edit"></i> {{ widget.name || widget.url || defaultName }}
</h5>
2017-12-23 04:42:43 +00:00
<div class="my-ibox-content">
2017-12-23 04:54:00 +00:00
<form (submit)="saveWidget(widget)" novalidate name="editForm">
2017-12-23 04:52:24 +00:00
<ng-container *ngTemplateOutlet="widgetParams;context:{widget:widget}"></ng-container>
2017-12-23 04:42:43 +00:00
2017-12-23 04:52:24 +00:00
<div style="margin-top: 25px">
<button type="submit" class="btn btn-sm btn-primary" [disabled]="isUpdating">
2017-12-23 06:19:30 +00:00
<i class="far fa-save"></i> Save Widget
2017-12-23 04:52:24 +00:00
</button>
2017-12-23 04:54:00 +00:00
<button type="button" class="btn btn-sm btn-danger" [disabled]="isUpdating" (click)="removeWidget(widget)">
2017-12-23 06:19:30 +00:00
<i class="far fa-trash-alt"></i> Remove Widget
2017-12-23 04:52:24 +00:00
</button>
</div>
2017-12-23 04:42:43 +00:00
</form>
</div>
</my-ibox>
</div>