Merge pull request #525 from pcoder/feature/glasfaser_cms_template
Feature/glasfaser cms template
This commit is contained in:
		
				commit
				
					
						333b7a99fb
					
				
			
		
					 21 changed files with 877 additions and 2 deletions
				
			
		|  | @ -218,6 +218,7 @@ CMS_TEMPLATES = ( | |||
|     ('page.html', gettext('Page')), | ||||
|     # dcl | ||||
|     ('datacenterlight/cms_page.html', gettext('Data Center Light')), | ||||
|     ('ungleich_page/glasfaser_cms_page.html', gettext('Glasfaser')), | ||||
| ) | ||||
| 
 | ||||
| DATABASES = { | ||||
|  |  | |||
							
								
								
									
										61
									
								
								ungleich_page/cms_menus.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								ungleich_page/cms_menus.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,61 @@ | |||
| from menus.base import NavigationNode | ||||
| from menus.menu_pool import menu_pool | ||||
| from django.utils.translation import ugettext_lazy as _ | ||||
| from cms.menu_bases import CMSAttachMenu | ||||
| from cms.templatetags.cms_tags import _get_placeholder | ||||
| from cms.utils.plugins import get_plugins | ||||
| 
 | ||||
| 
 | ||||
| class GlasfaserMenu(CMSAttachMenu): | ||||
| 
 | ||||
|     name = _("Glasfaser menu") | ||||
| 
 | ||||
|     def get_nodes(self, request): | ||||
|         nodes = [] | ||||
|         if request and request.current_page: | ||||
|             template_context = { | ||||
|                 "request": request, | ||||
|             } | ||||
|             placeholder_name_list = [ | ||||
|                 'Top Section', 'Middle Section',  'Glasfaser Services', | ||||
|                 'Glasfaser About', 'Contact Section' | ||||
|             ] | ||||
|             plugins_list = [ | ||||
|                 'SectionWithImage', 'UngelichContactUsSection', | ||||
|                 'UngelichTextSection', 'Service', 'About' | ||||
|             ] | ||||
|             for placeholder_name in placeholder_name_list: | ||||
|                 placeholder = _get_placeholder( | ||||
|                     request.current_page, request.current_page, | ||||
|                     template_context, placeholder_name | ||||
|                 ) | ||||
|                 plugins = get_plugins( | ||||
|                     request, placeholder, request.current_page.get_template() | ||||
|                 ) | ||||
|                 for plugin in plugins: | ||||
|                     if type(plugin).__name__ in plugins_list: | ||||
|                         section_hash = request.build_absolute_uri() | ||||
|                         if hasattr(plugin, 'menu_text'): | ||||
|                             menu_text = plugin.menu_text | ||||
|                             if menu_text.strip() == '': | ||||
|                                 continue | ||||
|                             menu_words = menu_text.split() | ||||
|                             if len(menu_words) > 0: | ||||
|                                 section_hash = '{}#{}'.format( | ||||
|                                     section_hash, | ||||
|                                     menu_words[0] | ||||
|                                 ) | ||||
|                         else: | ||||
|                             continue | ||||
|                         newnode = NavigationNode( | ||||
|                             menu_text, | ||||
|                             url=section_hash, | ||||
|                             id="{}-{}".format( | ||||
|                                 request.current_page.id, plugin.id | ||||
|                             ) | ||||
|                         ) | ||||
|                         nodes.append(newnode) | ||||
|         return nodes | ||||
| 
 | ||||
| 
 | ||||
| menu_pool.register_menu(GlasfaserMenu) | ||||
							
								
								
									
										147
									
								
								ungleich_page/cms_plugins.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										147
									
								
								ungleich_page/cms_plugins.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,147 @@ | |||
| from cms.plugin_base import CMSPluginBase | ||||
| from cms.plugin_pool import plugin_pool | ||||
| 
 | ||||
| from .models import ( | ||||
|     UngelichContactUsSection, UngelichTextSection, Service, ServiceItem, | ||||
|     About, AboutItem, SectionWithImage | ||||
| ) | ||||
| 
 | ||||
| 
 | ||||
| def get_section_id(plugin_instance, default): | ||||
|     """ | ||||
|     A helper function to get the section id from a given menu text | ||||
|     :param plugin_instance: | ||||
|     :param default: The default section id to return in case a section id | ||||
|                     is not found | ||||
|     :return: The section id for the plugin_instance | ||||
|     """ | ||||
|     section_id = default | ||||
|     if hasattr(plugin_instance, 'menu_text'): | ||||
|         menu_words = plugin_instance.menu_text.split() | ||||
|         if len(menu_words) > 0: | ||||
|             section_id = menu_words[0] | ||||
|     return section_id | ||||
| 
 | ||||
| 
 | ||||
| @plugin_pool.register_plugin | ||||
| class SectionWithImagePlugin(CMSPluginBase): | ||||
|     model = SectionWithImage | ||||
|     render_template = "ungleich_page/glasfaser/section_with_image.html" | ||||
|     cache = False | ||||
| 
 | ||||
|     def render(self, context, instance, placeholder): | ||||
|         context.update({ | ||||
|             'image': instance.image, | ||||
|             'object': instance, | ||||
|             'placeholder': placeholder | ||||
|         }) | ||||
|         return context | ||||
| 
 | ||||
| 
 | ||||
| @plugin_pool.register_plugin | ||||
| class SectionContact(CMSPluginBase): | ||||
|     model = UngelichContactUsSection | ||||
|     render_template = "ungleich_page/glasfaser/section_contact.html" | ||||
|     cache = False | ||||
| 
 | ||||
|     def render(self, context, instance, placeholder): | ||||
|         context = super(SectionContact, self).render( | ||||
|             context, instance, placeholder | ||||
|         ) | ||||
|         context['instance'] = instance | ||||
|         context['section_id'] = get_section_id(instance, 'contact') | ||||
|         return context | ||||
| 
 | ||||
| 
 | ||||
| @plugin_pool.register_plugin | ||||
| class SectionTextParagraphDCL(CMSPluginBase): | ||||
|     model = UngelichTextSection | ||||
|     render_template = "ungleich_page/glasfaser/section_text_dcl.html" | ||||
|     cache = False | ||||
| 
 | ||||
|     def render(self, context, instance, placeholder): | ||||
|         context = super(SectionTextParagraphDCL, self).render( | ||||
|             context, instance, placeholder | ||||
|         ) | ||||
|         context['instance'] = instance | ||||
|         context['section_id'] = get_section_id(instance, 'your') | ||||
|         return context | ||||
| 
 | ||||
| 
 | ||||
| @plugin_pool.register_plugin | ||||
| class SectionTextParagraphGlasfaser(CMSPluginBase): | ||||
|     model = UngelichTextSection | ||||
|     render_template = "ungleich_page/glasfaser/section_text_glasfaser.html" | ||||
|     cache = False | ||||
| 
 | ||||
|     def render(self, context, instance, placeholder): | ||||
|         context = super(SectionTextParagraphGlasfaser, self).render( | ||||
|             context, instance, placeholder | ||||
|         ) | ||||
|         context['instance'] = instance | ||||
|         context['section_id'] = get_section_id(instance, 'our') | ||||
|         return context | ||||
| 
 | ||||
| 
 | ||||
| @plugin_pool.register_plugin | ||||
| class GlasfaserServicesPlugin(CMSPluginBase): | ||||
|     name = "Glasfaser Services Plugin" | ||||
|     model = Service | ||||
|     render_template = "ungleich_page/glasfaser/section_services.html" | ||||
|     cache = False | ||||
|     allow_children = True | ||||
|     child_classes = ['GlasfaserServicesItemPlugin'] | ||||
| 
 | ||||
|     def render(self, context, instance, placeholder): | ||||
|         context['service_instance'] = instance | ||||
|         context['section_id'] = get_section_id(instance, 'services') | ||||
|         return context | ||||
| 
 | ||||
| 
 | ||||
| @plugin_pool.register_plugin | ||||
| class GlasfaserServicesItemPlugin(CMSPluginBase): | ||||
|     name = "Glasfaser Service Item Plugin" | ||||
|     model = ServiceItem | ||||
|     render_template = "ungleich_page/glasfaser/_services_item.html" | ||||
|     cache = False | ||||
|     require_parent = True | ||||
|     parent_classes = ['GlasfaserServicesPlugin'] | ||||
| 
 | ||||
|     def render(self, context, instance, placeholder): | ||||
|         context = super(GlasfaserServicesItemPlugin, self).render( | ||||
|             context, instance, placeholder | ||||
|         ) | ||||
|         context['instance'] = instance | ||||
|         return context | ||||
| 
 | ||||
| 
 | ||||
| @plugin_pool.register_plugin | ||||
| class GlasfaserAboutPlugin(CMSPluginBase): | ||||
|     name = "Glasfaser About Plugin" | ||||
|     model = About | ||||
|     render_template = "ungleich_page/glasfaser/section_about.html" | ||||
|     cache = False | ||||
|     allow_children = True | ||||
|     child_classes = ['GlasfaserAboutItemPlugin'] | ||||
| 
 | ||||
|     def render(self, context, instance, placeholder): | ||||
|         context['about_instance'] = instance | ||||
|         context['section_id'] = get_section_id(instance, 'about') | ||||
|         return context | ||||
| 
 | ||||
| 
 | ||||
| @plugin_pool.register_plugin | ||||
| class GlasfaserAboutItemPlugin(CMSPluginBase): | ||||
|     name = "Glasfaser About Item Plugin" | ||||
|     model = AboutItem | ||||
|     render_template = "ungleich_page/glasfaser/_about_item.html" | ||||
|     cache = False | ||||
|     require_parent = True | ||||
|     parent_classes = ['GlasfaserAboutPlugin'] | ||||
| 
 | ||||
|     def render(self, context, instance, placeholder): | ||||
|         context = super(GlasfaserAboutItemPlugin, self).render( | ||||
|             context, instance, placeholder | ||||
|         ) | ||||
|         context['instance'] = instance | ||||
|         return context | ||||
							
								
								
									
										106
									
								
								ungleich_page/migrations/0001_initial.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										106
									
								
								ungleich_page/migrations/0001_initial.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,106 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| # Generated by Django 1.9.4 on 2017-10-18 18:23 | ||||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.db import migrations, models | ||||
| import django.db.models.deletion | ||||
| import djangocms_text_ckeditor.fields | ||||
| import filer.fields.image | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     initial = True | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('filer', '0004_auto_20160328_1434'), | ||||
|         ('cms', '0014_auto_20160404_1908'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.CreateModel( | ||||
|             name='Service', | ||||
|             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')), | ||||
|                 ('title', models.CharField(max_length=200)), | ||||
|                 ('sub_title', models.CharField(max_length=200)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'abstract': False, | ||||
|             }, | ||||
|             bases=('cms.cmsplugin',), | ||||
|         ), | ||||
|         migrations.CreateModel( | ||||
|             name='ServiceItem', | ||||
|             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')), | ||||
|                 ('title', models.CharField(max_length=200)), | ||||
|                 ('description', djangocms_text_ckeditor.fields.HTMLField()), | ||||
|                 ('image', filer.fields.image.FilerImageField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='service_item_image', to='filer.Image')), | ||||
|             ], | ||||
|             options={ | ||||
|                 'abstract': False, | ||||
|             }, | ||||
|             bases=('cms.cmsplugin',), | ||||
|         ), | ||||
|         migrations.CreateModel( | ||||
|             name='UngelichContactUsSection', | ||||
|             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')), | ||||
|                 ('email', models.EmailField(max_length=200)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'abstract': False, | ||||
|             }, | ||||
|             bases=('cms.cmsplugin',), | ||||
|         ), | ||||
|         migrations.CreateModel( | ||||
|             name='UngelichPicture', | ||||
|             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')), | ||||
|                 ('title', models.CharField(max_length=400)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'abstract': False, | ||||
|             }, | ||||
|             bases=('cms.cmsplugin',), | ||||
|         ), | ||||
|         migrations.CreateModel( | ||||
|             name='UngelichTextSection', | ||||
|             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')), | ||||
|                 ('title', models.CharField(max_length=200)), | ||||
|                 ('description', djangocms_text_ckeditor.fields.HTMLField()), | ||||
|             ], | ||||
|             options={ | ||||
|                 'abstract': False, | ||||
|             }, | ||||
|             bases=('cms.cmsplugin',), | ||||
|         ), | ||||
|         migrations.CreateModel( | ||||
|             name='About', | ||||
|             fields=[ | ||||
|                 ('service_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='ungleich_page.Service')), | ||||
|             ], | ||||
|             options={ | ||||
|                 'abstract': False, | ||||
|             }, | ||||
|             bases=('ungleich_page.service',), | ||||
|         ), | ||||
|         migrations.CreateModel( | ||||
|             name='AboutItem', | ||||
|             fields=[ | ||||
|                 ('ungelichpicture_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='ungleich_page.UngelichPicture')), | ||||
|                 ('inverted', models.BooleanField(default=False)), | ||||
|             ], | ||||
|             options={ | ||||
|                 'abstract': False, | ||||
|             }, | ||||
|             bases=('ungleich_page.ungelichpicture',), | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='ungelichpicture', | ||||
|             name='image', | ||||
|             field=filer.fields.image.FilerImageField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='image', to='filer.Image'), | ||||
|         ), | ||||
|     ] | ||||
							
								
								
									
										30
									
								
								ungleich_page/migrations/0002_sectionwithimage.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								ungleich_page/migrations/0002_sectionwithimage.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,30 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| # Generated by Django 1.9.4 on 2017-10-18 22:02 | ||||
