From e4c235fef810a278a562d605a7dfb6b4da08e684 Mon Sep 17 00:00:00 2001 From: Evandro Jr Date: Thu, 31 Jul 2014 10:03:18 -0300 Subject: [PATCH] Validation and comment from email fix --- lib/ext/article.rb | 2 +- public/comment_paragraph_macro.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ext/article.rb b/lib/ext/article.rb index eb01c04..d8fa24a 100644 --- a/lib/ext/article.rb +++ b/lib/ext/article.rb @@ -8,7 +8,7 @@ class Article def body_change_with_comments if body && body_changed? && !self.comments.empty? - paragraphs_with_comments = self.comments.where("'article_id' IS NOT NULL") + paragraphs_with_comments = self.comments.where("'paragraph_id' IS NOT NULL") errors[:base] << (N_('You are unable to change the body of the article when paragraphs are commented')) unless (paragraphs_with_comments).empty? end end diff --git a/public/comment_paragraph_macro.js b/public/comment_paragraph_macro.js index a8af011..14d32e8 100644 --- a/public/comment_paragraph_macro.js +++ b/public/comment_paragraph_macro.js @@ -64,13 +64,13 @@ jQuery(document).ready(function($) { // cssApplier.toggleSelection(); // }); - function processSomething(){ + function processAnchor(){ var anchor = window.location.hash; if(anchor.length==0) return; var val = anchor.split('-'); //anchor format = #comment-\d+ if(val.length!=2 || val[0]!='#comment') return; - if($('div[data-macro=comment_paragraph_plugin/allow_comment]').length==0) return; //comment_paragraph_plugin/allow_comment div must exists + if($('div[data-macro=comment_paragraph_plugin\\/allow_comment]').length==0) return; //comment_paragraph_plugin/allow_comment div must exists var comment_id = val[1]; if(!/^\d+$/.test(comment_id)) return; //test for integer @@ -85,7 +85,7 @@ jQuery(document).ready(function($) { }); } - processSomething(); + processAnchor(); $(document).on('mouseover', 'li.article-comment', function(){ var selected_area = $(this).find('input.paragraph_comment_area').val(); -- libgit2 0.21.2