76 Commits

Author SHA1 Message Date
Kabiru Mwenja 499d7820a2 Add render_mode flag and MailFormattingHelper
`format_text` accepts `render_mode:` (`:in_app_html`, `:external_html`,
`:external_text`), which resolves the `only_path`, `static_html` and
`plain_text` context flags as a set. External surfaces (mailer HTML
body, future RSS/PDF/webhook) need absolute URLs and static rendering
together; pinning the trio at the public API keeps callers from
forgetting one. Explicit primitive kwargs still override.

`MailFormattingHelper` exposes `format_mail_html` and `format_mail_text`
thin wrappers around `format_text(render_mode:)`. The `_html` / `_text`
suffix matches the `.html.erb` / `.text.erb` template extension so
caller intent stays visible in the view, with no introspection of
`formats`.

The five WorkPackageMailer view sites use the helpers; `_work_package_details`,
`mentioned.html`, `mentioned.text`, `watcher_changed.html`, `watcher_changed.text`
drop the `static_html:`/`only_path:`/`plain_text:` boilerplate.
2026-05-27 13:04:26 +03:00
Alexander Brandon Coles bd9bdab748 Fix #format_text to return HTML-safe empty strings 2025-05-27 11:22:22 +01:00
Alexander Brandon Coles 0e74294319 Rework Renderer#text_format to use keyword params 2025-05-27 11:03:09 +01:00
Alexander Brandon Coles cf5c4f752d Rewrite #format_text to use keyword params 2025-05-27 11:03:09 +01:00
Alexander Brandon Coles 8748ab6e09 Document OpenProject::TextFormatting 2025-05-27 10:25:37 +01:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
ulferts 3b2121f733 Revert "Merge remote-tracking branch 'origin/release/13.4' into dev"
This reverts commit 40b2bbeb09, reversing
changes made to b4c6cb17cc.
2024-03-21 11:31:17 +01:00
Ivan Kuchin 7787e457a3 Revert "Merge branch 'dev' into release/13.4"
This reverts commit a901541269, reversing
changes made to e573ca00b7.
2024-03-20 20:19:08 +01:00
Ivan Kuchin 9e4934cd0a change quotes using rubocop --only Style/StringLiterals,Style/QuotedSymbols -a 2024-03-20 18:05:22 +01:00
Christophe Bliard c795874f7f Update copyright year for 2024
command used: `rg -l 'Copyright \(C\) 2012-202\d the OpenProject' | xargs -n 100 sed -i -r 's/Copyright \(C\) 2012-202. the OpenProject/Copyright (C) 2012-2024 the OpenProject/'`
2024-01-02 16:23:54 +01:00
Christophe Bliard 21a696ef9b Update copyright information for 2023 2022-12-30 15:51:26 +01:00
Christophe Bliard 48a4f1b6ad lint with rubocop --autocorrect (safe cops only) 2022-06-02 10:40:10 +02:00
Christophe Bliard a33524ef6d remove ruby magic comment for utf-8
ruby interprets source encoding as utf-8 since 2.0.0, making magic comment redundant and useless
2022-03-10 19:36:58 +01:00
Christophe Bliard bc8d423ec2 update copyright information for 2022 2022-03-01 17:05:59 +01:00
Oliver Günther ccfa29c728 Move license and copyright docs to root, fix names and references 2021-09-02 21:50:46 +02:00
ulferts 1bdd2ab9ae safe automatic fixes by rubocop (#8994) 2021-02-11 16:02:18 +01:00
ulferts 6140f4c7e9 update copyright to 2021 (#8925)
Updates the copyright to 2021 for all files that have a copyright. Files in our source code without the copyright header still do not receive one automatically. Additionally, backlisted files are also excluded.

Previously the copyright of chiliproject which references redmine stated a copyright of redmine up to and including 2017 which is not true for the code we have in here. Because of that I changed that to 2013
2021-01-13 17:47:45 +01:00
Henriette Dinger bd7f4e4814 Update copyright notice 2020-01-15 11:31:26 +01:00
Jens Ulferts 319f33e924 remove textile 2018-07-17 12:14:51 +02:00
Oliver Günther e7af788a3c [27955] Add include wiki page macro in markdown / ckeditor
https://community.openproject.com/projects/openproject/work_packages/27955
2018-07-05 13:31:28 +02:00
Oliver Günther cdbf49c208 Upgrade at.js 2018-02-28 20:31:49 +01:00
Oliver Günther d036f3a470 Don't descend when rendering ### links 2018-02-22 15:43:34 +01:00
Oliver Günther ea45a2194d Fix legacy formatting module 2018-02-12 15:38:06 +01:00
Oliver Günther 688648581e Introduce pattern matcher pipeline filter 2018-02-12 15:38:05 +01:00
Oliver Günther 0cebd23863 Switchable markdown setting 2018-02-12 15:38:05 +01:00
Oliver Günther daaf6e1bc2 Introduce commonmark and html-pipeline 2018-02-12 15:38:04 +01:00
Oliver Günther 6ef4211e77 Bump copyright to 2018 (#6171)
[ci skip]
2018-02-12 08:51:12 +01:00
Oliver Günther 7a1896bb55 Unsafe anchor URL generation in text formatting (#6143)
[ci skip]
2018-01-22 07:20:51 +01:00
Oliver Günther 1fe4891ff6 [26868] Treat svg as inline-able attachment
https://community.openproject.com/wp/26868

[ci skip]
2018-01-16 07:44:03 +01:00
Wieland Lindenthal 4e22681e78 User mentions feature (#5897)
* Extend syntax for linking users via their ID

* Allow login names for linking user profiles.

* User require_relative for legacy tests

* Add specs for login name based user links; Fixes other specs, too.

* Notify mentioned users

* Notify linked users;

 - require quotes for login names in user links as login names can
contain spaces, dots that are typical word boundaries
- Adding specs

* For the decision who gets notified due to mentions only the visibility permissions of the recipient are relevant.

* Rubucop satisfaction

* Add autocomplete for user names to work pack package descriptions and activity

- Uses API V3 Principals endpoint.
- Extends API endpoint with name filter and name order.
- Make it activate when user types an "@" or a "user#"
- Still for work packages only.

* Directly show a list of users after typing '@' and allow navigating list with cursor keys

* Add an '@' before the rendered user link

* Adopting spec as WP autocompleter now expects whitespace before hash sign

* Adding spec for using user autocompleter

* Introduce magic pageSize of 0 for maximum length

* Add id filter for principals

* Allow pagination for principals and protect from falling back to a too low default value

* Fixing specs

* fixing typo in spec

* Add magic number 0 for user custom fields

* Add a toParams method for ApiV3FilterBuilder

* User ApiV3FilterBuilder in path helper service

* Add test for mentions principals to path helper

* WIP

* Convert auto complete helper to TS

[ci skip]
2017-09-12 15:47:09 +02:00
Oliver Günther 7cf11bb689 Update copyright notice 2017-01-10 15:11:43 +01:00
Oliver Günther cd378f458b Execute macros as secondary rule in TextFormatting
This allows us to move this into the block of `parse_non_pre_blocks`.
2016-11-22 10:02:54 +01:00
Oliver Günther 4d694c70b5 [24332] Avoid macro expansion inside pre/code tags
https://community.openproject.com/work_packages/24332
2016-11-21 16:27:41 +01:00
Oliver Günther 60cbf95b44 Fix escaping angular expressions when in isolated scope
Isolated scopes do not inherit from rootScope and thus do not have
`DOUBLE_LEFT_CURLY_BRACE`.

However, every scope has a reference to the rootScope with
`scope.$root` (https://docs.angularjs.org/api/ng/type/$rootScope.Scope)
2016-11-14 13:27:45 +01:00
cklein cb56985929 Improve rendering of wiki toc for multi line headings
https://community.openproject.com/work_packages/24244
2016-11-09 08:37:52 +01:00
Jens Ulferts 571b2098c7 Merge branch 'release/6.0' into dev 2016-10-06 11:17:09 +02:00
Oliver Günther 92f9f8f6ad Avoid double escaping when using nested format_text
Macros such as `macro_list(wiki)` will call format_text within the macro
expansion, which will cause escaped angular braces to be escaped twice.
2016-09-07 11:57:17 +02:00
Jens Ulferts 3246747ae0 adapt to newly introduced query 2016-08-25 10:27:33 +02:00
Oliver Günther c5acedb1eb Let text_formatter write the slug as a link 2016-07-27 11:03:18 +02:00
Oliver Günther 9a34fe27c7 Migrate wiki titles to URL slugs
Wiki titles in 6.0 can contain ANY character, which is causing issues
for specific characters processed by textile and CGI-escaped before we
can actually parse wiki links.

To mitigate the issue of linking space/underscored wiki pages, introduce
a permalink URL based on the title and create a migration to move old
underscored titles
(e.g., `base_de_donées` to spaced titles `base de donées`).
2016-07-27 11:00:09 +02:00
Oliver Günther ec1b03d12a Escape macros that were not expanded. 2016-07-05 09:04:50 +02:00
Jens Ulferts 606232d81f remove no longer necessary constraint on the wiki page title 2016-03-14 08:00:39 +01:00
Oliver Günther e6abd839bd Extend quick info with path_info option
WorkPackageHelper#quick_info by default only output path links, which
won't work when formatting mail references.
2016-03-07 15:12:26 +01:00
Henriette Dinger e1a2f00a23 Remove icon class since it is not needed 2016-02-19 14:28:27 +01:00
Henriette Dinger 463aa185da Update icon classes from 'not-watch' until 'pulldown-arrow4' 2015-12-02 21:32:11 +01:00
Alex Coles ddbbecdc3a Add path helper shim to support :only_path option
`:only_path` is deprecated.

Signed-off-by: Alex Coles <alex@alexbcoles.com>
2015-09-15 09:59:49 +02:00
Henriette Dinger 87c17a0809 made style changes to please rubocop 2015-08-27 15:23:09 +02:00
Henriette Dinger fa40630b95 replaced images in Wiki, Tables, TopMenu and restructered the _tables.sass 2015-08-27 15:22:12 +02:00
Alex Coles 071e9eed7c Add explicit join references in TextFormatting
Signed-off-by: Alex Coles <alex@alexbcoles.com>
2015-07-01 20:41:09 +02:00
Alex Coles a6c54cb25f Migrate AR finder/query methods in lib code
Signed-off-by: Alex Coles <alex@alexbcoles.com>
2015-06-30 12:12:53 +02:00