styled form errors and success messages

This commit is contained in:
Bret Haynie 2014-04-25 13:10:57 -04:00
parent 7b30af0684
commit fec3064162
4 changed files with 37 additions and 13 deletions

View File

@ -2,6 +2,14 @@ body {
margin-top: 50px; margin-top: 50px;
} }
h2 {
margin-top: 0;
}
strong, label, th {
color: #395C84;
}
ul { ul {
list-style: none; list-style: none;
padding-left: 0; padding-left: 0;
@ -11,6 +19,16 @@ ul {
font-size: .85em; font-size: .85em;
} }
.alert {
margin-bottom: 0;
margin-top: 1.5em;
padding: 5px 10px;
}
.alert-form {
margin-top: .5em !important;
}
// $medgray: #3A9AC9; // $medgray: #3A9AC9;
.videolisting { .videolisting {

View File

@ -1,5 +1,13 @@
<div class="container">
<section>
<div id="flash"> <div id="flash">
<% flash.each do |key, value| -%> <% flash.each do |key, value| -%>
<div id="flash_<%= key %>"><%= value %></div> <% if flash[:notice] %>
<div id="flash_<%= key %>" class="alert alert-success"><%= value %></div>
<% else %>
<div id="flash_<%= key %>" class="alert alert-danger"><%= value %></div>
<% end %>
<% end -%> <% end -%>
</div> </div>
</section>
</div>

View File

@ -4,9 +4,8 @@
file: :vertical_file_input, file: :vertical_file_input,
boolean: :vertical_boolean boolean: :vertical_boolean
}) do |frm| %> }) do |frm| %>
<% if @campaign.errors.any? %> <!-- <% if @campaign.errors.any? %>
<div class="row"> <div class="error_explanation">
<div class="col-md-12 error_explanation">
<h2><%= pluralize(@campaign.errors.count, "error") %> prohibited this campaign from being saved:</h2> <h2><%= pluralize(@campaign.errors.count, "error") %> prohibited this campaign from being saved:</h2>
<ul> <ul>
<% @campaign.errors.full_messages.each do |msg| %> <% @campaign.errors.full_messages.each do |msg| %>
@ -14,8 +13,7 @@
<% end %> <% end %>
</ul> </ul>
</div> </div>
</div> <% end %> -->
<% end %>
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">

View File

@ -9,7 +9,7 @@ SimpleForm.setup do |config|
b.use :label b.use :label
b.wrapper tag: 'div', class: 'controls' do |ba| b.wrapper tag: 'div', class: 'controls' do |ba|
ba.use :input ba.use :input
ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' } ba.use :error, wrap_with: { tag: 'div', class: 'alert alert-danger alert-form' }
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
end end
end end
@ -23,7 +23,7 @@ SimpleForm.setup do |config|
prepend.use :input prepend.use :input
end end
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' } input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
input.use :error, wrap_with: { tag: 'span', class: 'help-inline' } input.use :error, wrap_with: { tag: 'div', class: 'alert alert-danger alert-form' }
end end
end end
@ -36,7 +36,7 @@ SimpleForm.setup do |config|
append.use :input append.use :input
end end
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' } input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
input.use :error, wrap_with: { tag: 'span', class: 'help-inline' } input.use :error, wrap_with: { tag: 'div', class: 'alert alert-danger alert-form' }
end end
end end