You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by gc...@apache.org on 2022/03/31 15:57:55 UTC

[allura] branch gc/8423 created (now e788863)

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

gcruz pushed a change to branch gc/8423
in repository https://gitbox.apache.org/repos/asf/allura.git.


      at e788863  [#8423] improvements on wiki pages versions

This branch includes the following new commits:

     new e788863  [#8423] improvements on wiki pages versions

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[allura] 01/01: [#8423] improvements on wiki pages versions

Posted by gc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gcruz pushed a commit to branch gc/8423
in repository https://gitbox.apache.org/repos/asf/allura.git

commit e7888639e899a93e50d5599bf44c0cf084d012b7
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 20b5b6a..2e94265 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"><p>You can find the latest version of this page <a href="{{ base_url }}" rel="nofollow">here</a></p></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 180d3ea..4228c8c 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')