File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,34 @@ module ClassMethods
34
34
def sanitizer_vendor
35
35
Rails ::Html ::Sanitizer
36
36
end
37
+
38
+ if method_defined? ( :sanitized_allowed_tags= ) || private_method_defined? ( :sanitized_allowed_tags= )
39
+ undef_method ( :sanitized_allowed_tags= )
40
+ end
41
+
42
+ # Replaces the allowed tags for the +sanitize+ helper.
43
+ #
44
+ # class Application < Rails::Application
45
+ # config.action_view.sanitized_allowed_tags = 'table', 'tr', 'td'
46
+ # end
47
+ #
48
+ def sanitized_allowed_tags = ( tags )
49
+ sanitizer_vendor . white_list_sanitizer . allowed_tags = tags
50
+ end
51
+
52
+ if method_defined? ( :sanitized_allowed_attributes= ) || private_method_defined? ( :sanitized_allowed_attributes= )
53
+ undef_method ( :sanitized_allowed_attributes= )
54
+ end
55
+
56
+ # Replaces the allowed HTML attributes for the +sanitize+ helper.
57
+ #
58
+ # class Application < Rails::Application
59
+ # config.action_view.sanitized_allowed_attributes = ['onclick', 'longdesc']
60
+ # end
61
+ #
62
+ def sanitized_allowed_attributes = ( attributes )
63
+ sanitizer_vendor . white_list_sanitizer . allowed_attributes = attributes
64
+ end
37
65
end
38
66
end
39
67
end
You can’t perform that action at this time.
0 commit comments