Commits

Ivan Melnikov  committed 01cf63e Draft

Add lock icon to private pages

  • Participants
  • Parent commits 976c47f

Comments (0)

Files changed (3)

 			return True
 		parents.reverse()
 		for path in parents[1:]:
-			log.info(path)
 			page = get_page(path)
 			if page is not None:
 				if page.access == Access.PARENT:
 					continue
 				if page.access == Access.PRIVATE:
 					if user.key().id() != page.user_id:
+						log.info('No access to "%s"', page.path)
 						return False
 				if page.access == Access.ALL:
 					return True
 		if user.key().id() == page.user_id:
 			return True
 		else:
+			log.info('No access to "%s"', page.path)
 			return False
 
 	if page.access == Access.ALL:

File template/page/get.html

 
 {% block content %}
 
-{% if page and page is access %}
+{% set has_access = page is access %}
+
+{% if page and has_access %}
 {# cant show any menu for dead page #}
 
 {# page settings #}
 
 {# breadcrumbs #}
 <div class="breadcrumbs">
-<a href="/">wiki</a> :
-{% for name, url in breadcrumbs %}
-	{% if not loop.last %}
-		<a href="{{ url }}">{{ name }}</a> /
-	{% else %}
-		{{ name }}
+	<a href="/">wiki</a> :
+	
+	{% for name, url in breadcrumbs %}
+		{% if not loop.last %}
+			<a href="{{ url }}">{{ name }}</a> /
+		{% else %}
+			{{ name }}
+		{% endif %}
+	{% endfor %}
+
+	{% if page.access == 'PRIVATE' %}
+		<img src="/_static/img/lock.png" style="vertical-align: top;"/>
 	{% endif %}
-{% endfor %}
 </div>
 
 {# check access #}
-{% if page is not access %}
+{% if not has_access %}
 	
 	<h2>Доступ к данной странице закрыт</h2>
 

File template/static/img/lock.png

Added
New image