Wagtail: How to use wagtailuserbar for moderation (approving and rejecting draft posts) - wagtail

We are using the wagtailuserbar templatetag on our site and it works fine for published pages. We get the "Edit this page" and "View in admin" options etc.
The documentation says that wagtailuserbar can also be used by moderators to approve/reject drafts but I can't get this work.
Quote from the documentation:
Moderators are also given the ability to accept or reject a page being previewed as part of content moderation.
This screenshot shows the admin website with a page that has been submitted for moderation:
Clicking the preview link opens a new tab but the wagtail userbar is not visible.
If one instead uses the View Draft feature in the page explorer then again, new tab but no userbar.
Looking at the source code here these lines seem to remove the userbar for any preview view:
# Don't render if this is a preview. Since some routes can render the userbar without going through Page.serve(),
# request.is_preview might not be defined.
if getattr(request, 'is_preview', False):
return ''
My question is:
How can I use the wagtail userbar to approve or reject previews of pages submitted for moderation? The documentation suggests this is possible but experience and my understanding of the code suggests not.
It's a feature I'd really love to use.
Thanks for any help.

Thanks for this very clear description of the problem. I think this is a bug, which I've raised here:
https://github.com/wagtail/wagtail/issues/6008

Related

Error on clicking the LinkedIn Share Button on IE/Edge

I am using the below Share Plugin of LinkedIn in my ReactJS app:
<script src="https://platform.linkedin.com/in.js" type="text/javascript">lang: en_US</script>
<script type="IN/Share" data-url="https://www.linkedin.com"></script>
From LinkedIn Docs: https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/plugins/share-plugin
It is working completely fine on Chrome/Firefox/Safari. But, on clicking the LinkedIn Share button (generated by the above scripts), the LinkedIn Share Popup appears and I get an error in my app console which says:
[object Error]: {description: "[Messenger] Required property 'target'
was not provided", message: "[Messenger] Required property 'target'
was not provided", nr#seenError: true, stack: "Error: [Messenger]
Required property 'target' was not provided at Anonymous function
(https://platform.linkedin.com/xdoor/scripts/in.js:7:55143) at
Array.prototype.forEach (native code) at t
(https://platform.linkedin.com/xdoor/scripts/in.js:7:54936) at e
(https://platform.linkedin.com/xdoor/scripts/in.js:7:56462) at e
(https://platform.linkedin.com/xdoor/scripts/in.js:7:34661) at value
(https://platform.linkedin.com/xdoor/scripts/in.js:18:23834) at s
(https://platform.linkedin.com/xdoor/scripts/in.js:18:38221) at
nrWrapper
([MY_SITE_LINK_ADDRESS]:9:16587)"}
Note: I hid the [MY_SITE_LINK_ADDRESS].
The problem here seems to be that you're relying on the plugin's JS, CSS, and HTML to handle every browser. Take a look: Here's someone else posting in 2018 having the same exact problem, Issue on IE with LinkedIn Share plugin. And, officially from LinkedIn, if you want this plugin to work, you need to ask your users to do this:
Open Internet Explorer.
Click Tools and select Compatibility View Settings.
Uncheck the box next to "Display all websites in compatibility view".
Click Close.
Is it reasonable to ask your users to reconfigure their browser just to be able to click one, single button on your website? Answer: No.
You don't need to rely on the LinkedIn Share Plugin. All you really ought to need is...
https://www.linkedin.com/sharing/share-offsite/?url={url}
Then making sure it works cross-browser is in your hands.
Source: Microsoft LinkedIn Share URL Documentation.
Sure, everyone says: Don't Reinvent the Wheel! I totally agree! But when you find a car that has square, cubic wheels, then maybe you want to reconsider!
If you are interested in a regularly maintained GitHub project that keeps track of this so you don't have to, check it out! Social Share URLs

Wagtail Admin UI: create HomePage without a Site leads to AttributeError crash

I'm new to Wagtail, and I'm exploring the Bakery demo [that is a great demo, by the way!]. I can produce an AttributeError, 'NoneType' has no attribute 'startswith'".
The problem is that the Preview code in the Admin UI assumes that there is a site for every Page. But in my case there is no site yet.
I got to this point by not paying enough attention to the warnings in the Admin UI. But still, a little defensive programming in the Wagtail admin code will protect against this error.
Steps to reproduce:
Get the Bakery demo up and running.
Wonder about creating my own site, as a sibling of the Bakery site. Note the absence of a 'Sites' entry in the Admin UI sidebar, and decide to create a new HomePage thing via Pages -> Add child page (to Root) -> select HomePage as the type of the new child of Root.
Read this warning, but pay no attention: "These is no site set up for this location. Pages created here will not accessible at any URL until a site is associated with this location. Create a site now"
Create a new HomePage thing.
Click "Preview".
Uh-oh.
The problem is that the Preview code in the Admin UI assumes that there is a site. But in my case there is no site yet.
It seems to me that the code that does the Preview operation can check in advance for an associated Site. Or perhaps the code can catch the AttributeError and compose an error response of its own.
Moved to github, as suggested by gasman. I apologize - I misread the wagtail.io website about where to get support.

Weird Content of Facebook share/like button preview from angular app

I have an issue with share/like button from Angular app. I finally made it working correctly with links but share/like preview if completely wrong. I tried XFBML.parse(), switching to html 5 mode, etc.
There are two complete enigmas:
1. I got "Given URL is not allowed by the Application configuration..." despite adding all possible variants to fb app setting.
When share preview appear - it has "Angular", but I never added it anywhere.
Here is the link
Would be grateful for any ideas...
Thx
The Facebook Scraper only looks at the HTML code your server delivers, it does not execute any JavaScript.
So if you want to share different articles, you need an individual URL for each article, that delivers the relevant meta data when requested from the server.
You can find some more explanation and hints on how to implement this in this article, http://www.michaelbromley.co.uk/blog/171/enable-rich-social-sharing-in-your-angularjs-app

In joomla 3.1.4 menu item does not show article content

I have created a menu item "Contact us" in Joomla and its type is "single article". But when I click on this menu item in frontend, it doesn't show article content. Instead, it redirects me to the "Contact us.html" file, and the error page not found is shown.
When I access the article using name and id (through the link), it works properly.
What do I have to do in my template so the user could be redirected properly to the article?
Thanks.
Joomla!™ 3.1.4 had security bugs and you should upgrade asap to 3.1.5 which is at this time the most recent version.
Then, check if your problem is still present and post here.

Show all post content in dotnetnuke blog module

I'm got a website with the DNN blog module. Almost all of the posts have images in them, but on the standard view of the posts they're all listed out with none of the html content and simply a "read more" link at the bottom of the post. Is there a way to display the full post content as you would see in the details view?
Please have a look at the Ultimate DNN Blog Module - SunBlogNuke, which supports the option "ShowAll in the EntryList" for some specific entries or all the entries. I thought that this handy option should fit your requirement. Hope it makes sense.
BTW, you can try out the demo website here - demo.sunblognuke.com.

Resources