2016-02-26 58 views
5

有沒有辦法用Mandrill定義Handlebars幫手?假設我有一個對象,貨幣以美分爲單位。使用Mandrill創建自定義Handlebars幫手?

"products": [ 
    { 
     "sku": "hdrPhotos", 
     "price": 19000, 
     "title": "Unlimited HDR Photography" 
    }, 
    { 
     "sku": "panos", 
     "price": 2500, 
     "title": "Panoramas/Virtuals" 
    }, 
    { 
     "sku": "fullVideo", 
     "price": 43000, 
     "title": "Full Video" 
    }, 
    { 
     "sku": "aerialDaytimePhotos", 
     "price": 17500, 
     "title": "Aerial Daytime Photography" 
    }, 
    ] 

我有這個模板:

  <!-- BEGIN PRODUCT LOOP // --> 
      {{#each products}} 
      <tr class="item"> 
       <td valign="top" class="textContent"> 
       <h4 class="itemName">{{title}}</h4> 
       <span class="contentSecondary">${{toCurrency price}}</span> 
       <br/> 
       <span class="contentSecondary sku"><em>{{sku}}</em></span> 
       <br/> 
       </td> 
      </tr> 
      {{/each}} 

我想借此price,這是仙,並編寫自定義的助手toCurrency,僅僅由100

自定義其劃分助手很容易在標準Handlebars中完成,但Mandrill是否可以利用它?

回答