Merge pull request #4972 from opf/fix/24083/types-dropdown-delay

[24083] Don't show the drop-down until the form and types are loaded
pull/4976/head
ulferts 8 years ago committed by GitHub
commit 1290c14892
  1. 3
      app/assets/stylesheets/layout/_drop_down.sass
  2. 2
      frontend/app/components/context-menus/types-context-menu/types-context-menu.service.html
  3. 11
      frontend/app/components/context-menus/types-context-menu/types-context-menu.service.ts
  4. 2
      frontend/app/components/wp-create/wp-create.service.ts

@ -59,6 +59,9 @@
padding: 3px 0
margin: 0
.dropdown-menu.-empty
visibility: hidden
.dropdown .dropdown-panel
padding: 10px

@ -1,6 +1,6 @@
<div class="dropdown dropdown-relative dropdown-anchor-right dropdownToolbar"
id="types-context-menu">
<ul class="dropdown-menu">
<ul class="dropdown-menu" ng-class="{'-empty': $ctrl.types.length === 0 }">
<li ng-repeat="type in $ctrl.types">
<a class="menu-item" ui-sref="{{$ctrl.stateName}}({type: type.id})">
{{ type.name }}

@ -27,19 +27,18 @@
//++
import {opWorkPackagesModule} from '../../../angular-modules';
import {ApiWorkPackagesService} from '../../api/api-work-packages/api-work-packages.service';
import {WorkPackageCreateService} from '../../wp-create/wp-create.service';
class TypesContextMenuController {
public types = [];
constructor(protected $state, protected $scope, apiWorkPackages) {
constructor(protected $state, protected $scope, protected wpCreate:WorkPackageCreateService) {
const project = $scope.projectIdentifier;
$scope.$ctrl = this;
apiWorkPackages
.emptyCreateForm({}, project)
.then(form =>
this.types = form.schema.type.allowedValues);
wpCreate.getEmptyForm(project).then((form:any) => {
this.types = form.schema.type.allowedValues;
});
}
public get stateName() {

@ -60,7 +60,7 @@ export class WorkPackageCreateService {
});
}
private getEmptyForm(projectIdentifier):ng.IPromise<HalResource> {
public getEmptyForm(projectIdentifier):ng.IPromise<HalResource> {
if (!this.form) {
this.form = this.apiWorkPackages.emptyCreateForm({}, projectIdentifier);
}

Loading…
Cancel
Save