From c34fcd301efe1560e4837030711b76f42fa11cfb Mon Sep 17 00:00:00 2001
From: Steven H Johnson <shjohnson.pi@gmail.com>
Date: Sat, 2 Jul 2016 18:10:29 -0400
Subject: [PATCH] Add option to hide titles for tab documents

---
 .../migrations/0028_tabdocument_show_title.py | 20 +++++++++++++++++++
 htmleditor/models.py                          |  3 +++
 htmleditor/templates/htmleditor/view.html     |  7 +++++--
 3 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 htmleditor/migrations/0028_tabdocument_show_title.py

diff --git a/htmleditor/migrations/0028_tabdocument_show_title.py b/htmleditor/migrations/0028_tabdocument_show_title.py
new file mode 100644
index 0000000..9548584
--- /dev/null
+++ b/htmleditor/migrations/0028_tabdocument_show_title.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.1 on 2016-07-02 22:08
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('htmleditor', '0027_navigationnode_show_title'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='tabdocument',
+            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 0c894e3..e066ba6 100644
--- a/htmleditor/models.py
+++ b/htmleditor/models.py
@@ -317,6 +317,9 @@ class TabDocument(SortableMixin):
     title = models.CharField(max_length=MAX_LENGTH,
                              help_text="This is the tab text")
     document = models.ForeignKey('Document', models.CASCADE)
+    show_title = models.BooleanField(
+        blank=True, default=True,
+        help_text="Show the document title at the top of the page.");
     navigation_node = models.ForeignKey('NavigationNode', models.CASCADE,
                                         related_name='tabs')
 
diff --git a/htmleditor/templates/htmleditor/view.html b/htmleditor/templates/htmleditor/view.html
index ed1d88a..aa8cfa9 100644
--- a/htmleditor/templates/htmleditor/view.html
+++ b/htmleditor/templates/htmleditor/view.html
@@ -25,8 +25,11 @@
         </ul>
         {% for tab in node.tabs.all %}
             <div id="tab-{{ tab.pk }}" class="content">
-                <h1>{{ tab.document.name }} {% if perms.htmleditor.change_document %}<a href="{% url 'admin:htmleditor_document_change' tab.document.pk %}?next={{ request.get_full_path|urlencode }}"><img alt="Pencil" title="Edit" src="{% static 'usta/edit.png' %}"></a>{% endif %}</h1>
-                <br>
+                {% if tab.show_title %}
+                    <h1>{{ tab.document.name }} {% if perms.htmleditor.change_document %}<a href="{% url 'admin:htmleditor_document_change' tab.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' tab.document.pk %}?next={{ request.get_full_path|urlencode }}"><img alt="Pencil" title="Edit" src="{% static 'usta/edit.png' %}"></a></h1>{% endif %}
+                {% endif %}
                 {% docreplace tab.document.content %}
             </div>
         {% endfor %}
-- 
GitLab