0

如何覆盖模板在 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>vs <ul>,但我刚刚开始使用 Tower 来评估铁路和德比。这是 CoffeKup 问题还是 Mint 问题?

4

1 回答 1

1

您可以通过设置自定义该标签:

Tower.View.fieldListTag = 'ul' # or whatever

配置变量在这里:

于 2012-10-11T18:09:48.817 回答