From 314f05122816a1f2b6bd13071fe42468c1ca78cd Mon Sep 17 00:00:00 2001 From: aswindasfog Date: Sun, 13 Aug 2017 15:26:45 +0800 Subject: [PATCH 1/2] Modified Gruntfile.js to live reload project It can run watch with livereload and connect server at the same time. --- Gruntfile.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index bfc0590..1eef85c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -98,7 +98,10 @@ function initializeGruntConfig(grunt) { watch: { files: [SRC_DIR + '/**'], tasks: ['test'], - options: { nospawn: true} + options: { + nospawn: true, + livereload: true + } }, // Unit tests @@ -111,8 +114,7 @@ function initializeGruntConfig(grunt) { server: { options: { port: 8000, - base: '.', - keepalive: true + base: '.' } } }, @@ -201,6 +203,6 @@ module.exports = function (grunt) { grunt.registerTask("build-production", ["version", "test", "uglify"]); grunt.registerTask('build', ['concat', 'copy', 'umd', 'cssmin']); grunt.registerTask('test', ['build','jshint', 'qunit']); - grunt.registerTask("default", ["test", "watch"]); + grunt.registerTask("default", ["test", "connect", "watch"]); grunt.registerTask("prepublish", ["test", "uglify"]); }; From cd2dee581a8d82509763f7925af3989983094a05 Mon Sep 17 00:00:00 2001 From: aswindasfog Date: Sun, 13 Aug 2017 15:32:09 +0800 Subject: [PATCH 2/2] Fixed error message in Bootstrap 3 horizontal form display problem Fixed the problem that error message show at bad place when using checkbox, radio and input-group in Bootstrap 3 horizontal form. This can close #126 and close #272. --- src/main/dialogs.js | 12 ++- test/bootstrap3.html | 224 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 231 insertions(+), 5 deletions(-) create mode 100644 test/bootstrap3.html diff --git a/src/main/dialogs.js b/src/main/dialogs.js index 1fc9443..1747812 100644 --- a/src/main/dialogs.js +++ b/src/main/dialogs.js @@ -32,11 +32,13 @@ return $($elem.valAttr('error-msg-container')); } else { var $parent = $elem.parent(); - if (!$parent.hasClass('form-group') && !$parent.closest('form').hasClass('form-horizontal')) { - var $formGroup = $parent.closest('.form-group'); - if ($formGroup.length) { - return $formGroup.eq(0); - } + if($elem.attr('type') === 'checkbox' && $elem.closest('.checkbox').length) { + $parent = $elem.closest('.checkbox').parent(); + } else if($elem.attr('type') === 'radio' && $elem.closest('.radio').length) { + $parent = $elem.closest('.radio').parent(); + } + if($parent.closest('.input-group').length) { + $parent = $parent.closest('.input-group').parent(); } return $parent; } diff --git a/test/bootstrap3.html b/test/bootstrap3.html new file mode 100644 index 0000000..f724db1 --- /dev/null +++ b/test/bootstrap3.html @@ -0,0 +1,224 @@ + + + + + Bootstrap 3 Compatibility Test + + + +
+

Not Bootstrap form

+
+

Text + +

+

Check + CheckBox 1 + CheckBox 2 + CheckBox 3 +

+

Select + Radio 1 + Radio 2 + Radio 3 +

+ +
+
+

Basic form

+
+
+ + +
+
+
+
+ +
+
+
+ +
+ +
+
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+

Inline form

+
+
+ + +
+
+
+
+ +
+
+
+ +
+ +
+
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+

Horizontal form

+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+ + + + +