Source

wdmmg / wdmmg / templates / _util.html

Full commit
<html
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:py="http://genshi.edgewall.org/"
  xmlns:xi="http://www.w3.org/2001/XInclude"
  py:strip=""
  >

  <!--! Herein can be found generic helper methods for a whole bunch of common
        templating issues -->

  <div py:def="render_key(key)" class="key-desc" style="display: inline;">
    <a href="${url(controller='key', action='view', name_or_id=key.name)}">${key.name}</a>
    <py:if test="key.notes">
    &ndash; 
    ${' '.join(key.notes.split()[:20]) + ' ...'}
    </py:if>
  </div>

  <span py:def="currency_symbols(currency)">
    <py:if test="">&ndash;</py:if>
  </span>

  <div py:def="render_entries(entries)">
    <ul class="entry-list">
      <li py:for="row in entries">
        <a href="${url(controller='entry', action='view', id_=row.get('id'))}">
          <span class="time">${row.get('time')}</span>: <span class="from">${row.get('from.label')}</span> spent
          <span class="amount">${h.format_number(row.get('amount'))}</span>
          with
          <span class="to">${row.get('to.label')}</span>
        </a>
        <div class="summary">
          ${row.get('description', '')}
        </div>
        <a href="${url(controller='entry', action='view', id_=row.get('id'))}">More info &raquo;</a>
      </li>
    </ul>
  </div>

  <div py:def="render_short_entries(entries)">
    <ul class="entry-list">
      <li py:for="row in entries" py:with="from_=row.get('from.label', ''); from_code=row.get('from.id', ''); to_code=row.get('to.id', '');  time=row.get('time', ''); amount=row.get('amount', 0); to_=row.get('to.label', 'General Population');">
          <span class="time">${time}</span>: 
          <a href="	${url(controller='entity', action='view', name_or_id=from_code)}">
            <span class="from">${from_}</span>
          </a> spent
          <span class="amount">${h.format_number(amount)}</span>
          with
          <a href="	${url(controller='entity', action='view', name_or_id=to_code)}">
              <span class="to">${to_}</span></a>.
          <br/>
          <a href="${url(controller='entry', action='view', id_=row.get('id', 1))}">See full entry &raquo;</a>
      </li>
    </ul>
  </div>

  <div py:def="disqus_thread(id)" py:strip="">
    <div id="disqus_thread"></div>
    <script type="text/javascript">
      var disqus_identifier = "${id}";
      var disqus_developer = 1;
      (function() {
       var dsq = document.createElement('script'); 
       dsq.type = 'text/javascript'; 
       dsq.async = true;
       dsq.src = 'http://wdmmg.disqus.com/embed.js';
       (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
      })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript=wdmmg">comments powered by Disqus.</a></noscript>
  </div>

</html>