| 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 = [ | ||||
|         ('filer', '0004_auto_20160328_1434'), | ||||
|         ('ungleich_page', '0001_initial'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.CreateModel( | ||||
|             name='SectionWithImage', | ||||
|             fields=[ | ||||
|                 ('ungelichpicture_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='ungleich_page.UngelichPicture')), | ||||
|                 ('price_tag_url', models.URLField(default='', max_length=300)), | ||||
|                 ('price_tag_image', filer.fields.image.FilerImageField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='price_tag_image', to='filer.Image')), | ||||
|             ], | ||||
|             options={ | ||||
|                 'abstract': False, | ||||
|             }, | ||||
|             bases=('ungleich_page.ungelichpicture',), | ||||
|         ), | ||||
|     ] | ||||
							
								
								
									
										35
									
								
								ungleich_page/migrations/0003_auto_20171019_1007.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								ungleich_page/migrations/0003_auto_20171019_1007.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| # Generated by Django 1.9.4 on 2017-10-19 10:07 | ||||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('ungleich_page', '0002_sectionwithimage'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.AddField( | ||||
|             model_name='sectionwithimage', | ||||
|             name='menu_text', | ||||
|             field=models.CharField(default='', max_length=100), | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='service', | ||||
|             name='menu_text', | ||||
|             field=models.CharField(default='', max_length=100), | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='ungelichcontactussection', | ||||
|             name='menu_text', | ||||
|             field=models.CharField(default='', max_length=100), | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='ungelichtextsection', | ||||
|             name='menu_text', | ||||
|             field=models.CharField(default='', max_length=100), | ||||
|         ), | ||||
|     ] | ||||
							
								
								
									
										40
									
								
								ungleich_page/migrations/0004_auto_20171019_1113.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								ungleich_page/migrations/0004_auto_20171019_1113.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,40 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| # Generated by Django 1.9.4 on 2017-10-19 11:13 | ||||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('ungleich_page', '0003_auto_20171019_1007'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.AlterField( | ||||
