Skip to content

Conversation

@backportbot-libresign
Copy link

@backportbot-libresign backportbot-libresign bot commented Dec 5, 2025

Backport of #6006

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

Update to latest version which includes:
- initialScale prop for setting initial zoom level
- @scale-changed event for zoom updates
- @pdf-editor:ready event for initialization

Signed-off-by: Vitor Mattos <[email protected]>
- Auto-save footer template with 500ms debounce
- Live PDF preview with zoom controls
- Persistent zoom level using AppConfig
- Reset to default functionality
- Uses VuePdfEditor v1.5.0 events to eliminate workarounds
- Dynamic textarea height adjustment

Signed-off-by: Vitor Mattos <[email protected]>
Replace inline footer template editing with dedicated component
providing better UX with live preview and zoom controls

Signed-off-by: Vitor Mattos <[email protected]>
Store zoom level preference for footer template preview

Signed-off-by: Vitor Mattos <[email protected]>
- Add footer_preview_width (default: 595)
- Add footer_preview_height (default: 80)
- Used by FooterTemplateEditor component for preview dimensions

Signed-off-by: Vitor Mattos <[email protected]>
- Add width and height controls with validation (100-2000, 10-500)
- Add reset button for dimensions (UndoVariant icon)
- Implement auto-save with debounce (500ms)
- Delete AppConfig keys when dimensions are default (595x80)
- Add watchers for dimension changes to regenerate PDF
- Separate saveDimensions() method for cleaner logic
- Show reset button only when dimensions differ from default
- Fix containerHeight variable naming conflict

Signed-off-by: Vitor Mattos <[email protected]>
- Remove inline SPDX comment from footer.twig template
- Add lib/Handler/Templates/footer.twig to REUSE.toml annotations

Signed-off-by: Vitor Mattos <[email protected]>
- Add [email protected] for code editing
- Add [email protected] for syntax highlighting
- Required for CodeEditor component with Twig support

Signed-off-by: Vitor Mattos <[email protected]>
- Create reusable CodeEditor component using vue-codemirror
- Add Twig mode for syntax highlighting
- Enable bracket matching and auto-close
- Use Material theme integrated with Nextcloud colors
- Support line numbers, line wrapping, and auto-indent

Signed-off-by: Vitor Mattos <[email protected]>
- Replace simple textarea with CodeEditor component
- Add syntax highlighting for Twig templates
- Remove manual textarea resize logic (CodeMirror handles it)
- Improve developer experience with professional code editor

Signed-off-by: Vitor Mattos <[email protected]>
- Add IL10N dependency injection for translations
- Replace const ALLOWED_VARIABLES with instance property
- Add initializeVariablesMetadata() method with full metadata
- Add getVariablesMetadata() method returning associative array
- Include type, description, example, and optional default for each variable
- Add defaults for signedBy, linkToSite, and validateIn variables
- Update tests with IL10N mock and comprehensive coverage
- Add DataProviders for testing defaults and types

Signed-off-by: Vitor Mattos <[email protected]>
- Add TemplateVariables as constructor parameter
- Remove manual instantiation with 'new TemplateVariables()'
- Add getTemplateVariablesMetadata() method exposing metadata
- Update tests to use real TemplateVariables instance instead of mock
- Test getTemplateVariablesMetadata returns complete metadata structure

Signed-off-by: Vitor Mattos <[email protected]>
- Add getTemplateVariablesMetadata() method delegating to FooterHandler
- Update tests to validate metadata retrieval
- Fix UUID regex in preview tests to match new format (36 chars with hyphens)

Signed-off-by: Vitor Mattos <[email protected]>
- Add GET /api/v1/admin/footer-template/variables endpoint
- Return complete metadata for all available Twig variables
- Include type, description, example, and optional default values
- Add NoCSRFRequired attribute for read-only endpoint
- Document response schema with psalm annotations

Signed-off-by: Vitor Mattos <[email protected]>
- Add getFooterTemplateVariables endpoint to OpenAPI specs
- Generate TypeScript types for template variables metadata
- Document response schema with variable metadata structure
- Update both administration and full API specifications

Signed-off-by: Vitor Mattos <[email protected]>
- Add space after fn in arrow function callback

Signed-off-by: Vitor Mattos <[email protected]>
- Add FooterService injection to Admin settings
- Provide footer_template_variables in initial state
- Remove API endpoint getFooterTemplateVariables (no longer needed)
- Update OpenAPI specs removing the endpoint
- Variables now loaded at page load instead of via separate API call

Signed-off-by: Vitor Mattos <[email protected]>
- Add label prop to display accessible label for screen readers
- Generate unique ID for editor instance
- Bind label to editor via for attribute

Signed-off-by: Vitor Mattos <[email protected]>
- Add dialog with list of available Twig template variables
- Display variable metadata: type, description, example, default value
- Implement click-to-copy functionality with icon feedback
- Use NcFormBoxButton for consistent UI with Nextcloud standards
- Variables loaded via initial state for performance
- Icon changes from copy to check mark for 2 seconds after copying
- Fallback to prompt() if Clipboard API unavailable

Signed-off-by: Vitor Mattos <[email protected]>
- Add footer_template to initial state
- Add footer_template_is_default to initial state
- Update footer_preview_height default from 80 to 100
- Eliminates extra API call on settings page load

Signed-off-by: Vitor Mattos <[email protected]>
- Clarify that empty template parameter resets to default
- Document width and height parameters with defaults
- Add response type annotations

Signed-off-by: Vitor Mattos <[email protected]>
- Add FooterTemplateEditor component with Twig template editor
- Implement template variables helper dialog with click-to-copy
- Add preview controls (zoom, width, height) with reset functionality
- Display variable metadata (type, description, example, default)
- Use constants for default dimensions (595x100)
- Integrate with Validation settings via template-reset event
- Load template data from initial state to avoid extra API call

Signed-off-by: Vitor Mattos <[email protected]>
- Return preview_width and preview_height in response
- Update PHPDoc return type annotation
- Regenerate OpenAPI specs

Signed-off-by: Vitor Mattos <[email protected]>
Signed-off-by: Vitor Mattos <[email protected]>
- Add FooterService to test dependencies

- Fix constructor argument count mismatch

Signed-off-by: Vitor Mattos <[email protected]>

[skip ci]
@vitormattos vitormattos marked this pull request as ready for review December 5, 2025 14:01
@vitormattos vitormattos merged commit 8ef6026 into stable31 Dec 5, 2025
62 checks passed
@vitormattos vitormattos deleted the backport/6006/stable31 branch December 5, 2025 14:14
@github-project-automation github-project-automation bot moved this from 0. Needs triage to 4. to release in Roadmap Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 4. to release

Development

Successfully merging this pull request may close these issues.

2 participants