Closed mielvds closed 3 months ago
Is this a custom-made page? Because I can't exactly find this in the jinja templates of the project.
The main issue I see with your links, is the missing conceptscheme ID in the generated URL.
So all I can say for now is:
1) make sure you pass scheme_id=x
to the url generator method of your choice route_path
, route_url
etc.
2) if you do pass it, make sure that the x
of step 1 receives a value in the view (return {"x": conceptscheme_id}
). If it doesn't exist, jinja is pretty forgiving with not causing errors.
@Wim-De-Clercq this is a custom page indeed and I see the problem now, my bad. I was indeed not assigning the right variable to the scheme_id
property. Thanks, solved!
About my second comment: is there a way to also use the conceptscheme URI as the ID, equivalent to the concepts? See the distinction in the screenshots below:
There's no easy way that I can think of atm. At least on the existing pages. On your own custom pages it's simple.
In atramhasis:templates/conceptscheme.jinja2
that is
<h2 class="id-header right">[ ID : {{ conceptscheme.scheme_id }} ]</h2>
And, yes, you could override the view with your own and make sure that conceptscheme.scheme_id
contains the uri. But that would also break all url generation on that page which also uses conceptscheme.scheme_id
.
So on the python side I see no possible fix.
On the jinja side, you can of course override this. But that involves some quite laboursome and boring overriding of atramhasis templates and editing just for that 1 header. And any future atramhasis updates to the templates could need merging and changes. It would be á solution, but not an ideal solution.
Just for the record. The best thing I can come up with is this kind of Jinja overriding:
# pyramid config startup
config.override_asset(
to_override="atramhasis:templates/conceptscheme.jinja2",
override_with="myproject:templates/my_conceptscheme.jinja2",
)
my_conceptscheme.jinja2
{% extends 'conceptscheme.jinja2' %}
{% block content %}
{{ super() }}
<script>
header = document.getElementsByClassName("id-header right")[0]
header.innerHTML = '{{ conceptscheme.uri }}'
</script>
{% endblock %}
I use javascript just to avoid having to copy-paste that jinja block from atramhasis.
Also just a little headsup -- in case you're not yet on 2.1.1 -- In 2.1.1 there have been some route name reworks. I've prepared a little table for that here: https://github.com/OnroerendErfgoed/atramhasis/blob/513408f060db7c44bbae6acc6218e16384c26cfa/docs/source/customisation.rst#update-to-211
Most of the "new" route names would already work before 2.1.1 (because atramhasis was duplicating them with different names) so you could future-proof your url generation already if you use the new names.
Thanks for the heads-up @Wim-De-Clercq; using 2.1.1 indeed.
About the URI/ID: is there also a difference in the database, because it might be better to change things there. Anyway, I digress and will open a new issue about this if necessary. Closing this now.
When I use an imported conceptschemes that uses URIs for concepts, the navigation to these concepts is broken.
Clicking on one of the concepts from the screenshot below...
will navigate to the link http://localhost:6543/conceptschemes//c/https://data.hetarchief.be/id/iec60094-type/II?type=&label=, which returns a 404. Encoding the concept's URI like so http://localhost:6543/conceptschemes/c/https%3A%2F%2Fdata.hetarchief.be%2Fid%2Fiec60094-type%2FII?type=&label= (which I would expect to be necessary) does not solve the problem.
Note that there's also an inconsistency between the ID for the conceptscheme, which is a number, and the ID for the concept, which is the URI. (Personally, I would prefer to use URIs everywhere)