sbrl / Pepperminty-Wiki

A wiki in a box
https://peppermint.mooncarrot.space/
Mozilla Public License 2.0
178 stars 20 forks source link

Feature request: Create Page button #194

Closed virtadpt closed 3 years ago

virtadpt commented 4 years ago

It's a nice shortcut to search for a page that doesn't exist and be offered the chance to create the page. However, it would be handy to have the option of setting a dedicated "Create Page" button on the toolbar to bypass the "search for something that doesn't exist" workflow.

sbrl commented 3 years ago

Finally got around to this! I think my implementation is quite an elegant solution to the issue. You can now add a "create new page" button to your navigation links with the latest commit I've just pushed. This enables you to add something like this to your nav_links, nav_links_extra, or nav_links_bottom:

[
    "+",
    "index.php?action=edit&unknownpagename=yes"
]

Let me know how you get on. While I was at it I also squashed a few potential XSS attacks in the page editor, so hopefully those fixes don't cause issues (since the code I touched was really quite old).

virtadpt commented 3 years ago

Hmmm... it keeps not letting me go to the Index Page and forces me to create a Main Page (which I don't have). I'm trying to get it out of that mode.

virtadpt commented 3 years ago

Whenever I log in, it throws me to a "Creating Main Page" editing action instead of my old "action=list" page by default. I'm not sure what's going on there.

sbrl commented 3 years ago

Hrm, that sounds like a bug. Are you sure that this only started happening after you updated to this commit?

I recommend you set the content of your Main Page to something like this:

# REDIRECT [some text](?action=list)

...and setting the redirect_absolute_enable to true, @virtadpt.

If you changed defaultaction to list instead of the default view, you may have issues because the defaultaction is intended to be an action that views a page, not an action that lists pages. It's a pretty old setting actually, so I'm unsure of the exact effects of changing it from the default.

virtadpt commented 3 years ago

Somehow, defaultaction was changed to view. I re-set it to list and the problem seems to be gone.

sbrl commented 3 years ago

That doesn't sound right, @virtadpt. defaultaction should be set to view, as the default action is intended to be an action that displays a page.

virtadpt commented 3 years ago

Yup, that fixed it. I think I was tinkering with a few other settings earlier and forgot about about it.