Commit 0ee683a48fef54b5a469e8a78338e1c764ce1d6c

Authored by Braulio Bhavamitra
2 parents ab48799c 57c595aa

Merge branch 'plugin-bug-fixes' into 'master'

Newsletter and Sniffer plugins bug fixes

Fixes some bugs found:
- Check box in newsletter moderation task page wasn't showing up;
- Newsletter header in moderation task page wasn't exactly like the preview of the newsletter since a padding was added;
- Sniffer plugin wasn't filtering out enterprises based on distance.

See merge request !736
plugins/newsletter/public/style.css
... ... @@ -17,6 +17,11 @@
17 17 margin-left: 10px;
18 18 }
19 19  
  20 +#newsletter-moderation-preview th {
  21 + padding: 0px;
  22 + border: 0px;
  23 +}
  24 +
20 25 #newsletter-moderation-preview input[type=checkbox] {
21 26 margin-left: -27px;
22 27 margin-top: 16px;
... ...
plugins/newsletter/test/functional/newsletter_plugin_admin_controller_test.rb
1   -require File.dirname(__FILE__) + '/../../../../test/test_helper'
  1 +require 'test_helper'
2 2  
3 3 class NewsletterPluginAdminControllerTest < ActionController::TestCase
4 4  
... ...
plugins/newsletter/test/functional/newsletter_plugin_controller_test.rb
1   -require File.dirname(__FILE__) + '/../../../../test/test_helper'
  1 +require 'test_helper'
2 2  
3 3 class NewsletterPluginControllerTest < ActionController::TestCase
4 4  
... ...
plugins/newsletter/views/tasks/newsletter_plugin/_moderate_newsletter_accept_details.html.erb
... ... @@ -3,14 +3,14 @@
3 3 <h1><%= _('Check posts you want to include') %></h1>
4 4  
5 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 8 <% newsletter.posts.each do |post| %>
9 9 <% input_name = "tasks[#{task.id}][task][post_ids][]" %>
10 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 14 <% end %>
15 15  
16 16 <%= newsletter_content %>
... ...
plugins/sniffer/lib/sniffer_plugin/helper.rb
... ... @@ -5,7 +5,7 @@ module SnifferPlugin::Helper
5 5 def filter_visible_attr_profile(profile)
6 6 filtered_profile = {}
7 7 visible_attributes = [:id, :name, :lat, :lng, :sniffer_plugin_distance]
8   - visible_attributes.each{ |a| filtered_profile[a] = profile[a] || 0 }
  8 + visible_attributes.each{ |a| filtered_profile[a] = profile.send(a) || 0 }
9 9 filtered_profile
10 10 end
11 11  
... ...