3
부트 스트랩 플래시 메시지에 문제가 있습니다. 플래시 메시지에서 일부 텍스트의 색을 변경해야합니다.레일에서 부트 스트랩 플래시 메시지를 수정하는 방법 4
컨트롤러
redirect_to complaints_path, notice: "Complaint was successfully created & Your Complaint Reference Id is #{@complaint.complaint_id}"
나는 @ 불만/complaint_id
<% flash.each do |name, msg| %>
<div class="alert alert-<%= name == :notice ? "success" : "danger" %>">
<span class="close" data-dismiss="alert">×</span>
<%= content_tag :div, msg, :id => "flash_#{name}" if msg.is_a?(String) %>
</div>
<% end %>
그것은 녹색 색상의 성공 메시지가 표시됩니다의 변화 색상을 가지고있다.
이module ApplicationHelper
def bootstrap_class_for flash_type
{ success: "alert-success", error: "alert-danger", alert: "alert-warning", notice: "alert-info" }[flash_type] || flash_type.to_s
end
def flash_messages(opts = {})
flash.each do |msg_type, message|
concat(content_tag(:div, message, class: "alert #{bootstrap_class_for(msg_type)} fade in") do
concat content_tag(:button, 'x', class: "close", data: { dismiss: 'alert' })
concat message
end)
end
nil
end
end
이 그런 다음 application.html.erb 레이아웃을 사용하지만 난