From 33720c473c6dda1e2627705388e7fdbdb0348cc8 Mon Sep 17 00:00:00 2001 From: Stefan Date: Fri, 1 Nov 2024 17:33:33 +0100 Subject: [PATCH 1/2] Fix issue disabled button --- .../components/form/use_reference_button.js | 12 +++++------ src/sdg/producten/models/product.py | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/sdg/js/components/form/use_reference_button.js b/src/sdg/js/components/form/use_reference_button.js index c6cbfed48..8ff6eb9d8 100644 --- a/src/sdg/js/components/form/use_reference_button.js +++ b/src/sdg/js/components/form/use_reference_button.js @@ -1,9 +1,7 @@ -import {ReferenceTextComponent} from './abstract/reference_text_component'; - +import { ReferenceTextComponent } from "./abstract/reference_text_component"; /** @type {NodeListOf} */ -const USE_REFERENCE_BUTTONS = document.querySelectorAll('.form__reference-btn'); - +const USE_REFERENCE_BUTTONS = document.querySelectorAll(".form__reference-btn"); /** * Button allow the user to use the reference text. @@ -24,10 +22,10 @@ class UseReferenceButton extends ReferenceTextComponent { updateLabel() { super.updateLabel(); - if(this.getFormControlDisabled()) { - this.setState({label: 'Bewerken uitgeschakeld'}); + if (this.getFormControlDisabled()) { + this.setState({ label: "Bewerken uitgeschakeld", disabled: true }); } else { - this.setState({label: this.state.originalLabel}); + this.setState({ label: this.state.originalLabel, disabled: false }); } } } diff --git a/src/sdg/producten/models/product.py b/src/sdg/producten/models/product.py index 3cfe40b4c..63e19c161 100644 --- a/src/sdg/producten/models/product.py +++ b/src/sdg/producten/models/product.py @@ -548,3 +548,23 @@ class Meta: def __str__(self): return f"{self.product} (uitvoering)" + +class BrokenLinks(models.Model): + """ + Broken Links + + Model that keeps track of each link with a One-To-One relationship to the product this link is present. + The model has different columns that keep track of data that is used to determine if a monthly must be email send. + """ + product = models.ForeignKey(Product, on_delete=models.CASCADE) + url = models.URLField(default="") + error_count = models.PositiveIntegerField(default=0) + last_checked = models.DateTimeField(auto_now=True) + + def increment_error_count(self): + self.error_count += 1 + self.save() + + def get_url(self): + # Haal de URL uit het betreffende veld in het Product + return getattr(self.product, self.field_name, None) From 2d895cca3384330ca7f35264f5eb28d8a803972d Mon Sep 17 00:00:00 2001 From: Stefan Date: Fri, 1 Nov 2024 17:36:17 +0100 Subject: [PATCH 2/2] :fire: commited wrong code --- src/sdg/producten/models/product.py | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/sdg/producten/models/product.py b/src/sdg/producten/models/product.py index 63e19c161..3cfe40b4c 100644 --- a/src/sdg/producten/models/product.py +++ b/src/sdg/producten/models/product.py @@ -548,23 +548,3 @@ class Meta: def __str__(self): return f"{self.product} (uitvoering)" - -class BrokenLinks(models.Model): - """ - Broken Links - - Model that keeps track of each link with a One-To-One relationship to the product this link is present. - The model has different columns that keep track of data that is used to determine if a monthly must be email send. - """ - product = models.ForeignKey(Product, on_delete=models.CASCADE) - url = models.URLField(default="") - error_count = models.PositiveIntegerField(default=0) - last_checked = models.DateTimeField(auto_now=True) - - def increment_error_count(self): - self.error_count += 1 - self.save() - - def get_url(self): - # Haal de URL uit het betreffende veld in het Product - return getattr(self.product, self.field_name, None)