value=params[:val]
bad_request("Not a numeric value: #{value}") if value && !Api::Utils.is_number?(value)
- measure=ManualMeasure.find(:first, :conditions => ['resource_id=? and metric_id=?', resource.id, metric.id])
+ measure=ManualMeasure.first(:conditions => ['resource_id=? and metric_id=?', resource.id, metric.id])
if measure.nil?
measure=ManualMeasure.new(:resource => resource, :user_login => current_user.login, :metric_id => metric.id)
end
--- /dev/null
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2012 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# Sonar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+#
+
+class MacroInterpreter
+
+ def self.interpret_macro(text)
+ Java::OrgSonarServerUi::JRubyFacade.getInstance().getMacroInterpreter().interpret(text)
+ end
+
+end
\ No newline at end of file
<div class="modal-body">
<% if @rule.description.strip.start_with?('<p>') %>
- <%= interpret_macro @rule.description %>
+ <%= MacroInterpreter.interpret_macro @rule.description %>
<% else %>
- <p><%= interpret_macro @rule.description %></p>
+ <p><%= MacroInterpreter.interpret_macro @rule.description %></p>
<% end %>
<% if @rule.note && !@rule.note.text.strip.blank? %>
<div class="doc">
<% if @rule.description.strip.start_with?('<p>') %>
- <%= interpret_macro @rule.description %>
+ <%= MacroInterpreter.interpret_macro @rule.description %>
<% else %>
- <p><%= interpret_macro @rule.description %></p>
+ <p><%= MacroInterpreter.interpret_macro @rule.description %></p>
<% end %>
<% if @rule.note && !@rule.note.text.strip.blank? %>
<div id="<%= note_detail_div_id -%>">
<% if rule.description.strip.start_with?('<p>') %>
- <%= interpret_macro rule.description %>
+ <%= MacroInterpreter.interpret_macro rule.description %>
<% else %>
- <p><%= interpret_macro rule.description %></p>
+ <p><%= MacroInterpreter.interpret_macro rule.description %></p>
<% end %>
<% if note && !note.text.strip.blank? %>