OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Correctly update disabled state in wp-create-button
Oliver Günther5580b30f8a5d
diff --git a/frontend/src/app/components/wp-buttons/wp-create-button/wp-create-button.component.ts b/frontend/src/app/components/wp-buttons/wp-create-button/wp-create-button.component.tsindex 7a79cea8a18..4d2f2b4f2f1 100644--- a/frontend/src/app/components/wp-buttons/wp-create-button/wp-create-button.component.ts+++ b/frontend/src/app/components/wp-buttons/wp-create-button/wp-create-button.component.ts@@ -26,8 +26,8 @@// See docs/COPYRIGHT.rdoc for more details.// ++-import {StateService} from '@uirouter/core';-import {ChangeDetectionStrategy, Component, Input, OnDestroy, OnInit} from '@angular/core';+import {StateService, TransitionService} from '@uirouter/core';+import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy, OnInit} from '@angular/core';import {I18nService} from "core-app/modules/common/i18n/i18n.service";import {CurrentProjectService} from "core-components/projects/current-project.service";import {AuthorisationService} from "core-app/modules/common/model-auth/model-auth.service";@@ -43,8 +43,10 @@ export class WorkPackageCreateButtonComponent implements OnInit, OnDestroy {@Input('stateName') stateName:string;allowed:boolean;+ disabled:booleanprojectIdentifier:string|null;types:any;+ transitionUnregisterFn:Function;text = {createWithDropdown: this.I18n.t('js.work_packages.create.button'),@@ -55,7 +57,9 @@ export class WorkPackageCreateButtonComponent implements OnInit, OnDestroy {constructor(readonly $state:StateService,readonly currentProject:CurrentProjectService,readonly authorisationService:AuthorisationService,- readonly I18n:I18nService) {+ readonly transition:TransitionService,+ readonly I18n:I18nService,+ readonly cdRef:ChangeDetectorRef) {}ngOnInit() {@@ -72,18 +76,24 @@ export class WorkPackageCreateButtonComponent implements OnInit, OnDestroy {let [module, permission] = combined.split('.');return this.authorisationService.can(module, permission);});++ this.updateDisabledState();});+++ this.transitionUnregisterFn = this.transition.onSuccess({}, this.updateDisabledState.bind(this));}ngOnDestroy():void {- // Nothing to do+ this.transitionUnregisterFn();}createWorkPackage() {this.$state.go(this.stateName, {projectPath: this.projectIdentifier});}- isDisabled() {- return !this.allowed || this.$state.includes('**.new');+ private updateDisabledState() {+ this.disabled = !this.allowed || this.$state.includes('**.new');+ this.cdRef.detectChanges();}}diff --git a/frontend/src/app/components/wp-buttons/wp-create-button/wp-create-button.html b/frontend/src/app/components/wp-buttons/wp-create-button/wp-create-button.htmlindex b747ff72ff9..5bc00757609 100644--- a/frontend/src/app/components/wp-buttons/wp-create-button/wp-create-button.html+++ b/frontend/src/app/components/wp-buttons/wp-create-button/wp-create-button.html@@ -1,6 +1,6 @@<div class="wp-create-button"><button class="button -alt-highlight add-work-package"- [disabled]="isDisabled()"+ [disabled]="disabled"[attr.aria-label]="text.explanation"opTypesCreateDropdown[projectIdentifier]="projectIdentifier"diff --git a/modules/bim/spec/features/bcf/export_spec.rb b/modules/bim/spec/features/bcf/export_spec.rbindex 084647f3c7f..7c8d0510ec7 100644--- a/modules/bim/spec/features/bcf/export_spec.rb+++ b/modules/bim/spec/features/bcf/export_spec.rb@@ -26,7 +26,7 @@# See docs/COPYRIGHT.rdoc for more details.#++require 'spec_helper'-require_relative '../support/pages/ifc_models/show_default'+require_relative '../../support/pages/ifc_models/show_default'describe 'bcf export', type: :feature, js: true dolet(:status) { FactoryBot.create(:status, name: 'New', is_default: true) }