我找到了一个帖子,它提供了一个链接示例,它只打开了一个撰写消息窗口.但是,我希望它打开一个带有完整Gmail界面的窗口,但可以编写新邮件.
当然这有效:
https://mail.google.com/mail/u/0/#compose
但是,我还想添加一个主题,to,bcc等.我尝试了类似下面的内容,但无济于事:
https://mail.google.com/mail/?to=inbox@example.com&bcc=admin@example.com&subject=Hey#compose
有任何想法吗?谢谢.
我一直在将应用程序转换为Rails 3.1(现在转到3.2)并在资产管道上观看Railscast.我将所有第三方jquery插件文件移动到/ vendor/assets/javascripts /目录.在我的/app/assets/javascripts/application.js中,我有以下内容:
//= require jquery
//= require jquery_ujs
//= require_tree .
//= require_self
Run Code Online (Sandbox Code Playgroud)
我意识到require_tree .调用只加载/ app/assets/javascripts /目录的树.(这是正确的吗?)包含所有 "供应商"javascripts 的最佳方式是什么?(我现在并不担心订购.)当然,我可以在/app/assets/javascripts/application.js中逐行索取.我的另一个想法是使用以下内容创建/vendor/assets/javascripts/vendor_javascripts.js:
//= require_tree .
Run Code Online (Sandbox Code Playgroud)
然后在/app/assets/javascripts/application.js中添加以下内容:
//= require vendor_javascripts
Run Code Online (Sandbox Code Playgroud)
这看起来有点笨拙.有没有更好的方法来自动包含所有"供应商"(和/或"lib")javascripts?
PS.我看到了关于index.js文件的内容,但我最终可能会得到多个名为index.js的文件,对吧?哦,我尝试重新启动我的服务器.
我知道i18n语言环境文件中有一些预设结构,以便Rails自动提取值.例如,如果要为新记录设置默认提交按钮文本:
# /config/locales/en.yml
en:
helpers:
submit:
create: "Create %{model}"
user:
create: "Sign Up"
Run Code Online (Sandbox Code Playgroud)
使用此设置,在视图中将产生以下结果:
# /app/views/things/new.html.erb
<%= f.submit %> #=> Renders a submit button reading "Create Thing"
# /app/views/users/new.html.erb
<%= f.submit %> #=> Renders a submit button reading "Sign Up"
Run Code Online (Sandbox Code Playgroud)
因此,Rails使用预设层次结构来获取不同模型的提交按钮文本.(也就是说,你不必告诉它在使用时可以获得哪些i18n文本f.submit.)我一直试图找到一种方法来使用flash通知和警报.是否有类似的预设结构来指定默认的Flash消息?
我知道您可以指定自己的任意结构,如下所示:
# /config/locales/en.yml
en:
controllers:
user_accounts:
create:
flash:
notice: "User account was successfully created."
# /app/controllers/users_controller.rb
def create
...
redirect_to root_url, notice: t('controllers.user_accounts.create.flash.notice')
...
end
Run Code Online (Sandbox Code Playgroud)
但notice: t('controllers.user_accounts.create.flash.notice')每次指定都很繁琐.有没有办法做到这一点,以便控制器"只知道"何时抓取并显示区域设置文件中指定的相应闪存消息?如果是这样,这些的默认YAML结构是什么?
在研究HTML5的新部分标签时,我想知道h1,h2,h3,h4,h5和h6标签的处理......
HTML5规范说"[h1,h2等]元素代表其章节的标题"(http://www.w3.org/TR/html5/sections.html#the-h1-h2-h3-h4- h5-and-h6-elements).此外,在规范的"4.4.11标题和部分"部分中,目前有三个构建关于苹果的文档的示例.
如果我们遵循第一个规范,其中指出标题元素"应该代表其部分的标题",那么第三个苹果示例似乎是最正确的结构(即,在每个部分和子部分中使用标题为h1标记).使用这个逻辑似乎很少使用h2,h3,h4,h5和h6标签,如果有的话.
这就是我想知道的:如果实际上它们基本上标记了小节,那么真的应该使用h2,h3,h4,h5或h6标签吗?使用section标签来分隔各个部分是不是更有意义,每个部分都有自己的标题,而不是依赖于h2,h3等来启动隐式部分?("标题和部分"部分还讨论了使用h2,h3等隐含的部分)
也许这是我的关系数据库知识导致偏见,但创建多个带有数字(h 1,h 2,h 3)的标题标签似乎是不好的做法,从技术上讲,它们每个都标题为自己的部分或子部分.
你的想法是什么?
我无法想出使用CSS完成以下任务的优雅方法:

我需要有序列表的数字才能看到蓝绿色的背景.我有这个图像(包括白色笔划):

但我无法弄清楚如何使用CSS将它放在每个数字后面.谢谢.
假设我在Rails 4应用程序中有以下内容:
class Person < ActiveRecord::Base
has_many :email_addresses, as: :emailable
has_one :user_account
end
class EmailAddress < ActiveRecord::Base
belongs_to :emailable, polymorphic: true
# There is an :address column
end
class UserAccount < ActiveRecord::Base
belongs_to :person
end
Run Code Online (Sandbox Code Playgroud)
一个人可以有多个电子邮件地址.一个人也可以拥有一个用户帐户.(我已经把它移到了它自己的模型中,因为不是所有人都是用户.)登录时,任何人的电子邮件地址都可以用作"用户名".
鉴于此,我想使用Devise gem.我看到您可以指定应用身份验证的模型.User被广泛使用,但我会使用UserAccount.但是,Devise然后希望电子邮件(用户名)字段在此模型中.
当一个人注册一个用户帐户时,实际上会创建三个相关的记录(Person,EmailAddress和UserAccount).我无法弄清楚如何让Devise使用这个设置.有任何想法吗?谢谢你的帮助.
我有以下内容:
# /config/routes.rb
resources :employees, :as => :firm_employments, :controller => :firm_employments do
resource :user_account
end
Run Code Online (Sandbox Code Playgroud)
但是,我得到以下内容:
@firm_employment = FirmEmployment.find(1)
@user_account = @firm_employment.employee.user_account
firm_employment_user_account_path(@firm_employment, @user_account) # => '/employees/1/user_account.3'
Run Code Online (Sandbox Code Playgroud)
为什么句点和@user_account id被追加到此路径?我试图让它简单地返回:"/ employees/1/user_account"
提前致谢.
在向Gemfile添加"gem'redcarpet'"后运行"$ bundle"时,我得到以下内容:
$ bundle
...
Using paperclip (2.3.11)
Using passenger (3.0.7)
Installing redcarpet (1.17.2) with native extensions /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:551:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/robs/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
creating Makefile
make
sh: make: command not found
Gem files will remain installed in /Users/robs/.rvm/gems/ruby-1.9.2-p180@rails-3.0/gems/redcarpet-1.17.2 for inspection.
Results logged to /Users/robs/.rvm/gems/ruby-1.9.2-p180@rails-3.0/gems/redcarpet-1.17.2/ext/redcarpet/gem_make.out
from /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in `block in build_extensions'
from /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in `each'
from /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in `build_extensions'
from /Users/robs/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:180:in `install'
from /Users/robs/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.15/lib/bundler/source.rb:101:in `block in install'
from /Users/robs/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
...
from /Users/robs/.rvm/gems/ruby-1.9.2-p180@global/gems/bundler-1.0.15/bin/bundle:13:in `<top …Run Code Online (Sandbox Code Playgroud) 我有以下内容:
class Project < ActiveRecord::Base
has_many :project_people
has_many :people, :through => :project_people
end
class Person < ActiveRecord::Base
has_many :project_people
has_many :projects, :through => :project_people
end
class ProjectPerson < ActiveRecord::Base
belongs_to :project
belongs_to :person
scope :lead, where(:is_lead => true)
scope :member, where(:is_lead => false)
end
Run Code Online (Sandbox Code Playgroud)
将"引导"ProjectPerson添加到新项目时,它似乎构建正确,但在调用"@ project.project_people"时,该数组为空:
@project = Project.new
=> #<Project id: nil, name: nil>
@project.project_people.lead.build
=> #<ProjectPerson id: nil, project_id: nil, person_id: nil, is_lead: true>
@project.project_people
=> []
Run Code Online (Sandbox Code Playgroud)
当我在没有范围的情况下尝试此操作时,ProjectPerson将显示在数组中:
@project.project_people.build
=> #<ProjectPerson id: nil, project_id: nil, person_id: nil, is_lead: …Run Code Online (Sandbox Code Playgroud) 我有一个“可排序”表,其中当前排序列的标题显示一个图标:
排序图标将显示在文本的末尾(即我们支持 LTR/RTL)。我目前正在使用display:flex. 但是,如果表格宽度缩小并且列标题文本开始换行,我会遇到模棱两可的状态,其中不清楚哪一列被排序:
相反,我想满足以下要求:
例如:
我一直在试验display: inline/inline-block/flex/grid, position, ::before/::after, 甚至float(!)的一系列不同组合,但无法获得所需的行为。这是我当前的代码来演示这个问题:
.table {
border-collapse: collapse;
width: 100%;
}
.thead {
border-bottom: 3px solid #d0d3d3;
}
.thead .tr {
vertical-align: bottom;
}
.button {
padding: 1rem;
text-align: start;
font-family: Arial, "noto sans", sans-serif;
font-size: 0.875rem;
border: 0;
background-color: transparent;
width: 100%;
display: flex;
align-items: flex-end;
font-weight: bold;
line-height: 1.4;
} …Run Code Online (Sandbox Code Playgroud)