$message_icons_path: "/assets/icons/messages/"; @mixin messages { .error { @include error_message; } .warning { @include warning_message; } .success { @include success_message; } .notice { @include notice_message; } .waiting { @include waiting_message; } } // wrappers for default messages @mixin error_message { @include message(error, small); } @mixin warning_message { @include message(warning, small); } @mixin success_message { @include message(success, small); } @mixin notice_message { @include message(notice, small); } @mixin waiting_message { @include message(warning, small, "waiting_small.gif"); } // helper for generating custom messages @mixin message($type, $icon_size: "small", $icon_url: "") { margin:0 0 1.5em; border: 2px solid #666; @include border-radius; background-color: #ddd; background-position: 1em center; background-repeat: no-repeat; padding: 1em; h3 { margin-bottom:0.5em; } div { border: 0; } @if $type == error { color: $error-color; border-color: $error-border-color; background-color: $error-background-color; } @else if $type == warning { color: $warning-color; border-color: $warning-border-color; background-color: $warning-background-color; } @else if $type == success { color: $success-color; border-color: $success-border-color; background-color: $success-background-color; } @else if $type == notice { color: $notice-color; border-color: $notice-border-color; background-color: $notice-background-color; } @if $icon_size == small { padding-left: 60px; min-height: 15px; } @else if $icon_size == medium { padding-left: 80px; min-height: 40px; } @else if $icon_size == large { padding-left: 100px; min-height: 60px; } @else if $icon_size == none { background-image:none; } @if $icon_size != none { @if $icon_url != "" { @include message_icon("#{$message_icons_path}#{$icon_url}"); } @else { @include message_icon("#{$message_icons_path}#{$type}_#{$icon_size}.png"); } } } @mixin message_icon($path_to_icon) { background-image: image-url($path_to_icon); }