|             model_name='sectionwithimage', | ||||
|             name='menu_text', | ||||
|             field=models.CharField(blank=True, default='', max_length=100), | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|             model_name='sectionwithimage', | ||||
|             name='price_tag_url', | ||||
|             field=models.URLField(blank=True, default='', max_length=300), | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|             model_name='service', | ||||
|             name='menu_text', | ||||
|             field=models.CharField(blank=True, default='', max_length=100), | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|             model_name='ungelichcontactussection', | ||||
|             name='menu_text', | ||||
|             field=models.CharField(blank=True, default='', max_length=100), | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|             model_name='ungelichtextsection', | ||||
|             name='menu_text', | ||||
|             field=models.CharField(blank=True, default='', max_length=100), | ||||
|         ), | ||||
|     ] | ||||
							
								
								
									
										45
									
								
								ungleich_page/migrations/0005_auto_20171019_1517.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								ungleich_page/migrations/0005_auto_20171019_1517.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,45 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| # Generated by Django 1.9.4 on 2017-10-19 15:17 | ||||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('ungleich_page', '0004_auto_20171019_1113'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.AddField( | ||||
|             model_name='ungelichcontactussection', | ||||
|             name='address', | ||||
|             field=models.CharField(blank=True, default='In der Au 7, Schwanden 8762', max_length=100), | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='ungelichcontactussection', | ||||
|             name='contact_form_header_text', | ||||
|             field=models.CharField(blank=True, default='Send us a message.', max_length=100), | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='ungelichcontactussection', | ||||
|             name='contact_text', | ||||
|             field=models.CharField(blank=True, default='Contact', max_length=100), | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='ungelichcontactussection', | ||||
|             name='country', | ||||
|             field=models.CharField(blank=True, default='Switzerland', max_length=100), | ||||
|         ), | ||||
|         migrations.AddField( | ||||
|             model_name='ungelichcontactussection', | ||||
|             name='organization_name', | ||||
|             field=models.CharField(blank=True, default='ungleich GmbH', max_length=100), | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|             model_name='ungelichcontactussection', | ||||
|             name='email', | ||||
|             field=models.EmailField(default='info@ungleich.ch', max_length=200), | ||||
|         ), | ||||
|     ] | ||||
							
								
								
									
										20
									
								
								ungleich_page/migrations/0006_aboutitem_link_url.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								ungleich_page/migrations/0006_aboutitem_link_url.py
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| # Generated by Django 1.9.4 on 2017-10-20 06:42 | ||||
| from __future__ import unicode_literals | ||||
| 
 | ||||
