Show Siblings in Sidebar at Leaf Nodes

This commit is contained in:
Anand Doshi 2014-02-13 00:52:40 +05:30
parent fb8925fe8a
commit 929ef59df9
4 changed files with 17 additions and 8 deletions

View file

@ -1,7 +1,7 @@
{% if children -%}
{%- for child in children -%}
<div class="sidebar-item">
<a href="/{{ child.name|lower }}" class="no-decoration">
<a href="{{ child.name }}" class="no-decoration {% if child.name == pathname %}active{% endif %}">
{{ child.page_title }}
{% if not child.public_read %}
(<i class="icon-fixed-width icon-lock"></i>)

View file

@ -388,6 +388,12 @@ a.no-decoration {
color: inherit;
}
a.active {
pointer-events: none;
cursor: default;
color: initial;
}
.page-breadcrumbs .breadcrumb {
padding: 0px;
margin-bottom: 2px;

View file

@ -244,23 +244,19 @@ $.extend(wn, {
},
load_via_ajax: function(href) {
console.log("calling ajax");
// console.log("calling ajax");
window.previous_href = href;
history.pushState(null, null, href);
$.ajax({ url: href, cache: false }).done(function(data) {
history.replaceState(data, data.title, href);
$("html, body").animate({ scrollTop: 0 }, "slow");
wn.render_json(data);
})
},
render_json: function(data) {
if(data.reload) {
window.location = location.href;
// } else if(data.html) {
// var newDoc = document.open("text/html", "replace");
// newDoc.write(data.html);
// newDoc.close();
} else {
$('[data-html-block]').each(function(i, section) {
var $section = $(section);

View file

@ -147,7 +147,14 @@ def build_sitemap_options(path):
sitemap_options.children = webnotes.conn.sql("""select * from `tabWebsite Sitemap`
where parent_website_sitemap=%s
and public_read=1 order by idx asc, page_title asc""", (sitemap_options.name,), as_dict=True)
and public_read=1 order by -idx desc, page_title asc""", (sitemap_options.pathname,), as_dict=True)
# leaf node, show siblings
if not sitemap_options.children:
sitemap_options.children = webnotes.conn.sql("""select * from `tabWebsite Sitemap`
where ifnull(parent_website_sitemap, '')=%s
and public_read=1 order by -idx desc, page_title asc""",
sitemap_options.parent_website_sitemap or "", as_dict=True)
# determine templates to be used
if not sitemap_options.base_template_path: