【发布时间】:2026-01-09 02:35:02
【问题描述】:
我写了如下代码来展示项目:
<%= for project <- @projects do %>
<div class="col-sm-4">
<div class="panel panel-default" style="min-height: 1200px; margin-bottom:50px;height:auto;">
<div class="panel-heading">
<img src="<%= Microflow.Avatar.url({project.picture, project}, :original) %>" alt="" width="330px" height="240px"/>
</div>
<div class="panel-body" style="min-height: 350px">
<h2 style="font-family: 'Montserrat', sans-serif;"><%= project.name %></h2>
<h3 style="font-family: 'Raleway', sans-serif;"><%= raw(project.description) %></h3>
<h2 style="font-family: 'Montserrat', sans-serif;">
</h2>
<h2 style="font-family: 'Montserrat', sans-serif;"><%= project.raise_amount %> USD</h2>
<iframe width="100%" height="100%" src= "<%=project.video_url%>"</iframe>
<%= link "Delete Project", to: project_path(@conn, :delete, project), method: :delete, data: [confirm: "Are you sure?"], class: "btn btn-info btn-xs" %>
<%= link "Start Your Own Project", to: project_path(@conn, :new), method: :new, class: "btn btn-success btn-xs" %>
</div>
</div>
</div>
<% end %>
除了这一行之外,一切都很好:
<iframe width="100%" height="100%" src= "<%=project.video_url%>"</iframe>
其中显示:
"No route found for GET /Video%20Goes%20Here (MyApp.Router)"
我需要修复路由或定义函数吗?...以下 Ruby 指南在 Phoenix/Elixir 中可能仍然有效,但需要进行一些调整:
How to add youtube frame to ERB file Embed youtube video in rails
【问题讨论】:
标签: iframe youtube elixir phoenix-framework