loogart / impact-canada

Canadian Government's Privy Council's Office Impact Canada website.
https://loogart.github.io/impact-canada/
0 stars 0 forks source link

Drafting revisions #61

Closed loogart closed 3 years ago

loogart commented 5 years ago

@djsutter for existing pages on our website (e.g. partner with us), we would like to have the capability to draft a new revision (leave it in draft more) while keeping the existing revision live. Does that make sense?

djsutter commented 5 years ago

Yes there is a module that we can use. I think it works in Drupal 8. Will investigate on the dev site.

loogart commented 5 years ago

awesome that would be great, thank you.

djsutter commented 5 years ago

I have just enabled the Editorial Workflow for these content types on the dev site: Challenge, Challenge News, Basic page When editing content, you will find that the publishing options look slightly different above the save button, and also you can look at the Revisions tab for a content item to see current and previous revisions. The big difference now is that if you have a published article and then save a draft, the published one remains published, and you create a new draft. Look at the Revisions tab for details. If you're not familiar with how this works, use the dev site to try everything you can think of. I can always refresh the content. QUESTION: I know that you want others to be able to review draft content. Is it ok that they have a login account with a role, or do you need them to be anonymous/public?

djsutter commented 5 years ago

Adding @habernation to this issue.

loogart commented 5 years ago

@djsutter this is awesome stuff. I will be trying it out in the next day or so for a new basic page (Careers).

Yes we would like to have no login ideally and simply an anonymous public link they can use to review and pass around.

loogart commented 5 years ago

@djsutter works like charm! Just tested it out on the Qualivera version of Crush it Challenge. Will this also work on Challenge Subpages (I know you mentioned Challenge, Ch. News and Basic page).

djsutter commented 5 years ago

Great! Yeah just say what content types you want. You could do it too... it's under configuration > workflow, but probably best that we keep track of what config changes are being made. OK I will work on the anonymous access. Hopefully that module is production-ready for D8.

djsutter commented 5 years ago

I just installed the module that allows anonymous access to unpublished content.

To use it, edit your draft content (I just edited the Crush it! Challenge) Look on the sidebar for TEMPORARY UNPUBLISHED ACCESS and expand it. The first time you will see this: image

Then click on Generate token; you will get this:

image

Then click on Copy and you will get the URL. I have done this, the URL is below. Try using it in private or incognito mode, or while logged out.

http://impact.qualivera.com/en/node/91/latest?auHash=ePUOkeWONNIuDnkplx4C1hsHXCvedIzBpW6CesOoMCg

djsutter commented 5 years ago

If all this looks good, I can do it in production tomorrow.

loogart commented 5 years ago

@djsutter for some reason, the template for challenges is not being used for the draft preview link. (I assume this is related to the drafting feature).

Is there a way to fix that?

Preview draft link screen shot 2019-02-07 at 6 19 38 am

Published link screen shot 2019-02-07 at 6 21 23 am

djsutter commented 5 years ago

I can look at this to understand why, but thinking ahead, I'm wondering how it's supposed to treat the links to related content. So in the example above, the main challenge page is in draft, but what about "The Challenge", and "Process", etc.? If they're all drafts too, and you're expecting links to drafts, then I think we may have a problem. Not sure what the solution might be. But I think this ability to preview draft content is pretty much on a node-by-node basis.

loogart commented 5 years ago

@djsutter the primary reason this is important is because our stakeholders need to give a look to their minister's office for approval - therefore these drafts become a vehicle for approvals.

djsutter commented 5 years ago

This gets pretty complicated, need to follow the logic. Here goes...

  1. The URL scheme to access node revisions (which includes unpublished ones) uses this format: /node/id/latest or /node/id/revisions/revision-id. IT DOES NOT WORK WITH THE URL ALIAS (friendly URLs)

  2. The access_unpublished module, which provides anonymous access to unpublished content, relies on the URL scheme described above, as it's the only way to access a draft revision. It further adds a token to the URL, as a query-string.

  3. The challenge page REQUIRES the URL to be an alias in the form of /challenges/challenge-name, the key part being the first URL segment "challenges", which is needed to route the request through the challenge_pages module which handles the display with the tabs for sub pages.

  4. The challenge sub pages use a URL scheme like this: /challenges/challenge-name/subpage, where subpage is any name supplied by the author to identify a sub page.

What this means: a) To use the anonymous-accesss token to view a draft page, will only work with the /node/id/latest format, which means that the page will be displayed using the default template and the sub-page tabs will not be present. (this is what you're seeing now) b) If you try to coherse the system into using the alias in combination with the access token, first it triggers a software error which can probably be fixed, but it also conflicts with the rules of alias URLS. For example: With the URL /en/challenges/smart-cities, if you try to access the latest revision, then the url would be /en/challenges/smart-cities/latest, but "latest" would be interpreted as a sub-page.

How to fix: 1) This can only possibly work with the node alias syntax, because it's the only way to get the challenge pages to route through the challenge_pages module. 2) Need to work /latest/ into the URL scheme so that it can be used in combination with /subpage/. So the resulting URL would be something like /en/challenges/smart-cities/latest/process OR /en/challenges/smart-cities/process/latest (need to choose one or the other!) 3) Currently, you get the token-URL from the node edit page, and it will always give you the /node/id/latest syntax, which you will have to manually convert into an alias URL.

Alternatively, we try to work using the /node/id format, but I don't know how we will route it through the challenge_pages module, and also the tabs for sub-pages will need to be modified to use the node/id/subpage/latest format.

I can tell you that this will be a challenge!

djsutter commented 5 years ago

It may be worth investing some time to see if the challenge page can be made compatible with the /node/id URL format and still display the right template with the subpage tabs. Also making the sub pages query strings instead of URL segments may eliminate the conflict with competing URL structures.

loogart commented 5 years ago

Hey @djsutter (i am off today - in Montreal), but my head was spinning after the fix you described above! So, would the simplest solution be signing in?

In any case, when I setup a challenge in draft more, anonymous users can still access the draft - so maybe leave it as is?