覆盖TowerJS视图中的模板逻辑

时间:2012-08-24 11:27:33

标签: towerjs coffeekup

如何覆盖TowerJS中模板的呈现方式?我知道我可以使用Jade,但如果我坚持使用CoffeeKup,我怎么能有这样的代码:

formFor @user, (form) ->
  form.fieldset "Profile", (fields) ->
    fields.field "firstName"
    fields.field "lastName"
    fields.field "email"
  form.fieldset "Address", (fields) ->
    fields.field "lat", as: hidden
    fields.field "lng", as: hidden
    fields.field "street"
    fields.field "city", as: "select", collection: ["CA"]

...生成这个:

<form class='form' data-method='post' method='post' novalidate='true' role='form'>
  <fieldset class='fieldset' id='profile'>
    <legend class='legend'>
      <span>Profile</span>
    </legend>
    <li class='field-list'>
      <li class='field string optional validate'>
        <label class='label' for='active-record-user-first-name-input'>
          <span>First Name</span>

......而不是:

<form class='form' data-method='post' method='post' novalidate='true' role='form'>
  <fieldset class='fieldset' id='profile'>
    <legend class='legend'>
      <span>Profile</span>
    </legend>
    <ol class='field-list'>
      <li class='field string optional validate'>
        <label class='label' for='active-record-user-first-name-input'>
          <span>First Name</span>

我想我对<ol><ul>的挑剔,但我刚开始使用Tower评估铁路和德比。这是CoffeKup问题还是Mint问题?

1 个答案:

答案 0 :(得分:1)

您可以通过设置:

来自定义该标记
Tower.View.fieldListTag = 'ul' # or whatever

配置变量如下: