浏览代码

Standardize the global form error see #4099 (#4102)

The render is now a Bootstrap 3 alert dismissible
Jérémy 9 年之前
父节点
当前提交
594368ed9c

+ 0 - 13
Resources/public/css/colors.css

@@ -24,19 +24,6 @@ input.title {
     width: 500px;
     width: 500px;
 }
 }
 
 
-div.sonata-ba-form-error {
-    width: 495px;
-    border: 3px solid #CE6F6F;
-    background-color: #F79992;
-    color: #9C2F2F;
-    padding: 5px;
-    margin-bottom: 10px;
-}
-
-div.sonata-ba-form-error ul {
-    margin: 0;
-}
-
 div.sonata-ba-field-error input{
 div.sonata-ba-field-error input{
     border: 1px solid #f79992;
     border: 1px solid #f79992;
 }
 }

+ 2 - 5
Resources/views/CRUD/base_acl_macro.html.twig

@@ -16,11 +16,8 @@ file that was distributed with this source code.
           method="POST"
           method="POST"
             {% if not admin_pool.getOption('html5_validate') %}novalidate="novalidate"{% endif %}
             {% if not admin_pool.getOption('html5_validate') %}novalidate="novalidate"{% endif %}
             >
             >
-        {% if form.vars.errors|length > 0 %}
-            <div class="sonata-ba-form-error">
-                {{ form_errors(form) }}
-            </div>
-        {% endif %}
+
+        {{ include('SonataAdminBundle:Helper:render_form_dismissable_errors.html.twig') }}
 
 
         <div class="box box-success">
         <div class="box box-success">
             <div class="body table-responsive no-padding">
             <div class="body table-responsive no-padding">

+ 2 - 5
Resources/views/CRUD/base_edit_form.html.twig

@@ -17,11 +17,8 @@
               {% if not sonata_admin.adminPool.getOption('html5_validate') %}novalidate="novalidate"{% endif %}
               {% if not sonata_admin.adminPool.getOption('html5_validate') %}novalidate="novalidate"{% endif %}
               {% block sonata_form_attributes %}{% endblock %}
               {% block sonata_form_attributes %}{% endblock %}
               >
               >
-            {% if form.vars.errors|length > 0 %}
-                <div class="sonata-ba-form-error">
-                    {{ form_errors(form) }}
-                </div>
-            {% endif %}
+
+            {{ include('SonataAdminBundle:Helper:render_form_dismissable_errors.html.twig') }}
 
 
             {% block sonata_pre_fieldsets %}
             {% block sonata_pre_fieldsets %}
                 <div class="row">
                 <div class="row">

+ 6 - 0
Resources/views/Helper/render_form_dismissable_errors.html.twig

@@ -0,0 +1,6 @@
+{% for error in form.vars.errors %}
+    <div class="alert alert-danger alert-dismissable">
+        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
+        {{ error.message }}
+    </div>
+{% endfor %}