Commit 6c96c297b0da91768b200b4a9b2b1d1313bbfc0a
1 parent
906a56a3
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
comment_paragraph: small fixes
Showing
10 changed files
with
13 additions
and
15 deletions
Show diff stats
plugins/comment_paragraph/lib/ext/article.rb
| @@ -6,8 +6,6 @@ class Article | @@ -6,8 +6,6 @@ class Article | ||
| 6 | 6 | ||
| 7 | before_save :comment_paragraph_plugin_parse_html | 7 | before_save :comment_paragraph_plugin_parse_html |
| 8 | 8 | ||
| 9 | - before_create :comment_paragraph_plugin_set_initial_value | ||
| 10 | - | ||
| 11 | settings_items :comment_paragraph_plugin_activate, :type => :boolean, :default => false | 9 | settings_items :comment_paragraph_plugin_activate, :type => :boolean, :default => false |
| 12 | 10 | ||
| 13 | def comment_paragraph_plugin_enabled? | 11 | def comment_paragraph_plugin_enabled? |
| @@ -21,6 +19,7 @@ class Article | @@ -21,6 +19,7 @@ class Article | ||
| 21 | protected | 19 | protected |
| 22 | 20 | ||
| 23 | def comment_paragraph_plugin_parse_html | 21 | def comment_paragraph_plugin_parse_html |
| 22 | + comment_paragraph_plugin_set_initial_value unless persisted? | ||
| 24 | return unless comment_paragraph_plugin_activated? | 23 | return unless comment_paragraph_plugin_activated? |
| 25 | 24 | ||
| 26 | if body && (body_changed? || setting_changed?(:comment_paragraph_plugin_activate)) | 25 | if body && (body_changed? || setting_changed?(:comment_paragraph_plugin_activate)) |
| @@ -45,7 +44,6 @@ class Article | @@ -45,7 +44,6 @@ class Article | ||
| 45 | def comment_paragraph_plugin_set_initial_value | 44 | def comment_paragraph_plugin_set_initial_value |
| 46 | self.comment_paragraph_plugin_activate = comment_paragraph_plugin_enabled? && | 45 | self.comment_paragraph_plugin_activate = comment_paragraph_plugin_enabled? && |
| 47 | comment_paragraph_plugin_settings.activation_mode == 'auto' | 46 | comment_paragraph_plugin_settings.activation_mode == 'auto' |
| 48 | - true | ||
| 49 | end | 47 | end |
| 50 | 48 | ||
| 51 | def comment_paragraph_plugin_settings | 49 | def comment_paragraph_plugin_settings |
plugins/comment_paragraph/test/functional/comment_paragraph_plugin_admin_controller_test.rb
| 1 | -require File.dirname(__FILE__) + '/../../../../test/test_helper' | ||
| 2 | -require File.dirname(__FILE__) + '/../../controllers/comment_paragraph_plugin_admin_controller' | 1 | +require_relative '../../../../test/test_helper' |
| 2 | +require_relative '../../controllers/comment_paragraph_plugin_admin_controller' | ||
| 3 | 3 | ||
| 4 | # Re-raise errors caught by the controller. | 4 | # Re-raise errors caught by the controller. |
| 5 | class CommentParagraphPluginAdminController; def rescue_action(e) raise e end; end | 5 | class CommentParagraphPluginAdminController; def rescue_action(e) raise e end; end |
plugins/comment_paragraph/test/functional/comment_paragraph_plugin_profile_controller_test.rb
| 1 | -require File.dirname(__FILE__) + '/../test_helper' | ||
| 2 | -require File.dirname(__FILE__) + '/../../controllers/profile/comment_paragraph_plugin_profile_controller' | 1 | +require_relative '../test_helper' |
| 2 | +require_relative '../../controllers/profile/comment_paragraph_plugin_profile_controller' | ||
| 3 | 3 | ||
| 4 | # Re-raise errors caught by the controller. | 4 | # Re-raise errors caught by the controller. |
| 5 | class CommentParagraphPluginProfileController; def rescue_action(e) raise e end; end | 5 | class CommentParagraphPluginProfileController; def rescue_action(e) raise e end; end |
plugins/comment_paragraph/test/functional/comment_paragraph_plugin_public_controller_test.rb
| 1 | -require File.dirname(__FILE__) + '/../test_helper' | ||
| 2 | -require File.dirname(__FILE__) + '/../../controllers/public/comment_paragraph_plugin_public_controller' | 1 | +require_relative '../test_helper' |
| 2 | +require_relative '../../controllers/public/comment_paragraph_plugin_public_controller' | ||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | # Re-raise errors caught by the controller. | 5 | # Re-raise errors caught by the controller. |
plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb
plugins/comment_paragraph/test/test_helper.rb
plugins/comment_paragraph/test/unit/allow_comment_test.rb
plugins/comment_paragraph/test/unit/article_test.rb
plugins/comment_paragraph/test/unit/comment_paragraph_plugin_test.rb
| 1 | -require File.dirname(__FILE__) + '/../test_helper' | 1 | +require_relative '../test_helper' |
| 2 | include ActionView::Helpers::FormTagHelper | 2 | include ActionView::Helpers::FormTagHelper |
| 3 | 3 | ||
| 4 | class CommentParagraphPluginTest < ActiveSupport::TestCase | 4 | class CommentParagraphPluginTest < ActiveSupport::TestCase |
plugins/comment_paragraph/test/unit/comment_test.rb