Repository: UTNkar/moore

Issue:
Make searchbar optional
### Description
Currently, the search-bar on the home page is not optional and cannot be toggled on or off in the settings panel. There should be an option in the settings panel for a Home Page to decide if the search bar should be visible or not. 

### Why? 
Not all pages need a search bar and the search functionality is not the best in the world. It also takes a lot of focus from the banners being displayed.

Forms are missing form introduction.
### Description

Creating a new form in Wagtail lets you specify an introduction to the form, which isn't displayed.



Discussion:

Resolving patch:
diff --git a/src/home/migrations/0018_homepage_show_searchbar.py b/src/home/migrations/0018_homepage_show_searchbar.py
new file mode 100644
--- /dev/null
+++ b/src/home/migrations/0018_homepage_show_searchbar.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.1.7 on 2019-07-07 09:49
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('home', '0017_auto_20181229_0326'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='homepage',
+            name='show_searchbar',
+            field=models.BooleanField(default=True),
+        ),
+    ]
diff --git a/src/home/models/home_page.py b/src/home/models/home_page.py
--- a/src/home/models/home_page.py
+++ b/src/home/models/home_page.py
@@ -2,7 +2,7 @@
 from django.db import models
 from django.utils.translation import ugettext_lazy as _
 from wagtail.admin.edit_handlers import InlinePanel, FieldPanel, \
-        StreamFieldPanel, TabbedInterface, ObjectList
+        StreamFieldPanel, TabbedInterface, ObjectList, MultiFieldPanel
 from wagtail.core.fields import StreamField
 from wagtail.core.models import Page
 from blocks.models import WAGTAIL_STATIC_BLOCKTYPES
@@ -14,15 +14,16 @@ class HomePage(Page):
     # ---- General Page information ------
     title_sv = models.CharField(max_length=255)
     translated_title = TranslatedField('title', 'title_sv')
+    show_searchbar = models.BooleanField(default=True)
 
     body_en = StreamField(
-        WAGTAIL_STATIC_BLOCKTYPES
-        + [('news', LatestNewsBlock())],
+        WAGTAIL_STATIC_BLOCKTYPES +
+        [('news', LatestNewsBlock())],
         blank=True,
     )
     body_sv = StreamField(
-        WAGTAIL_STATIC_BLOCKTYPES
-        + [('news', LatestNewsBlock())],
+        WAGTAIL_STATIC_BLOCKTYPES +
+        [('news', LatestNewsBlock())],
         blank=True,
     )
     body = TranslatedField('body_en', 'body_sv')
@@ -38,10 +39,16 @@ class HomePage(Page):
         StreamFieldPanel('body_sv'),
     ]
 
+    custom_settings_panel = Page.settings_panels + [
+        MultiFieldPanel([
+            FieldPanel('show_searchbar')
+        ], 'Searchbar settings')
+    ]
+
     edit_handler = TabbedInterface([
         ObjectList(banner_panels, heading=_('Banners')),
         ObjectList(content_panels_en, heading=_('English')),
         ObjectList(content_panels_sv, heading=_('Swedish')),
         ObjectList(Page.promote_panels, heading=_('Promote')),
-        ObjectList(Page.settings_panels, heading=_('Settings')),
+        ObjectList(custom_settings_panel, heading=_('Settings')),
     ])


Test patch: