Sfoglia il codice sorgente

CensusEntry Gaelic added to bootstrap

Andrew Grant 5 mesi fa
parent
commit
448c3ed990

+ 2 - 0
src/main/java/scot/carricksoftware/grants/bootstrap/DataLoadCensus.java

@@ -15,6 +15,7 @@ import scot.carricksoftware.grants.commands.census.CensusEntryCommand;
 import scot.carricksoftware.grants.commands.census.CensusEntryCommandImpl;
 import scot.carricksoftware.grants.domains.places.Place;
 import scot.carricksoftware.grants.enums.censusentry.CensusEntryCondition;
+import scot.carricksoftware.grants.enums.censusentry.CensusEntryGaelic;
 import scot.carricksoftware.grants.enums.censusentry.CensusEntryRelationship;
 import scot.carricksoftware.grants.services.census.CensusEntryService;
 import scot.carricksoftware.grants.services.census.CensusService;
@@ -69,6 +70,7 @@ public class DataLoadCensus {
         censusEntryCommand.setPerson(personService.findById(1L));
         censusEntryCommand.setRelationship(CensusEntryRelationship.COUSIN);
         censusEntryCommand.setCondition(CensusEntryCondition.MARRIED);
+        censusEntryCommand.setGaelic(CensusEntryGaelic.GAELIC);
         censusEntryService.saveCensusEntryCommand(censusEntryCommand);
     }
 

+ 10 - 0
src/main/resources/templates/censusentry/form.html

@@ -99,6 +99,16 @@ rounded-3 text-center p-4">
                     </select>
                 </div>
             </div>
+            <div class="col-md-3">
+                <label for="gaelic">Gaelic</label>
+                <div>
+                    <select id="gaelic" style="width: 200px;" name="gaelic" th:field="*{gaelic}">
+                        <option th:value="${''}" th:text="${''}"></option>
+                        <option th:each="value : ${T(scot.carricksoftware.grants.enums.censusentry.CensusEntryGaelic).values()}"
+                                th:value="${value}" th:text="${value}"></option>
+                    </select>
+                </div>
+            </div>
         </div>
         <button type="submit" class="btn btn-primary">Commit</button>
         <a class="btn btn-secondary" th:href="@{/censusEntries}" th:text="${'List all'}">List all</a>

+ 3 - 0
src/test/java/scot/carricksoftware/grants/bootstrap/DataLoadCensusTest.java

@@ -12,6 +12,7 @@ import scot.carricksoftware.grants.domains.census.Census;
 import scot.carricksoftware.grants.domains.people.Person;
 import scot.carricksoftware.grants.domains.places.Place;
 import scot.carricksoftware.grants.enums.censusentry.CensusEntryCondition;
+import scot.carricksoftware.grants.enums.censusentry.CensusEntryGaelic;
 import scot.carricksoftware.grants.enums.censusentry.CensusEntryRelationship;
 import scot.carricksoftware.grants.services.census.CensusEntryService;
 import scot.carricksoftware.grants.services.census.CensusService;
@@ -74,6 +75,7 @@ public class DataLoadCensusTest {
         Person person = GetRandomPerson();
         CensusEntryRelationship relationship = CensusEntryRelationship.COUSIN;
         CensusEntryCondition condition = CensusEntryCondition.MARRIED;
+        CensusEntryGaelic gaelic = CensusEntryGaelic.GAELIC;
         when(censusServiceMock.findById(1L)).thenReturn(census);
         when(personServiceMock.findById(1L)).thenReturn(person);
 
@@ -85,6 +87,7 @@ public class DataLoadCensusTest {
         assertEquals(person, captor.getValue().getPerson());
         assertEquals(relationship, captor.getValue().getRelationship());
         assertEquals(condition, captor.getValue().getCondition());
+        assertEquals(gaelic, captor.getValue().getGaelic());
     }