Commit a5e0b197a69dd21b4f556868a7e271152dd9bd56
1 parent
f9937d0e
Exists in
staging
and in
4 other branches
changed paragraph_id to paragraph_uuid
Showing
17 changed files
with
76 additions
and
76 deletions
Show diff stats
plugins/comment_paragraph/controllers/profile/comment_paragraph_plugin_profile_controller.rb
... | ... | @@ -3,9 +3,9 @@ class CommentParagraphPluginProfileController < ProfileController |
3 | 3 | |
4 | 4 | def view_comments |
5 | 5 | @article_id = params[:article_id] |
6 | - @paragraph_id = params[:paragraph_id] | |
6 | + @paragraph_uuid = params[:paragraph_uuid] | |
7 | 7 | article = profile.articles.find(@article_id) |
8 | - @comments = article.comments.without_spam.in_paragraph(@paragraph_id) | |
8 | + @comments = article.comments.without_spam.in_paragraph(@paragraph_uuid) | |
9 | 9 | @comments_count = @comments.count |
10 | 10 | @comments = @comments.without_reply |
11 | 11 | end | ... | ... |
plugins/comment_paragraph/controllers/public/comment_paragraph_plugin_public_controller.rb
... | ... | @@ -3,7 +3,7 @@ class CommentParagraphPluginPublicController < PublicController |
3 | 3 | |
4 | 4 | def comment_paragraph |
5 | 5 | @comment = Comment.find(params[:id]) |
6 | - render :json => { :paragraph_id => @comment.paragraph_id } | |
6 | + render :json => { :paragraph_uuid => @comment.paragraph_uuid } | |
7 | 7 | end |
8 | 8 | |
9 | 9 | end | ... | ... |
plugins/comment_paragraph/lib/comment_paragraph_plugin.rb
... | ... | @@ -14,11 +14,11 @@ class CommentParagraphPlugin < Noosfero::Plugin |
14 | 14 | |
15 | 15 | def comment_form_extra_contents(args) |
16 | 16 | comment = args[:comment] |
17 | - paragraph_id = comment.paragraph_id || args[:paragraph_id] | |
17 | + paragraph_uuid = comment.paragraph_uuid || args[:paragraph_uuid] | |
18 | 18 | proc { |
19 | 19 | arr = [] |
20 | 20 | arr << hidden_field_tag('comment[id]', comment.id) |
21 | - arr << hidden_field_tag('comment[paragraph_id]', paragraph_id) if paragraph_id | |
21 | + arr << hidden_field_tag('comment[paragraph_uuid]', paragraph_uuid) if paragraph_uuid | |
22 | 22 | arr << hidden_field_tag('comment[comment_paragraph_selected_area]', comment.comment_paragraph_selected_area) unless comment.comment_paragraph_selected_area.blank? |
23 | 23 | arr << hidden_field_tag('comment[comment_paragraph_selected_content]', comment.comment_paragraph_selected_content) unless comment.comment_paragraph_selected_content.blank? |
24 | 24 | arr |
... | ... | @@ -50,22 +50,22 @@ class CommentParagraphPlugin < Noosfero::Plugin |
50 | 50 | # if !@article.id.blank? && self.auto_marking_enabled?(settings, @article.class.name) |
51 | 51 | # |
52 | 52 | # parsed_paragraphs = [] |
53 | -# paragraph_id = 0 | |
53 | +# paragraph_uuid = 0 | |
54 | 54 | # |
55 | 55 | # doc = Hpricot(@article.body) |
56 | 56 | # paragraphs = doc.search("/*").each do |paragraph| |
57 | 57 | # |
58 | -# if paragraph.to_html =~ /^<div(.*)paragraph_comment(.*)$/ || paragraph.to_html =~ /^<p>\W<\/p>$/ | |
58 | +# if paragraph.to_html =~ /^<div(.*)paragraph_comment(.*)$/ || paragraph.t o_html =~ /^<p>\W<\/p>$/ | |
59 | 59 | # parsed_paragraphs << paragraph.to_html |
60 | 60 | # else |
61 | 61 | # if paragraph.to_html =~ /^(<div|<table|<p|<ul).*/ |
62 | -# parsed_paragraphs << CommentParagraphPlugin.parse_paragraph(paragraph.to_html, paragraph_id) | |
62 | +# parsed_paragraphs << CommentParagraphPlugin.parse_paragraph(paragraph.to_html, paragraph_uuid) | |
63 | 63 | # else |
64 | 64 | # parsed_paragraphs << paragraph.to_html |
65 | 65 | # end |
66 | 66 | # end |
67 | 67 | # |
68 | -# paragraph_id += 1 | |
68 | +# paragraph_uuid += 1 | |
69 | 69 | # |
70 | 70 | # end |
71 | 71 | # |
... | ... | @@ -82,10 +82,10 @@ class CommentParagraphPlugin < Noosfero::Plugin |
82 | 82 | # end |
83 | 83 | |
84 | 84 | |
85 | - def self.parse_paragraph( paragraph_content, paragraph_id ) | |
85 | + def self.parse_paragraph( paragraph_content, paragraph_uuid ) | |
86 | 86 | "<div class='macro article_comments paragraph_comment' " + |
87 | 87 | "data-macro='comment_paragraph_plugin/allow_comment' " + |
88 | - "data-macro-paragraph_id='#{paragraph_id}'>#{paragraph_content}</div>\r\n" + | |
88 | + "data-macro-paragraph_uuid='#{paragraph_uuid}'>#{paragraph_content}</div>\r\n" + | |
89 | 89 | "<p> </p>" |
90 | 90 | end |
91 | 91 | ... | ... |
plugins/comment_paragraph/lib/comment_paragraph_plugin/macros/allow_comment.rb
1 | 1 | #FIXME See a better way to generalize this parameter. |
2 | -ActionView::Base.sanitized_allowed_attributes += ['data-macro', 'data-macro-paragraph_id'] | |
2 | +ActionView::Base.sanitized_allowed_attributes += ['data-macro', 'data-macro-paragraph_uuid'] | |
3 | 3 | |
4 | 4 | class CommentParagraphPlugin::AllowComment < Noosfero::Plugin::Macro |
5 | 5 | def self.configuration |
... | ... | @@ -12,13 +12,13 @@ class CommentParagraphPlugin::AllowComment < Noosfero::Plugin::Macro |
12 | 12 | end |
13 | 13 | |
14 | 14 | def parse(params, inner_html, source) |
15 | - paragraph_id = params[:paragraph_id].to_i | |
15 | + paragraph_uuid = params[:paragraph_uuid] | |
16 | 16 | article = source |
17 | - count = article.paragraph_comments.without_spam.in_paragraph(paragraph_id).count | |
17 | + count = article.paragraph_comments.without_spam.in_paragraph(paragraph_uuid).count | |
18 | 18 | |
19 | 19 | proc { |
20 | 20 | render :partial => 'comment_paragraph_plugin_profile/comment_paragraph', |
21 | - :locals => {:paragraph_id => paragraph_id, :article_id => article.id, :inner_html => inner_html, :count => count, :profile_identifier => article.profile.identifier } | |
21 | + :locals => {:paragraph_uuid => paragraph_uuid, :article_id => article.id, :inner_html => inner_html, :count => count, :profile_identifier => article.profile.identifier } | |
22 | 22 | } |
23 | 23 | end |
24 | 24 | end | ... | ... |
plugins/comment_paragraph/lib/ext/comment.rb
... | ... | @@ -2,17 +2,17 @@ require_dependency 'comment' |
2 | 2 | |
3 | 3 | class Comment |
4 | 4 | |
5 | - scope :without_paragraph, :conditions => {:paragraph_id => nil } | |
5 | + scope :without_paragraph, :conditions => {:paragraph_uuid => nil } | |
6 | 6 | |
7 | 7 | settings_items :comment_paragraph_selected_area, :type => :string |
8 | 8 | settings_items :comment_paragraph_selected_content, :type => :string |
9 | 9 | |
10 | - scope :in_paragraph, proc { |paragraph_id| { | |
11 | - :conditions => ['paragraph_id = ?', paragraph_id] | |
10 | + scope :in_paragraph, proc { |paragraph_uuid| { | |
11 | + :conditions => ['paragraph_uuid = ?', paragraph_uuid] | |
12 | 12 | } |
13 | 13 | } |
14 | 14 | |
15 | - attr_accessible :paragraph_id, :comment_paragraph_selected_area, :id, :comment_paragraph_selected_content | |
15 | + attr_accessible :paragraph_uuid, :comment_paragraph_selected_area, :id, :comment_paragraph_selected_content | |
16 | 16 | |
17 | 17 | before_validation do |comment| |
18 | 18 | comment.comment_paragraph_selected_area = nil if comment.comment_paragraph_selected_area.blank? | ... | ... |
plugins/comment_paragraph/public/comment_paragraph.js
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | // jQuery('#article_body_ifr').contents().find('body').children('p,table,img').each(function( index ) { |
48 | 48 | // text=jQuery(this).prop('outerHTML'); |
49 | 49 | // if(text!="" && text!=" " && text!="<br>"){ |
50 | -// paragraphsTxt+='<div class="macro article_comments paragraph_comment" data-macro="comment_paragraph_plugin/allow_comment" data-macro-paragraph_id="' + index + '">' + text + '</div><br>' | |
50 | +// paragraphsTxt+='<div class="macro article_comments paragraph_comment" data-macro="comment_paragraph_plugin/allow_comment" data-macro-paragraph_uuid="' + index + '">' + text + '</div><br>' | |
51 | 51 | // } |
52 | 52 | // }); |
53 | 53 | // tinyMCE.activeEditor.setContent(paragraphsTxt); | ... | ... |
plugins/comment_paragraph/public/comment_paragraph_macro.js
... | ... | @@ -20,9 +20,9 @@ jQuery(document).ready(function($) { |
20 | 20 | |
21 | 21 | all_paragraphs = $('.comment_paragraph'); |
22 | 22 | all_paragraphs.each( function(paragraph) { |
23 | - var paragraph_id = $( all_paragraphs.get(paragraph) ).attr('data-paragraph'); | |
23 | + var paragraph_uuid = $( all_paragraphs.get(paragraph) ).attr('data-paragraph'); | |
24 | 24 | var paragraph_content = all_paragraphs.get(paragraph).innerHTML; |
25 | - original_paragraphs.push( { id: paragraph_id, content: paragraph_content } ); | |
25 | + original_paragraphs.push( { id: paragraph_uuid, content: paragraph_content } ); | |
26 | 26 | }); |
27 | 27 | |
28 | 28 | $(document).keyup(function(e) { |
... | ... | @@ -248,8 +248,8 @@ jQuery(document).ready(function($) { |
248 | 248 | |
249 | 249 | $(document).on('mouseenter', 'li.article-comment', function() { |
250 | 250 | var selected_area = $(this).find('input.paragraph_comment_area').val(); |
251 | - var paragraph_id = $(this).find('input.paragraph_id').val(); | |
252 | - var rootElement = $('#comment_paragraph_' + paragraph_id).get(0); | |
251 | + var paragraph_uuid = $(this).find('input.paragraph_uuid').val(); | |
252 | + var rootElement = $('#comment_paragraph_' + paragraph_uuid).get(0); | |
253 | 253 | |
254 | 254 | if(selected_area != ""){ |
255 | 255 | rangy.deserializeSelection(selected_area, rootElement); |
... | ... | @@ -258,11 +258,11 @@ jQuery(document).ready(function($) { |
258 | 258 | }); |
259 | 259 | |
260 | 260 | $(document).on('mouseleave', 'li.article-comment', function() { |
261 | - var paragraph_id = $(this).find('input.paragraph_id').val(); | |
262 | - var rootElement = $('#comment_paragraph_'+ paragraph_id).get(0); | |
261 | + var paragraph_uuid = $(this).find('input.paragraph_uuid').val(); | |
262 | + var rootElement = $('#comment_paragraph_'+ paragraph_uuid).get(0); | |
263 | 263 | |
264 | 264 | original_paragraphs.each( function(paragraph) { |
265 | - if (paragraph.id == paragraph_id) { | |
265 | + if (paragraph.id == paragraph_uuid) { | |
266 | 266 | rootElement.innerHTML = paragraph.content; |
267 | 267 | } |
268 | 268 | }); | ... | ... |
plugins/comment_paragraph/test/functional/comment_paragraph_plugin_profile_controller_test.rb
... | ... | @@ -19,28 +19,28 @@ class CommentParagraphPluginProfileControllerTest < ActionController::TestCase |
19 | 19 | attr_reader :profile |
20 | 20 | |
21 | 21 | should 'be able to show paragraph comments' do |
22 | - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) | |
23 | - xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_id => 0 | |
22 | + comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_uuid => 0) | |
23 | + xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_uuid => 0 | |
24 | 24 | assert_template 'comment_paragraph_plugin_profile/view_comments' |
25 | 25 | assert_match /comments_list_paragraph_0/, @response.body |
26 | 26 | assert_match /\"comment-count-0\", \"1\"/, @response.body |
27 | 27 | end |
28 | 28 | |
29 | 29 | should 'do not show global comments' do |
30 | - fast_create(Comment, :source_id => article, :author_id => profile, :title => 'global comment', :body => 'global', :paragraph_id => nil) | |
31 | - fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) | |
32 | - xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_id => 0 | |
30 | + fast_create(Comment, :source_id => article, :author_id => profile, :title => 'global comment', :body => 'global', :paragraph_uuid => nil) | |
31 | + fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_uuid => 0) | |
32 | + xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_uuid => 0 | |
33 | 33 | assert_template 'comment_paragraph_plugin_profile/view_comments' |
34 | 34 | assert_match /comments_list_paragraph_0/, @response.body |
35 | 35 | assert_match /\"comment-count-0\", \"1\"/, @response.body |
36 | 36 | end |
37 | 37 | |
38 | 38 | should 'be able to show all comments of a paragraph' do |
39 | - comment1 = fast_create(Comment, :created_at => Time.now - 1.days, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'a comment', :paragraph_id => 0) | |
40 | - comment2 = fast_create(Comment, :created_at => Time.now - 2.days, :source_id => article, :author_id => profile, :title => 'b comment', :body => 'b comment', :paragraph_id => 0) | |
41 | - comment3 = fast_create(Comment, :created_at => Time.now - 3.days, :source_id => article, :author_id => profile, :title => 'c comment', :body => 'c comment', :paragraph_id => 0) | |
42 | - comment4 = fast_create(Comment, :created_at => Time.now - 4.days, :source_id => article, :author_id => profile, :title => 'd comment', :body => 'd comment', :paragraph_id => 0) | |
43 | - xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_id => 0 | |
39 | + comment1 = fast_create(Comment, :created_at => Time.now - 1.days, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'a comment', :paragraph_uuid => 0) | |
40 | + comment2 = fast_create(Comment, :created_at => Time.now - 2.days, :source_id => article, :author_id => profile, :title => 'b comment', :body => 'b comment', :paragraph_uuid => 0) | |
41 | + comment3 = fast_create(Comment, :created_at => Time.now - 3.days, :source_id => article, :author_id => profile, :title => 'c comment', :body => 'c comment', :paragraph_uuid => 0) | |
42 | + comment4 = fast_create(Comment, :created_at => Time.now - 4.days, :source_id => article, :author_id => profile, :title => 'd comment', :body => 'd comment', :paragraph_uuid => 0) | |
43 | + xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_uuid => 0 | |
44 | 44 | assert_match /a comment/, @response.body |
45 | 45 | assert_match /b comment/, @response.body |
46 | 46 | assert_match /c comment/, @response.body | ... | ... |
plugins/comment_paragraph/test/functional/comment_paragraph_plugin_public_controller_test.rb
... | ... | @@ -20,17 +20,17 @@ class CommentParagraphPluginPublicControllerTest < ActionController::TestCase |
20 | 20 | attr_reader :profile |
21 | 21 | |
22 | 22 | |
23 | - should 'be able to return paragraph_id for a comment' do | |
24 | - comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) | |
23 | + should 'be able to return paragraph_uuid for a comment' do | |
24 | + comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_uuid => 0) | |
25 | 25 | cid = comment.id |
26 | 26 | xhr :get, :comment_paragraph, :id => cid |
27 | - assert_match /\{\"paragraph_id\":0\}/, @response.body | |
27 | + assert_match /\{\"paragraph_uuid\":0\}/, @response.body | |
28 | 28 | end |
29 | 29 | |
30 | - should 'return paragraph_id=null for a global comment' do | |
30 | + should 'return paragraph_uuid=null for a global comment' do | |
31 | 31 | comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala' ) |
32 | 32 | xhr :get, :comment_paragraph, :id => comment.id |
33 | - assert_match /\{\"paragraph_id\":null\}/, @response.body | |
33 | + assert_match /\{\"paragraph_uuid\":null\}/, @response.body | |
34 | 34 | end |
35 | 35 | |
36 | 36 | ... | ... |
plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb
... | ... | @@ -11,7 +11,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
11 | 11 | |
12 | 12 | def setup |
13 | 13 | @profile = fast_create(Community) |
14 | - @page = fast_create(Article, :profile_id => @profile.id, :body => "<div class=\"macro\" data-macro-paragraph_id=\"0\" data-macro='comment_paragraph_plugin/allow_comment' ></div>") | |
14 | + @page = fast_create(Article, :profile_id => @profile.id, :body => "<div class=\"macro\" data-macro-paragraph_uuid=\"0\" data-macro='comment_paragraph_plugin/allow_comment' ></div>") | |
15 | 15 | @environment = Environment.default |
16 | 16 | @environment.enable_plugin(CommentParagraphPlugin) |
17 | 17 | end |
... | ... | @@ -19,7 +19,7 @@ class ContentViewerControllerTest < ActionController::TestCase |
19 | 19 | attr_reader :page |
20 | 20 | |
21 | 21 | should 'parse article body and render comment paragraph view' do |
22 | - comment1 = fast_create(Comment, :paragraph_id => 0, :source_id => page.id) | |
22 | + comment1 = fast_create(Comment, :paragraph_uuid => 0, :source_id => page.id) | |
23 | 23 | get :view_page, @page.url |
24 | 24 | assert_tag 'div', :attributes => {:class => 'comment_paragraph'} |
25 | 25 | end | ... | ... |
plugins/comment_paragraph/test/unit/allow_comment_test.rb
... | ... | @@ -15,11 +15,11 @@ class AllowCommentTest < ActiveSupport::TestCase |
15 | 15 | should 'parse contents to include comment paragraph view' do |
16 | 16 | profile = fast_create(Community) |
17 | 17 | article = fast_create(Article, :profile_id => profile.id) |
18 | - comment = fast_create(Comment, :paragraph_id => 1, :source_id => article.id) | |
18 | + comment = fast_create(Comment, :paragraph_uuid => 1, :source_id => article.id) | |
19 | 19 | inner_html = 'inner' |
20 | - content = macro.parse({:paragraph_id => comment.paragraph_id}, inner_html, article) | |
20 | + content = macro.parse({:paragraph_uuid => comment.paragraph_uuid}, inner_html, article) | |
21 | 21 | |
22 | - expects(:render).with({:partial => 'comment_paragraph_plugin_profile/comment_paragraph', :locals => {:paragraph_id => comment.paragraph_id, :article_id => article.id, :inner_html => inner_html, :count => 1, :profile_identifier => profile.identifier} }) | |
22 | + expects(:render).with({:partial => 'comment_paragraph_plugin_profile/comment_paragraph', :locals => {:paragraph_uuid => comment.paragraph_uuid, :article_id => article.id, :inner_html => inner_html, :count => 1, :profile_identifier => profile.identifier} }) | |
23 | 23 | instance_eval(&content) |
24 | 24 | end |
25 | 25 | ... | ... |
plugins/comment_paragraph/test/unit/article_test.rb
... | ... | @@ -11,14 +11,14 @@ class ArticleTest < ActiveSupport::TestCase |
11 | 11 | attr_reader :article |
12 | 12 | |
13 | 13 | should 'return paragraph comments from article' do |
14 | - comment1 = fast_create(Comment, :paragraph_id => 1, :source_id => article.id) | |
15 | - comment2 = fast_create(Comment, :paragraph_id => nil, :source_id => article.id) | |
14 | + comment1 = fast_create(Comment, :paragraph_uuid => 1, :source_id => article.id) | |
15 | + comment2 = fast_create(Comment, :paragraph_uuid => nil, :source_id => article.id) | |
16 | 16 | assert_equal [comment1], article.paragraph_comments |
17 | 17 | end |
18 | 18 | |
19 | 19 | should 'allow save if comment paragraph macro is not removed for paragraph with comments' do |
20 | - article.body = "<div class=\"macro\" data-macro-paragraph_id=0></div>" | |
21 | - comment1 = fast_create(Comment, :paragraph_id => 0, :source_id => article.id) | |
20 | + article.body = "<div class=\"macro\" data-macro-paragraph_uuid=0></div>" | |
21 | + comment1 = fast_create(Comment, :paragraph_uuid => 0, :source_id => article.id) | |
22 | 22 | assert article.save |
23 | 23 | end |
24 | 24 | ... | ... |
plugins/comment_paragraph/test/unit/comment_paragraph_plugin_test.rb
... | ... | @@ -29,9 +29,9 @@ class CommentParagraphPluginTest < ActiveSupport::TestCase |
29 | 29 | should 'not add comment_paragraph_selected_area if comment_paragraph_selected_area is blank' do |
30 | 30 | comment = Comment.new |
31 | 31 | comment.comment_paragraph_selected_area = "" |
32 | - comment.paragraph_id = 2 | |
32 | + comment.paragraph_uuid = 2 | |
33 | 33 | cpp = CommentParagraphPlugin.new |
34 | - prok = cpp.comment_form_extra_contents({:comment=>comment, :paragraph_id=>4}) | |
34 | + prok = cpp.comment_form_extra_contents({:comment=>comment, :paragraph_uuid=>4}) | |
35 | 35 | assert_nil /comment_paragraph_selected_area/.match(prok.call.inspect) |
36 | 36 | end |
37 | 37 | ... | ... |
plugins/comment_paragraph/test/unit/comment_test.rb
... | ... | @@ -10,16 +10,16 @@ class CommentTest < ActiveSupport::TestCase |
10 | 10 | attr_reader :article |
11 | 11 | |
12 | 12 | should 'return comments that belongs to a specified paragraph' do |
13 | - comment1 = fast_create(Comment, :paragraph_id => 1, :source_id => article.id) | |
14 | - comment2 = fast_create(Comment, :paragraph_id => nil, :source_id => article.id) | |
15 | - comment3 = fast_create(Comment, :paragraph_id => 2, :source_id => article.id) | |
13 | + comment1 = fast_create(Comment, :paragraph_uuid => 1, :source_id => article.id) | |
14 | + comment2 = fast_create(Comment, :paragraph_uuid => nil, :source_id => article.id) | |
15 | + comment3 = fast_create(Comment, :paragraph_uuid => 2, :source_id => article.id) | |
16 | 16 | assert_equal [comment1], article.comments.in_paragraph(1) |
17 | 17 | end |
18 | 18 | |
19 | 19 | should 'return comments that do not belongs to any paragraph' do |
20 | - comment1 = fast_create(Comment, :paragraph_id => 1, :source_id => article.id) | |
21 | - comment2 = fast_create(Comment, :paragraph_id => nil, :source_id => article.id) | |
22 | - comment3 = fast_create(Comment, :paragraph_id => 2, :source_id => article.id) | |
20 | + comment1 = fast_create(Comment, :paragraph_uuid => 1, :source_id => article.id) | |
21 | + comment2 = fast_create(Comment, :paragraph_uuid => nil, :source_id => article.id) | |
22 | + comment3 = fast_create(Comment, :paragraph_uuid => 2, :source_id => article.id) | |
23 | 23 | assert_equal [comment2], article.comments.without_paragraph |
24 | 24 | end |
25 | 25 | ... | ... |
plugins/comment_paragraph/views/comment/comment_extra.html.erb
1 | 1 | <input type="hidden" value="<%= comment.comment_paragraph_selected_area%>" class="paragraph_comment_area" /> |
2 | -<input type="hidden" value="<%= comment.paragraph_id%>" class="paragraph_id" /><input type="hidden" value="<%= comment.comment_paragraph_selected_content%>" class="paragraph_selected_content" /> | |
2 | +<input type="hidden" value="<%= comment.paragraph_uuid%>" class="paragraph_uuid" /><input type="hidden" value="<%= comment.comment_paragraph_selected_content%>" class="paragraph_selected_content" /> | |
3 | 3 | <input type="hidden" value="<%= comment.comment_paragraph_selected_content%>" class="paragraph_selected_content" /> | ... | ... |
plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb
1 | 1 | <table class="comments"> |
2 | 2 | <tr> |
3 | 3 | <td> |
4 | - <div class="comment_paragraph" id="comment_paragraph_<%= paragraph_id %>" data-paragraph="<%= paragraph_id %>"> | |
4 | + <div class="comment_paragraph" id="comment_paragraph_<%= paragraph_uuid %>" data-paragraph="<%= paragraph_uuid %>"> | |
5 | 5 | <%= inner_html %> |
6 | 6 | </div> |
7 | 7 | </td> |
8 | 8 | <td> |
9 | - <div align="center" class="side-comments-counter" id="side_comments_counter_<%= paragraph_id %>" data-paragraph="<%= paragraph_id %>" style="vertical-align: middle; padding-left: 3px; padding-right: 5px;"> | |
10 | - <span id="comment-count-<%= paragraph_id %>" class='comment-count'> | |
9 | + <div align="center" class="side-comments-counter" id="side_comments_counter_<%= paragraph_uuid %>" data-paragraph="<%= paragraph_uuid %>" style="vertical-align: middle; padding-left: 3px; padding-right: 5px;"> | |
10 | + <span id="comment-count-<%= paragraph_uuid %>" class='comment-count'> | |
11 | 11 | <%= count %> |
12 | 12 | </span> |
13 | 13 | </div> |
... | ... | @@ -15,28 +15,28 @@ |
15 | 15 | <td> |
16 | 16 | <div class="comment-paragraph-group-comments"> |
17 | 17 | <%= |
18 | - url = { :profile => profile_identifier, :controller => 'comment_paragraph_plugin_profile', :action => 'view_comments', :paragraph_id => paragraph_id, :article_id => article_id} | |
18 | + url = { :profile => profile_identifier, :controller => 'comment_paragraph_plugin_profile', :action => 'view_comments', :paragraph_uuid => paragraph_uuid, :article_id => article_id} | |
19 | 19 | link_to_remote( |
20 | 20 | '', |
21 | 21 | { |
22 | 22 | :url => url, |
23 | 23 | :method => :post, |
24 | - :condition => "!toggleParagraph(#{paragraph_id})", | |
25 | - :complete => "loadCompleted(#{paragraph_id})" | |
24 | + :condition => "!toggleParagraph(#{paragraph_uuid})", | |
25 | + :complete => "loadCompleted(#{paragraph_uuid})" | |
26 | 26 | }, |
27 | 27 | { |
28 | - :id => "link_to_ajax_comments_#{paragraph_id}", | |
28 | + :id => "link_to_ajax_comments_#{paragraph_uuid}", | |
29 | 29 | :'data-url' => url_for(url) |
30 | 30 | } |
31 | 31 | )%> |
32 | 32 | |
33 | - <div class="side-comment" id="side_comment_<%= paragraph_id %>" data-paragraph="<%= paragraph_id %>" style="display:none"> | |
34 | - <div class="comment-paragraph-loading-<%= paragraph_id %>"> | |
35 | - <div class="comments_list_toggle_paragraph_<%= paragraph_id %>" > | |
36 | - <div class="article-comments-list" id="comments_list_paragraph_<%= paragraph_id %>"></div> | |
37 | - <div class ="article-comments-list-more" id="comments_list_paragraph_<%= paragraph_id %>_more"></div> | |
38 | - <div id="page-comment-form-<%= paragraph_id %>" class='post_comment_box closed'> | |
39 | - <%= render :partial => 'comment/comment_form', :locals => {:comment => Comment.new, :display_link => true, :cancel_triggers_hide => true, :paragraph_id => paragraph_id}%> | |
33 | + <div class="side-comment" id="side_comment_<%= paragraph_uuid %>" data-paragraph="<%= paragraph_uuid %>" style="display:none"> | |
34 | + <div class="comment-paragraph-loading-<%= paragraph_uuid %>"> | |
35 | + <div class="comments_list_toggle_paragraph_<%= paragraph_uuid %>" > | |
36 | + <div class="article-comments-list" id="comments_list_paragraph_<%= paragraph_uuid %>"></div> | |
37 | + <div class ="article-comments-list-more" id="comments_list_paragraph_<%= paragraph_uuid %>_more"></div> | |
38 | + <div id="page-comment-form-<%= paragraph_uuid %>" class='post_comment_box closed'> | |
39 | + <%= render :partial => 'comment/comment_form', :locals => {:comment => Comment.new, :display_link => true, :cancel_triggers_hide => true, :paragraph_uuid => paragraph_uuid}%> | |
40 | 40 | </div> |
41 | 41 | </div> |
42 | 42 | </div> | ... | ... |
plugins/comment_paragraph/views/comment_paragraph_plugin_profile/view_comments.rjs
1 | -page.replace_html "comments_list_paragraph_#{@paragraph_id}", :partial => 'comment/comment.html.erb', :collection => @comments | |
2 | -page.replace_html "comment-count-#{@paragraph_id}", @comments_count | |
1 | +page.replace_html "comments_list_paragraph_#{@paragraph_uuid}", :partial => 'comment/comment.html.erb', :collection => @comments | |
2 | +page.replace_html "comment-count-#{@paragraph_uuid}", @comments_count | ... | ... |