Commit e4c235fef810a278a562d605a7dfb6b4da08e684
1 parent
c0f78c63
Exists in
master
Validation and comment from email fix
Showing
2 changed files
with
4 additions
and
4 deletions
Show diff stats
lib/ext/article.rb
| @@ -8,7 +8,7 @@ class Article | @@ -8,7 +8,7 @@ class Article | ||
| 8 | 8 | ||
| 9 | def body_change_with_comments | 9 | def body_change_with_comments |
| 10 | if body && body_changed? && !self.comments.empty? | 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 | errors[:base] << (N_('You are unable to change the body of the article when paragraphs are commented')) unless (paragraphs_with_comments).empty? | 12 | errors[:base] << (N_('You are unable to change the body of the article when paragraphs are commented')) unless (paragraphs_with_comments).empty? |
| 13 | end | 13 | end |
| 14 | end | 14 | end |
public/comment_paragraph_macro.js
| @@ -64,13 +64,13 @@ jQuery(document).ready(function($) { | @@ -64,13 +64,13 @@ jQuery(document).ready(function($) { | ||
| 64 | // cssApplier.toggleSelection(); | 64 | // cssApplier.toggleSelection(); |
| 65 | // }); | 65 | // }); |
| 66 | 66 | ||
| 67 | - function processSomething(){ | 67 | + function processAnchor(){ |
| 68 | var anchor = window.location.hash; | 68 | var anchor = window.location.hash; |
| 69 | if(anchor.length==0) return; | 69 | if(anchor.length==0) return; |
| 70 | 70 | ||
| 71 | var val = anchor.split('-'); //anchor format = #comment-\d+ | 71 | var val = anchor.split('-'); //anchor format = #comment-\d+ |
| 72 | if(val.length!=2 || val[0]!='#comment') return; | 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 | var comment_id = val[1]; | 74 | var comment_id = val[1]; |
| 75 | if(!/^\d+$/.test(comment_id)) return; //test for integer | 75 | if(!/^\d+$/.test(comment_id)) return; //test for integer |
| 76 | 76 | ||
| @@ -85,7 +85,7 @@ jQuery(document).ready(function($) { | @@ -85,7 +85,7 @@ jQuery(document).ready(function($) { | ||
| 85 | }); | 85 | }); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | - processSomething(); | 88 | + processAnchor(); |
| 89 | 89 | ||
| 90 | $(document).on('mouseover', 'li.article-comment', function(){ | 90 | $(document).on('mouseover', 'li.article-comment', function(){ |
| 91 | var selected_area = $(this).find('input.paragraph_comment_area').val(); | 91 | var selected_area = $(this).find('input.paragraph_comment_area').val(); |