这有点难以解释,但我会试一试.我正在使用此滑块教程(http://css-tricks.com/slider-with-sliding-backgrounds/)来创建步骤表单.
它工作得很好,除了我有一个小问题,我有一个部分上传图片(大背景图片),我没有调整高度.
由于此上传部分位于第一张幻灯片的顶部,因此当我上传图片时,它会向下推动第二张和第三张幻灯片.有没有办法让其他幻灯片(2和3)保持在顶部而不管第一张幻灯片做了什么?
一个快速的图表,以帮助进一步解释我在做什么.
Ps:我遵循与教程中使用的语义相同的语义.例如.id,类等
刚刚开始使用Ruby on Rails.在我的layouts/application.html.erb中我有:
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= render 'layouts/header' %>
<div class="container">
<%= yield %>
</div>
<%= render 'layouts/footer' %>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
来自php - > codeigniter背景,我假设渲染类似于$ this-> load-> view(''); 在codeigniter.
虽然这很好,但我希望有多个应用程序布局文件,例如
在codeigniter中,您只需声明您希望使用哪些模板/布局文件,但是作为ruby on rails有点神奇(它为您做了很多事情),我假设它默认调用应用程序布局.我想知道是否有办法选择我想要的布局文件?
我正在使用select2 jquery gem.我正在尝试获取与用户输入内容相匹配的主题列表.它没有按预期工作,我花了一整天时间试图找出原因.我一直在控制台中收到此错误
Uncaught TypeError: Cannot call method 'toUpperCase' of undefined select2.js?body=1:363
Uncaught TypeError: Cannot call method 'localeCompare' of undefined
Run Code Online (Sandbox Code Playgroud)
第二个错误链接到此行上的js文件
return this.text.localeCompare(term) === 0;
Run Code Online (Sandbox Code Playgroud)
有什么我做错了吗?提前致谢.
我的路线:
get '/topic/topic_list' => 'topic#topic_list'
Run Code Online (Sandbox Code Playgroud)
在我的Topic控制器中,我有:
def topic_list
@topics = Topic.order(:name)
respond_to do |format|
format.html
format.json { render json: @topics.where('name like ?', "%#{params[:q]}%") }
end
end
Run Code Online (Sandbox Code Playgroud)
主题js文件
$(function () {
$('#story_topic_list').select2({
tags: true,
width: '100%',
tokenSeparators: [","," "],
createSearchChoice: function(term, data) {
if ($(data).filter(function() {
return this.text.localeCompare(term) === 0;
}).length === 0) {
return …Run Code Online (Sandbox Code Playgroud) 我有一个简单的文本编辑器,我想像使用粗体标签一样在当前选择周围切换h1标签。使用粗体标签,我可以:
function onBoldClick() {
document.execCommand( 'bold', false );
}
Run Code Online (Sandbox Code Playgroud)
这会自动在当前选择周围切换b标签。
使用h1标签:
function onHeading1Click() {
document.execCommand('formatBlock', false, '<h1>');
}
Run Code Online (Sandbox Code Playgroud)
这只会将h1环绕选择,但是无法删除它。
还有另一种解决方法吗?Nb:应该在
在我的身份验证规范中我有
require 'spec_helper'
describe "Authentication" do
subject { page }
describe "Signup page" do
before { visit new_user_registration_path }
let(:submit) { "Create my account" }
describe "with invalid information" do
it "should not create a user" do
expect { click_button submit }.not_to change(User, :count)
end
describe "after submission" do
before { click_button submit }
it { should have_content('Sign up') }
it { should have_content('error') }
end
end
describe "with valid information" do
before do
fill_in "First name", with: "Example"
fill_in …Run Code Online (Sandbox Code Playgroud) 我从 @post.date 获取了 2014-04-05 格式的日期,
我想将其转换为“Saturday Apr 5”格式。
如果日期是今天,我希望它使用这种格式“今天 4 月 6 日”目前我有
<% if @post.date === Date.today.strftime("%Y-%m-%d") %>
<p> Today Month(short form) Day(number) </p>
<% else %>
<p> Day(word) Month(short form) Day(number) </p>
<% end %>
Run Code Online (Sandbox Code Playgroud)
我该如何格式化日期?
提前致谢。