digitalfabrik / integreat-cms

Simplified content management back end for the Integreat App - a multilingual information platform for newcomers
https://digitalfabrik.github.io/integreat-cms/
Apache License 2.0
55 stars 33 forks source link

Auto create/update link texts to Integreat content #1878

Open svenseeberg opened 1 year ago

svenseeberg commented 1 year ago

Motivation

With the introduction of our location feature, we're more and more often referencing internal content. However, it is still a relatively high effort to create a new new link, for example to a location. First, a text has to be created. Then the text has to be selected and the link has to be inserted. If the title of the location changes in the structured database, the link description is not updated.

Proposed Solution

When inserting a link without having a text selected, automatically create a useful text from the link target. This is already happening for page titles. If it is a location, it should insert the title and address, including icons.

Also, and that is the most interesting part, add an additional HTML attribute that marks the link text as being automatically created. The attribute could be invented, for example integreat-auto-content=1. We can then use the Django linkcheck database to update the link text whenever we update the location, page title, etc. That means when updating a location, for example, we retrieve all pages that link to this location. We then iterate over all a tags with links and our attribute and then update the link text. This could probably be a part of our abstract content translation model save method.

It should be made obvious to the user how to use this. When inserting a link, we already have a dialog for selecting an internal content to link to. This dialog needs something like a check box "automatically update link description". This check box should be checked when having no text selected. When having a text selected, the checkbox should be unchecked.

Alternatives

None. It's a really cool killer feature :rocket:

Additional Context

It would be cool if translations are fixed automatically. That means if the location is translated into arabic, but the link in a page is still to the german location, this should be fixed automatically.

Design Requirements

We should probably get some good drafts for the dialog boxes. And we also have to improve the "change link" box.

Also we need nice defaults for rendering locations and maybe also events.

david-venhoff commented 8 months ago

If it is a location, it should insert the title and address, including icons.

Shouldn't stuff like this ideally be implemented in the frontend? That way, they could decide how to display all the relevent poi information and we would only have to provide some metadata with the link

timobrembeck commented 8 months ago

Shouldn't stuff like this ideally be implemented in the frontend? That way, they could decide how to display all the relevent poi information and we would only have to provide some metadata with the link

I did not find our previous discussion about this topic, but I think I remember we rejected the idea of having something like an intermediary html syntax that needs to be rendered differently by the app.