Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multilang-Site: Can't save frontmatter changes in expert mode in french language version. #798

Closed
ulilu opened this issue Apr 21, 2016 · 29 comments

Comments

@ulilu
Copy link

ulilu commented Apr 21, 2016

i’m doing a multilang-site (en/fr) and i can edit the english version without problems. however, in the french version, as soon as i switch to expert mode, edit the frontmatter and try to save, there is simply no response from grav. no reload, no error, not even a message in the debug console… rather strange.

i tried deleting some pages and created them anew, but the problem persists. if you want to try out yourself, here is my user-directory: http://toctoc.peacock.uberspace.de/_zips/user.zip - try changing the about/partners in the english / french version... if there's anything else you need, let me know.

thank you!

@rhukster
Copy link
Member

This is 'probably' an admin plugin issue. But we'll leave it here for now in case it's not.

@ulilu
Copy link
Author

ulilu commented Apr 21, 2016

hmm, after two more rounds of deleting and recreating the aforementioned "partners" mod-page, the problem seems to have dissolved into thin air - saving in expert mode suddenly works. i still have no explanation though... anyways, thanks for your – as always – excellent support @rhukster !

@ulilu
Copy link
Author

ulilu commented Apr 22, 2016

for documentation purposes:
upon encountering this problem again and trying to get rid of it, i discovered the following: theres somehow a connection between setting either a slug and/or a numeric prefix for a modular page. something gets irreversibly broken in the process, and the frontmatter for this page can't be saved in expert mode anymore (in my case in the french language version). the only solution i found is to delete both the child and parent page in both languages and then recreate them.

@rhukster
Copy link
Member

Thanks for the info. Would it possibly be related to a template override? I know we had a bug with that in 1.0.10 but we fixed it in the latest 1.1.0-beta.1 release.

@rhukster
Copy link
Member

If it's not that, can put together some exact repeatable steps so we can isolate the problem and get it fixed?

@ulilu
Copy link
Author

ulilu commented Apr 22, 2016

i think it's quite possible that there's a connection with template overrides. also, i think the bug surfaced only when i upgraded to v.1.0.10. anyhoogen, off for the weekend, will get back to you next week.

@rhukster
Copy link
Member

Please if you can try with the Beta package that would help as we did fix some things related to the template override that was causing problems.

@ulilu
Copy link
Author

ulilu commented May 2, 2016

sorry for the delay @rhukster, i was afk over the weekend. i already downloaded and would love to try out the new beta, but i'm still trying to figure out how to integrate it with the existing grav-installation (meaning: i'm not sure exactly which files and folders to copy over). is there a guide for it?

