Commit e4c235fef810a278a562d605a7dfb6b4da08e684

Authored by Evandro Jr
1 parent c0f78c63
Exists in master

Validation and comment from email fix

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
... ...
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();
... ...