Helma Logo
main list history
previous version  overview  next version

Version 4 by michi on 08. December 2005, 18:43

see http://home.leetsoft.com/liquid

  function i18n(input, key) # Global/filters.js
    if (getText(key)) function i18n_filter(input)
      return this.renderSkin(createSkin(getText(key)));if (getText(input))
      return this.renderSkin(createSkin(getText(input)));
    } else {
      return input;
    }
  
   function modulo(inputmodulo_filter(input, mod) skinParam)
     return input % mod;
  

  <h1>{{ "site # HopObject/macros.topics.header" | i18n }}</h1>js
function count_macro() {
  return this.count();
}

# Site/topiclist.skin
<h1>{{ "site.topics.header" | i18n }}</h1>
  <p>
  {% if this.count() topics.count == 0 %}
    {{ "No topics to display." | i18n("site.topics.noTopics") | i18n }}
  {% else if this.count() topics.count == 1 %}
    {{ "This site has just one topic." | i18n("site.topics.oneTopic") | i18n }}
  {% else %}
    {{ "This site has {{ this.count }} topics." | i18n("site.topics.moreTopics") }}  # FIXME ??| i18n }}
  {% endif %}
  {% for item in site.list() topiclist %}
    {% if forloop.first %}
      <table>
        <tr>
          <th>{{ "Topic" | i18n("site.topics.tableHead.topic") | i18n }}</th>
          <th>{{ "Number of Stories" | i18n("site.topics.tableHead.numberOfStories") | i18n) }}</th>
        </tr>
    {% endif %}
        <tr class="row{{ forloop.index | modulo(2) modulo 2 }}"
          <td>{{ item.name }}</td>
          <td>{{ item.count }}</td>
        </tr>
    {% if forloop.last %}
      </table>
    {% endif %}
  {% endfor %}

# Site/actions.js
function topiclist_action() {
this.renderSkin("topiclist", {topiclist: site.list()})
}

# locale/en.properties
  site.topics.header = All topics
  site.topics.noTopics = No topics to display.
  site.topics.oneTopic = This site has just one topic.
  site.topics.moreTopics = This site has {{ this.count }} topics.
  site.topics.tableHead.topic = Topic
  site.topics.tableHead.numberOfStories = Number of Stories

     removed
     added