also: the aforementioned problem (can't save frontmatter when in expert mode) only exists on our production environment (= on the server), not within my local installation of grav. and since i don't want to "break stuff" by installing the beta - is there an easy way to revert to the last stable version of grav, in case something goes haywire?

@flaviocopes
Copy link
Contributor

You cannot automatically roll back from 1.1-beta to 1.0.

Create a backup via Grav's backup tools, or simply copy the original folder.

@ulilu
Copy link
Author

ulilu commented May 19, 2016

i finally found the time to try the beta 4 version.

instead of updating my current production installation on the server, i set up a second installation with the beta version, removed its user folder and then copied the user folder over from the production installation (as suggested in @rhukster 's blog comment). i also updated all the plugins on the new beta installation.

unfortunately, the problem still exists in exactly the same form: i can update the front matter of the english version of the site, but once i open up the french version, i can't save anymore (a click on the save button has no effect). i'm sorta out of ideas what to do...

@ulilu
Copy link
Author

ulilu commented May 19, 2016

I don't know if this is related, but upon further investigation i found out, that i'm not able to set the parent page of the modular-page that has aforementioned problems: In expert mode, the pulldown "Parent" in the "Options" tab shows "- Select -". Once i select a parent and press Save, after the reload the pulldown still says "- Select -". However – when in normal mode, the correct parent is shown. But – again – this only applies to the french version - the english version works fine.

@rhukster
Copy link
Member

Is it possible to provide a zip of your user Oder so we can try and recreate the problem?

@ulilu
Copy link
Author

ulilu commented May 19, 2016

@rhukster - thanks so much for your support!
i just send you an e-mail with a link to the zipped folder - hope it helps...

@flaviocopes
Copy link
Contributor

Is the save problem occurring on some specific page, or on all pages?

Also, which browser are you using?

@ulilu
Copy link
Author

ulilu commented May 20, 2016

The save problem occurs in the french version on the page "À propos" > "Partenaires". I'm using the latest version of Chrome – however, i do have the exact same problem when using Firefox. And as i mentioned before in this thread – even when deleting the page "Partenaires" as well as its parent, and recreating them anew, the problem still presists (or rather resurfaces after a while)...

@flaviocopes
Copy link
Contributor

Recreated, @w00fz I get An invalid form control with name='data[route]' is not focusable. in the console, when the page is in Expert mode. It's a modular page. Any idea what could cause this?

@flaviocopes
Copy link
Contributor

Ok got how to fix it - the parent page was named page-modular.md, I renamed to modular.md and it works now.

@rhukster do we "force" modular pages to be called modular.md to work?

@rhukster
Copy link
Member

rhukster commented May 20, 2016

There is nothing hardcoded in Grav's underpinnnings that a modular page has to be called modular.md and so expects modular.html.twig. it's just a common convention. I think our Add Modular Page process in the admin assumes this though. Really we have no clear way of knowing from the admin if a template is modular or not, however, once created, we do know a page is by checking Page::modular(). This has logic in it that evaluates the header to determine if a page is a wrapper for modular subpages.

Frankly this is something that needs to be improved. We really need some way for the theme to know which templates are modular. Probably the best place would be an array of modular template types in the theme's blueprints. If known provided, it defaults to just modular.html.twig so it's fully backwards compatible. I think i'll add this today :)

@ulilu
Copy link
Author

ulilu commented May 20, 2016

@flaviocopes - hmm, that is strange. I tried what you suggested but in a slightly different manner, in order not to break my automatic Github webhook (which would occur when manually renaming an .md on the server):

I added modular.html.twig to the root of my templates (this file didn't exist before) and then in Gravs admin panel changed the template for the parent page to modular (thus renaming the md's automatically via Grav instead of manually). I verified that the parent page files on the server are now called modular.en.md and modular.fr.md.

Unfortunately on my end the problem still persists in exactly the same manner (in expert mode no save possible in french version and the "Parent" pulldown in "Options" tab always shows - Select - instead of actual parent).

Did i miss anything or do anything wrong while renaming the files?

@ulilu
Copy link
Author

ulilu commented May 26, 2016

I think i found the trigger for my problem:

Whenever i set a slug for the french version of the modular parent page, saving its modular children when in Expert mode stops working. As soon as i remove the slug from the parent page, it's working again.

There is - however - one strange workaround to this bug that makes it possible to save, even when the modular parent has a slug set:

  1. Edit modular child front matter in Expert mode
  2. Change tab to "Options"
  3. Select a parent in "Parent" pulldown (which is unset, see my previous posts)
  4. Save

Now the front-matter changes will be saved. However, the pulldown "loses" the parent value, and displays "- Select -" upon reload. Interestingly in Normal mode, "Advanced" tab, the parent pulldown displays the correct parent.

@flaviocopes
Copy link
Contributor

Ok ultimately I found the issue is the parent having a custom slug. So the "Parent" select does not find the correct page to highlight, and it's not set. Hence the JS error that prevents to save.

@flaviocopes
Copy link
Contributor

mentioning @w00fz as this is related to getgrav/grav-plugin-admin#606, page slug issue. It's not the same issue, but related to a page slug too

@ulilu
Copy link
Author

ulilu commented May 29, 2016

@flaviocopes - thanks to your input regarding the page slug issue i think i found a possible solution:

I first applied the proposed change getgrav/grav@02f863a [grav] to my beta-installation (version 04 at the time):

Taking inspiration from your fix, i also edited the following files:
system/blueprints/pages/move.yaml
system/blueprints/pages/modular_raw.yaml
system/blueprints/pages/raw.yaml

changing Route(s) to rawRoute(s), like so:

data-options@: '\Grav\Common\Page\Pages::parentsRawRoutes'
data-default@: '\Grav\Plugin\admin::rawRoute'

And then my problem had vanished, and i could easily save frontmatter in expert mode in both languages. Also, the parent pulldown in the options tab finally showed the correct setting.

However - after i upgraded to beta version 05 (including updates for all plugins) it stopped working :(. I think it might have something to do with the new additional blueprint .yaml-files for the admin panel, they probably need to be updated with the new rawRoutes as well?

@flaviocopes
Copy link
Contributor

Yes in the latest beta, some blueprints were moved into Admin as they are admin-only. They're still in Grav core too for backwards compatibility with older Admin plugin versions.

I have pushed another commit to both Admin and Grav core, can you check them out?

a381e5b
getgrav/grav-plugin-admin@9affe0f

@flaviocopes flaviocopes reopened this May 30, 2016
@ulilu
Copy link
Author

ulilu commented May 30, 2016

yes, this does solve the initial save problem. however, something else just surfaced (with beta05): whenever i'm in the admin panel and either try to change the language or save the current page, i get logged out instantly and have to re-login. the last saved change is preserved though, so the rawRoute-fix does work.

i'm not sure whether this has to do with my setup (are there new changes to the langswitcher plugin?) or my current language settings?

@ulilu
Copy link
Author

ulilu commented May 30, 2016

Also: When i log in again (after being "thrown out") i get the "Invalid security token" error message...

Edit: Ah, ok, you already discovered this bug

@flaviocopes
Copy link
Contributor

Ah yes, it's something related to a recent change.

@flaviocopes
Copy link
Contributor

Should now be fixed in Grav develop

@ulilu
Copy link
Author

ulilu commented May 30, 2016

wahouu! thank you so much :-)

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

No branches or pull requests

3 participants