我正在尝试更改说明中的html,以便我打开电子邮件客户端的超链接仍然可用,以及指向Google地图图钉的超链接。我想超链接是白色的,因为背景是蓝色的。请在说明框中查看下面的代码:
# app/controllers/confirmations_controller.rb
class ConfirmationsController < Devise::ConfirmationsController
# Remove the first skip_before_filter (:require_no_authentication) if you
# don't want to enable logged users to access the confirmation page.
skip_before_filter :require_no_authentication
skip_before_filter :authenticate_user!
# PUT /resource/confirmation
def update
with_unconfirmed_confirmable do
if @confirmable.has_no_password?
@confirmable.attempt_set_password(params[:user])
if @confirmable.valid? and @confirmable.password_match?
do_confirm
else
do_show
@confirmable.errors.clear #so that we wont render :new
end
else
@confirmable.errors.add(:email, :password_already_set)
end
end
if !@confirmable.errors.empty?
self.resource = @confirmable
render 'confirmations/show' #Change this if you don't have the views on default path
end
end
# GET /resource/confirmation?confirmation_token=abcdef
def show
with_unconfirmed_confirmable do
if @confirmable.has_no_password?
do_show
else
do_confirm
end
end
unless @confirmable.errors.empty?
self.resource = @confirmable
render 'confirmations/show' #Change this if you don't have the views on default path
end
end
protected
def with_unconfirmed_confirmable
@confirmable = User.find_or_initialize_with_error_by(:confirmation_token, params[:confirmation_token])
if !@confirmable.new_record?
@confirmable.only_if_unconfirmed {yield}
end
end
def do_show
@confirmation_token = params[:confirmation_token]
@requires_password = true
self.resource = @confirmable
render 'confirmations/show' #Change this if you don't have the views on default path
end
def do_confirm
@confirmable.confirm!
set_flash_message :notice, :confirmed
sign_in_and_redirect(resource_name, @confirmable)
end
end
答案 0 :(得分:0)
这是打开电子邮件客户端的标签
<a href="mailto:webmaster@example.com">Jon Doe</a>
然后对于Google地图页面,您只需要链接到您想要的城市/地点{hm <a href="https://www.google.com/maps/place">A place</a>
答案 1 :(得分:0)
您的代码中有一些奇怪的标记。
以下是使用css选择器的工作示例。
a {
color:#FF0000; // set all hyperlinks to red
}
[href^="mailto"] {
color:#FFFFFF; // set any hyperlink which starts with mailto in the href to white
}