浏览代码

Show Siblings in Sidebar at Leaf Nodes

version-14
Anand Doshi 11 年前
父节点
当前提交
929ef59df9
共有 4 个文件被更改,包括 17 次插入8 次删除
  1. +1
    -1
      webnotes/templates/includes/sidebar.html
  2. +6
    -0
      webnotes/website/css/website.css
  3. +2
    -6
      webnotes/website/js/website.js
  4. +8
    -1
      webnotes/webutils.py

+ 1
- 1
webnotes/templates/includes/sidebar.html 查看文件

@@ -1,7 +1,7 @@
{% if children -%} {% if children -%}
{%- for child in children -%} {%- for child in children -%}
<div class="sidebar-item"> <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 }} {{ child.page_title }}
{% if not child.public_read %} {% if not child.public_read %}
(<i class="icon-fixed-width icon-lock"></i>) (<i class="icon-fixed-width icon-lock"></i>)


+ 6
- 0
webnotes/website/css/website.css 查看文件

@@ -388,6 +388,12 @@ a.no-decoration {
color: inherit; color: inherit;
} }


a.active {
pointer-events: none;
cursor: default;
color: initial;
}

.page-breadcrumbs .breadcrumb { .page-breadcrumbs .breadcrumb {
padding: 0px; padding: 0px;
margin-bottom: 2px; margin-bottom: 2px;


+ 2
- 6
webnotes/website/js/website.js 查看文件

@@ -244,23 +244,19 @@ $.extend(wn, {


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


+ 8
- 1
webnotes/webutils.py 查看文件

@@ -147,7 +147,14 @@ def build_sitemap_options(path):


sitemap_options.children = webnotes.conn.sql("""select * from `tabWebsite Sitemap` sitemap_options.children = webnotes.conn.sql("""select * from `tabWebsite Sitemap`
where parent_website_sitemap=%s 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 # determine templates to be used
if not sitemap_options.base_template_path: if not sitemap_options.base_template_path:


正在加载...
取消
保存