浏览代码

#570: Use CSS classes instead of inline styling for icons, thanks to @dlcrush

Phuoc Nguyen 11 年之前
父节点
当前提交
a5d5fdca95

+ 1 - 0
CHANGELOG.md

@@ -20,6 +20,7 @@ __Improvements__
 * [#249](https://github.com/nghuuphuoc/bootstrapvalidator/pull/249), [#574](https://github.com/nghuuphuoc/bootstrapvalidator/issues/574), [#669](https://github.com/nghuuphuoc/bootstrapvalidator/issues/669): Add ```delay``` option to the [remote](http://bootstrapvalidator.com/validators/remote/) validator, thanks to [@q-state](https://github.com/q-state)
 * [#345](https://github.com/nghuuphuoc/bootstrapvalidator/issues/345), [#454](https://github.com/nghuuphuoc/bootstrapvalidator/pull/454): The [different](http://bootstrapvalidator.com/validators/different/) validator allows more than a 2-way comparison, thanks to [@AlaskanShade](https://github.com/AlaskanShade)
 * [#557](https://github.com/nghuuphuoc/bootstrapvalidator/issues/557), [#569](https://github.com/nghuuphuoc/bootstrapvalidator/pull/569): The [container](http://bootstrapvalidator.com/settings/#form-container) option can be defined by a callback, thanks to [@mattrick](https://github.com/mattrick)
+* [#570](https://github.com/nghuuphuoc/bootstrapvalidator/issues/570): Use CSS classes instead of inline styling to fix icons with ```input-group```, thanks to [@dlcrush](https://github.com/dlcrush)
 * [#675](https://github.com/nghuuphuoc/bootstrapvalidator/pull/675): The [emailAddress](http://bootstrapvalidator.com/validators/emailAddress/) validator accepts multiple email addresses, thanks to [@kenny-evitt](https://github.com/kenny-evitt)
 * [#734](https://github.com/nghuuphuoc/bootstrapvalidator/pull/734): The [uri](http://bootstrapvalidator.com/validators/uri/) validator adds support for custom protocol, thanks to [@bcamarneiro](https://github.com/bcamarneiro)
 * [#737](https://github.com/nghuuphuoc/bootstrapvalidator/issues/737): Support VAT number without prefixing by country code

+ 1 - 0
CONTRIBUTORS.md

@@ -18,6 +18,7 @@ I would like to give big thanks to the following contributors:
 * [@caijh](https://github.com/caijh)
 * [@CeRBeR666](https://github.com/CeRBeR666)
 * [@Djarnis](https://github.com/Djarnis)
+* [@dlcrush](https://github.com/dlcrush)
 * [@dlucazeau](https://github.com/dlucazeau)
 * [@dokterpasta](https://github.com/dokterpasta)
 * [@easonhan007](https://github.com/easonhan007)

+ 0 - 212
demo/basic.html

@@ -1,212 +0,0 @@
-<!-- Gives example of basic form -->
-
-<!DOCTYPE html>
-<html>
-<head>
-    <title>BootstrapValidator demo</title>
-
-    <link rel="stylesheet" href="../vendor/bootstrap/css/bootstrap.css"/>
-    <link rel="stylesheet" href="../dist/css/bootstrapValidator.css"/>
-
-    <script type="text/javascript" src="../vendor/jquery/jquery-1.10.2.min.js"></script>
-    <script type="text/javascript" src="../vendor/bootstrap/js/bootstrap.min.js"></script>
-    <script type="text/javascript" src="../dist/js/bootstrapValidator.js"></script>
-
-    <!-- Support datetime picker plugin: http://eonasdan.github.io/bootstrap-datetimepicker/ -->
-    <link rel="stylesheet" href="//eonasdan.github.io/bootstrap-datetimepicker/content/bootstrap-datetimepicker.css"/>
-    <script type="text/javascript" src="//eonasdan.github.io/bootstrap-datetimepicker/scripts/moment.js"></script>
-    <script type="text/javascript" src="//eonasdan.github.io/bootstrap-datetimepicker/scripts/bootstrap-datetimepicker.js"></script>
-
-    <style type="text/css">
-    /* Override to make the feedback icons shown properly */
-    .form .bv-input-group-icon {
-        top: 25px;
-        right: 35px;
-    }
-    </style>
-</head>
-<body>
-
-<div class="container-fluid">
-    <div class="row">
-        <div class="col-lg-8 col-lg-offset-2">
-            <form id="basicExample" action="target.php" method="post">
-                <div class="row">
-                    <div class="col-lg-1">
-                        <div class="form-group">
-                            <label for="prefix">Prefix:</label>
-                            <input type="text" name="prefix" class="form-control">
-                        </div>
-                    </div>
-                    <div class="col-lg-10">
-                        <div class="col-lg-4">
-                            <div class="form-group">
-                                <label for="firstname">First Name:</label>
-                                <input type="text" name="firstname" class="form-control">
-                            </div>
-                        </div>
-                        <div class="col-lg-4">
-                            <div class="form-group">
-                                <label for="middlename">Middle Name:</label>
-                                <input type="text" name="firstname" class="form-control">
-                            </div>
-                        </div>
-                        <div class="col-lg-4">
-                            <div class="form-group">
-                                <label for="lastname">Last Name:</label>
-                                <input type="text" name="lastname" class="form-control">
-                            </div>
-                        </div>
-                    </div>
-                    <div class="col-lg-1">
-                        <div class="form-group">
-                            <label for="suffix">Suffix:</label>
-                            <input type="text" name="suffix" class="form-control">
-                        </div>
-                    </div>
-                </div>
-                <div class="row">
-                    <div class="col-lg-6">
-                        <div class="form-group">
-                            <label for="email">Email:</label>
-                            <input type="email" name="email" class="form-control">
-                        </div>
-                    </div>
-                    <div class="col-lg-6">
-                        <div class="form-group">
-                            <label for="phonenumber">Phone Number:</label>
-                            <input type="text" name="phonenumber" class="form-control">
-                        </div>
-                    </div>
-                </div>
-
-                <div class="row">
-                    <div class="col-lg-12">
-                        <div class="form-group">
-                            <label for="languages">What Programming languages do you use?</label>
-                            <div class="checkbox">
-                                <label>
-                                    <input type="checkbox" name="languages[]" value="php"> PHP
-                                </label>
-                            </div>
-                            <div class="checkbox">
-                                <label>
-                                    <input type="checkbox" name="languages[]" value="asp"> ASP.NET MVC
-                                </label>
-                            </div>
-                            <div class="checkbox">
-                                <label>
-                                    <input type="checkbox" name="languages[]" value="coldfusion"> ColdFusion
-                                </label>
-                            </div>
-                            <div class="checkbox">
-                                <label>
-                                    <input type="checkbox" name="languages[]" value="javascript"> JavaScript
-                                </label>
-                            </div>
-                            <div class="checkbox">
-                                <label>
-                                    <input type="checkbox" name="languages[]" value="ruby"> Ruby
-                                </label>
-                            </div>
-                            <div class="checkbox">
-                                <label>
-                                    <input type="checkbox" name="languages[]" value="python"> Python
-                                </label>
-                            </div>
-                            <div class="checkbox">
-                                <label>
-                                    <input type="checkbox" name="languages[]" value="java"> Java
-                                </label>
-                            </div>
-                        </div>
-                    </div>
-                </div>
-
-
-                <div class="row">
-                    <div class="col-lg-12">
-                        <input type="submit" class="btn btn-primary btn-lg pull-right">
-                    </div>
-                </div>
-            </form>
-        </div>
-    </div>
-</div>
-
-<script>
-    $(function() {
-        $('#basicExample').bootstrapValidator({
-            message: 'This value is not valid',
-            feedbackIcons: {
-                valid: 'glyphicon glyphicon-ok',
-                invalid: 'glyphicon glyphicon-remove',
-                validating: 'glyphicon glyphicon-refresh'
-            },
-            fields: {
-                prefix: {
-                    validators: {
-                        // not required
-                    }
-                },
-                firstname: {
-                    validators: {
-                        notEmpty: {
-                            message: 'First Name is required.'
-                        }
-                    }
-                },
-                middlename: {
-                    validators: {
-                        notEmpty: {
-                            message: 'Middle Name is required.'
-                        }
-                    }
-                },
-                lastname: {
-                    validators: {
-                       notEmpty: {
-                            message: 'Last Name is required.'
-                        }
-                    }
-                },
-                suffix: {
-                    validators: {
-                        // not required
-                    }
-                },
-                email: {
-                    validators: {
-                        notEmpty: {
-                            message: 'Email is required.'
-                        },
-                        emailAddress: {
-                            message: 'The value is not a valid email address.'
-                        }
-                    }
-                },
-                phonenumber: {
-                    validators: {
-                        notEmpty: {
-                            message: 'Phone number is required.'
-                        },
-                        phone: {
-                            country: 'US',
-                            message: 'The value is not a valid US phone number.'
-                        }
-                    }
-                },
-                'languages[]': {
-                    validators: {
-                        notEmpty: {
-                            message: 'You must pick at least one.'
-                        }
-                    }
-                }
-            }
-        });
-    });
-</script>
-
-</body>
-</html>

+ 0 - 164
demo/date2.html

@@ -1,164 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-    <title>BootstrapValidator demo</title>
-
-    <link rel="stylesheet" href="../vendor/bootstrap/css/bootstrap.css"/>
-    <link rel="stylesheet" href="../dist/css/bootstrapValidator.css"/>
-
-    <script type="text/javascript" src="../vendor/jquery/jquery-1.10.2.min.js"></script>
-    <script type="text/javascript" src="../vendor/bootstrap/js/bootstrap.min.js"></script>
-    <script type="text/javascript" src="../dist/js/bootstrapValidator.js"></script>
-
-    <!-- Support datetime picker plugin: http://eonasdan.github.io/bootstrap-datetimepicker/ -->
-    <link rel="stylesheet" href="//eonasdan.github.io/bootstrap-datetimepicker/content/bootstrap-datetimepicker.css"/>
-    <script type="text/javascript" src="//eonasdan.github.io/bootstrap-datetimepicker/scripts/moment.js"></script>
-    <script type="text/javascript" src="//eonasdan.github.io/bootstrap-datetimepicker/scripts/bootstrap-datetimepicker.js"></script>
-
-    <style type="text/css">
-    /* Override to make the feedback icons shown properly */
-    .bv-form .bv-input-group-icon {
-        top: 25px;
-        right: 40px;
-    }
-    </style>
-</head>
-<body>
-    <div class="container">
-        <div class="row">
-            <!-- form: -->
-            <section>
-                <div class="col-lg-8 col-lg-offset-2">
-                    <div class="page-header">
-                        <h2>Date validator</h2>
-                    </div>
-
-                    <form id="defaultForm" method="post" action="target.php">
-                        <div class="row">
-                            <div class="col-lg-4">
-                                <div class="form-group">
-                                    <label for="monthDayYear">MM/DD/YYYY</label>
-                                    <input type="text" class="form-control" name="monthDayYear" />
-                                </div>
-                            </div>
-                            <div class="col-lg-4">
-                                <div class="form-group">
-                                    <label for="yearDayMonth">YYYY-DD-MM</label>
-                                    <input type="text" class="form-control" name="yearDayMonth" />
-                                </div>
-                            </div>
-                            <div class="col-lg-4">
-                                <div class="form-group">
-                                    <label for="yearMonthDay">YYYY.MM.DD</label>
-                                    <input type="text" class="form-control" name="yearMonthDay" />
-                                </div>
-                            </div>
-                        </div>
-                        <div class="row">
-                            <div class="col-lg-4">
-                                <div class="form-group">
-                                    <label for="monthDayYearTime">MM/DD/YYYY h:m A</label>
-                                    <input type="text" class="form-control" name="monthDayYearTime" />
-                                </div>
-                            </div>
-                            <div class="col-lg-4">
-                                <div class="form-group">
-                                    <label for="yearDayMonthTime">YYYY-DD-MM h:m A</label>
-                                    <input type="text" class="form-control" name="yearDayMonthTime" />
-                                </div>
-                            </div>
-                            <div class="col-lg-4">
-                                <!-- datetime picker -->
-                                <div class="form-group">
-                                    <label for="datetimePicker"><a href="http://eonasdan.github.io/bootstrap-datetimepicker/">DateTime Picker</a></label>
-                                    <div class="input-group date" id="datetimePicker">
-                                        <input type="text" class="form-control" name="datetimePicker" />
-                                        <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
-                                    </div>
-                                </div>
-                            </div>
-                        </div>
-                        <div class="form-group">
-                            <div class="col-lg-9 col-lg-offset-3">
-                                <button type="submit" class="btn btn-primary">Submit</button>
-                            </div>
-                        </div>
-                    </form>
-                </div>
-            </section>
-            <!-- :form -->
-        </div>
-    </div>
-
-<script type="text/javascript">
-$(document).ready(function() {
-    $('#datetimePicker').datetimepicker();
-
-    $('#defaultForm').bootstrapValidator({
-        message: 'This value is not valid',
-        feedbackIcons: {
-            valid: 'glyphicon glyphicon-ok',
-            invalid: 'glyphicon glyphicon-remove',
-            validating: 'glyphicon glyphicon-refresh'
-        },
-        fields: {
-            monthDayYear: {
-                validators: {
-                    date: {
-                        format: 'MM/DD/YYYY'
-                    }
-                }
-            },
-            yearDayMonth: {
-                validators: {
-                    date: {
-                        format: 'YYYY-DD-MM'
-                    }
-                }
-            },
-            yearMonthDay: {
-                validators: {
-                    date: {
-                        format: 'YYYY.MM.DD',
-                        separator: '.'
-                    }
-                }
-            },
-            monthDayYearTime: {
-                validators: {
-                    date: {
-                        format: 'MM/DD/YYYY h:m A'
-                    }
-                }
-            },
-            yearDayMonthTime: {
-                validators: {
-                    date: {
-                        format: 'YYYY-DD-MM h:m A'
-                    }
-                }
-            },
-            datetimePicker: {
-                validators: {
-                    notEmpty: {
-                        message: 'The date is required and cannot be empty'
-                    },
-                    date: {
-                        format: 'MM/DD/YYYY h:m A'
-                    }
-                }
-            }
-        }
-    });
-
-    $('#datetimePicker')
-        .on('dp.change dp.show', function(e) {
-            // Validate the date when user change it
-            $('#defaultForm').data('bootstrapValidator').revalidateField('datetimePicker');
-            // You also can call it as following:
-            // $('#defaultForm').bootstrapValidator('revalidateField', 'datetimePicker');
-        });
-});
-</script>
-</body>
-</html>

+ 4 - 4
dist/css/bootstrapValidator.css

@@ -20,11 +20,11 @@
     color: #a94442;
 }
 
-.bv-form .bv-no-label {
-	top: 0px;
+.bv-form .bv-icon-no-label {
+	top: 0;
 }
 
-.bv-form .bv-input-group-icon {
-	top: 0px;
+.bv-form .bv-icon-input-group {
+	top: 0;
 	z-index: 100;
 }

+ 2 - 2
dist/css/bootstrapValidator.min.css

@@ -2,10 +2,10 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.2-dev, built on 2014-09-06 8:59:12 AM
+ * @version     v0.5.2-dev, built on 2014-09-06 1:12:02 PM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT
  */
 
-.bv-form .help-block{margin-bottom:0}.bv-form .tooltip-inner{text-align:left}.nav-tabs li.bv-tab-success>a{color:#3c763d}.nav-tabs li.bv-tab-error>a{color:#a94442}.bv-form .bv-no-label{top:0}.bv-form .bv-input-group-icon{top:0;z-index:100}
+.bv-form .help-block{margin-bottom:0}.bv-form .tooltip-inner{text-align:left}.nav-tabs li.bv-tab-success>a{color:#3c763d}.nav-tabs li.bv-tab-error>a{color:#a94442}.bv-form .bv-icon-no-label{top:0}.bv-form .bv-icon-input-group{top:0;z-index:100}

+ 3 - 3
dist/js/bootstrapValidator.js

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.2-dev, built on 2014-09-06 8:59:12 AM
+ * @version     v0.5.2-dev, built on 2014-09-06 1:12:02 PM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT
@@ -361,8 +361,8 @@
                     }
                     // Fix feedback icons in input-group
                     if ($parent.find('.input-group').length !== 0) {
-                        $icon.addClass('bv-input-group-icon')
-                        .insertAfter($parent.find('.input-group').eq(0));
+                        $icon.addClass('bv-icon-input-group')
+                             .insertAfter($parent.find('.input-group').eq(0));
                     }
                 }
             }

文件差异内容过多而无法显示
+ 4 - 4
dist/js/bootstrapValidator.min.js


+ 4 - 4
src/css/bootstrapValidator.css

@@ -20,11 +20,11 @@
     color: #a94442;
 }
 
-.bv-form .bv-no-label {
-	top: 0px;
+.bv-form .bv-icon-no-label {
+	top: 0;
 }
 
-.bv-form .bv-input-group-icon {
-	top: 0px;
+.bv-form .bv-icon-input-group {
+	top: 0;
 	z-index: 100;
 }

+ 2 - 2
src/js/bootstrapValidator.js

@@ -360,8 +360,8 @@
                     }
                     // Fix feedback icons in input-group
                     if ($parent.find('.input-group').length !== 0) {
-                        $icon.addClass('bv-input-group-icon')
-                        .insertAfter($parent.find('.input-group').eq(0));
+                        $icon.addClass('bv-icon-input-group')
+                             .insertAfter($parent.find('.input-group').eq(0));
                     }
                 }
             }