Commit df303518ef8e36ba7d4e0a736a880cc8c01adbbb

Authored by Evandro Jr
1 parent 815ab990

Validation and comment from email fix

plugins/comment_paragraph/lib/ext/article.rb
... ... @@ -8,7 +8,7 @@ class Article
8 8  
9 9 def body_change_with_comments
10 10 if body && body_changed? && !self.comments.empty?
11   - paragraphs_with_comments = self.comments.where("'article_id' IS NOT NULL")
  11 + paragraphs_with_comments = self.comments.where("'paragraph_id' IS NOT NULL")
12 12 errors[:base] << (N_('You are unable to change the body of the article when paragraphs are commented')) unless (paragraphs_with_comments).empty?
13 13 end
14 14 end
... ...
plugins/comment_paragraph/public/comment_paragraph_macro.js
... ... @@ -64,13 +64,13 @@ jQuery(document).ready(function($) {
64 64 // cssApplier.toggleSelection();
65 65 // });
66 66  
67   - function processSomething(){
  67 + function processAnchor(){
68 68 var anchor = window.location.hash;
69 69 if(anchor.length==0) return;
70 70  
71 71 var val = anchor.split('-'); //anchor format = #comment-\d+
72 72 if(val.length!=2 || val[0]!='#comment') return;
73   - if($('div[data-macro=comment_paragraph_plugin/allow_comment]').length==0) return; //comment_paragraph_plugin/allow_comment div must exists
  73 + if($('div[data-macro=comment_paragraph_plugin\\/allow_comment]').length==0) return; //comment_paragraph_plugin/allow_comment div must exists
74 74 var comment_id = val[1];
75 75 if(!/^\d+$/.test(comment_id)) return; //test for integer
76 76  
... ... @@ -85,7 +85,7 @@ jQuery(document).ready(function($) {
85 85 });
86 86 }
87 87  
88   - processSomething();
  88 + processAnchor();
89 89  
90 90 $(document).on('mouseover', 'li.article-comment', function(){
91 91 var selected_area = $(this).find('input.paragraph_comment_area').val();
... ...