mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 05:07:50 +02:00
Add a default card image when no custom one exists (#23)
* Add a default card image when no custom one exists * Add coming_soon.png source * Use directly the svg source instead of the png raster
This commit is contained in:
@@ -3,6 +3,7 @@ from solo.admin import SingletonModelAdmin
|
|||||||
|
|
||||||
from portal.models import SiteConfiguration, Flatpage
|
from portal.models import SiteConfiguration, Flatpage
|
||||||
|
|
||||||
|
|
||||||
@admin.register(SiteConfiguration)
|
@admin.register(SiteConfiguration)
|
||||||
class SiteConfigurationAdmin(SingletonModelAdmin):
|
class SiteConfigurationAdmin(SingletonModelAdmin):
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
|
5
ram/portal/context_processors.py
Normal file
5
ram/portal/context_processors.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
|
def default_card_image(request):
|
||||||
|
return {"DEFAULT_CARD_IMAGE": settings.DEFAULT_CARD_IMAGE}
|
58
ram/portal/static/coming_soon.svg
Normal file
58
ram/portal/static/coming_soon.svg
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="420"
|
||||||
|
height="226"
|
||||||
|
viewBox="0 0 5.8333333 3.1388889"
|
||||||
|
version="1.1"
|
||||||
|
id="svg1"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<defs
|
||||||
|
id="defs1">
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient1">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ffffff;stop-opacity:1;"
|
||||||
|
offset="0.59606808"
|
||||||
|
id="stop2" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#f5f5f5;stop-opacity:1;"
|
||||||
|
offset="1"
|
||||||
|
id="stop1" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
xlink:href="#linearGradient1"
|
||||||
|
id="linearGradient2"
|
||||||
|
x1="0"
|
||||||
|
y1="1.5694444"
|
||||||
|
x2="5.8333335"
|
||||||
|
y2="1.5694444"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
gradientTransform="matrix(0.53809522,0,0,1.8584071,-3.1388889,0)"
|
||||||
|
spreadMethod="pad" />
|
||||||
|
</defs>
|
||||||
|
<g
|
||||||
|
id="layer1">
|
||||||
|
<rect
|
||||||
|
style="mix-blend-mode:normal;fill:url(#linearGradient2);stroke:none;stroke-width:0.801535"
|
||||||
|
id="rect1"
|
||||||
|
width="3.1388888"
|
||||||
|
height="5.8333335"
|
||||||
|
x="-3.1388888"
|
||||||
|
y="-2.220446e-16"
|
||||||
|
transform="rotate(-90)" />
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-weight:bold;font-size:0.444444px;line-height:1.25;font-family:'Noto Sans';-inkscape-font-specification:'Noto Sans Bold';letter-spacing:0px;word-spacing:0px;stroke-width:0.0138889"
|
||||||
|
x="1.5366687"
|
||||||
|
y="1.6798887"
|
||||||
|
id="text1"><tspan
|
||||||
|
id="tspan1"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:0.444444px;font-family:'Noto Sans';-inkscape-font-specification:'Noto Sans';fill:#dee2e6;fill-opacity:1;stroke-width:0.0138889"
|
||||||
|
x="1.5366687"
|
||||||
|
y="1.6798887">Coming soon</tspan></text>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.9 KiB |
@@ -1,4 +1,5 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
{% block header %}
|
{% block header %}
|
||||||
<p class="lead text-muted">Results found: {{ matches }}</p>
|
<p class="lead text-muted">Results found: {{ matches }}</p>
|
||||||
@@ -9,9 +10,11 @@
|
|||||||
{% for d in data %}
|
{% for d in data %}
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="card shadow-sm">
|
<div class="card shadow-sm">
|
||||||
{% for i in d.image.all %}
|
{% if d.image.count > 0 %}
|
||||||
{% if forloop.first %}<a href="{{d.get_absolute_url}}"><img class="card-img-top" src="{{ i.image.url }}" alt="Card image cap"></a>{% endif %}
|
<a href="{{d.get_absolute_url}}"><img class="card-img-top" src="{{ d.image.first.image.url }}" alt="{{ d }}"></a>
|
||||||
{% endfor %}
|
{% else %}
|
||||||
|
<a href="{{d.get_absolute_url}}"><img class="card-img-top" src="{% static DEFAULT_CARD_IMAGE %}" alt="{{ d }}"></a>
|
||||||
|
{% endif %}
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p class="card-text" style="position: relative;">
|
<p class="card-text" style="position: relative;">
|
||||||
<strong>{{ d }}</strong>
|
<strong>{{ d }}</strong>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
from ram.utils import git_suffix
|
from ram.utils import git_suffix
|
||||||
|
|
||||||
__version__ = "0.4.2"
|
__version__ = "0.4.3"
|
||||||
__version__ += git_suffix(__file__)
|
__version__ += git_suffix(__file__)
|
||||||
|
@@ -80,6 +80,7 @@ TEMPLATES = [
|
|||||||
"django.template.context_processors.request",
|
"django.template.context_processors.request",
|
||||||
"django.contrib.auth.context_processors.auth",
|
"django.contrib.auth.context_processors.auth",
|
||||||
"django.contrib.messages.context_processors.messages",
|
"django.contrib.messages.context_processors.messages",
|
||||||
|
"portal.context_processors.default_card_image",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -148,6 +149,10 @@ COUNTRIES_OVERRIDE = {
|
|||||||
"ZZ": "Freelance",
|
"ZZ": "Freelance",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Image used on cards without a custom image uploaded.
|
||||||
|
# The file must be placed in the root of the 'static' folder
|
||||||
|
DEFAULT_CARD_IMAGE = "coming_soon.svg"
|
||||||
|
|
||||||
DECODER_INTERFACES = [
|
DECODER_INTERFACES = [
|
||||||
(1, "NEM651"),
|
(1, "NEM651"),
|
||||||
(2, "NEM652"),
|
(2, "NEM652"),
|
||||||
|
Reference in New Issue
Block a user