You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by di...@apache.org on 2022/04/08 15:11:30 UTC

[allura] branch master updated: [#8423] improvements on wiki pages versions

This is an automated email from the ASF dual-hosted git repository.

dill0wn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git


The following commit(s) were added to refs/heads/master by this push:
     new eebc0effb [#8423] improvements on wiki pages versions
eebc0effb is described below

commit eebc0effb75b3bd9e290ce1e0360f93bb40825af
Author: Guillermo Cruz <gu...@slashdotmedia.com>
AuthorDate: Thu Mar 31 09:55:28 2022 -0600

    [#8423] improvements on wiki pages versions
---
 ForgeWiki/forgewiki/templates/wiki/page_view.html | 8 ++++++--
 ForgeWiki/forgewiki/wiki_main.py                  | 5 ++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ForgeWiki/forgewiki/templates/wiki/page_view.html b/ForgeWiki/forgewiki/templates/wiki/page_view.html
index 20b5b6a94..e26d9e149 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_view.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_view.html
@@ -20,6 +20,8 @@
 {% do g.register_forge_css('css/forge/hilite.css', compress=False) %}
 {% import 'allura:templates/jinja_master/lib.html' as lib with context %}
 
+{%  set base_url = page.url().split('?')[0] %}
+
 {% block title %}{{c.project.name}} / {{c.app.config.options.mount_label}} / {{page.title}}{% endblock %}
 
 {% block header %}{{page.title}}{% if page['deleted'] %}<span> (deleted)</span>{% endif %}{% endblock %}
@@ -39,7 +41,8 @@
 <link rel="alternate" type="application/atom+xml" title="Page Atom" href="feed.atom"/>
 <link rel="alternate" type="application/rss+xml" title="Wiki RSS" href="../feed.rss"/>
 <link rel="alternate" type="application/atom+xml" title="Wiki Atom" href="../feed.atom"/>
-<link rel="canonical" href="{{ h.absurl(page.url()) }}">
+<link rel="canonical" href="{{ h.absurl(base_url) }}">
+
 {% endblock %}
 {% block body_css_class %} {{super()}} wiki-{{(page.title).replace(' ','_')}}{% endblock %}
 
@@ -50,7 +53,7 @@
       {% elif c.user.is_anonymous() and h.is_allowed_by_role(page, 'edit', '*authenticated', c.project) %}
           <a href="{{ tg.config.get('auth.login_url', '/auth/') }}">Log in to Edit</a>
       {% endif %}
-      {{ g.icons['history'].render(href='history') }}
+      {{ g.icons['history'].render(href='history',rel='nofollow') }}
   {% elif h.has_access(page, 'delete')() %}
     {{ g.icons['undelete'].render(extra_css='post-link') }}
     <div class="confirmation_dialog" style="display:none">
@@ -75,6 +78,7 @@
 {% endblock %}
 
 {% block wiki_content %}
+    {%  if not is_latest_version %}<div data-alert class="alert-box info">There is a newer version of this page. You can find it <a href="{{ base_url }}" rel="nofollow">here</a>.</div>{% endif %}
 <div{% if h.has_access(page, 'edit') %} class="active-md" data-markdownlink="" {% endif %}>{{page.html_text}}</div>
 {% endblock %}
 
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 180d3ea1d..4228c8cba 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -605,13 +605,16 @@ class PageController(BaseController, FeedController):
         next = cur + 1
         hide_left_bar = not (c.app.show_left_bar)
         subscribed_to_page = M.Mailbox.subscribed(artifact=self.page)
+        latest_version = self.page.history().limit(1).first()
+        is_latest_version = cur == latest_version.version
         return dict(
             page=page,
             cur=cur, prev=prev, next=next,
             page_subscribed=subscribed_to_page,
             hide_left_bar=hide_left_bar, show_meta=c.app.show_right_bar,
             pagenum=pagenum, limit=limit, count=post_count,
-            noindex=c.app.should_noindex_page(self.page))
+            noindex=c.app.should_noindex_page(self.page),
+            is_latest_version=is_latest_version,)
 
     @without_trailing_slash
     @expose('jinja:forgewiki:templates/wiki/page_edit.html')