- Removed generic.sass import

- Error class management refactor
pull/8281/head
Aleix Suau 5 years ago
parent 7811c9ba36
commit 4eee2913c3
  1. 2
      app/assets/stylesheets/openproject/_generic.sass
  2. 22
      frontend/src/app/components/resizer/wp-resizer.component.ts
  3. 1
      modules/bim/app/assets/stylesheets/bim/ifc_viewer/generic.sass

@ -118,4 +118,4 @@
z-index: 0 !important z-index: 0 !important
.-error .-error
color: $content-form-error-color color: $content-form-error-color !important

@ -146,9 +146,7 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, A
const event = new Event(this.resizeEvent); const event = new Event(this.resizeEvent);
window.dispatchEvent(event); window.dispatchEvent(event);
if (this.resizer.classList.contains('-error')) { this.manageErrorClass(false);
this.resizer.classList.remove('-error');
}
} }
resizeMove(deltas:ResizeDelta) { resizeMove(deltas:ResizeDelta) {
@ -164,15 +162,11 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, A
newValue = this.elementMinWidth; newValue = this.elementMinWidth;
// Show the resizer red when it reaches its limit (min-width) // Show the resizer red when it reaches its limit (min-width)
if (!this.resizer.classList.contains('-error')) { this.manageErrorClass(true);
this.resizer.classList.add('-error');
}
} else { } else {
newValue = this.elementWidth; newValue = this.elementWidth;
if (this.resizer.classList.contains('-error')) { this.manageErrorClass(false);
this.resizer.classList.remove('-error');
}
} }
// Store item in local storage // Store item in local storage
@ -218,4 +212,14 @@ export class WpResizerDirective extends UntilDestroyedMixin implements OnInit, A
let fullScreenLeftView = jQuery('.work-packages-full-view--split-left')[0]; let fullScreenLeftView = jQuery('.work-packages-full-view--split-left')[0];
this.toggleColumns(fullScreenLeftView); this.toggleColumns(fullScreenLeftView);
} }
private manageErrorClass(shouldBePresent:boolean) {
  if (shouldBePresent && !this.resizer.classList.contains('-error')) {
   this.resizer.classList.add('-error');
  }
if (!shouldBePresent && this.resizer.classList.contains('-error')) {
this.resizer.classList.remove('-error');
}
}
} }

@ -1,7 +1,6 @@
// -------------------------- GENERIC -------------------------- // -------------------------- GENERIC --------------------------
@import "openproject/variables" @import "openproject/variables"
@import "openproject/mixins" @import "openproject/mixins"
@import "openproject/generic"
@import "fonts/openproject_icon_definitions" @import "fonts/openproject_icon_definitions"
@import "fonts/openproject_icon_font" @import "fonts/openproject_icon_font"

Loading…
Cancel
Save