rules.more_about_rule_on_profile_x=More about this rule on profile "{0}"
rules.identification=Identification
rules.parameters=Parameters
+rules.not_found=The rule "{0}" does not exists
#------------------------------------------------------------------------------
SECTION=Navigation::SECTION_CONFIGURATION
def show
- key=params[:id]
- if key.to_i==0
- parts=key.split(':')
- @rule=Rule.find(:first, :conditions => ['plugin_name=? and plugin_rule_key=?', parts[0], parts[1]])
+ @key=params[:id]
+ if @key.to_i==0
+ parts=@key.split(':')
+ @rule=Rule.first(:conditions => ['plugin_name=? and plugin_rule_key=?', parts[0], parts[1]])
else
- @rule=Rule.find(key)
+ @rule=Rule.find(@key)
+ end
+ @page_title=@rule.name if @rule
+
+ if params[:modal] == 'true'
+ render :partial => 'show'
end
- @page_title=@rule.name
end
end
def process_rule_description(rule)
description = rule.description
- description.gsub(/\{toRule (.+):(.+)\}/, "<a class='open-modal' href='#{ApplicationController.root_context}/rules/show/"+ '\1:\2' +"?layout=false'>"+ '\1:\2' +"</a>")
+ description.gsub(
+ /\{toRule (.+):(.+)\}/,
+ "<a class='open-modal rule-modal' href='#{ApplicationController.root_context}/rules/show/"+ '\1:\2' +"?modal=true&layout=false'>" + '\1:\2' +"</a>")
end
end
--- /dev/null
+<div style="padding:5px;">
+
+ <% if @rule %>
+ <div class="form-head" style="height:40px">
+ <h2>
+ <%= @rule.name %>
+ </h2>
+ <div class="subtitle" style="line-height:0px;">
+ <%= @rule.plugin_name -%> : <%= @rule.plugin_rule_key -%>
+ </div>
+ </div>
+ <% end %>
+
+ <div class="form-body">
+ <% if @rule %>
+ <% if @rule.description.strip.start_with?('<p>') %>
+ <%= process_rule_description @rule %>
+ <% else %>
+ <p><%= process_rule_description @rule %></p>
+ <% end %>
+
+ <% if @rule.note && !@rule.note.text.strip.blank? %>
+ <p><%= @rule.note.html_text -%></p>
+ <% end %>
+ <% else %>
+ <p class="error"><%= message('rules.not_found', :params => @key) %>
+ <% end %>
+ </div>
+
+ <div class="form-foot">
+ <a href="#" onclick="return closeModalWindow()"><%= h message('close') -%></a>
+ </div>
+
+</div>
+
+<script type="text/javascript">
+ $j(document).ready(function () {
+ $j('.rule-modal').modal()
+ });
+</script>
return this.each(function () {
var obj = $j(this);
var $link = obj.bind('click', function () {
- if ($j('#modal').length) {
- return; // another window is already opening
+ var $dialog = $j('#modal');
+ if (!$dialog.length) {
+ $dialog = $j('<div id="modal" class="ui-widget-overlay"></div>').appendTo('body');
}
- var $dialog = $j('<div id="modal" class="ui-widget-overlay"></div>').appendTo('body');
var url = $link.attr('modal-url') || $link.attr('href');
$j.get(url,function (html) {
$dialog.removeClass('ui-widget-overlay');