diff --git a/datacenterlight/cms_models.py b/datacenterlight/cms_models.py index 20e39fde..a424c27c 100644 --- a/datacenterlight/cms_models.py +++ b/datacenterlight/cms_models.py @@ -120,6 +120,26 @@ class DCLLinkPluginModel(CMSPlugin): ) +class DCLNavbarPluginModel(CMSPlugin): + logo_light = FilerImageField( + on_delete=models.CASCADE, null=True, blank=True, + help_text='Logo to be used on transparent navbar' + ) + logo_dark = FilerImageField( + on_delete=models.CASCADE, null=True, blank=True, + help_text='Logo to be used on white navbar' + ) + logo_url = models.URLField(max_length=300, null=True, blank=True) + + def get_logo_dark(self): + # used only if atleast one logo exists + return self.logo_dark.url if self.logo_dark else self.logo_white.url + + def get_logo_light(self): + # used only if atleast one logo exists + return self.logo_light.url if self.logo_light else self.logo_dark.url + + class DCLNavbarDropdownPluginModel(CMSPlugin): target = models.CharField( max_length=100, null=True, blank=True, diff --git a/datacenterlight/cms_plugins.py b/datacenterlight/cms_plugins.py index 70ecfaa2..60992889 100644 --- a/datacenterlight/cms_plugins.py +++ b/datacenterlight/cms_plugins.py @@ -1,12 +1,11 @@ from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool -from cms.models.pluginmodel import CMSPlugin from .cms_models import ( DCLBannerItemPluginModel, DCLBannerListPluginModel, DCLContactPluginModel, DCLFooterPluginModel, DCLLinkPluginModel, DCLNavbarDropdownPluginModel, DCLSectionIconPluginModel, DCLSectionImagePluginModel, - DCLSectionPluginModel, + DCLSectionPluginModel, DCLNavbarPluginModel ) from .models import VMTemplate @@ -84,7 +83,7 @@ class DCLBannerItemPlugin(CMSPluginBase): class DCLNavbarPlugin(CMSPluginBase): module = "Datacenterlight" name = "DCL Navbar Plugin" - model = CMSPlugin + model = DCLNavbarPluginModel render_template = "datacenterlight/cms/navbar.html" cache = False allow_children = True diff --git a/datacenterlight/migrations/0013_dclnavbarpluginmodel.py b/datacenterlight/migrations/0013_dclnavbarpluginmodel.py new file mode 100644 index 00000000..b02c2503 --- /dev/null +++ b/datacenterlight/migrations/0013_dclnavbarpluginmodel.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.4 on 2018-03-16 09:53 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion +import filer.fields.image + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms', '0014_auto_20160404_1908'), + ('datacenterlight', '0012_dclcalculatorpluginmodel'), + ] + + operations = [ + migrations.CreateModel( + name='DCLNavbarPluginModel', + fields=[ + ('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, + parent_link=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('logo_url', models.URLField(blank=True, max_length=300, null=True)), + ('logo_dark', filer.fields.image.FilerImageField(blank=True, help_text='Logo to be used on white navbar', + null=True, on_delete=django.db.models.deletion.CASCADE, to='filer.Image')), + ('logo_light', filer.fields.image.FilerImageField(blank=True, help_text='Logo to be used on transparent navbar', + null=True, on_delete=django.db.models.deletion.CASCADE, to='filer.Image')), + ], + options={ + 'abstract': False, + }, + bases=('cms.cmsplugin',), + ), + ] diff --git a/datacenterlight/static/datacenterlight/css/header-slider.css b/datacenterlight/static/datacenterlight/css/header-slider.css index 9f5161d7..e21e2b49 100644 --- a/datacenterlight/static/datacenterlight/css/header-slider.css +++ b/datacenterlight/static/datacenterlight/css/header-slider.css @@ -1,3 +1,18 @@ +.btn-trans { + color: #fff; + border: 2px solid #fff; + padding: 4px 18px; + letter-spacing: 0.6px; + background: rgba(0,0,0,0.35); +} + +.btn-trans:focus, +.btn-trans:active, +.btn-trans:hover { + background: #fff; + color: #333; +} + .header_slider > .carousel .carousel-inner { min-height: 95vh; display: flex; @@ -168,12 +183,4 @@ /* width: auto; */ height: 100%; } -} - -.btn-trans { - color: #fff; - border: 2px solid #fff; - padding: 4px 18px; - letter-spacing: 0.6px; - background: rgba(0,0,0,0.35); } \ No newline at end of file diff --git a/datacenterlight/static/datacenterlight/css/landing-page.css b/datacenterlight/static/datacenterlight/css/landing-page.css index 2f44613b..6361ea21 100755 --- a/datacenterlight/static/datacenterlight/css/landing-page.css +++ b/datacenterlight/static/datacenterlight/css/landing-page.css @@ -79,6 +79,10 @@ textarea { border-radius: 6px; } +.navbar-brand > img { + max-height: 30px; +} + @media (max-width: 767px) { .navbar-default .navbar-nav>li>a{ font-weight: 400; diff --git a/datacenterlight/static/datacenterlight/img/logo_black.svg b/datacenterlight/static/datacenterlight/img/logo_black.svg index 8c245f9c..7845f7b5 100644 --- a/datacenterlight/static/datacenterlight/img/logo_black.svg +++ b/datacenterlight/static/datacenterlight/img/logo_black.svg @@ -2,32 +2,32 @@ diff --git a/datacenterlight/templates/datacenterlight/cms/navbar.html b/datacenterlight/templates/datacenterlight/cms/navbar.html index 30624525..7be5e575 100644 --- a/datacenterlight/templates/datacenterlight/cms/navbar.html +++ b/datacenterlight/templates/datacenterlight/cms/navbar.html @@ -10,8 +10,14 @@ - - + {% url 'datacenterlight:index' as default_logo_url %} + {% if instance.logo_dark or instance.logo_white %} + + + {% else %} + + + {% endif %}