【问题标题】:Rails Render Content without NavigationRails 无需导航即可渲染内容
【发布时间】:2013-06-22 17:14:45
【问题描述】:

我正在使用 Bootstrap 和 rails,在我的布局文件夹中有我的 _navigation 文件。我正在尝试创建一个没有任何导航的“主页”。

:layout=>false

不包含任何 CSS 或任何布局 - 仅包含内容。我需要显示样式...

有没有办法渲染但忽略 _navigation 文件的包含?

【问题讨论】:

    标签: ruby-on-rails twitter-bootstrap


    【解决方案1】:

    想通了。我创建了一个空白布局。

    :render= layout=>'blank'
    

    我的空白布局是这样的(我删除了布局代码)

    !!!
    %html
      %head
        %meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}
          %title= content_for?(:title) ? yield(:title) : "App"
          %meta{:content => content_for?(:description) ? yield(:description) : "App", :name => "description"}
            = stylesheet_link_tag "application", :media => "all"
            = javascript_include_tag "application"
            = csrf_meta_tags
            = yield(:head)
      %body{:class => "#{controller_name} #{action_name}",:style=>"padding-top:0px"}
        #main{:role => "main"}
          .container
            .content
              .row
                .span12
                  = render 'layouts/messages'
                  = yield
              %footer
          / ! end of .container
        / ! end of #main
    

    还请注意,我将正文修改为具有 0px 的 padding-top(覆盖引导值)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-15
      • 2020-05-01
      • 1970-01-01
      • 2020-07-25
      • 2010-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多