Project

General

Profile

« Previous | Next » 

Revision e768c976

Added by Tomáš Strachota over 9 years ago

Fixes #6710 - unicode characters in url parameters

Original methods to_param defined on resources called name.parameterize
to get rid of url-unsafe characters. This function unfortunately also
stripped off unicode characters.

Changes:
- parameterization extracted into a separate module Parameterizable
- each resource defines methods 'to_param' and 'from_param' to ensure correct search
- views updated to always use to_param when building links
- parameterization changed to id+name for resources where it wasn't safe to rely only on names
- default parameter is id

View differences:

app/views/common_parameters/index.html.erb
</tr>
<% for common_parameter in @common_parameters %>
<tr>
<td><%= link_to_if_authorized trunc(common_parameter), hash_for_edit_common_parameter_path(:id => common_parameter.id).merge(:auth_object => common_parameter, :authorizer => authorizer, :permission => 'edit_globals') %></td>
<td><%= link_to_if_authorized trunc(common_parameter), hash_for_edit_common_parameter_path(:id => common_parameter).merge(:auth_object => common_parameter, :authorizer => authorizer, :permission => 'edit_globals') %></td>
<td style='overflow-wrap: break-word;'><%= trunc(common_parameter.safe_value, 80) %></td>
<td class="ra">
<%= display_delete_if_authorized hash_for_common_parameter_path(:id => common_parameter).merge(:auth_object => common_parameter, :authorizer => authorizer, :permission => 'destroy_globals'),

Also available in: Unified diff