init_issue
if request.xhr?
- render :partial => 'issue/view', :locals => {:issue => @issue, :issue_results => @issue_results, :snapshot => @snapshot}
+ render :partial => 'issue/view', :locals => {:issue => @issue, :issue_results => @issue_results, :snapshot => @snapshot, :show_source => true}
else
render :action => 'view'
end
end
- # Used in Eclipse Plugin
+ # GET /issue/show/<key>
+ # This URL is used by the Eclipse Plugin
+ #
+ # ==== Optional parameters
+ # 'layout' is false to remove sidebar and headers. Default value is true.
+ # 'source' is false to hide source code. Default value is true.
+ #
+ # ==== Example
+ # GET /issue/show/151f6853-58a1-4950-95e3-9866f8be3e35?layout=false&source=false
+ #
def show
require_parameters :id
init_issue
-
- params[:layout] = 'false'
render :action => 'view'
end
class RulesController < ApplicationController
SECTION=Navigation::SECTION_CONFIGURATION
-
+
+ # GET /rules/show/<key>
+ # This URL is used by the Eclipse plugin
+ #
+ # ==== Optional parameters
+ # 'layout' is false to remove sidebar and headers
+ #
+ # Example: GET /rules/show/squid:AvoidCycles
+ #
def show
+ require_parameters :id
+
@key=params[:id]
if @key.to_i==0
parts=@key.split(':')
@page_title=@rule.name if @rule
if params[:modal] == 'true'
- render :partial => 'show'
+ render :partial => 'show_modal'
end
end
-
end
<%= render :partial => 'issue/issue', :locals => {:issue => issue_results.issues.get(0)} -%>
</div>
- <% if snapshot && issue.line%>
+ <% if snapshot && issue.line && show_source %>
<div>
<%= snapshot_html_source(snapshot, {:line_range => (issue.line-5)..(issue.line+5), :highlighted_lines => [issue.line]}) -%>
</div>
<div>
- <%= render :partial => 'issue/view', :locals => {:issue => @issue, :issue_results => @issue_results, :snapshot => @snapshot} -%>
+ <%= render :partial => 'issue/view', :locals => {:issue => @issue, :issue_results => @issue_results, :snapshot => @snapshot, :show_source => params[:source]!='false'} -%>
</div>
+++ /dev/null
-<% if @rule %>
-<div class="modal-head">
- <h2 class="rule-title">
- <%= @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><%= @rule.plugin_name -%> : <%= @rule.plugin_rule_key -%></li>
- </ul>
-</div>
-
-<div class="modal-body rule_detail">
- <% if @rule.description.strip.start_with?('<p>') %>
- <%= Internal.text.interpretMacros(@rule.description) %>
- <% else %>
- <p><%= Internal.text.interpretMacros(@rule.description) %></p>
- <% end %>
-
- <% if @rule.note && !@rule.note.text.strip.blank? %>
- <p><%= @rule.note.html_text -%></p>
- <% end %>
-</div>
-
-<% else %>
-<div class="modal-body">
- <p class="error"><%= message('rules.not_found', :params => @key) %>
-</div>
-<% end %>
-
-<div class="modal-foot">
- <input type="button" value="<%= h message('close') -%>" onclick="return closeModalWindow()">
-</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_detail .rule-modal').modal()
- });
-</script>
--- /dev/null
+<% if @rule %>
+<div class="modal-head">
+ <h2 class="rule-title">
+ <%= @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><%= @rule.plugin_name -%> : <%= @rule.plugin_rule_key -%></li>
+ </ul>
+</div>
+
+<div class="modal-body rule_detail">
+ <% if @rule.description.strip.start_with?('<p>') %>
+ <%= Internal.text.interpretMacros(@rule.description) %>
+ <% else %>
+ <p><%= Internal.text.interpretMacros(@rule.description) %></p>
+ <% end %>
+
+ <% if @rule.note && !@rule.note.text.strip.blank? %>
+ <p><%= @rule.note.html_text -%></p>
+ <% end %>
+</div>
+
+<% else %>
+<div class="modal-body">
+ <p class="error"><%= message('rules.not_found', :params => @key) %>
+</div>
+<% end %>
+
+<div class="modal-foot">
+ <input type="button" value="<%= h message('close') -%>" onclick="return closeModalWindow()">
+</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_detail .rule-modal').modal()
+ });
+</script>