3

これは私の基本スリムファイルです:

doctype html
html lang="en"
  head
    meta charset="utf-8"
    title= "#{yield(:title) || 'Home'} | #{app_config.app_name} "
    = csrf_meta_tags

    /! Le HTML5 shim, for IE6-8 support of HTML elements
    /[if lt IE 9]
      = javascript_include_tag "http://html5shim.googlecode.com/svn/trunk/html5.js"
    /! Le styles
    = stylesheet_link_tag :application
    css:
      body {
        padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
      }

  body
    = render "layouts/navigation"

    .container-fluid
      = render "layouts/messages"

      - if show_title?
        h1= yield(:title)
        br

      .span2.sidebar
        - content_for :sidebar
      .span10
        = yield

    .container
        footer
        hr
        p Made by Awesoham with Rails and win.

    = javascript_include_tag :application

これは、特定のコントローラー用の特定の Slim ファイルです。

- title "All Known NEOs"
- unless @neos.empty?
    table
        - for neo in @neos
            tr
                td.name = neo.name
                td.ra = neo.ra_str
                td.dec = neo.dec_str

- content_for :sidebar do \
    | test

これを使用すると、「構文エラー、予期しない ';'」が表示されます。

yield基本的に、私の質問は、 1 つの Slim ファイルに2 つの を含めるにはどうすればよいですか? このような:

  .span2.sidebar
    < yield the sidebar here >
  .span10
    < yield other content here >
4

0 に答える 0