| from django.db import migrations, models | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('ungleich_page', '0005_auto_20171019_1517'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.AddField( | ||||
|             model_name='aboutitem', | ||||
|             name='link_url', | ||||
|             field=models.URLField(blank=True, default='', max_length=300), | ||||
|         ), | ||||
|     ] | ||||
|  | @ -1,3 +1,89 @@ | |||
| # from django.db import models | ||||
| from cms.models.pluginmodel import CMSPlugin | ||||
| from django.db import models | ||||
| from djangocms_text_ckeditor.fields import HTMLField | ||||
| from filer.fields.image import FilerImageField | ||||
| 
 | ||||
| # Create your models here. | ||||
| 
 | ||||
| class UngelichPicture(CMSPlugin): | ||||
|     image = FilerImageField( | ||||
|         null=True, | ||||
|         blank=True, | ||||
|         related_name="image", | ||||
|         on_delete=models.SET_NULL | ||||
|     ) | ||||
|     title = models.CharField(max_length=400) | ||||
| 
 | ||||
| 
 | ||||
| class SectionWithImage(UngelichPicture): | ||||
|     menu_text = models.CharField(max_length=100, default="", blank=True) | ||||
|     price_tag_image = FilerImageField( | ||||
|         null=True, | ||||
|         blank=True, | ||||
|         related_name="price_tag_image", | ||||
|         on_delete=models.SET_NULL | ||||
|     ) | ||||
|     price_tag_url = models.URLField(max_length=300, default="", blank=True) | ||||
| 
 | ||||
| 
 | ||||
| class UngelichContactUsSection(CMSPlugin): | ||||
|     menu_text = models.CharField(max_length=100, default="", blank=True) | ||||
|     email = models.EmailField(max_length=200, default="info@ungleich.ch") | ||||
|     contact_text = models.CharField( | ||||
|         max_length=100, default="Contact", blank=True | ||||
|     ) | ||||
|     organization_name = models.CharField( | ||||
|         max_length=100, default="ungleich GmbH", blank=True | ||||
|     ) | ||||
|     address = models.CharField( | ||||
|         max_length=100, default="In der Au 7, Schwanden 8762", blank=True | ||||
|     ) | ||||
|     country = models.CharField( | ||||
|         max_length=100, default="Switzerland", blank=True | ||||
|     ) | ||||
|     contact_form_header_text = models.CharField( | ||||
|         max_length=100, default="Send us a message.", blank=True | ||||
|     ) | ||||
| 
 | ||||
| 
 | ||||
| class UngelichTextSection(CMSPlugin): | ||||
|     menu_text = models.CharField(max_length=100, default="", blank=True) | ||||
|     title = models.CharField(max_length=200) | ||||
|     description = HTMLField() | ||||
| 
 | ||||
| 
 | ||||
| class Service(CMSPlugin): | ||||
|     menu_text = models.CharField(max_length=100, default="", blank=True) | ||||
|     title = models.CharField(max_length=200) | ||||
|     sub_title = models.CharField(max_length=200) | ||||
| 
 | ||||
|     def __str__(self): | ||||
|         return self.title | ||||
| 
 | ||||
| 
 | ||||
| class ServiceItem(CMSPlugin): | ||||
|     image = FilerImageField( | ||||
|         null=True, | ||||
|         blank=True, | ||||
|         related_name="service_item_image", | ||||
|         on_delete=models.SET_NULL | ||||
|     ) | ||||
|     title = models.CharField(max_length=200) | ||||
|     description = HTMLField() | ||||
| 
 | ||||
|     def __str__(self): | ||||
|         return self.title | ||||
| 
 | ||||
| 
 | ||||
| class About(Service): | ||||
|     pass | ||||
| 
 | ||||
| 
 | ||||
| class AboutItem(UngelichPicture): | ||||
|     inverted = models.BooleanField(default=False) | ||||
|     link_url = models.URLField(max_length=300, default="", blank=True) | ||||
| 
 | ||||
|     def __str__(self): | ||||
|         alignment = "Right" if self.inverted else "Left" | ||||
|         return "{alignment} - {title}".format( | ||||
|             alignment=alignment, title=self.title | ||||
|         ) | ||||
|  |  | |||
							
								
								
									
										12
									
								
								ungleich_page/static/ungleich_page/css/cms.css
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								ungleich_page/static/ungleich_page/css/cms.css
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| .lead, .split-description.wow.fadeInUp p{ | ||||
|     font-family: "Raleway" , "Helvetica Neue", Helvetica, Arial, sans-serif; | ||||
|     font-size: 21px; | ||||
|     color: #3a3a3a; | ||||
|     font-weight: 300 !important; | ||||
| } | ||||
| 
 | ||||
| @media(min-width: 768px) { | ||||
|     .custom-padding-bottom{ | ||||
|         padding-bottom: 0; | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,12 @@ | |||
| <li {% if instance.inverted %}class="timeline-inverted"{% endif %}> | ||||
|     {% if instance.link_url %}<a href="{{ instance.link_url }}" target="_blank">{% endif %} | ||||
|     <div class="timeline-image"> | ||||
|       <img class="img-circle img-responsive" src="{{ instance.image.url }}" alt=""> | ||||
|     </div> | ||||
|     {% if instance.link_url %}</a>{% endif %} | ||||
|     <div class="timeline-panel wow {% if instance.inverted %}slideInRight{% else %}slideInLeft{% endif %}"> | ||||
|       <div class="timeline-body"> | ||||
|         <p>{{ instance.title }}</p> | ||||
|       </div> | ||||
|     </div> | ||||
| </li> | ||||
|  | @ -0,0 +1,7 @@ | |||
| <div class="team-member wow fadeInUp" data-wow-delay="0.25s"> | ||||
|   <img src="{{ instance.image.url }}" class="img-responsive img-circle" alt=""> | ||||
|   <div class="team-member-caption inline-block"> | ||||
|     <h4 class="portfolio-caption">{{ instance.title }}</h4> | ||||
|     <p class="text-muted">{{ instance.description }}</p> | ||||
|   </div> | ||||
| </div> | ||||
							
								
								
									
										12
									
								
								ungleich_page/templates/ungleich_page/glasfaser/menus.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								ungleich_page/templates/ungleich_page/glasfaser/menus.html
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| {% load menu_tags %} | ||||
| 
 | ||||
| {% for child in children %} | ||||
| <li class="child{% if child.selected %} selected{% endif %}{% if child.ancestor %} ancestor{% endif %}{% if child.sibling %} sibling{% endif %}{% if child.descendant %} descendant{% endif %}"> | ||||
| 	<a href="{{ child.attr.redirect_url|default:child.get_absolute_url }}" class="page-scroll">{{ child.get_menu_title }}</a> | ||||
| 	{% if child.children %} | ||||
| 	<ul> | ||||
| 		{% show_menu from_level to_level extra_inactive extra_active template "" "" child %} | ||||
| 	</ul> | ||||
| 	{% endif %} | ||||
| </li> | ||||
| {% endfor %} | ||||
|  | @ -0,0 +1,18 @@ | |||
| {% load cms_tags %} | ||||
| <section id="{{section_id}}"> | ||||
|   <div class="container"> | ||||
|     <div class="text-center wow fadeInDown"> | ||||
|       <h2 class="section-heading">{{ about_instance.title }}</h2> | ||||
|       <h3 class="section-subheading text-muted">{{ about_instance.sub_title }}</h3> | ||||
|     </div> | ||||
|     <div class="row"> | ||||
|       <div class="col-lg-12"> | ||||
|         <ul class="timeline"> | ||||
|         {% for plugin in about_instance.child_plugin_instances %} | ||||
|             {% render_plugin plugin %} | ||||
|         {% endfor %} | ||||
|         </ul> | ||||
|       </div> | ||||
|     </div> | ||||
|   </div> | ||||
| </section> | ||||
|  | @ -0,0 +1,83 @@ | |||
| {% load i18n %} | ||||
| <!-- / contact section --> | ||||
| <div id="contact_section" class="full-contact-section"> | ||||
|   <div class="intro-header-2 contact-section" id="{{section_id}}"> | ||||
|     <div class="container"> | ||||
|       <div class="row"> | ||||
|         <div class="col-sm-6"> | ||||
|           <div class="title"> | ||||
|             <h2>{{instance.contact_text}}</h2> | ||||
|           </div> | ||||
|           <div class="contact-details"> | ||||
|             <div class="subtitle"> | ||||
|               <h3>{{instance.organization_name}}</h3> | ||||
|             </div> | ||||
|             <div class="description"> | ||||
|               <p>{{instance.email}}</p> | ||||
|               <p>{{instance.address}}</p> | ||||
|               <p>{{instance.country}}</p> | ||||
|             </div> | ||||
|           </div> | ||||
|           <div class="social"> | ||||
|             <a target="_blank" class="" href="https://twitter.com/datacenterlight"><i class="fa fa-twitter fa-fw"></i></a> | ||||
|             <a target="_blank"  class=""  href="https://github.com/ungleich"><i class="fa fa-github fa-fw"></i></a> | ||||
|             <a target="_blank"  class=""  href="https://www.facebook.com/ungleich.ch/"><i class="fa fa-facebook"></i></a> | ||||
|           </div> | ||||
|         </div> | ||||
|         <div class="col-sm-6"> | ||||
|           <div id="contact-form" class="contact-form"> | ||||
|             {% if success %} | ||||
|                 <div class="contact-form-success"> | ||||
|                     <div class="subtitle text-center"> | ||||
|                         <h3>{% trans "Thank you for contacting us." %}</h3> | ||||
|                     </div> | ||||
|                     <p> | ||||
|                         {% trans "Your message was successfully sent to our team." %} | ||||
|                     </p> | ||||
|                 </div> | ||||
|             {% else %} | ||||
|                 <div class="row"> | ||||
|                     <div class="col-sm-offset-2 col-sm-10"> | ||||
|                         <div class="subtitle"> | ||||
|                             <h3>{{instance.contact_form_header_text}}</h3> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|                 <form class="form-horizontal ajax-form" method="POST" action="{% url 'datacenterlight:contact_us' %}" data-toggle="validator" data-response="#contact-form"> | ||||
|                     {% csrf_token %} | ||||
|                     <input type="hidden" value="glasfaser" name="from_page"> | ||||
|                     <div class="form-group"> | ||||
|                         <label class="control-label col-sm-2" for="name">{% trans "Name" %}</label> | ||||
|                         <div class="col-sm-10"> | ||||
|                             <input id = "name" type="text" name="name" class="form-control" data-minlength="3" data-error="{% trans 'Please enter your name.' %}" required> | ||||
|                             {{contact_form.name.errors}} | ||||
|                         </div> | ||||
|                     </div> | ||||
|                     <div class="form-group"> | ||||
|                         <label class="control-label col-sm-2" for="email">{% trans "Email" %}</label> | ||||
|                         <div class="col-sm-10"> | ||||
|                             <input id = "email" name="email" type="email" pattern="^[^@\s]+@([^@\s]+\.)+[^@\s]+$" class="form-control" data-error="{% trans 'Please enter a valid email address.' %}" required> | ||||
|                             {{contact_form.email.errors}} | ||||
|                         </div> | ||||
|                     </div> | ||||
|                     <div class="form-group"> | ||||
|                         <label class="control-label col-sm-2" for="message">{% trans "Message" %}</label> | ||||
|                         <div class="col-sm-10"> | ||||
|                             <textarea class="form-control" name="message" id="message" rows="6" required></textarea> | ||||
|                             {{contact_form.message.errors}} | ||||
|                         </div> | ||||
|                     </div> | ||||
|                     <div class="form-group"> | ||||
|                         <div class="col-sm-offset-2 col-sm-10 text-right"> | ||||
|                             <div class="form-error hide">{% trans "Sorry, there was an unexpected error. Kindly retry." %}</div> | ||||
|                             <button type="submit" class="btn btn-default">{% trans "SUBMIT" %}</button> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </form> | ||||
|             {% endif %} | ||||
|           </div> | ||||
|         </div> | ||||
|       </div> | ||||
|     </div> | ||||
|   </div> | ||||
| </div> | ||||
|  | @ -0,0 +1,17 @@ | |||
| {% load static i18n cms_tags %} | ||||
| <section id="{{section_id}}" class="custom-padding-bottom"> | ||||
|   <div class="container"> | ||||
|     <div class="text-center wow fadeInDown"> | ||||
|       <h2 class="section-heading">{{ service_instance.title }}</h2> | ||||
|       <h3 class="section-subheading text-muted">{{ service_instance.sub_title }}</h3> | ||||
|     </div> | ||||
|     <div class="row text-center"> | ||||
|         {% for plugin in service_instance.child_plugin_instances %} | ||||
|             <div class="col-sm-4"> | ||||
|             {% render_plugin plugin %} | ||||
|             </div> | ||||
|         {% endfor %} | ||||
| 
 | ||||
|     </div> | ||||
|   </div> | ||||
| </section> | ||||
|  | @ -0,0 +1,12 @@ | |||
| <div class="split-section left" id="{{section_id}}"> | ||||
|   <div class="container"> | ||||
|     <div class="split-text"> | ||||
|       <div class="split-title"> | ||||
|         <h2>{{instance.title}}</h2> | ||||
|       </div> | ||||
|       <div class="split-description wow fadeInUp"> | ||||
|         <p class="lead">{{instance.description}}</p> | ||||
|       </div> | ||||
|     </div> | ||||
|   </div> | ||||
| </div> | ||||
|  | @ -0,0 +1,13 @@ | |||
| <section class="split-section right" id="{{section_id}}"> | ||||
|   <div class="container"> | ||||
|     <div class="split-text text-center"> | ||||
|       <div class="wow fadeInDown"> | ||||
|         <h2 class="section-heading text-center">{{instance.title}}</h2> | ||||
|         <h3 class="section-subheading text-muted"></h3> | ||||
|       </div> | ||||
|       <div class="split-description text-center wow fadeInUp"> | ||||
|         <p class="lead">{{instance.description}}</p> | ||||
|       </div> | ||||
|     </div> | ||||
|   </div> | ||||
| </section> | ||||
|  | @ -0,0 +1,10 @@ | |||
| <div class="intro-header" style="background:url({{ image.url }}) no-repeat center center; background-size: cover; background-position: left; background-color: rgb(118, 140, 163); background-attachment: fixed; flex-direction: column; align-items: flex-end; justify-content: space-between; padding-top: 70px;" id="home"> | ||||
|   <div class="price-tag-container"> | ||||
|     {% if object.price_tag_url %}<a href="{{ object.price_tag_url }}" target="_blank">{% endif %}{% if object.price_tag_image %}<div style="background:url({{ object.price_tag_image.url }}) no-repeat center center; background-size: cover;" class="price-tag"></div>{% endif %}{% if object.price_tag_url %}</a>{% endif %} | ||||
|   </div> | ||||
|   <div class="high-speed"> | ||||
|     <div class="high-speed-border"></div> | ||||
|       <h1>{{ object.title }}</h1> | ||||
|     <div class="high-speed-border"></div> | ||||
|   </div> | ||||
| </div> | ||||
							
								
								
									
										108
									
								
								ungleich_page/templates/ungleich_page/glasfaser_cms_page.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										108
									
								
								ungleich_page/templates/ungleich_page/glasfaser_cms_page.html
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,108 @@ | |||
| {% load static bootstrap3 i18n cms_tags sekizai_tags menu_tags %} | ||||
| {% get_current_language as LANGUAGE_CODE %} | ||||
| 
 | ||||
| <!DOCTYPE html> | ||||
| <html lang="de"> | ||||
| 
 | ||||
| <head> | ||||
|     <meta charset="utf-8"> | ||||
|     <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <meta name="description" content=""> | ||||
|     <meta name="author" content=""> | ||||
|     <title>ungleich GmbH</title> | ||||
| 
 | ||||
|     <!-- Bootstrap Core CSS --> | ||||
|     <link href="{% static 'ungleich_page/css/bootstrap.min.css' %}" rel="stylesheet"> | ||||
|     <link href="{% static 'ungleich_page/css/lib/animate.min.css' %}" rel="stylesheet"> | ||||
| 
 | ||||
|     <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> | ||||
|     <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> | ||||
|     <!--[if lt IE 9]> | ||||
|     <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> | ||||
|     <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> | ||||
|     <![endif]--> | ||||
| 
 | ||||
|     <link href="//fonts.googleapis.com/css?family=Open+Sans+Condensed:700|Lato:300,400,700|Montserrat:400,700" rel="stylesheet" type="text/css"> | ||||
| 
 | ||||
|     <!-- Custom CSS --> | ||||
|     <link href="{% static 'ungleich_page/css/agency.css' %}" rel="stylesheet"> | ||||
|     <link href="{% static 'ungleich_page/css/ungleich.css' %}" rel="stylesheet"> | ||||
|     <link href="{% static 'datacenterlight/css/landing-page.css' %}" rel="stylesheet"> | ||||
|     <link href="{% static 'ungleich_page/css/glasfaser.css' %}" rel="stylesheet"> | ||||
|     {% addtoblock "css" %} | ||||
|     <link href="{% static 'ungleich_page/css/cms.css' %}" media="screen" rel="stylesheet" type="text/css"/> | ||||
|     {% endaddtoblock %} | ||||
|     {% render_block "css" postprocessor "compressor.contrib.sekizai.compress" %} | ||||
|     {% render_block "js" postprocessor "compressor.contrib.sekizai.compress" %} | ||||
| 
 | ||||
|     <!-- Google analytics --> | ||||
|     {% include "google_analytics.html" %} | ||||
|     <!-- End Google Analytics --> | ||||
| 
 | ||||
|     <link rel="shortcut icon" href="{% static 'ungleich_page/img/favicon.ico' %}" type="image/x-icon"> | ||||
| </head> | ||||
| 
 | ||||
| <body id="page-top" class="index"> | ||||
| {% cms_toolbar %} | ||||
|     <nav class="navbar navbar-default navbar-fixed-top topnav navbar-transparent"> | ||||
|       <div class="topnav"> | ||||
|         <!-- Brand and toggle get grouped for better mobile display --> | ||||
|         <div class="navbar-header"> | ||||
|             <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> | ||||
|               <span class="sr-only">{% trans "Toggle navigation" %}</span> | ||||
|               <span class="icon-bar"></span> | ||||
|               <span class="icon-bar"></span> | ||||
|               <span class="icon-bar"></span> | ||||
|             </button> | ||||
|             <a href="{% url 'ungleich_page:landing' %}" id="logoBlack" class="navbar-brand topnav"><img src="{% static 'ungleich_page/img/logo_black.svg' %}"></a> | ||||
|             <a href="{% url 'ungleich_page:landing' %}" id="logoWhite" class="navbar-brand topnav"><img src="{% static 'ungleich_page/img/logo_white.svg' %}"></a> | ||||
|         </div> | ||||
|         <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> | ||||
|           <!-- Start Navbar collapse--> | ||||
|           <ul class="nav navbar-nav navbar-right"> | ||||
|               {% show_sub_menu 1 None 100 "ungleich_page/glasfaser/menus.html" %} | ||||
|           </ul> | ||||
|           <!-- /.navbar-collapse --> | ||||
|         </div> | ||||
|       </div> | ||||
|     </nav> | ||||
| 
 | ||||
|     {% placeholder 'Top Section' %} | ||||
| 
 | ||||
|     {% placeholder 'Middle Section' %} | ||||
| 
 | ||||
|     {% placeholder 'Glasfaser Services' %} | ||||
| 
 | ||||
|     {% placeholder 'Glasfaser About' %} | ||||
| 
 | ||||
|     {% placeholder 'Contact Section' %} | ||||
| 
 | ||||
|     <!-- Footer --> | ||||
|     {% include "ungleich_page/includes/_footer.html" %} | ||||
| 
 | ||||
|     <!-- jQuery --> | ||||
|     <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js" type="text/javascript"></script> | ||||
|     <script type="text/javascript"> | ||||
|         $(document).ready(function () { | ||||
|             if ($(".has-error").length != 0) { | ||||
|                 window.location = window.location.pathname + "#contact_section" | ||||
|             } | ||||
|         }); | ||||
|     </script> | ||||
|     <script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" type="text/javascript"></script> | ||||
| 
 | ||||
|     <!-- Plugin JavaScript --> | ||||
|     <script src="//cdnjs.cloudflare.com/ajax/libs/1000hz-bootstrap-validator/0.11.9/validator.min.js"></script> | ||||
|     <script src="//cdnjs.cloudflare.com/ajax/libs/classie/1.0.1/classie.min.js" type="text/javascript"></script> | ||||
|     <script src="//cdnjs.cloudflare.com/ajax/libs/wow/1.1.2/wow.min.js" type="text/javascript"></script> | ||||
| 
 | ||||
|     <!-- Custom Theme JavaScript --> | ||||
|     <script src="{% static 'ungleich_page/js/ungleich.js' %}" type="text/javascript"></script> | ||||
|     <script src="{% static 'datacenterlight/js/main.js' %}"></script> | ||||
| 
 | ||||
|     <!-- Custom Fonts --> | ||||
|     <link href="//fonts.googleapis.com/css?family=Raleway" rel="stylesheet" type="text/css"> | ||||
|     <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"> | ||||
| </body> | ||||
| </html> | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue