
    h              	       "   d dl mZ d dlmZ ddlmZ ddlmZ ddl	m
Z
mZ ddlmZmZmZ dd	lmZ dd
lmZmZ ddlmZmZ  ej,                  e      Z eej0                        Zej4                   G d d ed      e
ee             Zej4                   G d d ed      e
e             Zej4                   G d d ed      e
ee             Zej4                   G d d ed      e
e             Zej4                   G d d ed      e             Zy)    )plugin_pool)gettext_lazy   )settings)CMSUIPlugin)AttributesMixinBackgroundMixin)first_choiceget_plugin_templateget_template_path   )
navigation)LinkPluginMixinTextLinkPlugin   )formsmodelsc                        e Zd ZdZ ed      Z ed      Zej                  Z	e
j                  ZdZdZg dZddd	ifgZd
 Z fdZ xZS )NavigationPluginzs
    The NavigationPlugin class is a plugin used in Django CMS to create navigation menus or off-canvas menus.
    
NavigationFrontendz(djangocms_frontend/admin/navigation.htmlTNavLinkPluginPageTreePluginNavBrandPluginNfields)template)navbar_designnavbar_breakpointnavbar_containerc                 :    t        |ddt        j                        S )Nr   )r   r   NAVIGATION_TEMPLATE_CHOICESselfcontextinstanceplaceholders       a/home/dcms/DCMS/lib/python3.12/site-packages/djangocms_frontend/contrib/navigation/cms_plugins.pyget_render_templatez$NavigationPlugin.get_render_template8   s    "8\<ImImnn    c                 l    |j                   j                  dt              |d<   t        |   |||      S )Nr   nav_template)configgetdefault_templatesuperrenderr$   r%   r&   r'   	__class__s       r(   r1   zNavigationPlugin.render;   s2    "*//"5"5jBR"Sw~gx==r*   )__name__
__module____qualname____doc___namemoduler   r   modelr   NavigationFormformchange_form_templateallow_childrenchild_classes	fieldsetsr)   r1   __classcell__r3   s   @r(   r   r      sr     \?Dz]FEDENM  		
I o> >r*   r   r   c                        e Zd ZdZ ed      Z ed      Zej                  Z	e
j                  ZdZdZdgZdZddd	ifgZd
 Z fdZ xZS )r   z

    The PageTreePlugin class is a plugin for Django CMS that allows users to display a hierarchical
    tree-like structure of pages on the frontend.
    z	Page treer   z'djangocms_frontend/admin/page_tree.htmlFr   Nr   )start_levelc                 D    t        d|j                  dt              d      S )Nr   r,   	page_treer   r.   r/   r#   s       r(   r)   z"PageTreePlugin.get_render_template]   s     w{{>K[/\^ijjr*   c                 d    |j                   j                  dd      |d<   t        |   |||      S )NrE   r   )r-   r.   r0   r1   r2   s       r(   r1   zPageTreePlugin.render`   s1    !)!4!4]A!Fw~gx==r*   )r4   r5   r6   r7   r8   r9   r:   r   PageTreer;   r   PageTreeFormr=   r>   r?   parent_classesshow_add_formrA   r)   r1   rB   rC   s   @r(   r   r   @   sv     [>Dz]FOOEDDNN M '(	
Ik> >r*   r   rJ   c                       e Zd ZdZ ed      Z ed      Zej                  Z	e
j                  ZdZdZdgZdZdd	d
ifgZd Zy)r   a  
    The `NavBrandPlugin` class is a plugin used in Django CMS to create a navigation brand element.
    This plugin allows the user to define a brand logo or text that will be displayed in the
    navigation header. Content is added through child plugins.
    Brandr   z#djangocms_frontend/admin/brand.htmlTr   Nr   )simple_contentc                 D    t        d|j                  dt              d      S )Nr   r,   brandrH   r#   s       r(   r)   z"NavBrandPlugin.get_render_template   s     w{{>K[/\^effr*   )r4   r5   r6   r7   r8   r9   r:   r   NavBrandr;   r   NavBrandFormr=   r>   r?   rL   link_fieldset_positionrA   r)    r*   r(   r   r   e   sl     W:Dz]FOOED@NN   *+	
Igr*   r   rT   c                   l    e Zd ZdZ ed      Z ed      Zej                  Z	dZ
dZdgZg dZdd	d
ifgZy)NavContainerPluginzj
    The `NavContainerPlugin` class is a deprecated plugin without functionality. It will be removed.
    zNavigation containerr   z(djangocms_frontend/admin/deprecated.htmlT r   Nr   rW   )r4   r5   r6   r7   r8   r9   r:   r   NavContainerr;   r>   r?   rL   r@   rA   rW   r*   r(   rY   rY      sY     #$Dz]FEENTNM rN	
Ir*   rY   NavLinkc                   ~    e Zd ZdZ ed      Z ed      Zej                  Z	e
j                  ZdZdZdd gZg dZd Zy	)
r   ar  
    A plugin that allows creating navigation links for the frontend.

    Attributes:
    -----------
    - `name` (str): The name of the plugin, displayed in the plugin list when editing a page.
    - `module` (str): The module where the plugin belongs, displayed in the plugin list when editing a page.
    - `model` (Model): The Django model used to store the plugin's data.
    - `form` (Form): The form used to render the plugin's settings in the admin interface.
    - `change_form_template` (str): The path to the template used to render the plugin's change form in the admin
      interface.
    - `allow_children` (bool): Whether the plugin allows having child plugins.
    - `parent_classes` (list): List of parent plugin classes that this plugin can be nested within.
    - `child_classes` (list): List of child plugin classes that can be nested within this plugin.
    zNavigation linkr   z%djangocms_frontend/admin/navlink.htmlTr   )r   GridContainerPluginGridRowPluginListGroupPluginc                 D    t        d|j                  dt              d      S )Nr   r,   linkrH   r#   s       r(   r)   z!NavLinkPlugin.get_render_template   s     w{{>K[/\^deer*   N)r4   r5   r6   r7   r8   r9   r:   r   r\   r;   r   NavLinkFormr=   r>   r?   rL   r@   r)   rW   r*   r(   r   r      sS    
  Dz]FNNEDBN(/:NMfr*   r   N) cms.plugin_poolr   django.utils.translationr   r8   rZ   r   cms_pluginsr   commonr   r	   helpersr
   r   r   r   link.cms_pluginsr   r   r   r   get_renderermixin_factoryr"   r/   register_pluginr   r   r   rY   r   rW   r*   r(   <module>rm      s3   ' 6  & 6 K K  > %%%j1 D DE  +>,	+> +>\ !>*!> !>H g*	g gD ) : #f)#f #fr*   