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

55 lines
2.4 KiB
HTML
Raw Normal View History

2017-12-22 23:52:24 -05: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-22 23:54:00 -05:00
<!-- Annoyingly, this has to be copy/pasted to all the integration configs -->
<div *ngIf="isLoading">
<my-spinner></my-spinner>
</div>
2017-12-22 23:42:43 -05:00
<div *ngIf="!isLoading">
<my-ibox title="Add {{ defaultName }}" [isCollapsible]="true" [defaultCollapsed]="defaultExpandedWidgetId">
<div class="my-ibox-content">
<form (submit)="addWidget()" novalidate name="addForm">
2017-12-22 23:52:24 -05:00
<ng-container *ngTemplateOutlet="widgetParams;context:{widget:newWidget}"></ng-container>
2017-12-22 23:33:37 -05:00
2017-12-22 23:52:24 -05: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-22 23:42:43 -05:00
</form>
</div>
</my-ibox>
2017-12-22 23:33:37 -05:00
2017-12-22 23:42:43 -05:00
<my-ibox *ngFor="let widget of widgets trackById"
[isCollapsible]="true" [defaultCollapsed]="widget.id !== defaultExpandedWidgetId"
title="{{ widget.name || widget.url || defaultName }}">
<div class="my-ibox-content">
2017-12-22 23:54:00 -05:00
<form (submit)="saveWidget(widget)" novalidate name="editForm">
2017-12-22 23:52:24 -05:00
<ng-container *ngTemplateOutlet="widgetParams;context:{widget:widget}"></ng-container>
2017-12-22 23:42:43 -05:00
2017-12-22 23:52:24 -05:00
<div style="margin-top: 25px">
<button type="submit" class="btn btn-sm btn-primary" [disabled]="isUpdating">
<i class="fa fa-save"></i> Save Widget
</button>
2017-12-22 23:54:00 -05:00
<button type="button" class="btn btn-sm btn-danger" [disabled]="isUpdating" (click)="removeWidget(widget)">
2017-12-22 23:52:24 -05:00
<i class="fa fa-times"></i> Remove Widget
</button>
</div>
2017-12-22 23:42:43 -05:00
</form>
</div>
</my-ibox>
</div>