Commit 59489b86df33eca2dd1f978acc598758f50d4056

Authored by Antonio Terceiro
1 parent b4751309

Removing invented %{} 'markup' from links

It turns out that Internet Explorer has problems with it. It looks like it
is trying to parse that text as %-escape caracters, and since the parsing
fails, it does not put those links as proper DOM elements but as 'raw'
objects, and thus the .href attribute does not exist (actually an error
occurs if you try to access such attribute on those objects).

This bug was introduced by the HTTP caching commit (ActionItem1608)

(ActionItem1711)
app/helpers/application_helper.rb
@@ -1140,10 +1140,10 @@ module ApplicationHelper @@ -1140,10 +1140,10 @@ module ApplicationHelper
1140 end 1140 end
1141 1141
1142 def usermenu_logged_in 1142 def usermenu_logged_in
1143 - (_('Welcome, %s') % link_to('<i></i><strong>%{login}</strong>', '/%{login}', :id => "homepage-link", :title => _('Go to your homepage'))) + 1143 + (_('Welcome, %s') % link_to('<i></i><strong>{login}</strong>', '/{login}', :id => "homepage-link", :title => _('Go to your homepage'))) +
1144 usermenu_from_environment_features + 1144 usermenu_from_environment_features +
1145 link_to('<i class="icon-menu-admin"></i><strong>' + _('Administration') + '</strong>', { :controller => 'admin_panel', :action => 'index' }, :id => "controlpanel", :title => _("Configure the environment"), :class => 'admin-link', :style => 'display: none') + 1145 link_to('<i class="icon-menu-admin"></i><strong>' + _('Administration') + '</strong>', { :controller => 'admin_panel', :action => 'index' }, :id => "controlpanel", :title => _("Configure the environment"), :class => 'admin-link', :style => 'display: none') +
1146 - link_to('<i class="icon-menu-ctrl-panel"></i><strong>' + _('Control panel') + '</strong>', '/myprofile/%{login}', :id => "controlpanel", :title => _("Configure your personal account and content")) + 1146 + link_to('<i class="icon-menu-ctrl-panel"></i><strong>' + _('Control panel') + '</strong>', '/myprofile/{login}', :id => "controlpanel", :title => _("Configure your personal account and content")) +
1147 link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) 1147 link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system"))
1148 end 1148 end
1149 1149
app/views/blocks/login_block.rhtml
1 <div class="logged-user-info" style='display: none;'> 1 <div class="logged-user-info" style='display: none;'>
2 - <h2><%= _('Logged in as %s') % '%{login}' %></h2> 2 + <h2><%= _('Logged in as %s') % '{login}' %></h2>
3 <ul> 3 <ul>
4 - <li><%= _('User since %{year}/%{month}') %></li>  
5 - <li><%= link_to _('Homepage'), '/%{login}' %></li> 4 + <li><%= _('User since {year}/{month}') %></li>
  5 + <li><%= link_to _('Homepage'), '/{login}' %></li>
6 </ul> 6 </ul>
7 <div class="user-actions"> 7 <div class="user-actions">
8 <%= link_to content_tag('span', _('Logout')), { :controller => 'account', :action => 'logout' }, :class => 'button with-text icon-menu-logout' %> 8 <%= link_to content_tag('span', _('Logout')), { :controller => 'account', :action => 'logout' }, :class => 'button with-text icon-menu-logout' %>
app/views/shared/user_menu.rhtml
@@ -4,23 +4,23 @@ @@ -4,23 +4,23 @@
4 <div class='logged-in' style='display: none'> 4 <div class='logged-in' style='display: none'>
5 5
6 <div id="user_menu_head"> 6 <div id="user_menu_head">
7 - <%= image_tag 'icons-app/person-icon.png', :alt => "%{login} icon photo", :height => "20", :border => "0" %>  
8 - <span><%= _("%s's Menu") % '%{login}' %> </span> 7 + <%= image_tag 'icons-app/person-icon.png', :alt => "{login} icon photo", :height => "20", :border => "0" %>
  8 + <span><%= _("%s's Menu") % '{login}' %> </span>
