@@ -13,7 +13,7 @@ def error_key
1313 # error partial
1414 # overwrite render_errors to customize error rendering
1515 def render_errors
16- unless errors == false
16+ unless @included_config [ :errors ] == false && ( errors == false || errors . nil? ) || errors == false
1717 self . send ( wrapper_tag , class : wrapper_class , attributes : { 'v-if' : error_key } ) do
1818 self . send ( error_tag , class : error_class , attributes : { 'v-for' : "error in #{ error_key } " } ) do
1919 plain '{{ error }}'
@@ -23,23 +23,32 @@ def render_errors
2323 end
2424
2525 def wrapper_tag
26- tag = errors . is_a? ( Hash ) ? errors . dig ( :wrapper , :tag ) : :span
27- tag || :span
26+ tag = get_error_config ( @included_config [ : errors] , :wrapper , :tag ) || :span
27+ tag = get_error_config ( errors , :wrapper , :tag ) || tag
2828 end
2929
3030 def wrapper_class
31- klaas = errors . is_a? ( Hash ) ? errors . dig ( :wrapper , :class ) : 'errors'
32- klaas || 'errors'
31+ klass = get_error_config ( @included_config [ : errors] , :wrapper , :class ) || 'errors'
32+ klass = get_error_config ( errors , :wrapper , :class ) || klass
3333 end
3434
3535 def error_tag
36- tag = errors . is_a? ( Hash ) ? errors . dig ( :tag ) : :span
37- tag || :span
36+ tag = get_error_config ( @included_config [ : errors] , :tag ) || :span
37+ tag = get_error_config ( errors , :tag ) || tag
3838 end
3939
4040 def error_class
41- tag = errors . is_a? ( Hash ) ? errors . dig ( :class ) : 'error'
42- tag || 'error'
41+ klass = get_error_config ( @included_config [ :errors ] , :class ) || 'error'
42+ klass = get_error_config ( errors , :class ) || klass
43+ end
44+
45+ def input_error_class
46+ klass = get_error_config ( @included_config [ :errors ] , :input , :class ) || 'error'
47+ klass = get_error_config ( errors , :input , :class ) || klass
48+ end
49+
50+ def get_error_config ( hash , *keys )
51+ hash . dig ( *keys ) if hash . is_a? ( Hash ) && hash . dig ( *keys )
4352 end
4453
4554end
0 commit comments