<% if @rule %>
<div class="modal-head">
  <h2 class="rule-title">
    <%= h @rule.name %>
  </h2>
  <% unless @rule.ready? %>
    <div class="rule-status">
      <% if @rule.beta? %>
        <span><%= message('rules.status.beta') %></span>
      <% elsif @rule.deprecated? %>
        <span><%= message('rules.status.deprecated') %></span>
      <% end %>
    </div>
  <% end %>
  <ul class="modal-head-metadata">
    <li><%= h @rule.plugin_name -%> : <%= h @rule.plugin_rule_key -%></li>
  </ul>
</div>

<div class="modal-body rule-desc">
  <% if @rule.description.strip.start_with?('<p>') %>
    <%= Internal.text.interpretMacros(@rule.description) %>
  <% else %>
    <p><%= Internal.text.interpretMacros(@rule.description) %></p>
  <% end %>

  <% if @rule.note_data && !@rule.note_data.strip.blank? %>
    <p> <%= Api::Utils.markdown_to_html(@rule.note_data) -%></p>
  <% end %>
</div>

<% else %>
<div class="modal-body">
  <p class="error"><%= message('rules.not_found', :params => @key) %>
</div>
<% end %>

<div class="modal-foot">
  <a href="#" onclick="return closeModalWindow()" autofocus><%= h message('close') -%></a>
</div>

<script type="text/javascript">
  $j(document).ready(function () {
    // As links in rule description will be loaded after open-modal has been processed by jquery, we have to process manually rule-modal classes
    $j('.rule-desc .rule-modal').modal();
  });
</script>
