Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate all enhanced leaf texts on route change, store with jotai atom #10

Merged
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fc755d0
Tooltips only on first occurrence on page (use context of View compon…
ksuess Oct 19, 2024
2a96deb
Add testing configuration
ksuess Oct 19, 2024
c3195ce
Remove testing configuration
ksuess Oct 19, 2024
ee7ba4b
Refactor: Calculate texts once on route change and store in redux sta…
ksuess Oct 19, 2024
c38dc55
Add snapshot tests
ksuess Oct 19, 2024
9c83d49
Update mrs.developer.json: Test with 18.0.0-alpha.46
ksuess Oct 21, 2024
42e473f
No tooltips if route is not configured for tooltips
ksuess Oct 21, 2024
2cb30f8
Add changelog entries
ksuess Oct 21, 2024
039fbaa
Fix add mode
ksuess Oct 21, 2024
2fbe4c1
Add policy package
ksuess Oct 22, 2024
353fb36
Fix README
ksuess Oct 22, 2024
5d24599
Some documentation
ksuess Oct 22, 2024
5d5af2d
new policy package
ksuess Oct 22, 2024
ca6ab9f
Update policy package
ksuess Oct 23, 2024
c148353
appExtras : FetchTooltipTerms always, CalculateTexts only if location…
ksuess Oct 23, 2024
967b7ec
Update pnpm-lock.yaml
ksuess Oct 23, 2024
8fac89a
'pnpm install --force' due to build problems of dependencies @plone/r…
ksuess Oct 24, 2024
b9b27c8
Fix edit glossary term
ksuess Oct 24, 2024
2c19eb9
Add backend
ksuess Oct 24, 2024
2a75edb
locales
ksuess Oct 24, 2024
07a12c7
Update pnpm-lock.yaml
ksuess Oct 24, 2024
0bdc6a2
Makefile with backend commands
ksuess Oct 24, 2024
7d26f07
Add collective.glossary to backend
ksuess Oct 24, 2024
4e0588f
Update Makefile
ksuess Oct 24, 2024
7d815fd
Add matchOnlyFirstOccurence to readme.
mauritsvanrees Oct 24, 2024
951d551
Update README.md
ksuess Oct 25, 2024
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
60 changes: 59 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,65 @@ ADDON_NAME='volto-slate-glossary'
help: ## Show this help
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"

# Dev Helpers


###########################################
# Backend
###########################################
.PHONY: backend-install
backend-install: ## Create virtualenv and install Plone
$(MAKE) -C "./backend/" install
$(MAKE) backend-create-site

.PHONY: backend-build
backend-build: ## Build Backend
$(MAKE) -C "./backend/" install

.PHONY: backend-create-site
backend-create-site: ## Create a Plone site with default content
$(MAKE) -C "./backend/" create-site

.PHONY: backend-update-example-content
backend-update-example-content: ## Export example content inside package
$(MAKE) -C "./backend/" update-example-content

.PHONY: backend-start
backend-start: ## Start Plone Backend
$(MAKE) -C "./backend/" start

.PHONY: backend-test
backend-test: ## Test backend codebase
@echo "Test backend"
$(MAKE) -C "./backend/" test

# .PHONY: install
# install: ## Install
# @echo "Install Backend & Frontend"
# if [ -d $(GIT_FOLDER) ]; then $(PRE_COMMIT) install; else echo "$(RED) Not installing pre-commit$(RESET)";fi
# $(MAKE) backend-install
# $(MAKE) frontend-install

# .PHONY: start
# start: ## Start
# @echo "Starting application"
# $(MAKE) backend-start
# $(MAKE) frontend-start

# .PHONY: clean
# clean: ## Clean installation
# @echo "Clean installation"
# $(MAKE) -C "./backend/" clean
# $(MAKE) -C "./frontend/" clean

# .PHONY: check
# check: ## Lint and Format codebase
# @echo "Lint and Format codebase"
# $(PRE_COMMIT) run -a


###########################################
# Frontend
###########################################

.PHONY: install
install: ## Installs the add-on in a development environment
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

Volto Add-On `@rohberg/volto-slate-glossary` adds tooltips for glossary terms of [collective.glossary](https://github.com/collective/collective.glossary)

[![npm](https://img.shields.io/npm/v/volto-slate-glossary)](https://www.npmjs.com/package/@rohberg/volto-slate-glossary)
[![](https://img.shields.io/badge/-Storybook-ff4785?logo=Storybook&logoColor=white&style=flat-square)](https://ksuess.github.io/volto-slate-glossary/)
[![Code analysis checks](https://github.com/ksuess/volto-slate-glossary/actions/workflows/code.yml/badge.svg)](https://github.com/ksuess/volto-slate-glossary/actions/workflows/code.yml)
[![Unit tests](https://github.com/ksuess/volto-slate-glossary/actions/workflows/unit.yml/badge.svg)](https://github.com/ksuess/volto-slate-glossary/actions/workflows/unit.yml)
[![npm](https://img.shields.io/npm/v/@rohberg/volto-slate-glossary)](https://www.npmjs.com/package/@rohberg/volto-slate-glossary)
[![Unit tests](https://github.com/rohberg/volto-slate-glossary/actions/workflows/unit.yml/badge.svg)](https://github.com/rohberg/volto-slate-glossary/actions/workflows/unit.yml)
[![Code analysis checks](https://github.com/rohberg/volto-slate-glossary/actions/workflows/code.yml/badge.svg)](https://github.com/rohberg/volto-slate-glossary/actions/workflows/code.yml)


![Tooltips @rohberg/volto-slate-glossary](https://github.com/rohberg/volto-slate-glossary/raw/main/docs/volto-slate-glossary-tooltips.png)
Expand Down
14 changes: 14 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.editorconfig
.gitattributes
bin
Dockerfile
Dockerfile.acceptance
include
instance
instance.yaml
lib
lib64
Makefile
pyvenv.cfg
var
.venv
54 changes: 54 additions & 0 deletions backend/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Generated from:
# https://github.com/plone/meta/tree/master/config/default
# See the inline comments on how to expand/tweak this configuration file
#
# EditorConfig Configuration file, for more details see:
# http://EditorConfig.org
# EditorConfig is a convention description, that could be interpreted
# by multiple editors to enforce common coding conventions for specific
# file types

# top-most EditorConfig file:
# Will ignore other EditorConfig files in Home directory or upper tree level.
root = true


[*] # For All Files
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# Set default charset
charset = utf-8
# Indent style default
indent_style = space
# Max Line Length - a hard line wrap, should be disabled
max_line_length = off

[*.{py,cfg,ini}]
# 4 space indentation
indent_size = 4

[*.{yml,zpt,pt,dtml,zcml}]
# 2 space indentation
indent_size = 2

[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss,html}] # Frontend development
# 2 space indentation
indent_size = 2
max_line_length = 80

[{Makefile,.gitmodules}]
# Tab indentation (no size specified, but view as 4 spaces)
indent_style = tab
indent_size = unset
tab_width = unset


##
# Add extra configuration options in .meta.toml:
# [editorconfig]
# extra_lines = """
# _your own configuration lines_
# """
##
22 changes: 22 additions & 0 deletions backend/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated from:
# https://github.com/plone/meta/tree/master/config/default
# See the inline comments on how to expand/tweak this configuration file
[flake8]
doctests = 1
ignore =
# black takes care of line length
E501,
# black takes care of where to break lines
W503,
# black takes care of spaces within slicing (list[:])
E203,
# black takes care of spaces after commas
E231,

##
# Add extra configuration options in .meta.toml:
# [flake8]
# extra_lines = """
# _your own configuration lines_
# """
##
51 changes: 51 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Generated from:
# https://github.com/plone/meta/tree/master/config/default
# See the inline comments on how to expand/tweak this configuration file
# python related
*.egg-info
*.pyc
*.pyo

# tools related
build/
.coverage
coverage.xml
dist/
docs/_build
__pycache__/
.tox
.vscode/
node_modules/

# venv / buildout related
bin/
develop-eggs/
eggs/
.eggs/
etc/
.installed.cfg
include/
lib/
lib64
.mr.developer.cfg
parts/
pyvenv.cfg
var/

# mxdev
/instance/
/.make-sentinels/
/*-mxdev.txt
/reports/
/sources/
/venv/
.installed.txt
.lock

##
# Add extra configuration options in .meta.toml:
# [gitignore]
# extra_lines = """
# _your own configuration lines_
# """
##
94 changes: 94 additions & 0 deletions backend/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Generated from:
# https://github.com/plone/meta/tree/master/config/default
# See the inline comments on how to expand/tweak this configuration file
ci:
autofix_prs: false
autoupdate_schedule: monthly

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.14.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/collective/zpretty
rev: 3.1.0
hooks:
- id: zpretty

##
# Add extra configuration options in .meta.toml:
# [pre_commit]
# zpretty_extra_lines = """
# _your own configuration lines_
# """
##
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8

##
# Add extra configuration options in .meta.toml:
# [pre_commit]
# flake8_extra_lines = """
# _your own configuration lines_
# """
##
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli

##
# Add extra configuration options in .meta.toml:
# [pre_commit]
# codespell_extra_lines = """
# _your own configuration lines_
# """
##
- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
hooks:
- id: check-manifest
- repo: https://github.com/regebro/pyroma
rev: "4.2"
hooks:
- id: pyroma
- repo: https://github.com/mgedmin/check-python-versions
rev: "0.21.3"
hooks:
- id: check-python-versions
args: ['--only', 'setup.py,pyproject.toml']
- repo: https://github.com/collective/i18ndude
rev: "6.1.0"
hooks:
- id: i18ndude


##
# Add extra configuration options in .meta.toml:
# [pre_commit]
# i18ndude_extra_lines = """
# _your own configuration lines_
# """
##


##
# Add extra configuration options in .meta.toml:
# [pre_commit]
# extra_lines = """
# _your own configuration lines_
# """
##
10 changes: 10 additions & 0 deletions backend/CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

<!--
You should *NOT* be adding new change log entries to this file.
You should create a file in the news directory instead.
For helpful instructions, please see:
https://github.com/plone/plone.releaser/blob/master/ADD-A-NEWS-ITEM.rst
-->

<!-- towncrier release notes start -->
3 changes: 3 additions & 0 deletions backend/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Contributors

- Plone Foundation [collective@plone.org]
41 changes: 41 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# syntax=docker/dockerfile:1
ARG PLONE_VERSION=6.0.13
FROM plone/server-builder:${PLONE_VERSION} as builder

WORKDIR /app


# Add local code
COPY scripts/ scripts/
COPY . src

# Install local requirements and pre-compile mo files
RUN <<EOT
set -e
bin/pip install mxdev uv
mv src/requirements-docker.txt src/requirements.txt
sed -i 's/-e .\[test\]/./g' src/mx.ini
cd /app/src
# remove potentially existing virtualenv from local build
rm -rf .venv
../bin/mxdev -c mx.ini
../bin/uv pip install -r requirements-mxdev.txt
../bin/python /compile_mo.py
cd /app
rm -Rf src/
EOT

FROM plone/server-prod-config:${PLONE_VERSION}

LABEL maintainer="Plone Foundation <collective@plone.org>" \
org.label-schema.name="project-title-backend" \
org.label-schema.description="Project Title backend image." \
org.label-schema.vendor="Plone Foundation"

# Copy /app from builder
COPY --from=builder /app /app

RUN <<EOT
set -e
ln -s /data /app/var
EOT
Loading