Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ jobs:
docker compose run --rm phpfpm composer install
docker compose run --rm phpfpm composer coding-standards-check/phpcs

coding-standards-check-markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
docker compose run --rm markdownlint markdownlint '**/*.md'

code-analysis:
runs-on: ubuntu-latest
steps:
Expand All @@ -74,3 +81,22 @@ jobs:
./scripts/rector
- name: Check nothing has changed
run: git diff --exit-code

coding-standards-check-assets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
docker compose run --rm node npm install
docker compose run --rm node npm run coding-standards-apply
docker compose run --rm node npm run coding-standards-check

coding-standards-check-assets-built:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
docker compose run --rm node npm install
docker compose run --rm node npm run build
- name: Check that nothing has changed
run: git diff --exit-code
13 changes: 13 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"default": true,
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md
"line-length": {
"line_length": 120,
"code_blocks": false,
"tables": false
},
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md
"no-duplicate-heading": {
"siblings_only": true
}
}
8 changes: 8 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#ignoring-files
node_modules/
vendor/
LICENSE.md

# Local Variables:
# mode: gitignore
# End:
80 changes: 42 additions & 38 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,70 @@
# ITK Pretix D8 Change Log
All notable changes to this project should be documented in this file.
# ITK pretix changelog

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
All notable changes to this project will be documented in this file.

See ["how do I make a good changelog record?"](https://keepachangelog.com/en/1.0.0/#how)
before starting to add changes.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.3.0] - 2025-02-28

