From f44b872ba269e3c4789e81e9ed0c1fb0339ae718 Mon Sep 17 00:00:00 2001 From: Emilie Date: Thu, 1 Dec 2016 16:37:56 +0100 Subject: [PATCH] Linked orga : content + footer --- .../shop/0010_remove_product_content_model.py | 19 +++++++++++++ app/organization/core/context_processors.py | 5 +++- app/organization/core/models.py | 2 +- app/organization/network/admin.py | 1 + .../migrations/0063_auto_20161201_1154.py | 25 +++++++++++++++++ app/organization/network/models.py | 2 ++ app/static/src/sass/modules/_all.scss | 2 +- .../sass/modules/_linked-organizations.scss | 27 +++++++++++++++++++ .../core/inc/linked_organization_content.html | 16 +++++++++++ .../core/inc/linked_organization_footer.html | 8 ++++++ app/templates/includes/footer.html | 7 +++-- app/templates/pages/departmentpage.html | 4 +++ app/templates/pages/projecttopicpage.html | 5 +++- app/templates/pages/teampage.html | 4 +++ app/templates/projects/project_detail.html | 4 +++ 15 files changed, 123 insertions(+), 8 deletions(-) create mode 100644 app/migrations/shop/0010_remove_product_content_model.py create mode 100644 app/organization/network/migrations/0063_auto_20161201_1154.py create mode 100644 app/static/src/sass/modules/_linked-organizations.scss create mode 100644 app/templates/core/inc/linked_organization_content.html create mode 100644 app/templates/core/inc/linked_organization_footer.html diff --git a/app/migrations/shop/0010_remove_product_content_model.py b/app/migrations/shop/0010_remove_product_content_model.py new file mode 100644 index 00000000..54a9ff02 --- /dev/null +++ b/app/migrations/shop/0010_remove_product_content_model.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.11 on 2016-12-01 10:54 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('shop', '0009_product_content_model'), + ] + + operations = [ + migrations.RemoveField( + model_name='product', + name='content_model', + ), + ] diff --git a/app/organization/core/context_processors.py b/app/organization/core/context_processors.py index f0cc3e06..85c6d374 100644 --- a/app/organization/core/context_processors.py +++ b/app/organization/core/context_processors.py @@ -17,9 +17,12 @@ def settings(request): # HOST ORGANIZATION host_organization = Organization.objects.get(is_host=True) - + linked_organizations_content = host_organization.organizations_content.all() + linked_organizations_footer = host_organization.organizations_footer.all() return {'CURRENT_SEASON': CURRENT_SEASON, 'CURRENT_SEASON_STYLED': CURRENT_SEASON_STYLED, 'NEWSLETTER_SUBSCRIBING_URL': NEWSLETTER_SUBSCRIBING_URL, 'host_organization': host_organization, + 'LINKED_ORGA_CONTENT' : linked_organizations_content, + 'LINKED_ORGA_FOOTER' : linked_organizations_footer } diff --git a/app/organization/core/models.py b/app/organization/core/models.py index e1ed5f31..a6cede87 100644 --- a/app/organization/core/models.py +++ b/app/organization/core/models.py @@ -14,7 +14,7 @@ from django_countries.fields import CountryField COLOR_CHOICES = (('black', _('black')), ('yellow', _('yellow')), ('red', _('red'))) ALIGNMENT_CHOICES = (('left', _('left')), ('center', _('center')), ('right', _('right'))) -IMAGE_TYPE_CHOICES = (('logo', _('logo')), ('slider', _('slider')), ('card', _('card')), ('page_slider', _('page - slider')), ('page_featured', _('page - featured'))) +IMAGE_TYPE_CHOICES = (('logo', _('logo')), ('logo_white', _('logo white')), ('logo_black', _('logo black')), ('slider', _('slider')), ('card', _('card')), ('page_slider', _('page - slider')), ('page_featured', _('page - featured'))) class Description(models.Model): diff --git a/app/organization/network/admin.py b/app/organization/network/admin.py index fc183a48..caa0bc7e 100644 --- a/app/organization/network/admin.py +++ b/app/organization/network/admin.py @@ -40,6 +40,7 @@ class OrganizationAdmin(BaseTranslationModelAdmin): OrganizationImageInline, OrganizationBlockInline, OrganizationLinkInline ] + filter_horizontal = ['organizations_content', 'organizations_footer'] list_display = ['name', 'type', 'admin_thumb'] list_filter = ['is_on_map',] search_fields = ['name',] diff --git a/app/organization/network/migrations/0063_auto_20161201_1154.py b/app/organization/network/migrations/0063_auto_20161201_1154.py new file mode 100644 index 00000000..75c53074 --- /dev/null +++ b/app/organization/network/migrations/0063_auto_20161201_1154.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.11 on 2016-12-01 10:54 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('organization-network', '0062_auto_20161114_1842'), + ] + + operations = [ + migrations.AddField( + model_name='organization', + name='organizations_content', + field=models.ManyToManyField(blank=True, help_text='Usefull for host organization', related_name='_organization_organizations_content_+', to='organization-network.Organization', verbose_name='Linked organizations (in content)'), + ), + migrations.AddField( + model_name='organization', + name='organizations_footer', + field=models.ManyToManyField(blank=True, help_text='Usefull for host organization', related_name='_organization_organizations_footer_+', to='organization-network.Organization', verbose_name='Linked organizations (in footer)'), + ), + ] diff --git a/app/organization/network/models.py b/app/organization/network/models.py index b81c4170..8d5863d4 100644 --- a/app/organization/network/models.py +++ b/app/organization/network/models.py @@ -73,6 +73,8 @@ class Organization(Named, Address, URL, AdminThumbRelatedMixin): telephone = models.CharField(_('telephone'), max_length=64, blank=True, null=True) opening_times = models.TextField(_('opening times'), blank=True) subway_access = models.TextField(_('subway access'), blank=True) + organizations_content = models.ManyToManyField('self', verbose_name=_('Linked organizations (in content)'), related_name='organization_main', blank=True, help_text="Usefull for host organization") + organizations_footer = models.ManyToManyField('self', verbose_name=_('Linked organizations (in footer)'), related_name='organization_main', blank=True, help_text="Usefull for host organization") admin_thumb_type = 'logo' diff --git a/app/static/src/sass/modules/_all.scss b/app/static/src/sass/modules/_all.scss index e1387fa6..12359cf4 100755 --- a/app/static/src/sass/modules/_all.scss +++ b/app/static/src/sass/modules/_all.scss @@ -43,7 +43,7 @@ @import 'project-details'; @import 'map-infowindow'; @import 'map-legend'; - +@import 'linked-organizations'; // Typography modules @import 'dashed'; @import 'dotted'; diff --git a/app/static/src/sass/modules/_linked-organizations.scss b/app/static/src/sass/modules/_linked-organizations.scss new file mode 100644 index 00000000..e1dd0786 --- /dev/null +++ b/app/static/src/sass/modules/_linked-organizations.scss @@ -0,0 +1,27 @@ +$module: ".linked-organizations"; + +#{$module} { + + list-style-type: none; + padding: 0; + margin: 0; + + &__item { + + display: inline-block; + width: 30px; + height: 30px; + background-size: contain; + background-position: center center; + background-repeat: no-repeat; + + @include margin(1 1 0 0); + + a { + width : 30px; + height : 30px; + } + + } + +} diff --git a/app/templates/core/inc/linked_organization_content.html b/app/templates/core/inc/linked_organization_content.html new file mode 100644 index 00000000..22e9c496 --- /dev/null +++ b/app/templates/core/inc/linked_organization_content.html @@ -0,0 +1,16 @@ +{% load organization_tags %} +
+
+
    + {% for loc in LINKED_ORGA_CONTENT %} + {% with loc.images|get_type:"logo_black"|first as img %} +
  • + + + +
  • + {% endwith %} + {% endfor %} +
