Reputation: 7862
I'm using https://github.com/thoughtbot/paul_revere gem for managing announcements in my rails app. This gem has its partial to show announcements. It looks like this:
<% if announcement_visible?(current_announcement) %>
<div id="announcement">
<span><%= current_announcement.body.html_safe %></span>
<span class="hide">
<%= link_to "hide", "#", onclick: "hideAnnouncement('#{current_announcement.to_cookie_key}')" %>
</span>
</div>
<% end %>
I've add a little bit of css for it:
#announcement{
position: relative;
left: 10px;
width: 50%;
@extend .alert;
@extend .alert-dismissible;
@extend .alert-info;
@extend .animated;
@extend .fadeInUp;
}
But I cant make it work that hide link to hide alert. And I also want to have x instead of hide. Is there any way of doing that with pure css and without overriding gem partial?
Upvotes: 0
Views: 49
Reputation: 167182
If you are not able to change it in the source or in the gem
file, can you please add this jQuery bit?
$(document).ready(function () {
$("#announcement").find(".hide").html("×").attr("data-dismiss", "alert");
});
Upvotes: 1