diff --git a/plugins/comment_paragraph/controllers/profile/comment_paragraph_plugin_profile_controller.rb b/plugins/comment_paragraph/controllers/profile/comment_paragraph_plugin_profile_controller.rb new file mode 100644 index 0000000..2e37ebd --- /dev/null +++ b/plugins/comment_paragraph/controllers/profile/comment_paragraph_plugin_profile_controller.rb @@ -0,0 +1,22 @@ +class CommentParagraphPluginProfileController < ProfileController + append_view_path File.join(File.dirname(__FILE__) + '/../../views') + + def view_comments + @article_id = params[:article_id] + @paragraph_id = params[:paragraph_id] + + article = profile.articles.find(@article_id) + @paragraph_comment_page = (params[:paragraph_comment_page] || 1).to_i + + @comments = article.comments.without_spam.in_paragraph(@paragraph_id) + @comments_count = @comments.count + @comments = @comments.without_reply.paginate(:per_page => per_page, :page => @paragraph_comment_page ) + + @no_more_pages = @comments_count <= @paragraph_comment_page * per_page + end + + def per_page + 3 + end + +end diff --git a/plugins/comment_paragraph/controllers/public/comment_paragraph_plugin_public_controller.rb b/plugins/comment_paragraph/controllers/public/comment_paragraph_plugin_public_controller.rb new file mode 100644 index 0000000..dc07016 --- /dev/null +++ b/plugins/comment_paragraph/controllers/public/comment_paragraph_plugin_public_controller.rb @@ -0,0 +1,8 @@ +class CommentParagraphPluginPublicController < PublicController + append_view_path File.join(File.dirname(__FILE__) + '/../views') + + def comment_paragraph + render :json => { :paragraph_id => Comment.find(params[:id]).paragraph_id } + end + +end diff --git a/plugins/comment_paragraph/db/migrate/20140715201629_add_paragraph_id_to_comment.rb b/plugins/comment_paragraph/db/migrate/20140715201629_add_paragraph_id_to_comment.rb new file mode 100644 index 0000000..fa72648 --- /dev/null +++ b/plugins/comment_paragraph/db/migrate/20140715201629_add_paragraph_id_to_comment.rb @@ -0,0 +1,9 @@ +class AddParagraphIdToComment < ActiveRecord::Migration + def self.up + add_column :comments, :paragraph_id, :integer + end + + def self.down + remove_column :comments, :paragraph_id + end +end diff --git a/plugins/comment_paragraph/lib/comment_paragraph_plugin.rb b/plugins/comment_paragraph/lib/comment_paragraph_plugin.rb new file mode 100644 index 0000000..ba9c7ff --- /dev/null +++ b/plugins/comment_paragraph/lib/comment_paragraph_plugin.rb @@ -0,0 +1,34 @@ +class CommentParagraphPlugin < Noosfero::Plugin + + def self.plugin_name + "Comment Paragraph" + end + + def self.plugin_description + _("A plugin that display comments divided by paragraphs.") + end + + def unavailable_comments(scope) + scope.without_paragraph + end + + def comment_form_extra_contents(args) + comment = args[:comment] + paragraph_id = comment.paragraph_id || args[:paragraph_id] + proc { + hidden_field_tag('comment[paragraph_id]', paragraph_id) if paragraph_id + } + end + + def js_files + 'comment_paragraph_macro.js' + end + + def stylesheet? + true + end + + +end + +require_dependency 'comment_paragraph_plugin/macros/allow_comment' diff --git a/plugins/comment_paragraph/lib/comment_paragraph_plugin/macros/allow_comment.rb b/plugins/comment_paragraph/lib/comment_paragraph_plugin/macros/allow_comment.rb new file mode 100644 index 0000000..6e566e7 --- /dev/null +++ b/plugins/comment_paragraph/lib/comment_paragraph_plugin/macros/allow_comment.rb @@ -0,0 +1,24 @@ +#FIXME See a better way to generalize this parameter. +ActionView::Base.sanitized_allowed_attributes += ['data-macro', 'data-macro-paragraph_id'] + +class CommentParagraphPlugin::AllowComment < Noosfero::Plugin::Macro + def self.configuration + { :params => [], + :skip_dialog => true, + :generator => 'makeCommentable();', + :js_files => 'comment_paragraph.js', + :icon_path => '/designs/icons/tango/Tango/16x16/emblems/emblem-system.png', + :css_files => 'comment_paragraph.css' } + end + + def parse(params, inner_html, source) + paragraph_id = params[:paragraph_id].to_i + article = source + count = article.paragraph_comments.without_spam.in_paragraph(paragraph_id).count + + proc { + render :partial => 'comment_paragraph_plugin_profile/comment_paragraph', + :locals => {:paragraph_id => paragraph_id, :article_id => article.id, :inner_html => inner_html, :count => count, :profile_identifier => article.profile.identifier } + } + end +end diff --git a/plugins/comment_paragraph/lib/ext/article.rb b/plugins/comment_paragraph/lib/ext/article.rb new file mode 100644 index 0000000..9fcc072 --- /dev/null +++ b/plugins/comment_paragraph/lib/ext/article.rb @@ -0,0 +1,18 @@ +require_dependency 'article' + +class Article + + has_many :paragraph_comments, :class_name => 'Comment', :foreign_key => 'source_id', :dependent => :destroy, :order => 'created_at asc', :conditions => [ 'paragraph_id IS NOT NULL'] + + validate :not_empty_paragraph_comments_removed + + def not_empty_paragraph_comments_removed + if body && body_changed? + paragraphs_with_comments = Comment.find(:all, :select => 'distinct paragraph_id', :conditions => {:source_id => self.id}).map(&:paragraph_id).compact + paragraphs = Hpricot(body.to_s).search('.macro').collect{|element| element['data-macro-paragraph_id'].to_i} + errors[:base] << (N_('Not empty paragraph comment cannot be removed')) unless (paragraphs_with_comments-paragraphs).empty? + end + end + +end + diff --git a/plugins/comment_paragraph/lib/ext/comment.rb b/plugins/comment_paragraph/lib/ext/comment.rb new file mode 100644 index 0000000..78cc278 --- /dev/null +++ b/plugins/comment_paragraph/lib/ext/comment.rb @@ -0,0 +1,14 @@ +require_dependency 'comment' + +class Comment + + scope :without_paragraph, :conditions => {:paragraph_id => nil } + + scope :in_paragraph, proc { |paragraph_id| { + :conditions => ['paragraph_id = ?', paragraph_id] + } + } + + attr_accessible :paragraph_id + +end diff --git a/plugins/comment_paragraph/public/comment_paragraph.css b/plugins/comment_paragraph/public/comment_paragraph.css new file mode 100644 index 0000000..6a69d84 --- /dev/null +++ b/plugins/comment_paragraph/public/comment_paragraph.css @@ -0,0 +1,6 @@ +div.article_comments { + background-color:#dddddd; + border-style: solid; + border-color:#bbbbbb; + border-width:2px; +} diff --git a/plugins/comment_paragraph/public/comment_paragraph.js b/plugins/comment_paragraph/public/comment_paragraph.js new file mode 100644 index 0000000..056c4f7 --- /dev/null +++ b/plugins/comment_paragraph/public/comment_paragraph.js @@ -0,0 +1,47 @@ +function getNextParagraphId() { + max = -1; + paragraphs = jQuery('#article_body_ifr').contents().find('.article_comments'); + paragraphs.each(function(key, value) { + value = jQuery(value).attr('data-macro-paragraph_id'); + if(value>max) max = parseInt(value); + }); + return max+1; +} + +function makeCommentable() { + tinyMCE.activeEditor.focus(); + start = jQuery(tinyMCE.activeEditor.selection.getStart()).closest('p'); + end = jQuery(tinyMCE.activeEditor.selection.getEnd()).closest('p'); + + //text = start.parent().children(); + text = jQuery('#article_body_ifr').contents().find('*'); + selection = text.slice(text.index(start), text.index(end)+1); + + hasTag = false; + selection.each(function(key, value) { + commentTag = jQuery(value).closest('.article_comments'); + if(commentTag.length) { + commentTag.children().unwrap('
"); + } + } +} + diff --git a/plugins/comment_paragraph/public/comment_paragraph_macro.js b/plugins/comment_paragraph/public/comment_paragraph_macro.js new file mode 100644 index 0000000..3814002 --- /dev/null +++ b/plugins/comment_paragraph/public/comment_paragraph_macro.js @@ -0,0 +1,39 @@ +var comment_paragraph_anchor; +jQuery(document).ready(function($) { + 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 + var comment_id = val[1]; + if(!/^\d+$/.test(comment_id)) return; //test for integer + + comment_paragraph_anchor = anchor; + var url = '/plugin/comment_paragraph/public/comment_paragraph/'+comment_id; + $.getJSON(url, function(data) { + if(data.paragraph_id!=null) { + var button = $('div.comment_paragraph_'+ data.paragraph_id + ' a'); + button.click(); + $.scrollTo(button); + } + }); +}); + +function toggleParagraph(paragraph) { + var div = jQuery('div.comments_list_toggle_paragraph_'+paragraph); + var visible = div.is(':visible'); + if(!visible) + jQuery('div.comment-paragraph-loading-'+paragraph).addClass('comment-button-loading'); + + div.toggle('fast'); + return visible; +} + +function loadCompleted(paragraph) { + jQuery('div.comment-paragraph-loading-'+paragraph).removeClass('comment-button-loading') + if(comment_paragraph_anchor) { + jQuery.scrollTo(jQuery(comment_paragraph_anchor)); + comment_paragraph_anchor = null; + } +} diff --git a/plugins/comment_paragraph/public/images/comments.gif b/plugins/comment_paragraph/public/images/comments.gif new file mode 100644 index 0000000..e3982a9 Binary files /dev/null and b/plugins/comment_paragraph/public/images/comments.gif differ diff --git a/plugins/comment_paragraph/public/style.css b/plugins/comment_paragraph/public/style.css new file mode 100644 index 0000000..d8f9e6f --- /dev/null +++ b/plugins/comment_paragraph/public/style.css @@ -0,0 +1,7 @@ +div.article-comments-list-more{ + width: 100%; + height: 30px; + text-align: center; + font-size: 20px; + margin-bottom: 5px; +} diff --git a/plugins/comment_paragraph/test/functional/comment_group_plugin_profile_controller_test.rb b/plugins/comment_paragraph/test/functional/comment_group_plugin_profile_controller_test.rb new file mode 100644 index 0000000..012dc93 --- /dev/null +++ b/plugins/comment_paragraph/test/functional/comment_group_plugin_profile_controller_test.rb @@ -0,0 +1,72 @@ +require File.dirname(__FILE__) + '/../test_helper' +require File.dirname(__FILE__) + '/../../controllers/profile/comment_paragraph_plugin_profile_controller' + +# Re-raise errors caught by the controller. +class CommentParagraphPluginProfileController; def rescue_action(e) raise e end; end + +class CommentParagraphPluginProfileControllerTest < ActionController::TestCase + + def setup + @controller = CommentParagraphPluginProfileController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + + @profile = create_user('testuser').person + @article = profile.articles.build(:name => 'test') + @article.save! + end + attr_reader :article + attr_reader :profile + + should 'be able to show paragraph comments' do + comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) + xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_id => 0 + assert_template 'comment_paragraph_plugin_profile/view_comments' + assert_match /comments_list_paragraph_0/, @response.body + assert_match /\"comment-count-0\", \"1\"/, @response.body + end + + should 'do not show global comments' do + fast_create(Comment, :source_id => article, :author_id => profile, :title => 'global comment', :body => 'global', :paragraph_id => nil) + fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) + xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_id => 0 + assert_template 'comment_paragraph_plugin_profile/view_comments' + assert_match /comments_list_paragraph_0/, @response.body + assert_match /\"comment-count-0\", \"1\"/, @response.body + end + + should 'show first page comments only' do + comment1 = fast_create(Comment, :created_at => Time.now - 1.days, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'secondpage', :paragraph_id => 0) + comment2 = fast_create(Comment, :created_at => Time.now - 2.days, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'firstpage 1', :paragraph_id => 0) + comment3 = fast_create(Comment, :created_at => Time.now - 3.days, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'firstpage 2', :paragraph_id => 0) + comment4 = fast_create(Comment, :created_at => Time.now - 4.days, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'firstpage 3', :paragraph_id => 0) + xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_id => 0 + assert_match /firstpage 1/, @response.body + assert_match /firstpage 2/, @response.body + assert_match /firstpage 3/, @response.body + assert_no_match /secondpage/, @response.body + end + + should 'show link to display more comments' do + comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) + comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) + comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) + comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'secondpage', :body => 'secondpage', :paragraph_id => 0) + xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_id => 0 + assert_match /paragraph_comment_page=2/, @response.body + end + + should 'do not show link to display more comments if do not have more pages' do + comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) + comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) + comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) + xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_id => 0 + assert_no_match /paragraph_comment_page/, @response.body + end + + should 'do not show link to display more comments if do not have any comments' do + xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :paragraph_id => 0 + assert_no_match /paragraph_comment_page/, @response.body + end + +end diff --git a/plugins/comment_paragraph/test/functional/comment_group_plugin_public_controller_test.rb b/plugins/comment_paragraph/test/functional/comment_group_plugin_public_controller_test.rb new file mode 100644 index 0000000..01bc577 --- /dev/null +++ b/plugins/comment_paragraph/test/functional/comment_group_plugin_public_controller_test.rb @@ -0,0 +1,33 @@ +require File.dirname(__FILE__) + '/../test_helper' +require File.dirname(__FILE__) + '/../../controllers/public/comment_paragraph_plugin_public_controller' + +# Re-raise errors caught by the controller. +class CommentParagraphPluginPublicController; def rescue_action(e) raise e end; end + +class CommentParagraphPluginPublicControllerTest < ActionController::TestCase + + def setup + @controller = CommentParagraphPluginPublicController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + + @profile = create_user('testuser').person + @article = profile.articles.build(:name => 'test') + @article.save! + end + attr_reader :article + attr_reader :profile + + should 'be able to return paragraph_id for a comment' do + comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :paragraph_id => 0) + xhr :get, :comment_paragraph, :id => comment.id + assert_match /\{\"paragraph_id\":0\}/, @response.body + end + + should 'return paragraph_id=null for a global comment' do + comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala' ) + xhr :get, :comment_paragraph, :id => comment.id + assert_match /\{\"paragraph_id\":null\}/, @response.body + end + +end diff --git a/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb b/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb new file mode 100644 index 0000000..994c2d3 --- /dev/null +++ b/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb @@ -0,0 +1,28 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class ContentViewerController + append_view_path File.join(File.dirname(__FILE__) + '/../../views') + def rescue_action(e) + raise e + end +end + +class ContentViewerControllerTest < ActionController::TestCase + + def setup + @profile = fast_create(Community) + @page = fast_create(Article, :profile_id => @profile.id, :body => "") + @environment = Environment.default + @environment.enable_plugin(CommentParagraphPlugin) + end + + attr_reader :page + + should 'parse article body and render comment paragraph view' do + comment1 = fast_create(Comment, :paragraph_id => 1, :source_id => page.id) + get :view_page, @page.url + assert_tag 'div', :attributes => {:class => 'comment_paragraph_1'} + assert_tag 'div', :attributes => {:id => 'comments_paragraph_count_1'} + end + +end diff --git a/plugins/comment_paragraph/test/test_helper.rb b/plugins/comment_paragraph/test/test_helper.rb new file mode 100644 index 0000000..cca1fd3 --- /dev/null +++ b/plugins/comment_paragraph/test/test_helper.rb @@ -0,0 +1 @@ +require File.dirname(__FILE__) + '/../../../test/test_helper' diff --git a/plugins/comment_paragraph/test/unit/allow_comment_test.rb b/plugins/comment_paragraph/test/unit/allow_comment_test.rb new file mode 100644 index 0000000..f37a6f5 --- /dev/null +++ b/plugins/comment_paragraph/test/unit/allow_comment_test.rb @@ -0,0 +1,26 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class AllowCommentTest < ActiveSupport::TestCase + + def setup + @macro = CommentParagraphPlugin::AllowComment.new + end + + attr_reader :macro + + should 'have a configuration' do + assert CommentParagraphPlugin::AllowComment.configuration + end + + should 'parse contents to include comment paragraph view' do + profile = fast_create(Community) + article = fast_create(Article, :profile_id => profile.id) + comment = fast_create(Comment, :paragraph_id => 1, :source_id => article.id) + inner_html = 'inner' + content = macro.parse({:paragraph_id => comment.paragraph_id}, inner_html, article) + + 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} }) + instance_eval(&content) + end + +end diff --git a/plugins/comment_paragraph/test/unit/article_test.rb b/plugins/comment_paragraph/test/unit/article_test.rb new file mode 100644 index 0000000..b62af14 --- /dev/null +++ b/plugins/comment_paragraph/test/unit/article_test.rb @@ -0,0 +1,56 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'benchmark' + +class ArticleTest < ActiveSupport::TestCase + + def setup + profile = fast_create(Community) + @article = fast_create(Article, :profile_id => profile.id) + end + + attr_reader :article + + should 'return paragraph comments from article' do + comment1 = fast_create(Comment, :paragraph_id => 1, :source_id => article.id) + comment2 = fast_create(Comment, :paragraph_id => nil, :source_id => article.id) + assert_equal [comment1], article.paragraph_comments + end + + should 'do not allow a exclusion of a paragraph comment macro if this paragraph has comments' do + article.body = "" + comment1 = fast_create(Comment, :paragraph_id => 1, :source_id => article.id) + assert !article.save + assert_equal ['Not empty paragraph comment cannot be removed'], article.errors[:base] + end + + should 'allow save if comment paragraph macro is not removed for paragraph with comments' do + article.body = "" + comment1 = fast_create(Comment, :paragraph_id => 1, :source_id => article.id) + assert article.save + end + + should 'do not validate empty paragraph if article body is not changed' do + article.body = "" + assert article.save + comment1 = fast_create(Comment, :paragraph_id => 1, :source_id => article.id) + article.name = article.name + 'changed' + assert article.save + end + + should 'improve performance checking changes in body' do + i = 1 + time0 = (Benchmark.measure { 50.times { + i = i + 1 + article.body = "i = #{i}" + assert article.save + }}) + i = 1 + time1 = (Benchmark.measure { 50.times { + i = i + 1 + article.body = "i = 1" + assert article.save + }}) + assert time0.total > time1.total + end + +end diff --git a/plugins/comment_paragraph/test/unit/comment_paragraph_plugin_test.rb b/plugins/comment_paragraph/test/unit/comment_paragraph_plugin_test.rb new file mode 100644 index 0000000..4562b73 --- /dev/null +++ b/plugins/comment_paragraph/test/unit/comment_paragraph_plugin_test.rb @@ -0,0 +1,60 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class CommentParagraphPluginTest < ActiveSupport::TestCase + + def setup + @environment = Environment.default + @plugin = CommentParagraphPlugin.new + end + + attr_reader :environment, :plugin + + should 'have a name' do + assert_not_equal Noosfero::Plugin.plugin_name, CommentParagraphPlugin::plugin_name + end + + should 'describe yourself' do + assert_not_equal Noosfero::Plugin.plugin_description, CommentParagraphPlugin::plugin_description + end + + should 'have a js file' do + assert !plugin.js_files.blank? + end + + should 'have stylesheet' do + assert plugin.stylesheet? + end + + should 'have extra contents for comment form' do + comment = fast_create(Comment, :paragraph_id => 1) + content = plugin.comment_form_extra_contents({:comment => comment}) + expects(:hidden_field_tag).with('comment[paragraph_id]', comment.paragraph_id).once + instance_eval(&content) + end + + should 'do not have extra contents for comments without paragraph' do + comment = fast_create(Comment, :paragraph_id => nil) + content = plugin.comment_form_extra_contents({:comment => comment}) + assert_equal nil, instance_eval(&content) + end + + should 'call without_paragraph for scope passed as parameter to unavailable_comments' do + article = fast_create(Article) + article.expects(:without_paragraph).once + plugin.unavailable_comments(article) + end + +#FIXME Obsolete test +# +# should 'filter_comments returns all the comments wihout paragraph of an article passed as parameter' do +# article = fast_create(Article) +# c1 = fast_create(Comment, :source_id => article.id, :paragraph_id => 1) +# c2 = fast_create(Comment, :source_id => article.id) +# c3 = fast_create(Comment, :source_id => article.id) +# +# plugin = CommentParagraphPlugin.new +# assert_equal [], [c2, c3] - plugin.filter_comments(article.comments) +# assert_equal [], plugin.filter_comments(article.comments) - [c2, c3] +# end + +end diff --git a/plugins/comment_paragraph/test/unit/comment_test.rb b/plugins/comment_paragraph/test/unit/comment_test.rb new file mode 100644 index 0000000..9ba97f3 --- /dev/null +++ b/plugins/comment_paragraph/test/unit/comment_test.rb @@ -0,0 +1,26 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class CommentTest < ActiveSupport::TestCase + + def setup + profile = fast_create(Community) + @article = fast_create(Article, :profile_id => profile.id) + end + + attr_reader :article + + should 'return comments that belongs to a specified paragraph' do + comment1 = fast_create(Comment, :paragraph_id => 1, :source_id => article.id) + comment2 = fast_create(Comment, :paragraph_id => nil, :source_id => article.id) + comment3 = fast_create(Comment, :paragraph_id => 2, :source_id => article.id) + assert_equal [comment1], article.comments.in_paragraph(1) + end + + should 'return comments that do not belongs to any paragraph' do + comment1 = fast_create(Comment, :paragraph_id => 1, :source_id => article.id) + comment2 = fast_create(Comment, :paragraph_id => nil, :source_id => article.id) + comment3 = fast_create(Comment, :paragraph_id => 2, :source_id => article.id) + assert_equal [comment2], article.comments.without_paragraph + end + +end diff --git a/plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb b/plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb new file mode 100644 index 0000000..756728b --- /dev/null +++ b/plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb @@ -0,0 +1,31 @@ +