+
+
diff --git a/app/templates/core/inc/linked_organization_footer.html b/app/templates/core/inc/linked_organization_footer.html new file mode 100644 index 00000000..e28a7fc7 --- /dev/null +++ b/app/templates/core/inc/linked_organization_footer.html @@ -0,0 +1,8 @@ +{% load organization_tags %} +{% for lof in LINKED_ORGA_FOOTER %} + + {% with lof.images|get_type:"logo_white"|first as img %} + + {% endwith %} + +{% endfor %} diff --git a/app/templates/includes/footer.html b/app/templates/includes/footer.html index 2f0c1e02..ff0e8bec 100644 --- a/app/templates/includes/footer.html +++ b/app/templates/includes/footer.html @@ -53,10 +53,9 @@
{{ host_organization.description }}
{% trans 'under the tutelage of' %} :

- - - - + {% if LINKED_ORGA_FOOTER %} + {% include 'core/inc/linked_organization_footer.html' %} + {% endif %}
diff --git a/app/templates/pages/departmentpage.html b/app/templates/pages/departmentpage.html index c122ccdb..8c8b3688 100644 --- a/app/templates/pages/departmentpage.html +++ b/app/templates/pages/departmentpage.html @@ -26,6 +26,10 @@ {% endeditable %} {% endif %}--> + {% if LINKED_ORGA_CONTENT %} + {% include 'core/inc/linked_organization_content.html' %} + {% endif %} + {% if page.departmentpage.content %} {% editable page.departmentpage.content %} {{ page.departmentpage.content|richtext_filters|safe }} diff --git a/app/templates/pages/projecttopicpage.html b/app/templates/pages/projecttopicpage.html index 370a8a64..3f644845 100644 --- a/app/templates/pages/projecttopicpage.html +++ b/app/templates/pages/projecttopicpage.html @@ -34,7 +34,10 @@ {% endblock %} {% block page_content %} - + {% if LINKED_ORGA_CONTENT %} + {% include 'core/inc/linked_organization_content.html' %} + {% endif %} + {% if page.projecttopicpage.sub_title %} {% editable page.projecttopicpage.sub_title %}
diff --git a/app/templates/pages/teampage.html b/app/templates/pages/teampage.html index fce3cb8b..2e90fc67 100644 --- a/app/templates/pages/teampage.html +++ b/app/templates/pages/teampage.html @@ -21,6 +21,10 @@ {% block page_content %} + {% if LINKED_ORGA_CONTENT %} + {% include 'core/inc/linked_organization_content.html' %} + {% endif %} + {% if page.teampage.sub_title %} {% editable page.teampage.sub_title %}
diff --git a/app/templates/projects/project_detail.html b/app/templates/projects/project_detail.html index c1caaca4..61cec702 100644 --- a/app/templates/projects/project_detail.html +++ b/app/templates/projects/project_detail.html @@ -45,6 +45,10 @@

{{ project.title }}

{% endeditable %} + {% if LINKED_ORGA_CONTENT %} + {% include 'core/inc/linked_organization_content.html' %} + {% endif %} + {% if project.description %} {% editable project.description %}
-- 2.39.5