From f396641a9ceb48ecbc169a7722085e4c2d609222 Mon Sep 17 00:00:00 2001
From: Steven H Johnson <shjohnson.pi@gmail.com>
Date: Fri, 1 Jul 2016 10:55:00 -0400
Subject: [PATCH] Add toggle for nav node document titles

---
 htmleditor/admin.py                           |  3 ++-
 .../0027_navigationnode_show_title.py         | 20 +++++++++++++++++++
 htmleditor/models.py                          |  3 +++
 htmleditor/templates/htmleditor/view.html     |  6 +++++-
 4 files changed, 30 insertions(+), 2 deletions(-)
 create mode 100644 htmleditor/migrations/0027_navigationnode_show_title.py

diff --git a/htmleditor/admin.py b/htmleditor/admin.py
index 874ea00..7d16048 100644
--- a/htmleditor/admin.py
+++ b/htmleditor/admin.py
@@ -110,7 +110,8 @@ class NavigationNodeAdmin(SortableAdmin):
     list_display = ['name', 'get_path', 'document', 'view']
     fieldsets = (
         (None, {
-            'fields': ('name', 'parent', 'document', 'view', 'icon')
+            'fields': (
+                'name', 'parent', 'document', 'show_title', 'view', 'icon')
         }),
         ('Advanced', {
             'classes': ('collapse',),
diff --git a/htmleditor/migrations/0027_navigationnode_show_title.py b/htmleditor/migrations/0027_navigationnode_show_title.py
new file mode 100644
index 0000000..c5446de
--- /dev/null
+++ b/htmleditor/migrations/0027_navigationnode_show_title.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.1 on 2016-07-01 14:47
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('htmleditor', '0026_tabdocument_sorting'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='navigationnode',
+            name='show_title',
+            field=models.BooleanField(default=True, help_text='Show the document title at the top of the page.'),
+        ),
+    ]
diff --git a/htmleditor/models.py b/htmleditor/models.py
index d2dd842..0c894e3 100644
--- a/htmleditor/models.py
+++ b/htmleditor/models.py
@@ -240,6 +240,9 @@ class NavigationNode(SortableMixin):
                                 limit_choices_to={'parent': None})
     document = models.ForeignKey('Document', models.SET_NULL, blank=True,
                                  null=True)
+    show_title = models.BooleanField(
+        blank=True, default=True,
+        help_text="Show the document title at the top of the page.");
     view = models.CharField(
         max_length=MAX_LENGTH, choices=VIEW_CHOICES, blank=True, default="",
         help_text="This overrides document and any tab documents if set.")
diff --git a/htmleditor/templates/htmleditor/view.html b/htmleditor/templates/htmleditor/view.html
index 8c8c5c2..ed1d88a 100644
--- a/htmleditor/templates/htmleditor/view.html
+++ b/htmleditor/templates/htmleditor/view.html
@@ -5,7 +5,11 @@
 
 {% block main %}
 {% if document %}
-    <h1>{{ document.name }} {% if perms.htmleditor.change_document %}<a href="{% url 'admin:htmleditor_document_change' document.pk %}?next={{ request.get_full_path|urlencode }}"><img alt="Pencil" title="Edit" src="{% static 'usta/edit.png' %}"></a>{% endif %}</h1>
+    {% if node.show_title %}
+        <h1>{{ document.name }} {% if perms.htmleditor.change_document %}<a href="{% url 'admin:htmleditor_document_change' document.pk %}?next={{ request.get_full_path|urlencode }}"><img alt="Pencil" title="Edit" src="{% static 'usta/edit.png' %}"></a>{% endif %}</h1>
+    {% else %}
+        {% if perms.htmleditor.change_document %}<h1><a href="{% url 'admin:htmleditor_document_change' document.pk %}?next={{ request.get_full_path|urlencode }}"><img alt="Pencil" title="Edit" src="{% static 'usta/edit.png' %}"></a></h1>{% endif %}
+    {% endif %}
     {% docreplace document.content %}
 {% else %}
     <h1>{{ node.name }}</h1>
-- 
GitLab