Skip to content

Commit

Permalink
Add link to footer to edit current page on GitHub if 'ghEditPage' is …
Browse files Browse the repository at this point in the history
…present
  • Loading branch information
bdemers committed Oct 24, 2016
1 parent 7df034f commit a4a5962
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -357,4 +357,9 @@ ul.navigation a {
.warning {
color: #9F6000;
background-color: #FEEFB3;
}

.editThisPage {
position:absolute; bottom:2%; right:2%;
font-size:16px;
}
16 changes: 16 additions & 0 deletions assets/js/shiro-site.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

function addPageEditLink() {

var ghRepo = "apache/shiro-site";
var ghRelHref = "https://github.com/" + ghRepo + "/edit/master/";

var ghEditPageElement = $( "#ghEditPage" );
var editThisPageElement = $(".editThisPage");

if (ghEditPageElement && ghEditPageElement.val() && editThisPageElement) {
var relGHPage = ghEditPageElement.val();

var ghEditHref = ghRelHref + relGHPage;
editThisPageElement.append("<a href='" + ghEditHref + "'>Edit this Page on Github</a>");
}
}
9 changes: 9 additions & 0 deletions templates/default.vtl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/styles/default.min.css" integrity="sha256-Zd1icfZ72UBmsId/mUcagrmN7IN5Qkrvh75ICHIQVTk=" crossorigin="anonymous" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/highlight.min.js" integrity="sha256-s63qpgPYoQk+wv3U6WZqioVJrwFNBTgD4dkeegLuwvo=" crossorigin="anonymous"></script>

<script type="text/javascript" src="$root/assets/js/shiro-site.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script type="text/javascript" src="$root/assets/js/jquery_googleanalytics/jquery.google-analytics.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
Expand All @@ -65,6 +66,10 @@
//Google Analytics
jQuery.trackPage('UA-11551827-1');
});

$( document ).ready(function() {
addPageEditLink();
});
</script>
</head>

Expand Down Expand Up @@ -102,6 +107,10 @@
<a href="http://www.apache.org/foundation/contributing.html">Donate to the ASF</a> |
<a href="http://www.apache.org/licenses/LICENSE-2.0.html">License</a>
<p>Copyright &copy; 2008-$year The Apache Software Foundation</p>

<div class="editThisPage">
</div>

<div class="footer-shield"></div>

</div> <!--END FOOTER WRAPPER-->
Expand Down

0 comments on commit a4a5962

Please sign in to comment.