silverstripe-framework/admin/scss/_forms.scss
Naomi Guyer 9312c70696 Side-by-side preview options fixes.
Add extra preview-mode selector to the CMS actions so we can show
something when the preview is closed (and with it all options are not
visible).

Thanks @mateusz, @clarkepaul and @robert-h-curry for contributing.
2012-12-10 17:52:01 +01:00

745 lines
15 KiB
SCSS

/**
* This file defines common styles for form elements used throughout the CMS interface.
* It is an addition to the base styles defined in framework/css/Form.css.
*
* @package framework
* @subpackage admin
*/
/** ----------------------------------------------------
* Basic form fields
* ---------------------------------------------------- */
form.nostyle {
@include clear-form-field-styles();
}
.field {
display: block;
border-bottom: 1px solid $color-light-separator;
@include box-shadow(0 1px 0 $box-shadow-shine-minimal);
//TODO: use single border line with shadow instead:: http://daverupert.com/2011/06/two-tone-borders-with-css3/
//overflow: hidden;
// bottom padding accounts for the border and we have a negative
// margin with a postive padding to ensure the bottom border extends
// over the edges
padding: 0 0 $grid-y - 1 0;
margin: 0 0 $grid-y 0;
&:last-child {
border-bottom: none;
@include box-shadow(none);
}
// using the legacy version as some of the more complex form fields
// need to use relative positioning and overflow hidden will not expand
// the containing boxes
@include legacy-pie-clearfix();
&.nolabel {
.middleColumn {
margin-left: 0;
}
.help {
margin-left: 0;
}
}
&.checkbox label.right{
margin: $grid-y/2 0 0 0;
display:inline;
font-style: normal;
color: $color-text;
clear:none;
}
label {
&.left {
float: left;
display: block;
width: $grid-x * 22;
padding: $grid-y $grid-x $grid-y 0;
line-height: $grid-y * 2;
font-weight: bold;
@include text-shadow(1px 1px 0 $color-text-shadow);
}
&.right {
cursor: pointer;
clear: both;
color: lighten($color-text, 20%);
display: block;
font-style: italic;
margin: $grid-y/2 0 0 $grid-x*23;
}
}
.middleColumn {
margin-left: $grid-x * 23;
}
span.readonly {
padding-top: $grid-y;
line-height: $grid-y * 2;
display: block;
}
// Additional help text to clarify the field intent,
// displayed alongside the field (rather than in a tooltip)
.help {
clear: both;
color: lighten($color-text, 20%);
display: block;
font-style: italic;
margin: $grid-y/2 0 0 $grid-x*23;
}
&.help {
label.right {
clear: both;
color: lighten($color-text, 20%);
display: block;
font-style: italic;
margin: $grid-y/2 0 0 $grid-x*23;
}
}
input.text,
textarea,
select,
.TreeDropdownField {
width: 100%;
max-width: $grid-x * 64;
@include box-sizing(border-box);
&.help {
margin:0; //overrides help class adding left margin to the textarea input.
}
.help {
max-width: $grid-x * 64;
}
}
input.text,
textarea,
.TreeDropdownField {
background: #fff;
border: 1px solid lighten($color-medium-separator, 20%);
padding: ($grid-y - 1) ($grid-x - 1);
line-height: $grid-y * 2;
margin: 0;
outline: none;
@include transition(0.2s box-shadow ease-in);
@include transition(0.2s border ease-in);
@include border-radius(4px);
@include background-image(linear-gradient(#EAEAEA, #fff 10%));
&:focus {
border: 1px solid lighten($color-medium-separator, 10%);
border-top-color: $color-medium-separator;
@include box-shadow(0 1px 3px rgba(0,0,0,0.2) inset);
}
}
input[disabled], input.disabled,
textarea[disabled], textarea.disabled,
select[disabled], select.disabled {
color: lighten($color-text, 20%);
background: #efefef;
@include background-image(linear-gradient(darken(#efefef, 20%), #efefef 10%, #fff 90%, darken(#efefef, 20%)));
border: 1px solid lighten($color-medium-separator, 20%);
}
&#Action {
box-shadow: none;
}
}
form.stacked .field, .field.stacked {
label {
display: block;
float: none;
padding-bottom: 10px;
}
.middleColumn {
margin-left: 0px;
clear: left;
}
}
form .fieldgroup {
border-bottom: 1px solid rgba(201, 205, 206, 0.8);
box-shadow: 0 1px 0 rgba(244, 245, 245, 0.8);
display: block;
margin: 0 0 8px;
padding: 0 0 7px;
.fieldgroup {
border-bottom: none;
box-shadow: none;
padding-bottom: 0;
margin-bottom: 0;
}
}
form.small .field, .field.small {
label {
&.left {
width: $grid-x * 14;
}
}
.middleColumn {
margin-left: $grid-x * 15;
}
input.text,
textarea,
select,
.TreeDropdownField {
width: auto;
}
}
.field {
/* TreeDropdowns */
.TreeDropdownField {
padding: 0;
.treedropdownfield-panel {
border: 1px solid lighten($color-medium-separator, 20%);
border-top: none;
@include border-bottom-left-radius(4px);
@include border-bottom-right-radius(4px);
}
&.treedropdownfield-open-tree {
@include border-bottom-left-radius(0);
@include border-bottom-right-radius(0);
}
// Hide badges, as they cost too much horizontal space,
// and mess up rendering for selected node title
.badge {
display: none;
}
}
/* dropdowns */
.dropdown {
select {
margin-top: $grid-y;
}
}
/* chzn override */
.chzn-container {
max-width: 416px;
.chzn-results {
li {
font-size: 11px;
line-height: $grid-y * 2;
padding: $grid-y / 2 $grid-x / 2;
}
}
}
.chzn-container-active {
.chzn-single {
border: 1px solid lighten($color-medium-separator, 10%);
}
}
.chzn-container-single .chzn-single {
height: 26px;
line-height: 26px; /* not relative, as then we'd had to redo most of chzn */
font-size: $font-base-size;
@include background-image(linear-gradient(#efefef, #fff 10%, #fff 90%, #efefef));
&:hover, &:focus, &:active {
text-decoration: none;
outline: none;
}
div {
width: 24px;
b {
background-position: 4px 0px;
}
}
}
.chzn-choices {
@include border-radius(3px);
}
/* Date Fields */
input.month, input.day, input.year {
width: ($grid-x * 7);
}
input.time {
width: ($grid-x * 8); // smaller time field, since input is restricted
}
/* Hides borders in settings/access. Activated from JS */
&.remove-splitter {
border-bottom: none;
box-shadow: none;
}
}
/** ----------------------------------------------------
* Buttons
* ---------------------------------------------------- */
.cms {
.Actions, .cms-actions-row {
> * {
display: block;
float: left;
margin-right: $grid-x;
}
> *:last-child {
margin-right: 0;
}
}
.Actions {
min-height: 30px;
overflow: visible;
padding: 8px 12px;
}
.south .Actions, .ui-tabs-panel .Actions, .ui-tabs-panel iframe .Actions {
padding: 0;
}
input.loading, button.loading,
input.ui-state-default.loading, .ui-widget-content input.ui-state-default.loading,
.ui-widget-header input.ui-state-default.loading {
.ui-icon {
background: transparent url(../../images/network-save.gif) no-repeat 0 0;
}
color: lighten($color-text-dark, 20%);
border-color: darken($color-button-disabled, 10%);
cursor: default;
}
input.loading, button.loading {
&.ss-ui-action-constructive {
.ui-icon {
background: transparent url(../../images/network-save-constructive.gif) no-repeat 0 0;
}
}
}
.ss-ui-button {
margin-top:0px;
font-weight: bold;
text-decoration: none;
line-height: $grid-y * 2;
color: lighten($color-text-dark, 10%);
border: 1px solid $color-button-generic-border;
border-bottom: 1px solid darken($color-button-generic-border, 10%);
cursor: pointer;
background-color: $color-button-generic;
white-space: nowrap;
@include background(
linear-gradient(color-stops(
lighten($color-button-generic, 10%),
darken($color-button-generic, 5%)
))
);
@include text-shadow(lighten($color-button-generic, 20%) 0 1px 1px);
&.ui-state-hover, &:hover {
text-decoration: none;
background-color: lighten($color-button-generic, 10%);
@include background(
linear-gradient(color-stops(
lighten($color-button-generic, 20%),
$color-button-generic
))
);
@include box-shadow(0 0 5px darken($color-button-generic, 20%));
}
&:active, &:focus, &.ui-state-active, &.ui-state-focus {
border: 1px solid darken($color-button-generic, 20%);
background-color: lighten($color-button-generic, 10%);
@include background(
linear-gradient(color-stops(
lighten($color-button-generic, 20%),
$color-button-generic
))
);
@include box-shadow(0 0 5px darken($color-button-generic, 20%) inset);
}
/* constructive */
&.ss-ui-action-constructive {
text-shadow:none;
font-weight: bold;
color: $color-text-light;
border-color: $color-button-constructive-border;
border-bottom-color: darken($color-button-constructive-border, 10%);
background-color: $color-button-constructive;
@include background(
linear-gradient(color-stops(
scale-color(lighten($color-button-constructive, 10%), $red:50%),
$color-button-constructive
))
);
@include text-shadow(darken($color-button-constructive, 3%) 0 -1px -1px);
&.ui-state-hover, &:hover {
border-color: darken($color-button-constructive-border, 10%);
background-color: $color-button-constructive;
@include background(
linear-gradient(color-stops(
scale-color(saturate(lighten($color-button-constructive, 10%), 10%), $red:60%),
lighten($color-button-constructive, 5%)
))
);
}
&:active, &:focus, &.ui-state-active, &.ui-state-focus {
background-color: darken($color-button-constructive, 2%);
@include box-shadow(inset 0 1px 3px rgb(23, 24, 26), 0 1px 0 rgba(255, 255, 255, .6));
}
}
/* destructive */
&.ss-ui-action-destructive {
color: $color-button-destructive;
background-color: $color-button-generic;
}
&.ss-ui-button-small {
.ui-button-text {
padding: ($grid-y/4) ($grid-x/4);
font-size: $font-base-size - 2;
}
}
&.ui-state-highlight {
background-color: $color-button-highlight;
border: 1px solid $color-button-highlight-border;
}
&.ss-ui-action-minor {
background: none;
border: 0;
color: lighten($color-text-dark, 10%);
text-decoration: underline;
@include box-shadow(none);
&:hover {
text-decoration: none;
color: $color-text-dark;
}
&:focus,
&:active {
text-decoration: none;
color: lighten($color-text-dark, 20%);
}
}
&.ss-ui-button-loading {
opacity: 0.8;
}
}
.ss-ui-buttonset {
.ui-button {
margin-left: -1px;
}
}
.ss-ui-buttonset {
margin-left: 1px;
}
.ss-ui-loading-icon {
background: url(../../images/network-save.gif) no-repeat;
display: block;
width: 16px;
height: 16px;
}
}
/** ----------------------------------------------------
* Grouped form fields
* ---------------------------------------------------- */
.fieldgroup {
.fieldgroup-field {
float: left;
display: block;
padding: $grid-y 0 0 $grid-x;
&.odd {
}
&.even {
}
.field {
border: none;
padding-bottom: 0;
}
}
&.stacked {
.fieldgroup-field {
float: none;
}
}
}
.ss-toggle {
margin: $grid-y 0;
.ui-accordion-header {
font-weight: bold;
font-size: 12px;
&.ui-state-default {
@include background-image(
linear-gradient(lighten($color-shadow-light, 15%), $color-shadow-light)
);
text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
}
.ui-accordion-header-icon {
margin-top: -9px;
}
}
.ui-accordion-content {
padding: $grid-y 0 $grid-y*1.5;
.field {
@include box-shadow(none);
padding-left: $grid-x*1.5;
padding-right: $grid-x*1.5;
&:last-child {
margin-bottom: 0;
}
.middleColumn {
margin-left: 0;
}
label {
float: none;
margin-left: 0;
}
.help {
margin-left: 0;
}
}
}
}
/** ----------------------------------------------------
* Checkbox Field
* ---------------------------------------------------- */
.field.checkbox {
padding-left: $grid-x * 23;
margin-bottom: $grid-y;
input {
margin-left: 0;
}
}
input.checkbox {
margin-left: 0
}
/** ----------------------------------------------------
* Radiobutton Field
* ---------------------------------------------------- */
.field.radio {
padding-left: $grid-x * 23;
margin-bottom: $grid-y;
input {
margin-left: 0;
}
}
input.radio {
margin-left: 0
}
/** ----------------------------------------------------
* Optionsets and Checkboxsets
* ---------------------------------------------------- */
.optionset {
padding-bottom: 8px;
padding-top: 8px;
li {
float: left;
display: block;
width: $grid-x * 27;
padding-bottom: $grid-x;
padding-top: 0;
line-height: $grid-y * 2;
list-style: none;
input {
display: inline-block;
padding-right: 0;
margin-right: 0;
}
label {
display: inline;
cursor: pointer;
padding-left: $grid-y;
}
}
&.field {
padding-top: 0;
}
}
/** ----------------------------------------------------
* HTML Text
* ---------------------------------------------------- */
.htmleditor {
textarea {
visibility: hidden; // enabled by JS
}
.mceEditor {
input, select {
width: auto;
}
}
label.left {
padding-bottom: $grid-y/2;
}
}
.action-hidden {
display: none;
}
/***************************************************************
* On/Off Switch.
* Supports switching between two values (eg Draft/Published)
* Example html set-up:
* <div class="switch-states">
* <input type="checkbox" class="state" id="switch" checked>
* <label for="switch">
* <span class="switch-options">*
* <a href="" class="first active">On</a>
* <a href="" class="last">Off</a>
* </span>
* <span class="switch"></span>
* </label>
*</div>
****************************************************************/
.switch-states {
label { /* Single label includes both switch options*/
display: block;
overflow: hidden;
cursor: pointer;
@include border-radius(3px);
}
input:checked + label {
.switch-options {
margin-left: 0;
}
.switch {
right: 0px;
}
}
input.state{ /* Hidden checkbox records the state of the switch */
display:none;
}
.switch-options{ /* span wrapping both switch options */
display:block;
width: 200%;
margin-left: -100%;
@include transition(margin 0.3s ease-in 0s);
a {
text-align: right;
width: 50%;
float: left;
display: block;
padding: 0 8px 0 0;
height: 24px;
line-height: 24px;
color: #FFF;
background-color: #93BE42;
@include background-image(linear-gradient(
#2b9c32,
#64ab36
));
@include box-shadow(darken($color-menu-button, 15%) 0 0 2px inset);
@include box-sizing(border-box);
&:hover {
text-decoration: none;
@include background-image(linear-gradient(
lighten(#2b9c32, 5%),
lighten(#64ab36, 5%)
));
}
&.first {
text-align: left;
padding-left: 8px;
padding-right: 0;
background-color: $color-menu-button;
@include background-image(linear-gradient(
darken($color-menu-button, 10%),
$color-menu-button
));
&:hover{
@include background-image(linear-gradient(
$color-menu-button,
lighten($color-menu-button, 5%)
));
}
}
}
}
.switch { /* Divider, styled to look like a switch */
display:block;
width: 8px;
margin: 0px;
position: absolute;
top: 0;
bottom: 0;
right: 90px;
border: 1px solid lighten($color-medium-separator,10%);
@include box-shadow(#FFF 0 0 2px inset);
@include border-radius(3px);
background: $color-widget-bg;
@include background-image(linear-gradient(
rgba(0,0,0,0.2) 0%,
rgba(0,0,0,0) 100%
));
@include transition(all 0.3s ease-in 0s);
}
}