我是Rails的新手,并试图将使用HTML,CSS和Javascript制作的网页移动到rails环境中。我已将第三方库的样式表和javascript添加到供应商/资产以及相应的javascript和样式表文件夹中的自定义javascript和样式表到app / assets。
我在routes.rb中定义了一个到/ home的路由,将此页面显示为:
get '/home', to: 'home#index'
以及home_controller.rb中的操作
class HomeController < ApplicationController
def index
end
end
我添加了自定义HTML页面,其中包含index.html.erb
中的样式<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SMS scheduling site</title>
<!--css stylesheets-->
<%= stylesheet_link_tag "jquery-ui.min" %>
<%= stylesheet_link_tag "material.min" %>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link href='https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en'
rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Roboto+Mono' rel='stylesheet' type='text/css'>
<%= stylesheet_link_tag "mdDateTimePicker" %>
<%= stylesheet_link_tag "style" %>
</head>
<body>
<div class="container-div">
<!-- Colored FAB button with ripple -->
<button id="fab" class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored">
<i class="material-icons">add</i>
</button>
<style>
</style>
<div class="demo-card-wide mdl-card mdl-shadow--2dp">
<div class="mdl-card__title" id="text-div">
<h2 id="title-text" class="mdl-card__title-text">CAMPAIGN</h2>
<br>
<br>
<span id="success">Success!</span>
</div>
<div class="mdl-card__supporting-text">
<form action="#">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="campaign-name">
<label class="mdl-textfield__label" for="phone-number-receiver">Campaign Name</label>
</div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" pattern="-?[0-9]*(\.[0-9]+)?" id="phone-number-receiver">
<label class="mdl-textfield__label" for="phone-number-receiver">Phone Number for recipient</label>
<span class="mdl-textfield__error">Input is not a number!</span>
</div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="start-date">
<label class="mdl-textfield__label" for="start-date" id="start-date-label">Enter start date</label>
</div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="end-date">
<label class="mdl-textfield__label" for="end-date" id="end-date-label">Enter end date</label>
</div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="start-time">
<label class="mdl-textfield__label" for="end-date" id="start-time-label">Enter time</label>
</div>
<div class="mdl-textfield mdl-js-textfield less-margin">
<textarea class="mdl-textfield__input" type="text" id="sms-msg" rows="8" columns="40"></textarea>
<label class="mdl-textfield__label" for="sms-msg">Text lines...</label>
</div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="break-msg" value="1">
<label class="mdl-textfield__label" for="break-msg">Number of Pages</label>
</div>
</form>
</div>
</div>
</div>
<%= javascript_include_tag "jquery-3.0.0.min" %>
<%= javascript_include_tag "jquery-ui.min" %>
<%= javascript_include_tag "material.min" %>
<%= javascript_include_tag "moment.min" %>
<%= javascript_include_tag "draggabilly.pkgd.min" %>
<%= javascript_include_tag "mdDateTimePicker" %>
<%= javascript_include_tag "app" %>
</body>
</html>
我收到一个错误,即HomeController#index缺少此请求格式的模板。但是这个观点已经定义了。
如何修复错误?我怀疑它可能与视图中的HTML和CSS代码有关。