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

Can not move a page to a folder #1690

Open
ulab opened this issue Jun 6, 2019 · 10 comments
Open

Can not move a page to a folder #1690

ulab opened this issue Jun 6, 2019 · 10 comments
Assignees

Comments

@ulab
Copy link

ulab commented Jun 6, 2019

While editing a page, the Move button allows me to select a folder as target, but the page isn't moved there.

I can move a page into the folder using it's Advanced => Parent select box though.

@rhukster
Copy link
Member

rhukster commented Jun 6, 2019

we're actually reworking the whole parent/move field, so we'll definitely look at this issue during this process. Thanks.

@TheHackmeister
Copy link

I ran into this issue too. Just thought I'd mention the issue only happens if the drop down selection is outside of the "window" that pops up. If you scroll such that the selection falls within the white box, you can select, hit continue and the page will actually move.

I'm pretty sure the logic to exit the move page shadow box is incorrectly getting called when a selection from the dropdown is made. Hope it helps!

@mahagr mahagr self-assigned this Jan 29, 2020
@adrianw
Copy link

adrianw commented Jul 15, 2021

Is this still a live issue? I'm currently have issues moving modules using the current latest version (1.10.17), getting forbidden errors using either the move icon at the top or changing parent.

@rhukster
Copy link
Member

I know matias was going to look at this. He's on vacation this week though and will be back next week.

@adrianw
Copy link

adrianw commented Jul 15, 2021

I know matias was going to look at this. He's on vacation this week though and will be back next week.

Thanks for the update, I think the issue lies actually with the flex-objects plugin, or maybe admins usage of flexobjects, if I disable 'Directories Pages (Admin) ' in flex objects and go back to old style Pages I can then move pages/modules without issue, so at least I have a work around in the meantime.

@rhukster
Copy link
Member

thanks for that info.

@chronopoulos
Copy link

i had the same issue with Grav v1.7.42.3, Admin v1.10.42. @adrianw your workaround worked for me, thanks

@SpuGG
Copy link

SpuGG commented Aug 22, 2024

I have the same problem with Grav v1.7.46 - Admin v1.10.46 and @adrianw's workaround still works.

@SpuGG
Copy link

SpuGG commented Aug 25, 2024

Update, it SOMETIMES works. I have 2 sites I'm playing with (just to learn Grav) and they have different plugins.

In the one with the Editorial Theme (B), I have these plugins:
image

On my first test site (A), it just uses Quark and I have these plugins:
image

It works on site A, but not on B. On site A, it works as expected but on Site B, it will not allow me to select the folder in the dialog box when I try to move pages. So it's possible that the problem lies somewhere else. I will try to play around with turning off various plugins to see if I can isolate the problem (but it will probably take me a few days). If there's any updates, I'll post them here.

@SpuGG
Copy link

SpuGG commented Aug 25, 2024

I had a few more cycles so quickly looked at the dev console to see if I could gleam any more information.

It appears that on line 8726 that item is null.

      var item = element[0]._item;
      var column = value.column;
      var data = item[this.config.childKey] || this.data;
      var active = external_jQuery_default()(column).find(".".concat(this.config.className.active));

When you take a look at element[0] it is just the selected folder (e.g. on mouse click): <li class="fjs-item fjs-has-children fjs-item-dir" data-fjs-item="blog"><a href="" tabindex="-1"><span title="Blog"><i class="fa fa-folder"></i>Blog</span><span class="info-container"><span class="badge">8</span><i class="fa fa-caret-right"></i></span></a></li> but it has no _item child. In the working version (Site A), this is not a problem and I can see element[0]._item directly populated.

When I set a breakpoint at line 8855

      var list = external_jQuery_default()('<ul />');
      var items = data.map(function (item) {
        return _this5.createItem(item);
      });
      var fragments = items.reduce(function (fragment, current) {
        fragment.appendChild(current[0] || current);
        return fragment;
      }, document.createDocumentFragment());

It seems to disappear between the var items and var fragments. Inspecting the _this5.createItem() call shows that indeed it attaches what looks like the right object to listItems[0]._item but somehow it disappears in items afterwards.

Actually upon closer inspection, it IS there, but the behaviour is bizarre. Can anyone explain this?

JSON.stringify(items)
'[{"0":{"_item":{"name":"Nested Page","value":"/blog/nested/nested-page","item-key":"nested-page","filename":"nested-page","extension":".md","type":"dir","modified":1724609969,"size":0,"symlink":false,"has-children":false}},"length":1}]'
JSON.stringify(items[0])
'{"0":{"_item":{"name":"Nested Page","value":"/blog/nested/nested-page","item-key":"nested-page","filename":"nested-page","extension":".md","type":"dir","modified":1724609969,"size":0,"symlink":false,"has-children":false}},"length":1}'
JSON.stringify(items[0]._item)

(Context: I JSON.stringify-ed when I was on the var fragments line, so it shouldn't have started the reduce yet.)

So if we can figure out WHY it seems to be the right structure but also not the right structure (e.g. there's a hidden _item property???), then maybe it'll be easier to solve this. This is just odd. Maybe someone can provide a hint here...

Okay, I also tried attaching the object again to another property _backup, but again it does not show up on the object (yet it shows up in JSON.stringify().

JSON.stringify(items[0])
'{"0":{"_item":{"name":"<root>","value":"/","item-key":"","filename":".","extension":"","type":"root","modified":1724350895,"size":0,"symlink":false,"has-children":false},"_backup":{"name":"<root>","value":"/","item-key":"","filename":".","extension":"","type":"root","modified":1724350895,"size":0,"symlink":false,"has-children":false}},"length":1}'
JSON.stringify(items[0]._backup)
undefined

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

7 participants