I'm creating a news app in Rails and it has a carousel that shows the news stories highlighted. Each department has a place to show this prominence. I would like to know how to make an alert appear as soon as the "Featured News" checkbox is selected, asking if the user wants to change the highlighted news in a department (in case there is already a featured news in the respective department).
_form.html
<div id="highlight" class="field">
<%= f.label "Notícia em Destaque" %>
<%= f.check_box :highlight, :"data-selects-visibility" => ".triggered_by_checkbox" %>
</div>
<div class="field">
<%= f.label :department_id %><br />
<%= f.collection_select(:department_id , Department.all, :id, :name, options ={:prompt
=> "Select department"}) %>
</div>
_carousel.html
<div id="mycarousel" class="carousel slide" data-ride="carousel">
<!--Indicators -->
<ol class="carousel-indicators">
<li data-target="#mycarousel" data-slide-to="0" class="indicator active"></li>
<li data-target="#mycarousel" data-slide-to="1" class="indicator"></li>
<li data-target="#mycarousel" data-slide-to="2" class="indicator"></li>
<li data-target="#mycarousel" data-slide-to="3" class="indicator"></li>
<li data-target="#mycarousel" data-slide-to="4" class="indicator"></li>
<li data-target="#mycarousel" data-slide-to="5" class="indicator"></li>
</ol>
<div class="carousel-inner" role="listbox">
<% @carousel_content.each do |publication| %>
<div class="item">
<%= link_to publication do%>
<img src="<%= publication.image %>">
<div class="carousel-caption">
<h3><%= publication.image_description %></h3>
</div>
<% end %>
</div>
<% end %>
</div>