diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-07-02 15:30:30 -0400 | 
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-07-02 15:30:30 -0400 | 
| commit | 9cf94eec5ae98f750f9babc0c37373df87e3981c (patch) | |
| tree | 31ffe18ad835db2d786b406f76162766eabbbda9 | |
| parent | 7971d7ac77c83717afcceaa1f476d1eb9afd5918 (diff) | |
| download | thoughts-9cf94eec5ae98f750f9babc0c37373df87e3981c.tar.gz thoughts-9cf94eec5ae98f750f9babc0c37373df87e3981c.tar.bz2 thoughts-9cf94eec5ae98f750f9babc0c37373df87e3981c.zip | |
Styled flash and errors in admin panel
| -rw-r--r-- | app/assets/stylesheets/admin/layout.scss | 46 | ||||
| -rw-r--r-- | app/views/admin/blogs/_form.html.haml | 10 | ||||
| -rw-r--r-- | app/views/layouts/admin.html.haml | 19 | 
3 files changed, 61 insertions, 14 deletions
| diff --git a/app/assets/stylesheets/admin/layout.scss b/app/assets/stylesheets/admin/layout.scss index 811c2aa..bbe5383 100644 --- a/app/assets/stylesheets/admin/layout.scss +++ b/app/assets/stylesheets/admin/layout.scss | |||
| @@ -12,7 +12,7 @@ body { | |||
| 12 | background-color: #7bf; | 12 | background-color: #7bf; | 
| 13 | 13 | ||
| 14 | a { | 14 | a { | 
| 15 | display: block; | 15 | display: inline-block; | 
| 16 | text-decoration: none; | 16 | text-decoration: none; | 
| 17 | font-size: 2em; | 17 | font-size: 2em; | 
| 18 | margin: .25em 1em; | 18 | margin: .25em 1em; | 
| @@ -188,3 +188,47 @@ body { | |||
| 188 | border: 1px solid #ddd; | 188 | border: 1px solid #ddd; | 
| 189 | } | 189 | } | 
| 190 | } | 190 | } | 
| 191 | |||
| 192 | #errors { | ||
| 193 | padding-left: 0; | ||
| 194 | border: 2px solid red; | ||
| 195 | |||
| 196 | h3 { | ||
| 197 | margin: 0 0 .25em 0; | ||
| 198 | text-align: center; | ||
| 199 | } | ||
| 200 | |||
| 201 | ul { | ||
| 202 | margin: 0; | ||
| 203 | padding-left: 1em; | ||
| 204 | font-size: 0.75em; | ||
| 205 | } | ||
| 206 | |||
| 207 | li { | ||
| 208 | display: block; | ||
| 209 | } | ||
| 210 | } | ||
| 211 | |||
| 212 | #flash { | ||
| 213 | display: inline-block; | ||
| 214 | color: black; | ||
| 215 | background-color: white; | ||
| 216 | padding: .5em .75em; | ||
| 217 | font-size: .8em; | ||
| 218 | -webkit-box-shadow: 1px 1px 5px 0px rgba(0,0,0,0.75); | ||
| 219 | -moz-box-shadow: 1px 1px 5px 0px rgba(0,0,0,0.75); | ||
| 220 | box-shadow: 1px 1px 5px 0px rgba(0,0,0,0.75); | ||
| 221 | vertical-align: text-bottom; | ||
| 222 | } | ||
| 223 | |||
| 224 | .flash-tag { | ||
| 225 | font-weight: bold; | ||
| 226 | } | ||
| 227 | |||
| 228 | .flash-alert { | ||
| 229 | border-left: 5px solid red; | ||
| 230 | } | ||
| 231 | |||
| 232 | .flash-notice { | ||
| 233 | border-left: 5px solid green; | ||
| 234 | } | ||
| diff --git a/app/views/admin/blogs/_form.html.haml b/app/views/admin/blogs/_form.html.haml index 55a297a..4a1c410 100644 --- a/app/views/admin/blogs/_form.html.haml +++ b/app/views/admin/blogs/_form.html.haml | |||
| @@ -1,7 +1,3 @@ | |||
| 1 | - if f.object.errors.any? | ||
| 2 | %ul#errors | ||
| 3 | - f.object.errors.full_messages.each do |error| | ||
| 4 | %li= error | ||
| 5 | %fieldset#content | 1 | %fieldset#content | 
| 6 | .title-field | 2 | .title-field | 
| 7 | = f.label :title | 3 | = f.label :title | 
| @@ -13,6 +9,12 @@ | |||
| 13 | = f.label :body | 9 | = f.label :body | 
| 14 | = f.cktext_area :body | 10 | = f.cktext_area :body | 
| 15 | %fieldset#details | 11 | %fieldset#details | 
| 12 | - if f.object.errors.any? | ||
| 13 | #errors.details-module | ||
| 14 | %h3 Error! | ||
| 15 | %ul | ||
| 16 | - f.object.errors.full_messages.each do |error| | ||
| 17 | %li= error | ||
| 16 | .details-module | 18 | .details-module | 
| 17 | = f.fields_for :records, Record.new do |builder| | 19 | = f.fields_for :records, Record.new do |builder| | 
| 18 | .should-create-record-field | 20 | .should-create-record-field | 
| diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index a2c2d95..7f8c171 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml | |||
| @@ -6,7 +6,16 @@ | |||
| 6 | = stylesheet_link_tag 'admin', media: 'all', 'data-turbolinks-track': 'reload' | 6 | = stylesheet_link_tag 'admin', media: 'all', 'data-turbolinks-track': 'reload' | 
| 7 | = javascript_include_tag 'application', 'data-turbolinks-track': 'reload' | 7 | = javascript_include_tag 'application', 'data-turbolinks-track': 'reload' | 
| 8 | %body | 8 | %body | 
| 9 | #banner= link_to "Thoughts", root_url | 9 | #banner | 
| 10 | = link_to "Thoughts", root_url | ||
| 11 | - if flash[:alert] | ||
| 12 | #flash.flash-alert | ||
| 13 | %span.flash-tag ERROR: | ||
| 14 | = flash.alert | ||
| 15 | - if flash[:notice] | ||
| 16 | #flash.flash-notice | ||
| 17 | %span.flash-tag NOTICE: | ||
| 18 | = flash.notice | ||
| 10 | #container | 19 | #container | 
| 11 | %ul#sidebar | 20 | %ul#sidebar | 
| 12 | %li{major_sidebar_attrs("dashboard")} | 21 | %li{major_sidebar_attrs("dashboard")} | 
| @@ -16,12 +25,4 @@ | |||
| 16 | %ul.minors | 25 | %ul.minors | 
| 17 | %li.minor= link_to "New blog", new_admin_blog_url | 26 | %li.minor= link_to "New blog", new_admin_blog_url | 
| 18 | #main | 27 | #main | 
| 19 | - if flash[:alert] | ||
| 20 | #flash.flash-alert | ||
| 21 | %span.flash-tag ERROR: | ||
| 22 | = flash.alert | ||
| 23 | - if flash[:notice] | ||
| 24 | #flash.flash-notice | ||
| 25 | %span.flash-tag NOTICE: | ||
| 26 | = flash.notice | ||
| 27 | = yield | 28 | = yield | 
