[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] [BP][FIX] Calendars: Adjust preview close button behavior and hide calendar_header in preview mode

"Alvin Bauma \(@alvinBM\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a8d870e629b8_382b2661c9793c@gitlab-sidekiq-low-urgency-cpu-bound-v2-7f4b5767d6-6xdtc.mail>

Alvin Bauma pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki


Commits:
dbe10cc1 by Alvin Bauma at 2026-08-25T14:14:03+02:00
[BP][FIX] Calendars: Adjust preview close button behavior and hide calendar_header in preview mode
---
* rebase

See merge request tikiwiki/tiki!11054

- - - - -


2 changed files:

- lib/jquery_tiki/tiki-calendar_edit_item.js
- templates/calendar/view_item.tpl


Changes:

=====================================
lib/jquery_tiki/tiki-calendar_edit_item.js
=====================================
@@ -169,6 +169,7 @@ function handleEditCalendarItem() {
         if (btnName === "preview") {
             // also used when changing calendars to reload the form
             var $disabled = $form.find('select:disabled');
+            $form.find("#act").val("preview");
             $disabled.removeAttr('disabled');
             var params = $form.serialize();
             $disabled.attr('disabled', 'disabled');
@@ -271,6 +272,7 @@ function handleEditCalendarItem() {
     };
 
     const previewExecutor = delayedExecutor(500, function ($form) {
+        $form.find("#act").val("preview");
         $.post(
             $.service("calendar", "view_item"),
             $form.serialize(),
@@ -299,10 +301,16 @@ function handleEditCalendarItem() {
     });
 
     $(document).on("click", ".edit-event-form .preview .btn-close", function () {
+        // slideUp() (jQuery core, called just below) is what adds the inline style
+        // removed here: it animates height/overflow via inline styles and, on
+        // completion, leaves style="display: none;" on the element. Nothing else
+        // in this codebase sets an inline style on .preview, so removeAttr("style")
+        // fully undoes slideUp()'s effect, restoring the element to its initial
+        // "d-none" (class-only) hidden state instead of mixing it with an inline style.
         $(this).closest(".preview").slideUp(
             function () {
                 // put it back to how it was on page load
-                $(this).show().addClass("d-none");
+                $(this).removeAttr("style").addClass("d-none");
             }
         );
     });


=====================================
templates/calendar/view_item.tpl
=====================================
@@ -5,10 +5,32 @@
 {/block}
 
 {block name="content"}
-    {include 
-        file='calendar_header.tpl'
-        viewlist='listEventView'
-    }
+    {if not $modal and not $preview}
+        {include
+            file='calendar_header.tpl'
+            viewlist='listEventView'
+        }
+    {/if}
+
+    {if not $preview}
+        {include file='calendar_header.tpl' viewlist='listEventView'}
+
+        <div class="float-end">
+            {permission name='change_events' type='calendaritem' object=$calitem.calitemId}
+                <a href="{service controller='calendar' action='edit_item' calitemId=$calitem.calitemId|escape}" class="btn btn-primary edit-calendar-item-btn">
+                    {tr}Edit{/tr}
+                </a>
+            {/permission}
+            {if $tiki_p_add_events eq 'y'}
+                <a 
+                    href="{service controller='calendar' action='edit_item' calitemId=0 copy_from=$calitem.calitemId|escape modal=1 return_url='tiki-calendar.php'}"
+                    class="btn btn-light edit-calendar-item-btn cleanable-false"
+                    title="{tr}Create a new event based on this one{/tr}">
+                    {icon name='copy'} {tr}Duplicate{/tr}
+                </a>
+            {/if}
+        </div>
+    {/if}
   
     <h5 class="mt-3 mb-3">{tr}Title{/tr} : {$calitem.parsedName}</h5>
     <div class="summary mb-4">



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/dbe10cc1cc66713ada2e2ecdfdbaaea3b61b7fad

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/dbe10cc1cc66713ada2e2ecdfdbaaea3b61b7fad
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.