diff --git a/grambank/__init__.py b/grambank/__init__.py index afa3bd4..edcc9d9 100644 --- a/grambank/__init__.py +++ b/grambank/__init__.py @@ -3,9 +3,7 @@ from pyramid.config import Configurator from sqlalchemy.orm import joinedload -from clld.interfaces import ( - IValue, IDomainElement, IMapMarker, IValueSet, ILinkAttrs, IContribution, ICtxFactoryQuery, -) +from clld.interfaces import IMapMarker, ILinkAttrs, IContribution, ICtxFactoryQuery from clld.web.app import CtxFactoryQuery, menu_item from clld_glottologfamily_plugin.util import LanguageByFamilyMapMarker from clld.db.models import common @@ -15,6 +13,7 @@ from grambank import models from grambank import views from grambank import datatables +from grambank.util import icon_from_req _ = lambda s: s _('Parameters') @@ -25,21 +24,11 @@ class GrambankMapMarker(LanguageByFamilyMapMarker): def __call__(self, ctx, req): - if IValue.providedBy(ctx): # pragma: no cover - icon = ctx.domainelement.jsondata['icon'] - elif IValueSet.providedBy(ctx): - icon = ctx.values[0].domainelement.jsondata['icon'] - elif IDomainElement.providedBy(ctx): - icon = ctx.jsondata['icon'] - else: - icon = LanguageByFamilyMapMarker.get_icon(self, ctx, req) - icon = { - 'cffffff': 'c0077bb', - 'cff0000': 'ccc3311', - 'c0000ff': 'c009988', - 'cffff00': 'cee7733', - }.get(icon, icon) - return svg.data_url(svg.icon(icon, opacity=0.8)) + icon = icon_from_req(ctx, req) + if icon: + return icon.url(req) + return svg.data_url( + svg.icon(LanguageByFamilyMapMarker.get_icon(self, ctx, req), opacity='0.7')) class GrambankCtxFactoryQuery(CtxFactoryQuery): diff --git a/grambank/maps.py b/grambank/maps.py index 83bde57..c0f0d65 100644 --- a/grambank/maps.py +++ b/grambank/maps.py @@ -21,9 +21,6 @@ def get_layers(self): ), marker=helpers.map_marker_img(self.req, de, marker=self.map_marker)) - #def get_default_options(self): - # return {'hash': True, 'icon_size': 15, 'base_layer': "Esri.WorldPhysical"} - def includeme(config): config.register_map('parameter', FeatureMap) diff --git a/grambank/static/project.css b/grambank/static/project.css index fdf33ab..0e08a3d 100644 --- a/grambank/static/project.css +++ b/grambank/static/project.css @@ -125,4 +125,4 @@ a:hover { background-image: none; } -img.leaflet-marker-icon {opacity: 0.5;} +/*img.leaflet-marker-icon {opacity: 0.5;}*/ diff --git a/grambank/templates/combination/detail_html.mako b/grambank/templates/combination/detail_html.mako index 5fec0b9..289179f 100644 --- a/grambank/templates/combination/detail_html.mako +++ b/grambank/templates/combination/detail_html.mako @@ -1,7 +1,12 @@ <%inherit file="../${context.get('request').registry.settings.get('clld.app_template', 'app.mako')}"/> <%namespace name="util" file="../util.mako"/> <%! active_menu_item = "parameters" %> +<% from clld.web.icon import Icon %> + <%block name="title">F-Dependency ${'→'.join(p.id for p in ctx.parameters)|n}%block> +<%block name="head"> + ${util.head_coloris()|n} +%block>
${util.coloris_icon_picker(u.icon_from_req(de, req))|n} | +${de.name} | +${de.description} | +