Skip to content

Commit

Permalink
Merge pull request #80 from cathrkri/hotfix/75-hotfixfix-searching-ch…
Browse files Browse the repository at this point in the history
…arities

Fix: Added Missing fxml and fx:ids and...
  • Loading branch information
apbaluna authored Apr 22, 2026
2 parents fa18126 + 3cfdcc4 commit e38ea89
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public void initialize() {
CharityRegistry charities = db.getCharitiesFromDB();
allCharities = charities.getAllCharities();



cardsContainer.getChildren().clear();

searchField
Expand All @@ -77,8 +79,20 @@ private List<Charity> filterCharities(String query) {
}

for (Charity charity : allCharities) {
String name = charity.getName().toLowerCase();
String description = charity.getDescription().toLowerCase();
String name = charity.getName();
String description = charity.getDescription();

if (name == null || name.isBlank()){
name = "This one has no name";
} else {
name = name.toLowerCase();
}
if (description == null || description.isBlank()){
description = "This one has no description";
} else {
description = description.toLowerCase();
}


if (name.contains(query) || description.contains(query)) {
matches.add(charity);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.Cursor?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.effect.DropShadow?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.paint.Color?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>

<BorderPane prefHeight="900.0" prefWidth="1400.0"
style="-fx-background-color: #f4f4f4;"
xmlns="http://javafx.com/javafx/25"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="ntnu.systemutvikling.team6.controller.AvailableOrganizationController">
<BorderPane prefHeight="900.0" prefWidth="1400.0" style="-fx-background-color: #f4f4f4;" xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ntnu.systemutvikling.team6.controller.AvailableOrganizationController">

<!-- NAVBAR -->
<top>
Expand All @@ -34,43 +22,33 @@

<!-- MAIN CONTENT -->
<center>
<ScrollPane fitToWidth="true"
hbarPolicy="NEVER"
pannable="true"
vbarPolicy="AS_NEEDED"
style="-fx-background: #f4f4f4; -fx-background-color: #f4f4f4;">
<ScrollPane fitToWidth="true" hbarPolicy="NEVER" pannable="true" style="-fx-background: #f4f4f4; -fx-background-color: #f4f4f4;" vbarPolicy="AS_NEEDED">
<content>

<VBox spacing="30.0" style="-fx-background-color: #f4f4f4;">
<padding>
<Insets top="30.0" right="40.0" bottom="40.0" left="40.0" />
<Insets bottom="20.0" left="40.0" right="20.0" top="30.0" />
</padding>

<children>

<Label text="Available Organizations" textFill="#163b9f">
<Label text="Search" textFill="#163b9f">
<font>
<Font name="System Bold" size="32.0" />
</font>
</Label>
<TextField fx:id="searchField" prefHeight="50.0" prefWidth="1318.0" promptText="Search" style="-fx-background-radius: 15;">
<font>
<Font size="18.0" />
</font></TextField>
<Label text="Resulting Available Organizations" textFill="Black">
<font>
<Font name="System Bold" size="26.0" />
</font>
</Label>
<FlowPane fx:id="cardsContainer" hgap="20.0" vgap="20.0" HBox.hgrow="ALWAYS">

<GridPane hgap="28.0" vgap="36.0">
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS" percentWidth="33.33" />
<ColumnConstraints hgrow="ALWAYS" percentWidth="33.33" />
<ColumnConstraints hgrow="ALWAYS" percentWidth="33.33" />
</columnConstraints>

<rowConstraints>
<RowConstraints />
<RowConstraints />
<RowConstraints />
<RowConstraints />
</rowConstraints>
<children>

</FlowPane>

</children>
</GridPane>
</children>
</VBox>
</content>
Expand All @@ -83,4 +61,4 @@
<fx:include fx:id="footer" source="components/footer.fxml" />
</bottom>

</BorderPane>
</BorderPane>
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@
</Button>
</children>
</VBox>

</children>
</VBox>
</content>
Expand Down

0 comments on commit e38ea89

Please sign in to comment.