Fix namespacing of generated urls and use named routes where possible.

pull/6827/head
Christian Rijke 12 years ago
parent 46812b4010
commit 033d043c6e
  1. 6
      app/views/cost_types/_list.html.erb
  2. 4
      app/views/hourly_rates/_list_project.html.erb

@ -17,13 +17,13 @@
<% cost_types.each do |cost_type| %>
<% odd_even = cycle('odd', 'even') %>
<tr class="<%= odd_even %>">
<%= content_tag :td, link_to(cost_type.name, cost_type) %>
<%= content_tag :td, link_to(cost_type.name, {:controller => '/cost_types', :action => 'edit', :id => cost_type}) %>
<%= content_tag :td, cost_type.unit %>
<%= content_tag :td, cost_type.unit_plural %>
<% rate = cost_type.rate_at(@fixed_date) %>
<%= content_tag :td, number_to_currency( rate ? rate.rate : 0.0), :class => "currency", :id => "cost_type_#{cost_type.id}_rate"%>
<td>
<%= form_for cost_type, set_rate_cost_type_path(cost_tyoe) do |f| %>
<%= form_for cost_type, :url => { :controller => '/cost_types', :action => 'set_rate', :id => cost_type } do |f| %>
<label class="hidden-for-sighted" for="<%= "rate_field_#{cost_type.id}" %>"><%= l(:caption_set_rate) %></label>
<%= f.text_field :rate, :value => "", :name => :rate, :size => 7, :id => "rate_field_#{cost_type.id}" %> <%= Setting.plugin_openproject_costs['costs_currency'] %>
<%= image_submit_tag "save.png", :alt => l(:caption_save_rate), :title => l(:caption_save_rate) %>
@ -31,7 +31,7 @@
</td>
<%= content_tag :td, cost_type.is_default? ? image_tag('check.png', :alt => l(:general_text_Yes)) : "" %>
<td>
<%= form_for cost_type, toggle_delete_cost_type_path(cost_type) do |f| %>
<%= form_for cost_type, :url => { :controller => '/cost_types', :action => 'toggle_delete', :id => cost_type } do |f| %>
<%= image_submit_tag "locked.png", :alt => l(:button_lock), :title => l(:button_lock), :onclick => "return confirm('#{escape_javascript(l(:text_are_you_sure))}')" %>
<% end %>
</td>

@ -6,8 +6,8 @@
%>
<div class="contextual">
<% if project && User.current.allowed_to?(edit_project_hourly_rate_path(project)) %>
<%= link_to l(:button_update), edit_hourly_rate_path(@user), :class => 'icon icon-edit', :accesskey => accesskey(:edit) %>
<% if project && User.current.allowed_to?({:controller => '/hourly_rates', :action => 'edit'}, project) %>
<%= link_to l(:button_update), {:controller => '/hourly_rates', :action => 'edit', :project_id => project, :id => @user}, :class => 'icon icon-edit', :accesskey => accesskey(:edit) %>
<% end %>
</div>
<h3><%=h project.name %><%= (" - " + number_to_currency(current_rate.rate)) if current_rate %></h3>

Loading…
Cancel
Save