9 </div> 9 </div>
10 10
11 <div id="user_menu_ul"> 11 <div id="user_menu_ul">
12 <ul> 12 <ul>
13 13
14 <li> 14 <li>
15 - <%= link_to( '<span class="icon-menu-home"></span>' + __('My Home Page'), '/%{login}')%> 15 + <%= link_to( '<span class="icon-menu-home"></span>' + __('My Home Page'), '/{login}')%>
16 </li> 16 </li>
17 17
18 <li> 18 <li>
19 - <%= link_to('<span class="icon-menu-my-groups"></span>' + _('My groups'), '/myprofile/%{login}/memberships') %> 19 + <%= link_to('<span class="icon-menu-my-groups"></span>' + _('My groups'), '/myprofile/{login}/memberships') %>
20 </li> 20 </li>
21 21
22 <li> 22 <li>
23 - <%= lightbox_link_to('<span class="icon-new"></span>' + _('New article'), '/myprofile/%{login}/cms/new') %> 23 + <%= lightbox_link_to('<span class="icon-new"></span>' + _('New article'), '/myprofile/{login}/cms/new') %>
24 </li> 24 </li>
25 25
26 <%# for enterprise in user.enterprises %> 26 <%# for enterprise in user.enterprises %>
@@ -31,12 +31,12 @@ @@ -31,12 +31,12 @@
31 31
32 <% if MailConf.enabled? %> 32 <% if MailConf.enabled? %>
33 <li class='webmail-link' style='display: none'> 33 <li class='webmail-link' style='display: none'>
34 - <%= link_to '<span class="icon-menu-mail"></span>' + _('Webmail'), MailConf.webmail_url('%{login}', '%{email_domain}') %> 34 + <%= link_to '<span class="icon-menu-mail"></span>' + _('Webmail'), MailConf.webmail_url('{login}', '{email_domain}') %>
35 </li> 35 </li>
36 <% end %> 36 <% end %>
37 37
38 <li> 38 <li>
39 - <%= link_to('<span class="icon-menu-ctrl-panel"></span>'+ _('Control panel'), '/myprofile/%{login}', :id => 'link_edit_profile') %> 39 + <%= link_to('<span class="icon-menu-ctrl-panel"></span>'+ _('Control panel'), '/myprofile/{login}', :id => 'link_edit_profile') %>
40 </li> 40 </li>
41 41
42 <li class='admin-link' style='display: none'><%= link_to( '<span class="icon-menu-admin"></span>'+ _('Admin'), 42 <li class='admin-link' style='display: none'><%= link_to( '<span class="icon-menu-admin"></span>'+ _('Admin'),
public/javascripts/application.js
@@ -455,13 +455,13 @@ jQuery(function($) { @@ -455,13 +455,13 @@ jQuery(function($) {
455 $('body').addClass('logged-in'); 455 $('body').addClass('logged-in');
456 $('#user .logged-in, .login-block .logged-user-info').each(function() { 456 $('#user .logged-in, .login-block .logged-user-info').each(function() {
457 $(this).find('a[href]').each(function() { 457 $(this).find('a[href]').each(function() {
458 - var new_href = $(this).attr('href').replace('%{login}', data.login); 458 + var new_href = $(this).attr('href').replace('{login}', data.login);
459 if (data.email_domain) { 459 if (data.email_domain) {
460 - new_href = new_href.replace('%{email_domain}', data.email_domain); 460 + new_href = new_href.replace('{email_domain}', data.email_domain);
461 } 461 }
462 $(this).attr('href', new_href); 462 $(this).attr('href', new_href);
463 }); 463 });
464 - var html = $(this).html().replace(/%{login}/g, data.login).replace('%{month}', data.since_month).replace('%{year}', data.since_year); 464 + var html = $(this).html().replace(/{login}/g, data.login).replace('{month}', data.since_month).replace('{year}', data.since_year);
465 $(this).html(html).fadeIn(); 465 $(this).html(html).fadeIn();
466 if (data.is_admin) { 466 if (data.is_admin) {
467 $('#user .admin-link').show(); 467 $('#user .admin-link').show();
@@ -578,7 +578,7 @@ function limited_text_area(textid, limit) { @@ -578,7 +578,7 @@ function limited_text_area(textid, limit) {
578 } 578 }
579 579
580 jQuery(function($) { 580 jQuery(function($) {
581 - $('a').each(function($) { 581 + $('a').each(function() {
582 if (this.href == document.location.href) { 582 if (this.href == document.location.href) {
583 $(this).addClass('link-this-page'); 583 $(this).addClass('link-this-page');
584 } 584 }