我试图使我的边框看起来像这样:
有一个弯曲的一端.目前它看起来像这样:
我试图使用的CSS是border-bottom-right-radius: 10px;.代码如下所示:
<div class="title">
lorem ipsum
</div>
.title {
border-bottom: 10px solid $mainRed;
border-bottom-right-radius: 10px;
}
Run Code Online (Sandbox Code Playgroud)
我也尝试过border-radius: 10px;,除了两端弯曲外,它给我的结果相同.增加此数字只会使线条向上倾斜.如何使线看起来正确?
当我尝试将图片上传到"Car"对象时,我被拒绝访问S3.但是我添加了S3后,资源文件夹中的站点图像显示得很好.我得到的具体错误是:
2015-02-17T14:40:48.459629+00:00 app[web.1]: Excon::Errors::Forbidden (Expected(200) <=> Actual(403 Forbidden)
2015-02-17T14:40:48.459630+00:00 app[web.1]: excon.error.response
2015-02-17T14:40:48.459635+00:00 app[web.1]: "Connection" => "close"
2015-02-17T14:40:48.459637+00:00 app[web.1]: "Content-Type" => "application/xml"
2015-02-17T14:40:48.459639+00:00 app[web.1]: "Date" => "Tue, 17 Feb 2015 14:40:48 GMT"
2015-02-17T14:40:48.459640+00:00 app[web.1]: "Server" => "AmazonS3"
2015-02-17T14:40:48.459632+00:00 app[web.1]: :body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>2CE306ACD51F02A1</RequestId><HostId>tKLXUAKxyDFTMExl7kE+AuVVsEJOFqXh983li6N7R2UlYDXv1Z3GJRvW5zy1XIXVs2zArp310vg=</HostId></Error>"
2015-02-17T14:40:48.459642+00:00 app[web.1]: "x-amz-id-2" => ""part of secret key"="
Run Code Online (Sandbox Code Playgroud)
随着"秘密密钥的一部分"明显被编辑.我尝试创建一个不同的用户并使用新密钥,但这没有用.不是从这里去的地方.
应用程序/上传/ picture_uploader
class PictureUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
process resize_to_limit: [400, 400]
if Rails.env.production?
storage :fog
else
storage :file
end
# Override the directory where uploaded files …Run Code Online (Sandbox Code Playgroud) 我正在尝试在Rails应用程序顶部启动前端(仅HTML/CSS)页面,并且无法使用320px视口.有些元素不会缩小,我无法弄清楚原因.我已经通过Inspect Element给出了各种元素max-width: 100%;和/或width: 100%;其他固定宽度,但有些东西是错误的.
的index.html
<div class="temple">
<div class="container" style="height: 100%;"><div class="row" style="height: 100%;">
<div class="templeHeader">
Every tourist sees the temples
</div>
</div></div> <!-- container and row -->
</div>
Run Code Online (Sandbox Code Playgroud)
我在"太阳穴"里面有容器和行,因为我希望图像宽度为100%,而不是100%减去容器的边距.
layout.scss
@import "bootstrap-sprockets";
@import "bootstrap";
@mixin center-both {
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.temple {
/* background-image: image-url("temple.jpg"); */
position: relative;
height: 500px;
background-color: black;
.templeHeader {
font-size: 52px;
color: white;
position: relative;
text-align: center;
@include center-both; …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个按钮,它将开始自动下载页面的PDF,因为它看起来与sass样式.然而,我尝试的一切都以造型混乱而告终.
这是页面(这是一个有几种不同内容类型的测试站点)
但PDF看起来像这样:
我拉着jspdf.debug.js我的页面中有以下HTML按钮+脚本:
<div id="bypass"> <!-- keeps button from showing in PDF -->
<button id="pdf-new" style="margin: 50px;"><a href="javascript:demoFromHTML()" class="button" style="color: black;">Generate PDF</a></button>
</div>
<script>
function demoFromHTML() {
var pdf = new jsPDF('p', 'pt', 'letter');
// source can be HTML-formatted string, or a reference
// to an actual DOM element from which the text will be scraped.
source = $('#content')[0];
// we support special element handlers. Register them with jQuery-style
// ID selector for either ID or node …Run Code Online (Sandbox Code Playgroud) 我是React的新手,并制作了一个允许搜索保存的应用程序.这将拉出JSON,但目前正从静态数组中提取data.我无法从搜索列表中删除搜索.
这是jsbin:http://jsbin.com/nobiqi/edit?js,output
这是我的删除按钮元素:
var DeleteSearch = React.createClass({
render: function() {
return (
<button onClick="this.props.deleteSearchItem" value={index}><i className="fa fa-times"></i>
</button>
);
}
});
Run Code Online (Sandbox Code Playgroud)
和我的功能
deleteSearchItem: function(e) {
var searchItemIndex = parseInt(e.target.value, 10);
console.log('remove task: %d', searchItemIndex);
this.setState(state => {
state.data.splice(searchItemIndex, 1);
return { data: state.data };
});
}
Run Code Online (Sandbox Code Playgroud)
我试过按照教程,我不知道从哪里开始.如何删除搜索项?
当以管理用户身份登录时尝试删除用户时,我在heroku日志中收到以下错误:
2015-03-24T07:47:23.506661+00:00 app[web.1]: Started DELETE "/users/1" for 128.252.25.47 at 2015-03-24 07:47:23 +0000
2015-03-24T07:47:23.534256+00:00 app[web.1]: SQL (4.4ms) DELETE FROM "users" WHERE "users"."id" = $1 [["id", 1]]
2015-03-24T07:47:23.517508+00:00 app[web.1]: User Load (1.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 1]]
2015-03-24T07:47:23.541747+00:00 app[web.1]: Completed 500 Internal Server Error in 31ms
2015-03-24T07:47:23.534529+00:00 app[web.1]: PG::ForeignKeyViolation: ERROR: update or delete on table "users" violates foreign key constraint "fk_rails_274c57dd65" on table "cars"
2015-03-24T07:47:23.534534+00:00 app[web.1]: : DELETE FROM "users" WHERE "users"."id" = $1
2015-03-24T07:47:23.544385+00:00 …Run Code Online (Sandbox Code Playgroud) 我试图允许作者根据对话框中的下拉菜单使用选项“h1、h2、h3、h4”更改标记中的标题大小。如果未选择,则应默认为 h2。
我尝试使用三元代码来执行此操作,就像处理动态类或内容一样,但是当我执行此操作时,它只会将代码打印在页面上。以下结果应该是<h2> Heading </h2>或已将 h2 替换为对话框选择
<${properties.headingSize ? properties.headingSize : 'h2'}>
${properties.heading}
</${properties.headingSize ? properties.headingSize : 'h2'}>
Run Code Online (Sandbox Code Playgroud)
Inspect Element 中此代码的结果是
<${properties.headingSize ? properties.headingSize :="h2" }>Heading <!--${properties.headingSize-->
Run Code Online (Sandbox Code Playgroud)
这不是完成动态标记的推荐方法吗?或者有没有办法让三元正常工作?
我正在尝试使用以下格式在 Ruby 中验证用户电话号码:
123-456-7890
(123) 456-7890
123 456 7890
123.456.7890
+91 (123) 456-7890
Run Code Online (Sandbox Code Playgroud)
我使用了以下正则表达式:
/^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/
Run Code Online (Sandbox Code Playgroud)
尝试在 rails 控制台中创建用户时出现此错误:
ArgumentError:提供的正则表达式使用了多行锚点(^ 或 $),这可能会带来安全风险。您是想使用 \A 和 \z,还是忘记添加 :multiline => true 选项?
我知道这有一些宝石,但我想自己创建用户模型,使电话号码验证类似于电子邮件:
用户名
class User < ActiveRecord::Base
before_save { self.email = email.downcase }
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, length: { maximum: 255 },
format: { with: VALID_EMAIL_REGEX },
uniqueness: { case_sensitive: false }
VALID_PHONE_NUMBER_REGEX = /^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/
validates :phone_number, presence: true, length: {maximum: …Run Code Online (Sandbox Code Playgroud) 我正在做Michael Hartl的Rails教程的第7章,我在尝试在开发中注册用户时遇到错误.我已经完成了7.3的章节,因此我的所有测试都应该现在通过,但我仍在The action 'create' could not be found for UsersController开发中.
这是我的用户控制器
class UsersController < ApplicationController
def show
@user = User.find(params[:id])
end
def new
@user = User.new
def create
@user = User.new(user_params)
if @user.save
flash[:success] = "Welcome to the Sample App!"
redirect_to @user
else
render 'new'
end
end
def user_params
params.require(:user).permit(:name, :email, :password,
:password_confirmation)
end
end
end
Run Code Online (Sandbox Code Playgroud)
在本教程的这一点上,我应该能够在线表单中签署用户而不会出现问题.这是我的github存储库https://github.com/ajhausdorf/sample_app
我正在尝试迭代一个@idea_benefit看起来像这样的数组:
["happier_customers", "happier_employees", "increased_revenue", "happier_customers", "decreased_costs", "happier_customers", "increased_revenue", ]
Run Code Online (Sandbox Code Playgroud)
我需要将其元素人性化并大写,如:
["Happier Customers", "Increased Revenue", ...]
Run Code Online (Sandbox Code Playgroud)
我试过这个:
@idea_benefit = []
@evaluations.each do |eval|
@idea_benefit << eval.benefit
@idea_benefit.flatten
end
@idea_benefit.each do |benefit|
benefit.gsub("_", " ").capitalize
end
Run Code Online (Sandbox Code Playgroud)
但我无法针对单个字符串.我该如何工作?