URLSegment doesn't auto-update for new page #915

Open
febsn opened this Issue Dec 26, 2013 · 6 comments

Projects

None yet

5 participants

@febsn
febsn commented Dec 26, 2013

A customer pointed out that their URLSegment doesn't auto-update when changing the title of a newly created page (CMS version 3.1.2). Some research showed that this is only the case when using a non-english interface language, and some more research showed that the page title (via indexof('new')) is used to check whether it's a new page, which of course doesn't work if a new page isn't called 'new page', as in most languages.

@Martimiz
Martimiz commented Jan 4, 2014

I've noticed it too. You're referring to CMSMainEditForm.js - line 41

// Criteria for defining a "new" page
if ((urlSegmentInput.val().indexOf('new') == 0) && liveLinkInput.val() == '') {
    self.updateURLSegment(title);
} else {
    $('.update', self.parent()).show();
}

Basically this would auto-update any URLSegment that starts with 'new' as long as the page isn't published. This would also wrongfully apply to 'new-in-this-shop' but ignore translations like 'nieuwe-pagina'.

Possible solution: create a data-newpage="new-page" attribute with the default new-page name for the current locale, and check against that?

@febsn
febsn commented Jan 5, 2014

You're right. I've already fixed this and issued a pull request (can I somehow link issue and pull request? Github is rather news to me): #916

@madmatt
Contributor
madmatt commented Jan 10, 2014

Off-topic: In your commit message or PR message, you can type "Fixes #915" to link your PR to the original issue.

@simonwelsh simonwelsh added the 3.1 label Mar 16, 2014
@chillu
Member
chillu commented Mar 25, 2014

I'd suggest adding a disabled "Version" form field, and then only triggering the update on Version=1. The disabled attribute should prevent the field from being submitted with the form, which would be confusing since its misleading data upon save (a form submitted with Version=1 will actually cause Version=2 to be created).

@Martimiz

Sometimes I find I've saved the page before creating a new title for it. It now wouldn't auto-update after that...

A disabled boolean field that checks the current name against the i8n setting for the current locale (as simonwelsh suggested), defaulting to en_US - would that be an option?

@chillu
Member
chillu commented Apr 29, 2014

@Martimiz Sorry for the late reply. I think if you save the page without creating a title first, its an acceptable user experience that you need to manually update the URL. So I'll stick with my recommendation of the disabled Version field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment