0
我在我的Rails應用程序中嵌套html/haml標籤時遇到了問題。我有一個應用程序的默認佈局:在html中嵌套html標籤
!!!
%html
%head
= render 'shared/head'
%body
= render 'shared/alerts'
= render 'shared/header'
.content
= yield
= render 'shared/footer'
我有這個網站:
<html>
<head>..</head>
<body>
<div class="menubar">..</div>
<div class="content">..</div>
<div class="footer">..</div>
</body>
</html>
正如你可以看到footer
超出.content
的。問題是footer
嵌套到.content
在一個視圖文件,我不知道爲什麼:
<html>
<head>..</head>
<body>
<div class="menubar">..</div>
<div class="content">
<div class="footer">..</div>
</div>
</body>
</html>
查看其中的HTML是打破
<div id='topic' class='#{'un' unless @topic.locked?}locked'>
\#{render :partial => 'forem/topics/head', :locals => { :topic => @topic }}
.small-offset.up
- if @topic.can_be_replied_to? && can?(:reply, @topic)
= link_to t(".reply"), forem.new_topic_post_path(@topic), class: "button medium rounded lime"
- if @topic.user == forem_user || forem_admin?
= link_to t(".delete"), forem.forum_topic_path(@forum, @topic), method: :delete, data: { confirm: t("are_you_sure") }
- if forem_user
- if [email protected]?(forem_user.id)
= link_to t(".subscribe"), forem.subscribe_forum_topic_path(@forum, @topic), class: "button medium rounded blue"
- else
= link_to t(".unsubscribe"), forem.unsubscribe_forum_topic_path(@forum, @topic), class: "button medium rounded pink"
- if forem_admin?
= link_to t('forem.topic.links.edit'), forem.edit_admin_topic_path(@topic)
= link_to t(".hide.#{@topic.hidden}"), forem.toggle_hide_admin_topic_path(@topic), method: :put
= link_to t(".lock.#{@topic.locked}"), forem.toggle_lock_admin_topic_path(@topic), method: :put
= link_to t(".pin.#{@topic.pinned}"), forem.toggle_pin_admin_topic_path(@topic), method: :put
- if @topic.pending_review?
= t(".pending_review")
- if forem_admin_or_moderator?(@topic.forum)
= form_for @topic, url: forem.moderate_forum_topic_path(@topic.forum, @topic), method: :put do |f|
= render "/forem/moderation/options", f: f
= forem_pages_widget(@posts)
= render partial: "forem/posts/post", collection: @posts
= forem_pages_widget(@posts)
我們也沒有,因爲我們無法看到問題的文件。我懷疑時髦的HTML,特別是如果這是你在DOM中看到的 - 瀏覽器試圖修復破碎的HTML。 –
我不太瞭解哈姆,但我知道縮進會有所作爲。你是否嘗試過縮進你的= render'共享/頁腳'語句,就像yield語句是? – PhillipKregg
@DaveNewton我添加了查看文件。我認爲它可能不清楚,但它正是HTML打破的視圖文件 –