【问题标题】:popular flame icon does not display in CKAN流行的火焰图标在 CKAN 中不显示
【发布时间】:2018-10-31 17:13:58
【问题描述】:

场景:

我在 helpers.py 中使用默认的流行函数。但是,它不会在具有超过 10 个视图的包/资源之后显示图标。我如何在resource_item.html 模板中设置流行功能如下:

{{ h.popular('views', res.tracking_summary.total, min=10) }}

我还检查了将由h.popular 呈现的 sn-p:

{% if number >= min %}
<span class="popular ckan-icon ckan-icon-flame" title="{{ title.format(number=number) }}" xmlns="http://www.w3.org/1999/xhtml">{{ _('Popular') }}</span>
{% endif %}

它只能渲染文本“流行”。我试图删除文本,似乎 CKAN 无法获取ckan-icon-flame。然后我检查了icons.lessckan-icon-flame已经定义好了。

其他信息:

我实现了一个定制的跟踪工具。所以我没有在我的ckan.ini 文件中启用ckan.tracking_enabled。我想知道这个变化是否与正确加载图标有关。但是根据我对代码的阅读,我没有发现任何与图标渲染有关的情况。

更多信息:

变量.less:

@imagePath: "../../../base/images";
@spritePath: "@{imagePath}/sprite-ckan-icons.png";

icons.less:

.ckan-icon {
    //.ie7-restore-right-whitespace;
    display: inline-block;
    vertical-align: text-bottom;
    position: relative;
    top: 2px;
    width: 16px;
    height: 16px;
    background-image: url("@{imagePath}/sprite-ckan-icons.png");
    background-repeat: no-repeat;
    background-position: 16px 16px;
}

.ckan-icon-background-position(@offset,
@size) {
    @w: "@{size}X";
    @h: "@{size}Y";
    @x: "@{size}OffsetX";
    @y: "@{size}OffsetY";
    width: @@w;
    height: @@h;
    background-position: (@@x * @offset) @@y;
}

.ckan-icon-flame {
    .ckan-icon-background-position(2,
    "medium")
}

【问题讨论】:

    标签: python css less jinja2 ckan


    【解决方案1】:

    CKAN 有它的默认 css。它还允许开发人员自定义默认 css。我的问题是由覆盖引起的。我的新样式表将完全覆盖默认 css,而不是将它们添加到默认文件中。更详细的讨论可以参考这里的问题:https://github.com/ckan/ckan/issues/4542

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-06
      • 1970-01-01
      • 1970-01-01
      • 2015-03-16
      • 1970-01-01
      • 1970-01-01
      • 2015-09-18
      相关资源
      最近更新 更多