Skip to content

Instantly share code, notes, and snippets.

View markocupic's full-sized avatar
🏳️‍🌈
#StandWithUkraine

Marko Cupic markocupic

🏳️‍🌈
#StandWithUkraine
View GitHub Profile
@markocupic
markocupic / news_card.html.twig
Last active March 19, 2024 19:36
News Template for Contao 5x with AOS
<div class="news_card{{ class|default('') }}" data-aos="fade-down" data-aos-duration="600" data-aos-once="true" data-aos-anchor-placement="top-bottom" itemscope itemtype="http://schema.org/Article">
<div class="card">
{% if addImage|default %}
<a href="{{ insert_tag('news_url::'~id) }}" title="weiterlesen">
{% set picture = picture|merge({"alt": headline}) %}
<div class="image-zoom-in">
{% include '@Contao/picture_default' with picture %}
</div>
</a>
{% endif %}
@markocupic
markocupic / gal_col4_bs.html.twig
Last active March 19, 2024 20:27
Galery Template for Contao 5.x
{# Speichere dieses Template unter contao/templates/twig/content_element/gallery/gal_col4_bs.html.twig #}
{# Das Template wird dann im Inhaltselement Galerie verfügbar sein unter dem Namen "content_element/gallery/gal_col4_bs.html.twig #}
{# Vergiss nicht die .twig-root dotfile in contao/templates/twig/ abzulegen und den Contao cache neu aufzubauen #}
{% extends "@Contao/content_element/_base.html.twig" %}
{% use "@Contao/component/_list.html.twig" %}
{% use "@Contao/component/_figure.html.twig" %}
{# Ein weiteres Galerie Template für Contao 5. Als Vorlage dient das Galerie Core Template vendor/contao/core-bundle/contao/templates/twig/content_element/gallery.html.twig #}
@markocupic
markocupic / google_maps_cookiebar.html.twig
Last active March 10, 2024 22:25
Google Maps Cookiebar Script (Twig Template) for CONTAO CMS
{#
1. Store this file in the contao/templates/_new/content_element/template folder.
2. Don't forget to add an empty .twig-root file to the "contao/templates/_new" folder.
3. Clear the cache
Configuration:
a) Set the target id
b) Set your cookiebar markup
a)
@markocupic
markocupic / asyn_await_with_transitions.html
Last active July 20, 2023 22:52
async await with transitions
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
#outerBox {
display: inline-flex;
flex-wrap: wrap;
width: 100%;
@markocupic
markocupic / async_await_stack
Last active January 5, 2023 11:28
Demo: auto invocated javascript async await stack with promises
(async () => {
await (() => {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log('first');
resolve('first');
}, 5000);
});
})();
@markocupic
markocupic / vuejs_with_async_and_await.html
Last active November 16, 2022 22:22
Vue application example with async and await
<!DOCTYPE html>
<html>
<head>
<style>
#myVueAppInner {
transition: opacity 1.4s linear 0.2s;
opacity: 0;
}
#myVueAppInner[data-show-app="true"] {
@markocupic
markocupic / mod_navigation_bootstrap_navbar.html5
Last active August 27, 2022 20:16
Bootstrap 5 dropdown navbar template set for Contao 5.x
<!-- https://gist.github.com/markocupic/9fa8fbd4451b4cf57e81654ffc6fe814 -->
<!-- indexer::stop -->
<nav class="navbar navbar-expand-lg navbar-light bg-light <?= $this->class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>>
<div class="container-fluid">
<a class="navbar-brand" href="./">
<img src="https://getbootstrap.com/docs/5.2/assets/brand/bootstrap-logo.svg" alt="" width="30" height="24" class="d-inline-block align-text-top">
<?php if ($this->headline): ?><?= $this->headline ?><?php endif; ?>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
@markocupic
markocupic / nav_bs_dropdown_navbar.html.twig
Last active May 13, 2023 09:44
Contao navigation template supports bootstrap 5 dropdowns (www.sac-pilatus.ch)
{# https://gist.github.com/markocupic/b81df49ae8a832c1b82c1178936fff5d #}
{% set levelClass = level %}
{% if level == 'level_2' %}
<div class="dropdown-menu">
<div class="dropdown-menu-grid-container">
{% endif %}
<ul class="{{ levelClass }}">
@markocupic
markocupic / SendNotificationMessage.php
Last active August 7, 2021 21:59
Use terminal42/contao-notification_center to send messages when using markocupic/calendar-event-booking-bundle. Store these two files in src/EventListener respectively in contao/config. The Hook will transform a file uuid to a file path. Thus the file will be attached to the notification.
<?php
// src/EventListener/SendNotificationMessage.php
declare(strict_types=1);
namespace App\EventListener;
use Contao\CoreBundle\ServiceAnnotation\Hook;
use Contao\FilesModel;
use NotificationCenter\Model\Message;
@markocupic
markocupic / tl_calendar_events_member.php
Last active July 29, 2021 10:16
Extending tl_calendar_events_member.php
<?php
// For contao > 4.4:
// For extending your dca, store your custom dca file in: TL_ROOT/contao/dca/tl_calendar_events_member.php
use Contao\CoreBundle\DataContainer\PaletteManipulator;
PaletteManipulator::create()
->addField(
['mycustom1', 'mycustom2'],
'notes_legend',