Cookie Policy, Terms
Enabling the LegalDocument menu in the admin
LegalDocument menu is enabled in admin as default. If you’re using custom menu, include the following line in your admin/base.html file:
<li id="legaldocument-menu"><a href="{{baseurl}}admin/legaldocument/"><i class="fa fa-file"></i> <span class="name">{{#menu_legaldocument#}}</span></a></li>
How to display cookie policies
Cookie policy can be displayed in two steps:
- Create a cookie policy in admin at URL
admin/legaldocument
. - Add the following line before the closing body tag of base.html:
{% include 'legaldocument/show/cookiepolicy' %}
Important note: If cookie policy doesn’t exists in current locale, the popup window won’t be displayed!
The content of the popup window can be changed in language files legaldocument.{locale code}.lang.ini
.
How to add a link for popup terms
Every LegalDocument type (privacy, terms, cookiepolicy) can be opened in popup with ajax request to URL /legaldocument/{document_type}
, where document_type
is one of the following options: terms, privacy or cookiepolicy
.
For example, the following line opens terms in a popup window:
<a onclick="ofw.ajax.alert('legaldocument/terms');">Terms</a>
Every LegalDocument type can be opened as a page as well by URL legaldocument/{document_type}
. For example, the following line opens terms:
<a href="legaldocument/terms">Terms</a>
Other document type
The other Legaldocument type handles custom documents. You can define unlimited number of other LegalDocument type in every language. You can create this type of LegalDocument in three steps:
- Define document in admin, set friendly URL, which will be the name of the template (e.g. impress).
- Create a custom template file in
legaldocument/get
view directory for ajax popup (e.g. legaldocument/get/impress.html for impress document) or inlegaldocument
view directory for standard HTML page (e.g. legaldocument/impress.html for impress document). - You can access other LegalDocument type with the parameter GET friendlyurl:
/legaldocument/other/?friendlyurl={friendlyurl}
, e.g. /legaldocument/other/?friendlyurl=impress for impress page. To open impress page in a popup, use the following lines:<a onclick="ofw.ajax.alert('legaldocument/other/?friendlyurl=impress');">Terms</a>
Custom templates and template variables
To create a custom template for terms, privacy or cookie policy, just override the default template by creating a new HTML file in the proper directory:
- in view folder
legaldocument/get/{document_type}.html
for ajax popups (e.g.legaldocument/get/cookiepolicy.html
for cookie policy) - or in view folder
legaldocument/{document_type}.html
for standard HTML page
To create templates for other LegalDocument type, use friendly URL as template name (e.g. legaldocument/get/{friendlyurl}.html
for ajax popup HTML).
Variables in templates:
document.data.title
– the document title
document.data.content
– the HTML content of the document