These are chat archives for locomotivecms/v3

23rd
Apr 2017
Martin Berggren
@marthings
Apr 23 10:22
Hi! https://locomotive-v3.readme.io/docs/drops Is it possible to add a property to {{ page }} like {{ page.created_at }}{{ page.updated_at }} similar to entries drops? Or do i need custom drops / advanced stuff for that?
Felix Last
@felix-last
Apr 23 12:36
The production.log shows repetitive blocks of the following:
Started GET "/locomotive/sign_in" for <server ip> at 2017-04-22 21:15:18 +0200
[LocomotiveCMS] [fetch site] host = one.two.domain.com / site_handle = nil / locale = :en
MONGODB | localhost:21353 | myapp.find | STARTED | {"find"=>"locomotive_sites", "filter"=>{"domains"=>{"$in"=>["one.two.domain.com"]}}}
MONGODB | localhost:21353 | myapp.find | SUCCEEDED | 0.001013717s
MONGODB | localhost:21353 | myapp.count | STARTED | {"count"=>"locomotive_accounts", "query"=>{}}
MONGODB | localhost:21353 | myapp.count | SUCCEEDED | 0.000573364s
Manu
@manuchap
Apr 23 16:57

Hello, is it possible to filter a forloop so that similar entries are only rendered once? I have these bits of code that assign a department based on an organism model postal code field but I'd like to render the duplicates once:

{% for formation in contents.formations %}
<div class="checkbox">
  <label>
    <input type="checkbox" value="{{ formation.org.cop }}">
    <span>{% include 'dept' %}<span>
  </label>
</div>
{% endfor %}

dept snippet:

{% capture cp %}{{ formation.org.cop }}{% endcapture %}
{% capture dep %}{{ cp | divided_by: '1000' }}{% endcapture %}
{% if dep.size < 2 %}
    {% case dep %}
        {% when '1' %}{{ dep | prepend: 0 | append: ' - Ain' }}
        {% when '3' %}{{ dep | prepend: 0 | append: ' - Allier' }}
        {% when '7' %}{{ dep | prepend: 0 | append: ' - Ardèche' }}
    {% endcase %}
{% else %}
    {% case dep %}
        {% when '15' %}{{ dep | append: ' - Cantal' }}
        {% when '26' %}{{ dep | append: ' - Drôme' }}
        {% when '38' %}{{ dep | append: ' - Isère' }}
        {% when '42' %}{{ dep | append: ' - Loire' }}
        {% when '43' %}{{ dep | append: ' - Haute-Loire' }}
        {% when '63' %}{{ dep | append: ' - Puy-de-Dôme' }}
        {% when '69' %}{{ dep | append: ' - Rhône' }}
        {% when '73' %}{{ dep | append: ' - Savoie' }}
        {% when '74' %}{{ dep | append: ' - Haute-Savoie' }}
    {% endcase %}
{% endif %}

render:
Capture d’écran 2017-04-23 à 18.49.33.jpg