Commit d1261c16e728b749b7f1337f3eb0b7986ec1d52a

Authored by Larissa Reis
1 parent 75f13387

newsletter: Fix moderation checkbox regex

  regex should work regardless of the position of id in the tag
plugins/newsletter/views/tasks/newsletter_plugin/_moderate_newsletter_accept_details.html.erb
@@ -3,14 +3,14 @@ @@ -3,14 +3,14 @@
3 <h1><%= _('Check posts you want to include') %></h1> 3 <h1><%= _('Check posts you want to include') %></h1>
4 4
5 <div id='newsletter-moderation-preview'> 5 <div id='newsletter-moderation-preview'>
6 - <% newsletter_content = newsletter.body.gsub(/width: 640px;/,'').sub(/#{NewsletterPlugin::Newsletter::CSS['breaking-news-wrap']}/, '') %> 6 + <% newsletter_content = newsletter.body.gsub(/width: 640px;/,'').sub(/#{NewsletterPlugin::Newsletter::CSS['breakingnews-wrap']}/, '') %>
7 7
8 <% newsletter.posts.each do |post| %> 8 <% newsletter.posts.each do |post| %>
9 <% input_name = "tasks[#{task.id}][task][post_ids][]" %> 9 <% input_name = "tasks[#{task.id}][task][post_ids][]" %>
10 <% post_check_box = hidden_field_tag(input_name, '0') +check_box_tag(input_name, post.id, true) %> 10 <% post_check_box = hidden_field_tag(input_name, '0') +check_box_tag(input_name, post.id, true) %>
11 11
12 - <% newsletter_content.gsub!(/<span id="#{post.id}"/, post_check_box+ '<span') %>  
13 - <% newsletter_content.gsub!(/<img id="#{post.id}"/, post_check_box+ '<img') %> 12 + <% newsletter_content.gsub!(/<span([^>]*?) id="#{post.id}"/, post_check_box + '<span\\1')%>
  13 + <% newsletter_content.gsub!(/<img([^>]*?) id="#{post.id}"/, post_check_box + '<img\\1') %>
14 <% end %> 14 <% end %>
15 15
16 <%= newsletter_content %> 16 <%= newsletter_content %>