Browse Source

Allow easy configuration of a logo

To be displayed in non-admin views, topleft.
Jocelyn Delalande 6 years ago
parent
commit
ac26835905

+ 1 - 0
README.md

@@ -375,6 +375,7 @@ MEMBERSHIP_FEE_REMINDER_DATES = [
    stracktraces and enable [django-debug-toolbar](https://django-debug-toolbar.readthedocs.io).
 - `SITE_TITLE`: the base of site title (displayed in browser window/tab title)
 - `SITE_HEADER`: the site header (displayed in all pages as page header)
+- `SITE_LOGO_URL`: URL to website logo (by default, this is an ascii-duck)
 
 Accounting logs
 ---------------

+ 1 - 0
coin/isp_database/context_processors.py

@@ -12,4 +12,5 @@ def branding(request):
         'branding': ISPInfo.objects.first(),
         'SITE_HEADER': settings.SITE_HEADER,
         'SITE_TITLE': settings.SITE_TITLE,
+        'SITE_LOGO_URL': settings.SITE_LOGO_URL,
     }

+ 1 - 0
coin/settings_base.py

@@ -292,6 +292,7 @@ MEMBERSHIP_FEE_REMINDER_DATES = [
 # Customize template titles
 SITE_TITLE = "COIN - SI"
 SITE_HEADER = "COIN est un Outil pour un Internet Neutre"
+SITE_LOGO_URL = ''
 
 # Pattern used to display a unique reference for any subscription
 # Helpful for bank wire transfer identification

+ 4 - 3
coin/static/css/local.css

@@ -10,7 +10,7 @@ h1 {
     font-size: 2.2em;
     margin-bottom: 1em;
 }
-h1:before {
+h1 .default-logo:after {
     content: "\\_o<";
     color: #FF6600;
     font-weight: normal;
@@ -22,10 +22,11 @@ h1:before {
     width: 25%;
 }
 
-h1:hover:before {
+h1 .default-logo:hover:after {
     content: "\\_x<";
 }
-h1:hover:after {
+
+pPh1:hover:after {
     position: absolute;
     text-align: center;
     z-index: -1;

+ 8 - 1
coin/templates/base.html

@@ -34,7 +34,14 @@
             <div class="show-for-medium-up">
                 <div class="row">
                     <div class="large-12">
-                        <h1><a href="{% url 'home' %}">{{ SITE_HEADER }}</a></h1>
+                        <h1>
+                            {% if SITE_LOGO_URL %}
+                            <img class="medium-3 large-3 columns" src="{{ SITE_LOGO_URL }}" alt="" />
+                            {% else %}
+                            <span class="default-logo">&nbsp;</span>
+                            {% endif %}
+                            <a href="{% url 'home' %}">{{ SITE_HEADER }}</a>
+                        </h1>
                     </div>
                 </div>
             </div>