titledk / silverstripe-calendar

Highly flexible calendar system for SilverStripe
http://calendar.demo.title.dk/
MIT License
32 stars 24 forks source link

Translatable #4

Open dacar opened 9 years ago

dacar commented 9 years ago

There is a problem if you use the translatable module with silverstripe--calendar. The URL segment is in some cases, e.g. on save a page, broken: http://www.pcguth.de/test2014/admin/calendar/?locale=de_DEpastevents/

Can you give advice to fix it?

anselmdk commented 9 years ago

I think it might have something to do with the way I tweaked the backend, e.g. here: https://github.com/titledk/silverstripe-calendar/blob/1.0/templates/Includes/CalendarAdmin_Tools.ss#L12

Probably that would need some tweaking either of those links or figuring out what the translatable module is doing to links.

xini commented 9 years ago

@anselmdk: Just use Controller::join_links() to create your links. You can create methods in your CalendarAdmin like

public function PastEventsLink() {
    return self::join_links($this->Link(), 'pastevents');
}

[untested]

and in your template you can call $PastEventsLink instead of {$Link}pastevents/.

Controller::join_links() takes care of correctly joining any existing or new URL segments and parameters.

anselmdk commented 9 years ago

@xini nice, thanks! I'll look at this next time I'll work with the calendar - if no-one sends a pull request before that ;)