added basic support for htmx (ajax)
- if there is HX-Request header present we sent only a part of the whole html - we return only specific stream defined by [out ...] ezc statement - the name of the stream is passed in the 'frame' parameter (if not present then 'content' is assumed) - added ezc function: winix_is_htmx_request
This commit is contained in:
@@ -766,6 +766,7 @@ void Templates::CreateFunctions()
|
||||
ezc_functions.Insert("winix_locale_tab", winix_locale_tab);
|
||||
ezc_functions.Insert("winix_locale_tab_id", winix_locale_tab_id);
|
||||
ezc_functions.Insert("winix_locale_tab_name", winix_locale_tab_name);
|
||||
ezc_functions.Insert("winix_is_htmx_request", winix_is_htmx_request);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -661,7 +661,7 @@ namespace TemplatesFunctions
|
||||
void winix_locale_tab(Info & i);
|
||||
void winix_locale_tab_id(Info & i);
|
||||
void winix_locale_tab_name(Info & i);
|
||||
|
||||
void winix_is_htmx_request(Info & i);
|
||||
|
||||
/*
|
||||
who
|
||||
|
||||
@@ -375,6 +375,15 @@ void winix_locale_tab_name(Info & i)
|
||||
}
|
||||
|
||||
|
||||
void winix_is_htmx_request(Info & i)
|
||||
{
|
||||
if( cur->request->headers_in.has_key(L"HX-Request") || cur->request->headers_in.has_key(L"hx_request") )
|
||||
{
|
||||
// fastcgi will change the header to hx_request
|
||||
i.res = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user