]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2547 fix breadcrumb of manual measures
authorSimon Brandhof <simon.brandhof@gmail.com>
Thu, 21 Jul 2011 15:18:05 +0000 (17:18 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Thu, 21 Jul 2011 15:18:13 +0000 (17:18 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/manual_measures_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/manual_measures/index.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/manual_measures/new.html.erb

index f2a9c564f216ffaff7f1eb515b1cd8daeab07a1b..255a436722a4268e2046c867096995e11c4b2952 100644 (file)
@@ -48,22 +48,22 @@ class ManualMeasuresController < ApplicationController
     measure.description = params[:desc]
     measure.save!
     if (params[:redirect_to_new]=='true')
-      redirect_to :action => 'new', :resource => params[:resource]
+      redirect_to :action => 'new', :id => params[:id]
     else
-      redirect_to :action => 'index', :resource => params[:resource], :metric => params[:metric]
+      redirect_to :action => 'index', :id => params[:id], :metric => params[:metric]
     end
   end
 
   def delete
     metric=Metric.by_key(params[:metric])
     ManualMeasure.destroy_all(['resource_id=? and metric_id=?', @resource.id, metric.id])
-    redirect_to :action => 'index', :resource => params[:resource], :metric => params[:metric]
+    redirect_to :action => 'index', :id => params[:id], :metric => params[:metric]
   end
 
   private
 
   def load_resource
-    @resource=Project.by_key(params[:resource])
+    @resource=Project.by_key(params[:id])
     return redirect_to home_path unless @resource
     return access_denied unless has_role?(:admin, @resource)
     @snapshot=@resource.last_snapshot
index 33aefe64b410a7b357fdd63354d1075ca0f73247..70f1a4f0cc74f4c5b39db96da468ac5f62e0dde3 100644 (file)
@@ -50,7 +50,7 @@
           <% end %>
           <% if has_role?(:admin, @project) %>
             <li class="h2"><%= message('sidebar.project_system') -%></li>
-            <li class="<%= 'selected' if request.request_uri.include?('/manual_measures') -%>"><a href="<%= ApplicationController.root_context -%>/manual_measures?resource=<%= @project.id -%>"><%= message('manual_measures.page') -%></a></li>
+            <li class="<%= 'selected' if request.request_uri.include?('/manual_measures') -%>"><a href="<%= ApplicationController.root_context -%>/manual_measures/index/<%= @project.id -%>"><%= message('manual_measures.page') -%></a></li>
             <% if (@project.project? || @project.module?) %>
               <li class="<%= 'selected' if request.request_uri.include?('/project/settings') -%>"><a href="<%= ApplicationController.root_context -%>/project/settings/<%= @project.id -%>"><%= message('project_settings.page') -%></a></li>
             <% end %>
index af436a049469d5e78e51178efdfa333bcf6892ab..0b19dcd646b003053975386b1f25db69cd17d051 100644 (file)
@@ -14,7 +14,7 @@
   <ul class="operations">
     <li class="last">
       <%= image_tag 'add.png' -%>
-      <a href="<%= ApplicationController.root_context -%>/manual_measures/new?resource=<%= @resource.id -%>" id="addMeasureLink">Add measure</a>
+      <a href="<%= ApplicationController.root_context -%>/manual_measures/new/<%= @resource.id -%>" id="addMeasureLink">Add measure</a>
     </li>
   </ul>
 </div>
@@ -56,8 +56,8 @@
         <%= l(measure.updated_at) -%>
       </td>
       <td class="thin nowrap">
-        <a href="<%= url_for :controller => 'manual_measures', :action => 'new', :metric => measure.metric.key, :resource => @resource.key -%>">Edit</a>
-        <%= link_to 'Delete', {:action => 'delete', :metric => measure.metric.key, :resource => @resource.id}, {:method => 'POST', :confirm => "This measure will be deleted during next project analysis", :class => 'action'} -%>
+        <a href="<%= url_for :controller => 'manual_measures', :action => 'new', :metric => measure.metric.key, :id => @resource.id -%>">Edit</a>
+        <%= link_to 'Delete', {:action => 'delete', :metric => measure.metric.key, :id => @resource.id}, {:method => 'POST', :confirm => "This measure will be deleted during next project analysis", :class => 'action'} -%>
       </td>
     </tr>
   <% end %>
index 4dc0ef8e3bb5f513d22faf4b95b32f2184d605ce..5492e84df4cdf6490c77783fc2e9346dedb7c49f 100644 (file)
@@ -1,6 +1,6 @@
 <script type="text/javascript">
   function changeMetric() {
-    document.location = '<%= ApplicationController.root_context-%>/manual_measures/new?resource=<%= @resource.key -%>&metric=' + $('metricSelect').getValue();
+    document.location = '<%= ApplicationController.root_context-%>/manual_measures/new/<%= @resource.id -%>?metric=' + $('metricSelect').getValue();
     return false;
   }
   function saveAndAddNew() {
@@ -10,7 +10,7 @@
 </script>
 
 <form action="<%= url_for :action => (@measure ? 'save' : 'new') -%>" method="POST" id="createForm">
-  <input type="hidden" name="resource" value="<%= @resource.id -%>"/>
+  <input type="hidden" name="id" value="<%= @resource.id -%>"/>
   <table class="width100 form">
     <tbody>
     <tr>
@@ -69,7 +69,7 @@
           <input type="submit" value="Save"/>
           <input type="submit" value="Save & Add new" onclick="saveAndAddNew()"/>
         <% end %>
-        <%= link_to 'Cancel', :action => 'index', :resource => @resource.key -%>
+        <%= link_to 'Cancel', :action => 'index', :id => @resource.id -%>
       </td>
     </tr>
     </tbody>