Skip to content

Instantly share code, notes, and snippets.

View terryupton's full-sized avatar

Terry Upton terryupton

View GitHub Profile
@terryupton
terryupton / status-history.twig
Created February 1, 2022 11:01
Order Status History Craft Commerce
<h3 class="font-semibold mb-3 text-xl">
{{- 'Status History'|t -}}
</h3>
<ol class="space-y-5 text-sm">
{% for history in order.histories %}
<li>
<h5 class="mb-1 inline-block uppercase text-11 border px-1 py-0.5 leading-none text-{{ history.newStatus.color }}-500 border-{{ history.newStatus.color }}-500">
{{- history.newStatus -}}
</h5>
<div class="ml-2">
@terryupton
terryupton / .htaccess
Created December 22, 2021 15:53
HTAccess for Craft Sites 2021
<IfModule mod_rewrite.c>
# ------------------------------------------------------------------------------
# | Exclude directories from the rewrite rules |
# ------------------------------------------------------------------------------
# RewriteRule ^eShots - [L]
# ------------------------------------------------------------------------------
# | Rewrite engine |
# ------------------------------------------------------------------------------
# Turning on the rewrite engine and enabling the `FollowSymLinks` option is
@terryupton
terryupton / craft-updates-to-index.md
Last active December 22, 2021 10:54
Remember to check and update craft index.php and craft files on a regular basis!

Updating vlucas/phpdotenv on 22 December 2021

Wow! So I never knew this...and perhaps it's just me but thought I should put it out there....so I have upgraded to "vlucas/phpdotenv": "^5.4.0" as it seems all of my projects were still on ^2.4.0. What I never realised is that we should also be maintaining the index.php file and the craft files too. As these don't fall into the regular craft updates.

So today, I have just updated the index.php added the new bootstrap.php file and also updated the craft file too - so these all work with "vlucas/phpdotenv": "^5.4.0"

I must ensure I look out for updates on these files in the future. Perhaps everyone already knows this, but I never did until now. 😳

{% set checkboxFieldClasses =
"form-checkbox w-5 h-5 text-green-500" %}
{% if field.type == "checkbox_group" %}
{% set fieldClass = checkboxFieldClasses %}
<div class="mb-2">
{% include 'forms/_default/_partials/_label.twig' %}
{{ field.oneLine ? '<div class="flex flex-wrap">'|raw }}
{% set checkboxFieldClasses =
"form-checkbox w-5 h-5 text-green-500" %}
{% if field.type == "checkbox_group" %}
{% set fieldClass = checkboxFieldClasses %}
<div class="mb-2">
{% include 'forms/_default/_partials/_label.twig' %}
{{ field.oneLine ? '<div class="flex flex-wrap">'|raw }}
{% set checkboxFieldClasses =
"form-checkbox w-5 h-5 text-green-500" %}
{% if field.type == "checkbox_group" %}
{% set fieldClass = checkboxFieldClasses %}
<div class="mb-2">
{% include 'forms/_default/_partials/_label.twig' %}
{{ field.oneLine ? '<div class="flex flex-wrap">'|raw }}
{% set checkboxFieldClasses =
"form-checkbox w-5 h-5 text-green-500" %}
{% if field.type == "checkbox_group" %}
{% set fieldClass = checkboxFieldClasses %}
<div class="mb-2">
{% include 'forms/_default/_partials/_label.twig' %}
{{ field.oneLine ? '<div class="flex flex-wrap">'|raw }}
{% set checkboxFieldClasses =
"form-checkbox w-5 h-5 text-green-500" %}
{% if field.type == "checkbox_group" %}
{% set fieldClass = checkboxFieldClasses %}
<div class="mb-2">
{% include 'forms/_default/_partials/_label.twig' %}
{{ field.oneLine ? '<div class="flex flex-wrap">'|raw }}
{% set checkboxFieldClasses =
"form-checkbox w-5 h-5 text-green-500" %}
{% if field.type == "checkbox_group" %}
{% set fieldClass = checkboxFieldClasses %}
<div class="mb-2">
{% include 'forms/_default/_partials/_label.twig' %}
{{ field.oneLine ? '<div class="flex flex-wrap">'|raw }}
@terryupton
terryupton / modal.twig
Created April 9, 2020 18:18
Ajax Loading a page into a modal with Alpine JS
<section x-data="{showModal: false, html: ''}">
<button
@click="html='loading...'; showLoading = true; showModal = !showModal;
fetch('{{ entry.url }}', {
method: 'GET',
headers: {
'X-Requested-With': 'XMLHttpRequest',
},
})