* [PR-73](https://github.com/itk-dev/itk_pretix/pull/73)
Updated npm packages
* [PR-70](https://github.com/itk-dev/itk_pretix/pull/70)
Cleaned up and refactored Code
* [PR-69](https://github.com/itk-dev/itk_pretix/pull/69)
Added “Registration deadline” to date
*[72](https://github.com/itk-dev/itk_pretix/pull/72)
Add drupal 11 compatibility

## 1.2.2

- Allow nullabale pretix client
- Remove circular reference in services
## [1.2.3]

## 1.2.1
* Modified changelog

- Fix bug in order service
## [1.2.2]

## 1.2.0
* Allow nullabale pretix client
* Remove circular reference in services

- Remove cirkular reference
## [1.2.1]

## 1.1.0
* Fix bug in order service

- Make module ready for d-10
- Basic github actions added
- Update php requirements
## [1.2.0]

## 1.0.1 - 1.0.3
* Remove circular reference

- Minor changes.
## [1.1.0]

## 1.0.0
* Make module ready for d-10
* Basic github actions added
* Update php requirements

- Initial release
## [1.0.3]

## Example of change log record
* Minor changes.

```
## [x.x.x] Release name
### Added
- Description on added functionality.
## [1.0.2]

### Changed/Updated
- Description on changed/updated functionality.
* Minor changes.

### Deprecated
- Description of soon-to-be removed features.
## [1.0.1]

### Removed
- Description of removed features.
* Minor changes.

### Fixed
- Decription of bug fixes.
## [1.0.0]

### Security
- Security in case of vulnerabilities.
* Initial release

```
[Unreleased]: https://github.com/itk-dev/itk_pretix/compare/1.3.0...HEAD
[1.3.0]: https://github.com/itk-dev/itk_pretix/compare/1.2.3...1.3.0
[1.2.3]: https://github.com/itk-dev/itk_pretix/compare/1.2.2...1.2.3
[1.2.2]: https://github.com/itk-dev/itk_pretix/compare/1.2.1...1.2.2
[1.2.1]: https://github.com/itk-dev/itk_pretix/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/itk-dev/itk_pretix/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/itk-dev/itk_pretix/compare/1.0.3...1.1.0
[1.0.3]: https://github.com/itk-dev/itk_pretix/compare/1.0.2...1.0.3
[1.0.2]: https://github.com/itk-dev/itk_pretix/compare/1.0.1...1.0.2
[1.0.1]: https://github.com/itk-dev/itk_pretix/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/itk-dev/itk_pretix/releases/tag/1.0.0
35 changes: 27 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ITK Pretix

This Drupal 8 module creates a new field type that enables a link to
https://pretix.eu/ to be made.
<https://pretix.eu/> to be made.

Through the Pretix API it is possible to add, change or remove Pretix
event date entries from the Drupal interface.
Expand Down Expand Up @@ -30,6 +30,16 @@ If the value of `pretix_event_slug_template` is not empty, but `!nid` does not
occur in the value, `-!nid` will be appended and the final template will be
`dev-local-!nid`.

### Drupal base URL

For development, you may want to use a custom base URL for your Drupal site (overriding the base URL Drupal uses). To do
this, set `$settings['itk_pretix']['drupal_base_url']` in your local settings, e.g.

``` php
# settings.local.php
$settings['itk_pretix']['drupal_base_url'] = 'http://example.com:8888';
```

## Exporters

This module exposes a number of event Data exporters that are run via the pretix
Expand All @@ -46,22 +56,24 @@ The available exporters for a node can be run from

## Building assets

We use [Encore](https://symfony.com/doc/current/frontend/encore/installation.html) to build assets.

First, install tools and requirements:

```sh
docker compose run --rm node yarn install
docker compose run --rm node npm install
```

Build for development:
Build during development:

```sh
docker compose run --rm node yarn encore dev --watch
docker compose run --rm node npm run watch
```

Build for production:

```sh
docker compose run --rm node yarn encore production
docker compose run --rm node npm run build
```

## Coding standards
Expand All @@ -82,7 +94,14 @@ docker compose run --rm phpfpm composer coding-standards-check
Apply and check the coding standards in assets by running

```sh
docker compose run --rm node yarn install
docker compose run --rm node yarn coding-standards-apply
docker compose run --rm node yarn coding-standards-check
docker compose run --rm node npm install
docker compose run --rm node npm run coding-standards-apply
docker compose run --rm node npm run coding-standards-check
```

### Markdown

``` sh
docker compose run --rm markdownlint markdownlint '**/*.md' --fix
docker compose run --rm markdownlint markdownlint '**/*.md'
```
File renamed without changes.
1 change: 0 additions & 1 deletion assets/js/exporters.js

This file was deleted.

Empty file removed assets/js/exporters.scss
Empty file.
77 changes: 38 additions & 39 deletions assets/js/form.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,55 @@
/* global fetch, Drupal */
/* global addEventListener, Drupal, fetch */

import '../css/form.scss'
import '../css/form.css'
import 'dawa-autocomplete2/css/dawa-autocomplete2.css'

const $ = require('jquery')
require('jquery-validation')

// IE 11 does not support Object.assign
require('es6-object-assign/auto')
const dawaAutocomplete = require('dawa-autocomplete2')

const buildDawaAutocompleteElements = (context) => {
const addresses = Array.from(context.querySelectorAll('.field--type-pretix-date .js-dawa-element'))
addresses.forEach(address => {
// Check if dawa autocomplete has already been initialized.
if ($(address).closest('.dawa-autocomplete-container').length > 0) {
return
}

// Address autocomplete using https://dawa.aws.dk/.
const addressWrapper = document.createElement('div')
addressWrapper.setAttribute('class', 'dawa-autocomplete-container')
address.parentNode.replaceChild(addressWrapper, address)
addressWrapper.appendChild(address)

dawaAutocomplete.dawaAutocomplete(address, {
select: function (selected) {
fetch(selected.data.href)
.then(function (response) {
return response.json()
})
context
.querySelectorAll('.field--type-pretix-date .js-dawa-element')
.forEach(address => {
// Check if dawa autocomplete has already been initialized.
if (address.closest('.dawa-autocomplete-container')) {
return
}

// Address autocomplete using https://dawa.aws.dk/.
const addressWrapper = document.createElement('div')
addressWrapper.setAttribute('class', 'dawa-autocomplete-container')
address.parentNode.replaceChild(addressWrapper, address)
addressWrapper.appendChild(address)

dawaAutocomplete.dawaAutocomplete(address, {
select: function (selected) {
fetch(selected.data.href)
.then(function (response) {
return response.json()
})
}
})
})
})
}

const buildDateControls = (context) => {
$('.pretix-date-widget.hide-end-date').each(function () {
const $this = $(this)
const $startDate = $(this).find('input[name*="[time_from_value][date]"]')
const $endDate = $(this).find('input[name*="[time_to_value][date]"]')
$startDate.on('change', function () {
if ($this.hasClass('end-date-hidden')) {
$endDate.val($(this).val())
}
document
.querySelectorAll('.pretix-date-widget.hide-end-date')
.forEach(el => {
const startDate = el.querySelector('input[name*="[time_from_value][date]"]')
const endDate = el.querySelector('input[name*="[time_to_value][date]"]')

startDate.addEventListener('change', () => {
if (el.classList.contains('end-date-hidden')) {
endDate.value = startDate.value
}
})

el.classList.add('end-date-hidden')
})
$this.addClass('end-date-hidden')
})
}

$(() => {
Drupal.behaviors.itk_pretix_dawa = {
addEventListener('load', () => {
Drupal.behaviors.itk_pretix = {
attach: (context, settings) => {
buildDawaAutocompleteElements(context)
buildDateControls(context)
Expand Down
8 changes: 0 additions & 8 deletions build/entrypoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@
"js": [
"/build/form.js"
]
},
"exporters": {
"css": [
"/build/exporters.css"
],
"js": [
"/build/exporters.js"
]
}
}
}
1 change: 0 additions & 1 deletion build/exporters.css

This file was deleted.

1 change: 0 additions & 1 deletion build/exporters.js

This file was deleted.

2 changes: 1 addition & 1 deletion build/form.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/form.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions build/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"build/exporters.css": "/build/exporters.css",
"build/exporters.js": "/build/exporters.js",
"build/form.css": "/build/form.css",
"build/form.js": "/build/form.js"
}
5 changes: 5 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ services:
working_dir: /app
volumes:
- .:/app

markdownlint:
image: peterdavehello/markdownlint
volumes:
- .:/md
2 changes: 1 addition & 1 deletion itk_pretix.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'ITK Pretix'
type: module
description: 'A module using pretix API to generate events from field values'
# We're autowiring services and need Drupal 10.2 or newer (cf. https://www.drupal.org/node/3366757)
core_version_requirement: ^10.2
core_version_requirement: ^10.2 || ^11
package: 'ITK'
dependencies:
- drupal:field
2 changes: 1 addition & 1 deletion itk_pretix.install
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function itk_pretix_schema() {
}

/**
* Implements hook_update_N().
* Add registration_deadline_value property.
*/
function itk_pretix_update_10101(&$sandbox) {
_itk_pretix_field_type_add_properties(
Expand Down
Loading