Преглед изворни кода

#4196 - Make snippet cards clickable

roman.lesnikov@gmail.com пре 3 година
родитељ
комит
1b71d2feef

+ 12 - 1
inc/js/functions.js

@@ -956,7 +956,18 @@ function bx_time(sLang, isAutoupdate, sRootSel) {
         if ('undefined' !== typeof(eElement)) {
             // process js time
             eElement.bxTime();
-
+            
+            // process links in container
+            $('.bx-lnk-cnt .bx-lnk-src:not(.bx-inited)').each(function() {
+                $(this).addClass('bx-inited');
+                var sUrl = $(this).prop('href');
+                $(this).parents('.bx-lnk-cnt').first().addClass('cursor-pointer').click(function(oEvent){
+                    if ($(oEvent.target).closest('a').length == 0 && $(oEvent.target).closest('button').length == 0 && $(oEvent.target).closest('form').length == 0 &&  $(oEvent.target).closest('input').length == 0){
+                        location.href = sUrl;
+                    }
+                });
+            });
+            
             // process web forms
             if ($.isFunction($.fn.addWebForms))
 	            eElement.addWebForms();

+ 3 - 3
modules/boonex/artificer/data/template/bx_forum/unit_gallery.html

@@ -1,16 +1,16 @@
-<div onclick="location.href='__content_url__'" class="__class__ relative w-full bx-base-text-unit bx-base-text-unit-gallery bx-def-gal-unit-size group p-1 -m-1">
+<div class="__class__ relative bx-lnk-cnt w-full bx-base-text-unit bx-base-text-unit-gallery bx-def-gal-unit-size group p-1 -m-1">
     <div class="bg-white dark:bg-gray-800 shadow ring-1 ring-gray-300 dark:ring-gray-700 rounded-md xl:mx-auto h-full">
         <div class="h-full space-y-4 p-1 pb-4 flex flex-col">
             <bx_if:thumb>
                 <a href="__content_url__" title="__summary_attr__">   <img class="flex grow-0 w-full aspect-video overflow-y-auto align-top  object-cover rounded" src="__gallery_url__" alt=""></a>  
                 <div class="bx-base-text-unit-title grow px-3 mt-4 leading-tight">
-                    <a href="__content_url__" title="__summary_attr__" class="leading-tight">__title__ __badges__</a>
+                    <a href="__content_url__" title="__summary_attr__" class="leading-tight bx-lnk-src">__title__ __badges__</a>
                 </div>
             </bx_if:thumb>
                            
             <bx_if:no_thumb>
                 <div class="bx-base-text-unit-title grow-none px-3 mt-4 leading-tight">
-                    <a href="__content_url__" title="__summary_attr__" class="leading-tight">__title__ __badges__</a>
+                    <a href="__content_url__" title="__summary_attr__" class="leading-tight bx-lnk-src">__title__ __badges__</a>
                 </div>
                 <div class="grow relative rounded w-full max-w-full sm:aspect-video overflow-hidden font-normal text-sm  text-gray-500 group-hover:text-gray-600 dark:text-gray-400 dark:group-hover:text-gray-300">
                     <div class="absolute top-auto bottom-0  w-full h-1/4 bg-gradient-to-b from-white/0 to-white dark:from-gray-900/0 dark:to-gray-800"></div>

+ 2 - 2
modules/boonex/artificer/data/template/bx_timeline/item_timeline.html

@@ -1,6 +1,6 @@
 <div id="__html_id__" class="__style_prefix__-item __class__ bx-def-thumb-size-min-height relative pb-3 md:pb-4 lg:pb-6 bx-clearfix ">
     <a name="timeline-event-__id__"></a>
-    <div class="__style_prefix__-item-cnt bx-def-box bx-def-box-round-corners bx-def-color-bg-box __class_content__ hover:bg-gray-50 dark:hover:bg-gray-700/20 hover:shadow-lg hover:-translate-y-1 duration-300">
+    <div class="__style_prefix__-item-cnt bx-lnk-cnt bx-def-box bx-def-box-round-corners bx-def-color-bg-box __class_content__ hover:bg-gray-50 dark:hover:bg-gray-700/20 hover:shadow-lg hover:-translate-y-1 duration-300">
         <div class="__style_prefix__-blink-plate"></div>
         <bx_if:show_note>
             <div class="__style_prefix__-item-notes mt-3 md:mt-4">
@@ -80,7 +80,7 @@
             </bx_if:show_menu_item_actions>
             <bx_if:show_manage>
                 <div class="__style_prefix__-item-manage">
-                    <a class="group bx-stl-mil-sm" href="javascript:void(0)" onclick="__onclick__">
+                    <a class="group bx-lnk-cnt bx-stl-mil-sm" href="javascript:void(0)" onclick="__onclick__">
                         <span class="bx-menu-item-icon bx-def-align-center leading-5"><i class="sys-icon ellipsis-h"></i></span>
                     </a>
                 </div>

+ 1 - 1
modules/boonex/events/template/timeline_post.html

@@ -1,6 +1,6 @@
 <div class="vevent bx-tl-item-text">
     <div class="bx-tl-title bx-def-margin-sec-bottom bx-def-font-h3">
-        <a href="__url__" title="__title_attr__" class="summary url bx-tl-title">__title__</a>
+        <a href="__url__" title="__title_attr__" class="summary url bx-lnk-src bx-tl-title">__title__</a>
     </div>
     <bx_if:date>
     <div class="bx-tl-info bx-def-margin-sec-bottom bx-def-font-h3">

+ 1 - 1
modules/boonex/files/template/timeline_post.html

@@ -1,5 +1,5 @@
 <div class="bx-tl-item-text">
     <div class="bx-tl-title bx-def-margin-sec-bottom bx-def-font-h3">
-        <a href="__url__" title="__title_attr__" class="bx-tl-title"><i class="sys-icon __icon__"></i> __title__</a>
+        <a href="__url__" title="__title_attr__" class="bx-tl-title bx-lnk-src"><i class="sys-icon __icon__"></i> __title__</a>
     </div>
 </div>

+ 2 - 2
modules/boonex/forum/template/unit_gallery.html

@@ -1,4 +1,4 @@
-<div onclick="location.href='__content_url__'" class="__class__ bx-base-text-unit bx-forum-unit bx-base-text-unit-gallery bx-def-gal-unit-size flex flex-col w-full p-2 box-border relative inline-block cursor-pointer">
+<div class="__class__ bx-base-text-unit bx-lnk-cnt bx-forum-unit bx-base-text-unit-gallery bx-def-gal-unit-size flex flex-col w-full p-2 box-border relative inline-block cursor-pointer">
     <div class="bg-white dark:bg-gray-800 shadow ring-1 ring-gray-300 dark:ring-gray-700 rounded-md xl:mx-auto h-full">
         <div class="h-full space-y-4 p-1 pb-4 flex flex-col justify-between">
             <bx_if:thumb>
@@ -7,7 +7,7 @@
                 </a>  
             </bx_if:thumb>
             <div class="bx-base-text-unit-title grow-none px-3 mt-4 leading-tight">
-                <a href="__content_url__" title="__summary_attr__" class="leading-tight">__title__</a>
+                <a href="__content_url__" title="__summary_attr__" class="leading-tight bx-lnk-src">__title__</a>
             </div>               
             <bx_if:no_thumb>  
                 <div class="grow relative rounded w-full max-w-full sm:aspect-video overflow-hidden font-normal text-sm  text-gray-500 group-hover:text-gray-600 dark:text-gray-400 dark:group-hover:text-gray-300">

+ 1 - 1
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -2201,7 +2201,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
 
         if(!empty($sUrl) && !empty($sTitle))
             $sTitle = $this->parseLink($sUrl, $sTitle, array(
-            	'class' => $sStylePrefix . '-title',
+            	'class' => $sStylePrefix . '-title bx-lnk-src',
                 'title' => $sTitle
             ));
 

+ 1 - 1
modules/boonex/timeline/template/item_timeline.html

@@ -1,6 +1,6 @@
 <div id="__html_id__" class="__style_prefix__-item __class__ bx-def-thumb-size-min-height bx-def-padding-bottom bx-clearfix">
     <a name="timeline-event-__id__"></a>
-    <div class="__style_prefix__-item-cnt bx-def-box bx-def-padding-topbottom bx-def-round-corners __class_content__">
+    <div class="__style_prefix__-item-cnt bx-lnk-cnt bx-def-box bx-def-padding-topbottom bx-def-round-corners __class_content__">
         <div class="__style_prefix__-blink-plate"></div>
         <bx_if:show_note>
             <div class="__style_prefix__-item-notes">