-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#375 Refine the case templates section to allow setting default value…
…s to custom fields
- Loading branch information
Showing
8 changed files
with
86 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.metric-item { | ||
.metric-item, | ||
.customfield-item { | ||
background-color: #f9f9f9; | ||
padding: 10px; | ||
margin-bottom: 5px; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 41 additions & 37 deletions
78
ui/app/views/partials/admin/case-template/custom-fields.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,46 @@ | ||
<h4 class="vpad10 text-primary"> | ||
Custom fields ({{$vm.keys($vm.template.customFields).length}}) | ||
<span uib-dropdown class="pull-right"> | ||
<a href class="dropdown-toggle" uib-dropdown-toggle> | ||
<i class="fa fa-plus"></i> | ||
Add custom field | ||
<span class="caret"></span> | ||
</a> | ||
<ul class="dropdown-menu" uib-dropdown-menu> | ||
<li ng-repeat="(key, value) in $vm.fields"> | ||
<a ng-click="$vm.addCustomField(value)">{{value.name}}</a> | ||
</li> | ||
</ul> | ||
</span> | ||
</h4> | ||
<div class="case-template-section"> | ||
<h4 class="vpad10 text-primary"> | ||
Custom fields ({{$vm.keys($vm.template.customFields).length}}) | ||
</h4> | ||
|
||
<div ng-if="$vm.templateCustomFields.length !== 0" ng-init="isCollapsed=true" ui-sortable="$vm.sortableFields" ng-model="$vm.templateCustomFields"> | ||
<div class="panel panel-default" ng-repeat="m in $vm.templateCustomFields" ng-init="description=fields[m].description"> | ||
<div class="panel-heading"> | ||
<span class="drag-handle text-primary clickable mr-xxs"> | ||
<i class="fa fa-bars"></i> | ||
</span> | ||
<a href ng-click="isCollapsed=!isCollapsed"> | ||
<i class="fa" ng-class="{'fa-caret-down': isCollapsed, 'fa-caret-up': !isCollapsed}"></i> | ||
</a> | ||
<span class="hpad5">{{$vm.fields[m].name}}</span> | ||
<span class="pull-right"> | ||
<a class="text-danger" href ng-click="$vm.removeCustomField(m)"> | ||
<i class="fa fa-times"></i> Delete</a> | ||
</span> | ||
<div class="empty-message" ng-if="$vm.templateCustomFields.length === 0"> | ||
No custom fields have been added. <a href class="mr-xxxs" ng-click="$vm.addCustomFieldRow()">Add a custom field</a> | ||
</div> | ||
|
||
<div ng-if="$vm.templateCustomFields.length !== 0" ui-sortable="$vm.sortableFields" ng-model="$vm.templateCustomFields"> | ||
<div class="customfield-item" ng-repeat="cf in $vm.templateCustomFields"> | ||
<div class="row"> | ||
<div class="col-sm-12"> | ||
<span class="drag-handle text-primary clickable mr-xxs"> | ||
<i class="fa fa-bars"></i> | ||
</span> | ||
<a href ng-click="$vm.removeCustomField(cf)"><span class="pull-right text-danger"><i class="fa fa-trash"></i> Delete</span></a> | ||
</div> | ||
<div class="col-sm-6"> | ||
<select class="form-control" ng-model="cf.name" ng-options="item.reference as item.name for (key, item) in $vm.fields" required></select> | ||
</div> | ||
<div class="col-sm-6" ng-if="$vm.fields[cf.name].options.length > 0"> | ||
<select class="form-control" ng-model="cf.value" ng-options="v for v in $vm.fields[cf.name].options"> | ||
<option value=""></option> | ||
</select> | ||
</div> | ||
<div class="col-sm-6" ng-if="$vm.fields[cf.name].options.length === 0" ng-switch="$vm.fields[cf.name].type"> | ||
<input ng-switch-when="string" type="text" class="form-control" ng-model="cf.value"> | ||
<input ng-switch-when="number" type="number" class="form-control" ng-model="cf.value"> | ||
<select ng-switch-when="boolean" class="form-control" ng-model="cf.value" ng-options="v for v in [true, false]"> | ||
<option value=""></option> | ||
</select> | ||
<dt-picker ng-switch-when="date" date="cf.value"></dt-picker> | ||
</div> | ||
<div class="col-sm-12"> | ||
<i class="pl-xxss fa fa-question-circle" aria-hidden="true"></i> <small>{{$vm.fields[cf.name].description || 'No description'}}</small> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="panel-body" ng-hide="isCollapsed"> | ||
<p ng-show="description != ''">{{description}}</p> | ||
<p class="text-warning" ng-show="!description || description===''"> | ||
<em>No description specified</em> | ||
</p> | ||
<div ng-if="$vm.templateCustomFields.length > 0" class="mv-xs"> | ||
<a href ng-click="$vm.addCustomFieldRow()"> | ||
<i class="fa fa-plus"></i> Add a custom field | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="empty-message" ng-if="$vm.templateCustomFields.length === 0"> | ||
No custom fields have been added | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters