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
<% 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 %>
<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>
<%= 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 %>
<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() {
</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>
<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>