我想改变插入符号的颜色,使其与输入文本不相关,因为它很难让它看起来很好看.
我想更改悬停nav-tabs的文本颜色,所以我将其命名为:nav nav-tabs custom,因此我视图中的代码如下所示:
<li class="active"><%= link_to "Overview", '#' %>
</li>
<li><%= link_to "About", '#' %></li>
<li><%= link_to "What we do", '#' %></li>
<li><%= link_to "Partners", '#' %></li>
<li><%= link_to "Contact", '#' %></li>
<li><%= link_to "Support", '#' %></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
和我的custom.css.scss中的代码
.custom a:hover {color: black;}
Run Code Online (Sandbox Code Playgroud)
它不起作用.有人能帮我吗 ?
当Dropdown打开时 - 我想更改它的默认颜色.我想用css改变边框颜色和背景.
这是html代码:
<div class="row menu">
<ul class="nav nav-pills pull-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle"
data-toggle="dropdown">
My reports
<span class="caret my-reports-caret"></span>
</a>
<ul class="dropdown-menu">
<li><%= link_to "Performance", performance_reports_path %></li>
<li class="divider"></li>
<li><%= link_to "Account settings", '#' %></li>
</ul>
</li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
我的css,我试过:
.menu .nav-pills .dropdown .open .dropdown-toggle{
background-color: red;
}
Run Code Online (Sandbox Code Playgroud)
选择器中的问题在哪里?
我尝试了很多人的代码 - 如何测试rails中是否存在参数,但它不起作用():
if ( params.has_key?([:start_date]) && params.has_key?([:end_date]) )
Run Code Online (Sandbox Code Playgroud)
我想,那是因为复杂的参数,如果我写这个:
if ( params.has_key?([:report][:start_date]) && params.has_key?([:report][:end_date]) )
Run Code Online (Sandbox Code Playgroud)
给我错误
can't convert Symbol into Integer
Run Code Online (Sandbox Code Playgroud)
这也行不通:
if ( params[:report][:start_date] && params[:report][:end_date] )
Run Code Online (Sandbox Code Playgroud)
给我错误:
undefined method `[]' for nil:NilClass
Run Code Online (Sandbox Code Playgroud)
它总是进入其他声明.
这是我的参数:
report:
start_date: 01/08/2012
end_date: 10/08/2012
Run Code Online (Sandbox Code Playgroud)
有人能帮我吗 ?
我无法获得管理ssh密钥的系统.
我想将应用程序推送到Heroku,所以我试图推送但得到错误.
这是我的日志
$ git push heroku master
! Your key with fingerprint bf:f6:ed:14:9d:cd:52:a2:a3:16:b2:e9:b4:f2:bf:ba is not authorized to access warm-samurai-6574.
fatal: The remote end hung up unexpectedly
User@PK /e/examples (master)
$ heroku keys:add
Found existing public key: C:/Users/User/.ssh/id_rsa.pub
Uploading SSH public key C:/Users/User/.ssh/id_rsa.pub
!This key is already in use by another account. Each account must have a unique key.
User@PK /e/examples (master)
$ heroku keys
=== 1 key for denys.medynskyi@gmail.com
ssh-rsa AAAAB3NzaC...etyxYh4Q== User@PK
Run Code Online (Sandbox Code Playgroud)
每个帐户都有自己的ssh密钥.所以我可以从任何计算机上推,因为ssh键正在推送到heroku?
heroku上的每个应用程序都应该有自己的ssh密钥?
我正在使用Twitter Bootstrap我需要绘制菜单行:https: //www.dropbox.com/s/hl8moeabxxecu8j/dropdown.png.
所以我需要通过垂直分隔线绘制线条.
这就是我现在所拥有的 - http://jsfiddle.net/KckU3/8/
我不知道如何制作它?
我尝试过不同的make flash变种[:notice]无需重新加载.
Stackoverflow给了我这个 - 你如何使用Ajax请求处理Rail的flash?,但我找不到解决方案,这对我有用.
例如,添加到我的控制器:
def create
@entry = Entry.new(params[:entry])
respond_to do |format|
if @entry.save
format.html { redirect_to @entry, notice: 'Entry was successfully created.' }
format.js {
flash.now[:notice] = 'Website was successfully created.'
render action: 'create'
}
else
format.html { render action: "new" }
format.js { render action: "new" }
end
end
end
Run Code Online (Sandbox Code Playgroud)
create.js
$('<%= j render @website %>').appendTo('#websites').hide().fadeIn();
$(".alert").html("<%= escape_javascript(flash[:notice]) %>"); $(".alert").show(300);
$("#new_website")[0].reset();
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
有人可以告诉我可以理解的完整解决方案,这对他有用吗?
我有两个字段 - 结束日期和开始日期(日期范围),我应该将它们传递给控制器并重新加载此页面.
这是我的代码:
<%= form_tag(:controller => "financial_reports", :action => 'index', :method => 'post') do%>//maybe this line should be edited
<%= datepicker_input "report","start_date", :dateFormat => "dd/mm/yy" %>
<%= datepicker_input "report", "end_date", :dateFormat => "dd/mm/yy"%>
<%end%>
Run Code Online (Sandbox Code Playgroud)
并生成HTML():
<form accept-charset="UTF-8" action="/financial_reports?method=post" method="post"...>
<input id="report_start_date" name="report[start_date]" size="30" type="text" class="hasDatepicker"><script type="text/javascript">
<input id="report_end_date" name="report[end_date]" size="30" type="text" class="hasDatepicker"
<input class="btn wide" id="btn-report" name="commit" type="submit" value="Run Report">
</form>
Run Code Online (Sandbox Code Playgroud)
我可以像这样得到datepicker值:
$('#datepicker').datepicker({
onSelect: function(dateText, inst) {
$("input[name='report[start_date]']").val(dateText);
}
});
Run Code Online (Sandbox Code Playgroud)
我需要将它们传递给控制器并重新加载此页面,因为在此页面控制器中.
在这里,我需要通过法术价值
@financial_reports = current_user.financial_reports.where(:created_at => start_date.to_date..end_date.to_date)
Run Code Online (Sandbox Code Playgroud)
或者我应该添加其他行动或方法?你能建议什么?
我将图像从公共/图像移动到资源/图像路径
我有图像:
<%= image_tag("login_logo.png", :id => "login_logo") %>
Run Code Online (Sandbox Code Playgroud)
我将它从公共文件夹移动到资产并更改了路径.
它是可见的并且工作正常,但我在控制台中出错:
Started GET "/assets/logo_PG.png" for 127.0.0.1 at 2012-10-10 23:42:53 +0300
Served asset /logo_PG.png - 304 Not Modified (0ms)
ActionController::RoutingError (No route matches [GET] "/images/login_logo.png")
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?
我正在尝试检查 - 如果某些(语言)属性已更改,并且它等于某个值,我需要将其更改为其他适当的值。
这是我的代码:
编辑:
def update
@website = Website.find(params[:id])
@website.language = params[:website][:language]
if @website.language_changed?
if params[:website][:language] == "Automatic (by user's browser language)"
@website.language = full_language(request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first)
end
end
respond_to do |format|
if @website.save
format.html { redirect_to @website,
notice: 'Note: code has been updated. Please replace the code you have on your website with the code below. Only then changes will take effect.' }
end
end
end
Run Code Online (Sandbox Code Playgroud)
我的表格:
<%= f.label "Website category"%>
<%= f.select :category, options_for_select([
"--- please select ---", …Run Code Online (Sandbox Code Playgroud) 我有这样的麻烦:当我创建对象并设置一些日期时间它是在UTC TimeZone中保存数据库.这是一个例子:
//showing full list of object properties
Grant _id: 5108ee29e6b564611400000, start_date: 2013-01-30 09:56:27 UTC
//then showing a.start_date
Wed, 30 Jan 2013 13:56:27 +0400
Run Code Online (Sandbox Code Playgroud)
我试图禁止数据库使用UTC.这是mongoid.yml:
development:
options:
raise_not_found_error: false
sessions:
default:
use_activesupport_time_zone: true
use_utc: false
database: test_mongoid_production
hosts:
- localhost:27017
options:
consistency: :strong
Run Code Online (Sandbox Code Playgroud)
并在application.rb中:
config.time_zone = 'Moscow'
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
有人可以帮忙解决这个问题吗?
我无法使自定义网址验证规则生效。
我要添加新规则:
jQuery.validator.addMethod("complete_url", function(val, elem) {
// if no url, don't do anything
return /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/.test(val);
});
...
$("#new_website").validate({
rules: {
url: "complete_url",
'website[url]': {
url: true,
required: true}
}
});
Run Code Online (Sandbox Code Playgroud)
但这让我回来
invalid URL
Run Code Online (Sandbox Code Playgroud)
我检查了正则表达式在这里- http://www.rubular.com/。它正在工作,但是失败了我的自定义验证器。
我做错了什么?
我正在使用RubyOnRails,所以我的所有样式表都应该自动包含.
我想让我的下拉列表更加用户友好,我选择了Chsen插件.
这是我的页面代码:
<link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/chosen.css?body=1" media="all" rel="stylesheet" type="text/css" />
<script src="/assets/jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
<script src="/assets/chosen.jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/chosen.jquery.min.js?body=1" type="text/javascript"></script>
<script src="/assets/static_pages.js?body=1" type="text/javascript"></script>
<script src="/assets/application.js?body=1" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)
所以包括javascripts和样式表,是吗?
我的HTML代码(来自exmple):
<select tabindex="1" style="width:350px;" data-placeholder="Choose a Country">
<option value=""></option>
<option value="United States">United States</option>
<option value="United Kingdom">United Kingdom</option>
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
</select>
Run Code Online (Sandbox Code Playgroud)
在我的application.js文件中:
$(document).ready(function(){
$(".chzn-select").chosen();
});
Run Code Online (Sandbox Code Playgroud)
在Google控制台中没有错误,但在我的页面中它显示为默认选择列表.为什么?