geokrety / geokrety-website

Open source item tracking for all caching platforms - This is the actual code beside geokrety.org
https://geokrety.org
MIT License
12 stars 18 forks source link

Allow user to upload personal custom label templates #371

Open okainov opened 5 years ago

okainov commented 5 years ago

Is there a way to either upload my own templates or modify existing ones?

kumy commented 5 years ago

Really good feature request :+1: Unfortunately, as a user, you are not "yet" allowed to upload new template. We are currently reworking the whole website. Once finished, we may think about some general implementation.

Label templates are defined there https://github.com/geokrety/geokrety-website/tree/master/website/templates/labels it's just a matter of html file and smarty templating.

Feel free to provide a PR to add your own custom template and we'll publish it for everyone!

okainov commented 5 years ago

Thanks for the info, will check it out. But at least the names of the templates seem to be hardcoded in the database, so simple PR with adding templates probably won't work, it will require adding a row with a template into the database, correct?

Also by quick looking at existing templates, I haven't found anything related to multiple languages/translations... And the translations themselves don't work, it's English only... (at least for "1"/"medium" template)

kumy commented 5 years ago

Templates are declared here https://github.com/geokrety/geokrety-website/blob/2ecd397cadfe596cfc9ef86d0ef4058ea55a1921/website/labels.php#L73-L84

(Current) Translation mechanism here https://github.com/geokrety/geokrety-website/blob/2ecd397cadfe596cfc9ef86d0ef4058ea55a1921/website/templates/labels/index.php#L42

Honestly, that's a part of code I didn't explored well yet. ;)

kumy commented 3 years ago

@okainov I'm still fan of this, but honestly, I'll not implement an allow user to upload templates in a near future as I've still have a lot of work to bring new-theme branch to the same level of feature than actual prod branch. But I'll implement it "one day"…

That said, the label feature has been ported some time ago (may I say "thanks" to COVID-19???) to new-theme. It' doesn't use php file anymore, but templatized svg files using smarty. I've wrote a doc about it.

I'll be glad to add your custom label templates to the public list if you wish to contribute to them :+1: