From b252211a69079e5fceb47ffe62fd765e8a0676fe Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Tue, 20 Mar 2018 02:34:20 +0530 Subject: [PATCH] header btn target accepts id, navbar optional lang dropdown --- datacenterlight/cms_models.py | 4 ++++ ..._dclnavbarpluginmodel_language_dropdown.py | 20 +++++++++++++++++++ .../templates/datacenterlight/cms/navbar.html | 16 ++++++++------- .../migrations/0020_auto_20180320_0216.py | 20 +++++++++++++++++++ ungleich_page/models.py | 9 ++++++--- ...der_with_background_video_slider_item.html | 2 +- 6 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 datacenterlight/migrations/0014_dclnavbarpluginmodel_language_dropdown.py create mode 100644 ungleich_page/migrations/0020_auto_20180320_0216.py diff --git a/datacenterlight/cms_models.py b/datacenterlight/cms_models.py index df54589e..627c49ba 100644 --- a/datacenterlight/cms_models.py +++ b/datacenterlight/cms_models.py @@ -132,6 +132,10 @@ class DCLNavbarPluginModel(CMSPlugin): related_name="dcl_navbar_logo_dark", ) logo_url = models.URLField(max_length=300, null=True, blank=True) + language_dropdown = models.BooleanField( + default=True, + help_text='Select to include the language selection dropdown.' + ) def get_logo_dark(self): # used only if atleast one logo exists diff --git a/datacenterlight/migrations/0014_dclnavbarpluginmodel_language_dropdown.py b/datacenterlight/migrations/0014_dclnavbarpluginmodel_language_dropdown.py new file mode 100644 index 00000000..2c5e6306 --- /dev/null +++ b/datacenterlight/migrations/0014_dclnavbarpluginmodel_language_dropdown.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2018-03-19 20:46 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('datacenterlight', '0013_dclnavbarpluginmodel'), + ] + + operations = [ + migrations.AddField( + model_name='dclnavbarpluginmodel', + name='language_dropdown', + field=models.BooleanField(default=True, help_text='Select to include the language selection dropdown.'), + ), + ] diff --git a/datacenterlight/templates/datacenterlight/cms/navbar.html b/datacenterlight/templates/datacenterlight/cms/navbar.html index fdb28529..cc8ec96b 100644 --- a/datacenterlight/templates/datacenterlight/cms/navbar.html +++ b/datacenterlight/templates/datacenterlight/cms/navbar.html @@ -27,13 +27,15 @@ {% render_plugin plugin %} {% endfor %} -
  • - {% if LANGUAGE_CODE == 'en-us'%} - Deutsch   - {% else %} - English   - {% endif %} -
  • + {% if instance.language_dropdown %} +
  • + {% if LANGUAGE_CODE == 'en-us'%} + Deutsch   + {% else %} + English   + {% endif %} +
  • + {% endif %} {% if not request.user.is_authenticated %}
  • {% trans "Login" %}   diff --git a/ungleich_page/migrations/0020_auto_20180320_0216.py b/ungleich_page/migrations/0020_auto_20180320_0216.py new file mode 100644 index 00000000..1dbd46d2 --- /dev/null +++ b/ungleich_page/migrations/0020_auto_20180320_0216.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2018-03-19 20:46 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ungleich_page', '0019_merge'), + ] + + operations = [ + migrations.AlterField( + model_name='ungleichheaderwithbackgroundvideoslideritem', + name='btn_link', + field=models.CharField(blank=True, help_text='Url or #id to navigate on click. If this field is left empty, no button would be displayed.', max_length=100, null=True), + ), + ] diff --git a/ungleich_page/models.py b/ungleich_page/models.py index 4ffd1a33..6e25501f 100644 --- a/ungleich_page/models.py +++ b/ungleich_page/models.py @@ -125,9 +125,12 @@ class UngleichHeaderWithBackgroundVideoSliderItem(CMSPlugin): blank=True, null=True, help_text='An optional description for this slide.' ) - btn_link = models.URLField( - blank=True, null=True, - help_text='If this field is left empty, no button would be displayed.' + btn_link = models.CharField( + max_length=100, blank=True, null=True, + help_text=( + 'Url or #id to navigate on click. If this field is left empty, no ' + 'button would be displayed.' + ) ) btn_text = models.CharField( blank=True, null=True, max_length=50, diff --git a/ungleich_page/templates/ungleich_page/ungleich/_header_with_background_video_slider_item.html b/ungleich_page/templates/ungleich_page/ungleich/_header_with_background_video_slider_item.html index 78bb7ad8..f1edba16 100644 --- a/ungleich_page/templates/ungleich_page/ungleich/_header_with_background_video_slider_item.html +++ b/ungleich_page/templates/ungleich_page/ungleich/_header_with_background_video_slider_item.html @@ -22,6 +22,6 @@ {% endif %} {% if instance.btn_link %} {% trans "Learn More" as default_btn_text %} - {{ instance.btn_text|default:default_btn_text }} + {{ instance.btn_text|default:default_btn_text }} {% endif %}