
    hk              
          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 ddlmZ ddlmZmZ d	d
lmZ ddlmZmZ ddlmZ ddlmZ  ej4                  e      Zd ej8                  d      rdnddddfZddderedz   nez   ifgZ G d d      Z G d d ed      eeeee      Z dejB                  v r0 ejD                  e        d ejB                  v rd d!l#m$Z$ d"ge$_%        yyy)#    )plugin_pool)apps)settings)gettext_lazy)get_plugin_templateinsert_fields   )CMSUIPlugin)AttributesMixinSpacingMixin   )link   )formsmodels)USE_LINK_ICONS)GetLinkMixin)name	link_typedjangocms_url_managersiteurl_grouperr   )link_context	link_size)link_outline
link_blocklink_stretchedNfields)template))	icon_left
icon_rightc                   f     e Zd ZdZ ej
                  d      rdndZ fdZd fd	Zd	 fd	Z	 xZ
S )
LinkPluginMixinNr   )r   )r   targetc                 ~    d|v rt        |d   dd       |_        |j                         |d<   t        |   |||      S )Nrequestcurrent_page
mixin_link)getattr	_cms_pageget_linksuperrender)selfcontextinstanceplaceholder	__class__s       [/home/dcms/DCMS/lib/python3.12/site-packages/djangocms_frontend/contrib/link/cms_plugins.pyr.   zLinkPluginMixin.render*   sG    !();^T!RH ( 1 1 3w~gx==    c                 :    t        |   |||fi |}||_        |S )z;The link form needs the request object to check permissions)r-   get_formr'   )r/   r'   objchangekwargsformr3   s         r4   r7   zLinkPluginMixin.get_form0   s'    wf??r5   c                     t         |   ||      }| j                  ,t        || j                  t        d      | j                        }|S )NzLink settings)	blocknameposition)r-   get_fieldsetslink_fieldset_positionr   link_fields_)r/   r'   r8   	fieldsetsr3   s       r4   r?   zLinkPluginMixin.get_fieldsets6   sO    G)'37	&&2%  O,44	I r5   )NF)N)__name__
__module____qualname__r@   r   is_installedrA   r.   r7   r?   __classcell__)r3   s   @r4   r$   r$   &   s6    !0A0A0ABY0Z,`rK>	 	r5   r$   c                   z    e Zd ZdZ ed      Z ed      Zej                  Z	e
j                  ZdZdZdZdZeZd Zy)	TextLinkPluginz`
    Components > "Button" Plugin
    https://getbootstrap.com/docs/5.0/components/buttons/
    zLink / ButtonFrontendz"djangocms_frontend/admin/link.htmlTa  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-link-45deg" viewBox="0 0 16 16"><path d="M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1 1 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4 4 0 0 1-.128-1.287z"/><path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243z"/></svg>c                 :    t        |ddt        j                        S )Nr   )r   r   LINK_TEMPLATE_CHOICES)r/   r0   r1   r2   s       r4   get_render_templatez"TextLinkPlugin.get_render_templateY   s    "8VVX=[=[\\r5   N)rD   rE   rF   __doc__rB   r   moduler   Linkmodelr   LinkFormr;   change_form_templatetext_enabled	text_iconallow_childrenUILINK_FIELDSETrC   rN    r5   r4   rJ   rJ   B   sV    
 _Dz]FKKE>>D?L	h  NI]r5   rJ   rQ   zdjangocms_frontend.contrib.linkdjangocms_link)
LinkPlugin )&cms.plugin_poolr   django.appsr   django.confr   django_settingsdjango.utils.translationr   rB   djangocms_frontend.helpersr   r   r\   cms_pluginsr
   commonr   r   r   r   r   	constantsr   helpersr   get_renderermixin_factoryrG   UILINK_FIELDSrX   r$   rJ   INSTALLED_APPSregister_plugindjangocms_link.cms_pluginsr[   parent_classesrY   r5   r4   <module>rn      s   '  3 6 I  & 3   % !%%%d+ 0t001HIv!" 	mAO}==Ubd	
 8]]6*O\?\hju ]6 %(F(FFK/?9999%'D
! :	 Gr5   