Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Afform - Fix endless spinner on "New Search Display" dropdown #19997

Merged
merged 1 commit into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ext/afform/admin/ang/afAdmin/afAdminList.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
$scope.types = _.indexBy(ctrl.tabs, 'name');
_.each(['form', 'block', 'search'], function(type) {
if ($scope.types[type]) {
$scope.types[type].options = [];
if (type === 'form') {
$scope.types.form.default = '#create/form/Individual';
}
}
});
$scope.types.system.options = false;

this.afforms = _.transform(afforms, function(afforms, afform) {
afform.type = afform.type || 'system';
Expand All @@ -35,7 +35,7 @@

this.createLinks = function() {
ctrl.searchCreateLinks = '';
if ($scope.types[ctrl.tab].options.length) {
if ($scope.types[ctrl.tab].options) {
return;
}
var links = [];
Expand Down Expand Up @@ -66,6 +66,7 @@
$scope.types.block.options = _.sortBy(links, function(item) {
return item.url === '#create/block/*' ? '0' : item.label;
});
// Add divider after the * entity (content block)
$scope.types.block.options.splice(1, 0, {'class': 'divider', label: ''});
}

Expand Down
9 changes: 5 additions & 4 deletions ext/afform/admin/ang/afAdmin/afAdminList.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h1 crm-page-title>{{:: ts('Form Builder') }}</h1>
<div class="form-inline">
<label for="afform-list-filter">{{:: ts('Filter:') }}</label>
<input class="form-control" type="search" id="afform-list-filter" ng-model="$ctrl.searchAfformList" placeholder="&#xf002">
<div class="btn-group pull-right" ng-if="types[$ctrl.tab].options">
<div class="btn-group pull-right" ng-if="types[$ctrl.tab].options !== false">
<a ng-if="types[$ctrl.tab].default" href="{{ types[$ctrl.tab].default }}" class="btn btn-primary">
{{ ts('New %1', {1: types[$ctrl.tab].label }) }}
</a>
Expand All @@ -19,9 +19,10 @@ <h1 crm-page-title>{{:: ts('Form Builder') }}</h1>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<input ng-if="types[$ctrl.tab].options.length" type="search" class="form-control" placeholder="&#xf002" ng-model="searchCreateLinks.label">
<a href ng-if="!types[$ctrl.tab].options.length"><i class="crm-i fa-spinner fa-spin"></i></a>
<li ng-class="{disabled: !types[$ctrl.tab].options || !types[$ctrl.tab].options.length}">
<input ng-if="types[$ctrl.tab].options && types[$ctrl.tab].options.length" type="search" class="form-control" placeholder="&#xf002" ng-model="searchCreateLinks.label">
<a href ng-if="!types[$ctrl.tab].options"><i class="crm-i fa-spinner fa-spin"></i></a>
<a href ng-if="types[$ctrl.tab].options && !types[$ctrl.tab].options.length">{{:: ts('None Found') }}</a>
</li>
<li ng-repeat="link in types[$ctrl.tab].options | filter:searchCreateLinks" class="{{:: link.class }}">
<a ng-if=":: link.url" href="{{:: link.url }}">
Expand Down