diff --git a/samples/htmx_mustache/WebSiteControllerU.pas b/samples/htmx_mustache/WebSiteControllerU.pas index c965c7c6..a0ad89fe 100644 --- a/samples/htmx_mustache/WebSiteControllerU.pas +++ b/samples/htmx_mustache/WebSiteControllerU.pas @@ -38,6 +38,12 @@ type [MVCProduces(TMVCMediaType.TEXT_HTML)] procedure NewPerson; + [MVCPath('/modal/fordelete/($guid)')] + [MVCHTTPMethods([httpGET])] + [MVCProduces(TMVCMediaType.TEXT_HTML)] + function ShowModalForDelete(guid: string): String; + + [MVCPath('/edit/($guid)')] [MVCHTTPMethods([httpGET])] [MVCProduces(TMVCMediaType.TEXT_HTML)] @@ -48,6 +54,11 @@ type [MVCProduces(TMVCMediaType.TEXT_HTML)] procedure Index; + [MVCPath('/modal')] + [MVCHTTPMethods([httpGET])] + [MVCProduces(TMVCMediaType.TEXT_HTML)] + function ShowModal: String; + [MVCPath('/mustacheshowcase')] [MVCHTTPMethods([httpGET])] [MVCProduces(TMVCMediaType.TEXT_HTML)] @@ -66,6 +77,7 @@ var begin LDAL := TServicesFactory.GetPeopleDAL; LDAL.DeleteByGUID(GUID); + Context.Response.SetPageRefresh(true); RenderStatusMessage(HTTP_STATUS.OK); end; @@ -242,4 +254,27 @@ begin Context.Response.SetRedirect('/people'); end; +function TWebSiteController.ShowModal: String; +begin + var lJSON := StrToJSONObject('{"message":"Do you really want to delete row?", "title":"Bootstrap Modal Dialog"}'); + try + Result := GetRenderedView(['modal'], lJSON); + finally + lJSON.Free; + end; +end; + +function TWebSiteController.ShowModalForDelete(guid: string): String; +begin + var lJSON := TJsonObject.Create; + try + lJSON.S['title'] := 'Bootstrap Modal Dialog'; + lJSON.S['message'] := 'Do you really want to delete row?'; + lJSON.S['guid'] := guid; + Result := GetRenderedView(['modal'], lJSON); + finally + lJSON.Free; + end; +end; + end. diff --git a/samples/htmx_mustache/bin/templates/delete_person_link.mustache b/samples/htmx_mustache/bin/templates/delete_person_link.mustache index a2e346e1..e4abe96b 100644 --- a/samples/htmx_mustache/bin/templates/delete_person_link.mustache +++ b/samples/htmx_mustache/bin/templates/delete_person_link.mustache @@ -1 +1,9 @@ -Delete \ No newline at end of file + + + \ No newline at end of file diff --git a/samples/htmx_mustache/bin/templates/editperson.mustache b/samples/htmx_mustache/bin/templates/editperson.mustache index 6853bf6e..083d40a8 100644 --- a/samples/htmx_mustache/bin/templates/editperson.mustache +++ b/samples/htmx_mustache/bin/templates/editperson.mustache @@ -24,7 +24,7 @@
- +
@@ -46,7 +46,7 @@
- {{#deviceslist}} {{/deviceslist}} diff --git a/samples/htmx_mustache/bin/templates/header.mustache b/samples/htmx_mustache/bin/templates/header.mustache index 4fc6fde7..02548e5b 100644 --- a/samples/htmx_mustache/bin/templates/header.mustache +++ b/samples/htmx_mustache/bin/templates/header.mustache @@ -1,17 +1,18 @@ 
- + +
- +
-

HTMX Sample DMVCFramework

+

HTMX Sample DMVCFramework

\ No newline at end of file diff --git a/samples/htmx_mustache/bin/templates/modal.mustache b/samples/htmx_mustache/bin/templates/modal.mustache new file mode 100644 index 00000000..74751efc --- /dev/null +++ b/samples/htmx_mustache/bin/templates/modal.mustache @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/samples/htmx_mustache/bin/templates/partials/modal_placeholder.mustache b/samples/htmx_mustache/bin/templates/partials/modal_placeholder.mustache new file mode 100644 index 00000000..32fc82cd --- /dev/null +++ b/samples/htmx_mustache/bin/templates/partials/modal_placeholder.mustache @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/samples/htmx_mustache/bin/templates/people_list.mustache b/samples/htmx_mustache/bin/templates/people_list.mustache index a8095b9b..0c514ca4 100644 --- a/samples/htmx_mustache/bin/templates/people_list.mustache +++ b/samples/htmx_mustache/bin/templates/people_list.mustache @@ -1,5 +1,5 @@ -
-
+
+
{{>people_table}}
\ No newline at end of file diff --git a/samples/htmx_mustache/bin/templates/people_list_bottom.mustache b/samples/htmx_mustache/bin/templates/people_list_bottom.mustache index ace075b2..db822c81 100644 --- a/samples/htmx_mustache/bin/templates/people_list_bottom.mustache +++ b/samples/htmx_mustache/bin/templates/people_list_bottom.mustache @@ -1,8 +1,10 @@ -
-
- Export as CSV +
+ -
- Add New Person +
+
-
\ No newline at end of file +
+ +{{>partials/modal_placeholder}} \ No newline at end of file diff --git a/unittests/general/TestServer/templates/dataset_list.html b/unittests/general/TestServer/templates/dataset_list.html index 6ab7357e..4a6c31e0 100644 --- a/unittests/general/TestServer/templates/dataset_list.html +++ b/unittests/general/TestServer/templates/dataset_list.html @@ -4,5 +4,4 @@ --- {{#customers2}} {{CUST_NO}}|{{CUSTOMER}}|{{CONTACT_FIRST}}|{{CONTACT_LAST}}|{{PHONE_NO}}|{{ADDRESS_LINE1}}|{{CITY}}|{{COUNTRY}}|{{POSTAL_CODE}} -{{/customers2}} - \ No newline at end of file +{{/customers2}} \ No newline at end of file