Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/issue-1729
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Service/Cache.php
  • Loading branch information
hansmorb committed Feb 6, 2025
2 parents 9f3609e + ed0ac9e commit e2610b7
Show file tree
Hide file tree
Showing 151 changed files with 8,046 additions and 7,490 deletions.
3 changes: 2 additions & 1 deletion .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ project.json
README.md
tsconfig.*
webpack.config.js
phpstan.neon
phpstan.neon
phpstan-baseline.neon
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# .git-blame-ignore-revs
# Apply phpcbf to entire codebase
59340f68fb9c6d6e680ac3ad40a3d095e98837a6
19 changes: 17 additions & 2 deletions .github/actions/build-plugin/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: 'Build Plugin'
description: 'Builds plugin into ./build/commonsbooking'

inputs:
generate_zip:
description: 'Set to true, if a zip file should be generated in the root of the plugin folder'
required: false
default: 'false'
options:
- true
- false

runs:
using: "composite"
steps:
Expand Down Expand Up @@ -30,6 +39,12 @@ runs:
- run: npm ci --legacy-peer-deps --include=dev
shell: bash

- name: Run build script
- name: Run build script (skip zip generation)
if: ${{ inputs.generate_zip == 'false' }}
run: bin/build-zip.sh --skip-zip
shell: bash
shell: bash

- name: Run build script and generate zip file
if: ${{ inputs.generate_zip == 'true' }}
run: bin/build-zip.sh
shell: bash
52 changes: 52 additions & 0 deletions .github/workflows/zip-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build zip from PR
on:
pull_request:
branches:
- 'master'

jobs:
zip-pr:
runs-on: ubuntu-20.04
steps:

- uses: actions/checkout@v4
with:
fetch-depth: 0 # Important for getting full commit history

- name: Update Version Comment
run: |
sed -i "s|define('COMMONSBOOKING_VERSION_COMMENT',.*|define('COMMONSBOOKING_VERSION_COMMENT', '${{ github.head_ref }} at ${{ github.event.pull_request.head.sha}}');|" commonsbooking.php
- uses: ./.github/actions/build-plugin
with:
generate_zip: 'true'

- name: Upload zip
uses: SamKirkland/[email protected]
with:
exclude: |
**
! commonsbooking.zip
server: ${{ secrets.CBZIPUPLOAD_SERVER }}
username: ${{ secrets.CBZIPUPLOAD_USER }}
password: ${{ secrets.CBZIPUPLOAD_KEY }}
server-dir: ${{ github.event.number }}/
dangerous-clean-slate: true
protocol: ftps

- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Download built plugin zip

- name: Create or update comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
[Download built plugin zip](https://builds.commonsbooking.org/${{ github.event.number }}/commonsbooking.zip)
[Test Plugin in Wordpress Playground](https://playground.wordpress.net/#{%22steps%22:[{%22step%22:%22installPlugin%22,%22pluginData%22:{%22resource%22:%22url%22,%22url%22:%22https://builds.commonsbooking.org/${{ github.event.number }}/commonsbooking.zip%22}},{%22step%22:%22importWxr%22,%22file%22:{%22resource%22:%22url%22,%22url%22:%22https://raw.githubusercontent.com/wielebenwir/commonsbooking/refs/heads/master/tests/cypress/wordpress-files/content-example.xml%22}}],%22preferredVersions%22:{%22php%22:%227.4%22,%22wp%22:%22latest%22},%22login%22:true})
edit-mode: replace
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ CommonsBooking is a plugin for the management and booking of common goods. This
1. Make sure that composer is installed on your system
2. Navigate into your wp-content/plugins directory
3. Open a terminal and run `git clone https://github.com/wielebenwir/commonsbooking`
4. cd into the directory commonsbooking and run `composer install`
> This might fail, if you don't have the PHP extension [uopz](https://www.php.net/manual/en/book.uopz.php) installed. Try running `composer install --no-dev` if you just quickly want to test a specific branch without installing the extension.
4. cd into the directory commonsbooking and run `npm start`
> This might fail, if you don't have the PHP extension [uopz](https://www.php.net/manual/en/book.uopz.php) installed. Try running `composer install --no-dev && npm install && npm run dist` if you just quickly want to test a specific branch without installing the extension.
5. Activate the plugin in the plugins dashboard

## Contribute
Expand Down
10 changes: 10 additions & 0 deletions TECHNICAL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### Formatter

We use .git-blame-ignore-revs to track repo-wide cosmetic refactorings by auto format tools like prettier/phpcbf.
See [Github Documentation](https://docs.github.com/de/repositories/working-with-files/using-files/viewing-and-understanding-files#ignore-commits-in-the-blame-view)

You can also configure your local git so it always ignores the revs in that file:

```bash
git config blame.ignoreRevsFile .git-blame-ignore-revs
```
12 changes: 8 additions & 4 deletions assets/admin/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
let startTimeInput = $("#repetition-start_time");
let endTimeInput = $("#repetition-end_time");
let preserveManualCode = false;
let itemInput = $("#item-id");
let locationInput = $("#location-id");
let startDateInput = $("#repetition-start_date");
let bookingCodeInput = $("#_cb_bookingcode");
let allExist = [ fullDayCheckbox, startTimeInput, endTimeInput, itemInput, locationInput, startDateInput, bookingCodeInput ].every(domElement => domElement.length === 1);
if (!allExist) {
return;
}
fullDayCheckbox.on("change", function(event) {
if (fullDayCheckbox.is(":checked")) {
startTimeInput.val("00:00");
Expand All @@ -17,10 +25,6 @@
}
});
fullDayCheckbox.trigger("change");
let itemInput = $("#item-id");
let locationInput = $("#location-id");
let startDateInput = $("#repetition-start_date");
let bookingCodeInput = $("#_cb_bookingcode");
itemInput.on("change", function(event) {
let data = {
itemID: itemInput.val()
Expand Down
2 changes: 1 addition & 1 deletion assets/admin/js/admin.min.js

Large diffs are not rendered by default.

21 changes: 15 additions & 6 deletions assets/admin/js/src/booking.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@
let startTimeInput = $('#repetition-start_time');
let endTimeInput = $('#repetition-end_time');
let preserveManualCode = false;
let itemInput = $('#item-id');
let locationInput = $('#location-id');
let startDateInput = $('#repetition-start_date');
let bookingCodeInput = $('#_cb_bookingcode');

// check if this is loaded on right kind of backend page
let allExist = [
fullDayCheckbox, startTimeInput, endTimeInput, itemInput, locationInput, startDateInput, bookingCodeInput
].every(domElement => domElement.length === 1);

if (!allExist) {
// return early to prevent ajax calls with incorrect parameters
return;
}

fullDayCheckbox.on('change', function (event) {
if (fullDayCheckbox.is(':checked')) {
startTimeInput.val('00:00');
Expand All @@ -18,12 +33,6 @@
});
fullDayCheckbox.trigger('change');


let itemInput = $('#item-id');
let locationInput = $('#location-id');
let startDateInput = $('#repetition-start_date');
let bookingCodeInput = $('#_cb_bookingcode');

itemInput.on('change', function (event) {
let data = {
itemID: itemInput.val(),
Expand Down
36 changes: 18 additions & 18 deletions composer.lock

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

Loading

0 comments on commit e2610b7

Please sign in to comment.