_forms.scss 17.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812
/**
 * 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;
	@include doubleborder(bottom, $color-light-separator, $box-shadow-shine-minimal);
	//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: $grid-y 0;

	&.noborder, &:last-child {
		padding-bottom: 0;
		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;
		}
		.description {
			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;
	}

	.fieldgroup .fieldgroup-field.last {  /* This is used on page/settings/visibility */
    	padding-bottom: 8px; /* replicates li item spacing */
    }

	// Additional help text to clarify the field intent,
	// displayed alongside the field (rather than in a tooltip)
	.description {
		clear: both;
		color: lighten($color-text, 20%);
		display: block;
		font-style: italic;
		line-height: $grid-y * 2;
		margin: $grid-y/2 0 0 $grid-x*23; // left align with .middleColumn
	}
	
	&.checkbox .description, &.ss-gridfield .description {
		margin-left: 0;
	}
	
	input.text,
	textarea,
	select,
	.TreeDropdownField {
		margin-left: 10px;
		width: 100%;
		max-width: $grid-x * 64;
		@include box-sizing(border-box);
		&.description {
			margin:0; //overrides help class adding left margin to the textarea input.
		}
		.description {
			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 {
	@include form-field-stacked;
}

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);
		}

		&.treedropdownfield-with-rise {
			-webkit-border-radius: 0 0 4px 4px;
			-moz-border-radius: 0 0 4px 4px;
			border-radius: 0 0 4px 4px;

			.treedropdownfield-panel {
				border: 1px solid lighten($color-medium-separator, 20%);
				border-bottom: none;

				-webkit-border-radius: 4px 4px 0 0;
			-moz-border-radius: 4px 4px 0 0;
			border-radius: 4px 4px 0 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;
		}
	
		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 * 11); // 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 {
	.button-no-style{
		button{
			@include border-radius(0);
			background: none;
			border: none;
			color: $color-text-blue-link;
			display: block;
			font-weight:normal;	
			margin:0;
			outline:none;
			padding-left:10px;
			padding-right:10px;	
			text-align: left;			
			text-shadow: none;	
			white-space:normal;		
			&.ss-ui-action-destructive{
				color: darken($color-error,25%);
			}
			span{
				padding-left:0;
				padding-right:0;
			}
			&:hover, &:focus, &:active{	
				@include box-shadow(none);		
				outline:none;
				background:none;				
				border:none;
			}
			&.loading {
				background: transparent url(../../images/network-save.gif) no-repeat $grid-x center;
				.ui-button-text {
					padding-left: 16px /* icon */ + ($grid-x/2);
				}
				
				
			}
		}
	}

	.Actions, .cms-actions-row {
		> * {
			display: block;
			float: left;
			margin-right: $grid-x;
		}

		> *:last-child {
			margin-right: 0;
		}
	}

	.Actions {
		min-height: 30px;
		overflow: auto;
		padding: $grid-x $grid-y * 1.5;
	}
	.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);
		}

		&.ss-ui-action-minor {
			span {
				padding-left: 0;
				padding-right: 0;
			}
		}
		
		/* 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 {
				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 $grid-x 0 0;

		.field {
			border: none;
			padding-bottom: 0;
		}

		.fieldholder-small {
			padding: 0 0 $grid-y 0;
		}

		.fieldgroup input.text, .fieldgroup textarea, .fieldgroup select, .fieldgroup .TreeDropdownField {
			margin-left: 0;
		}

		// Style specific label with display block, otherwise
		// checkbox falls under the text
		.fieldholder-small-label {
			display: block;
		}

		label {
			padding: $grid-y $grid-x $grid-y 0;
			margin-left: 0;
			margin-right: 1em;
			width: auto;
		}
	}

	&.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;
			}
			.description {
				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 {

	@include form-field-stacked;
	
	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 up to 5 values (used for Draft/Published)
* Example html set-up:
*	<fieldset class="switch-states size_2"> 			
*		<div class="switch">				
*			<input id="Draft" class="first" name="view" type="radio" checked>
*			<label for="Draft">Draft</label>	
*			<input id="Published" class="last" name="view" type="radio">
*			<label for="Published">Published</label>						
*			<span class="slide-button"></span>	
*		</div>			
*	</fieldset>
****************************************************************/
fieldset.switch-states{	
	padding:0 20px 0 0;	
	margin-right: 5px;

	.switch{
		@include box-shadow(inset 0 2px 6px rgba(0, 0, 0, 0.1), 0 1px 0px rgba(255, 255, 255, 0.1));
		@include border-radius(3px);
		-webkit-animation: bugfix infinite 1s; //Bugfix for older Webkit, including mobile Webkit.
		background:lighten(#2d3035,69%); 
		display: block;				
		height: 25px;
		margin-top:3px;
		padding:0 10px;	
		position: relative;			
		width:100%;
		z-index:5;
		
		label{
			@include hide-text-overflow;
			@include text-shadow(0 1px 0 rgba(255,255,255,0.5));	
			color:lighten($color-text-dark,40%);
			color:rgba($color-text-dark,0.5);
			cursor: pointer;
			float:left;
			font-weight:bold;
			height: 100%;
			line-height: 25px;		
			position:relative;
			z-index:2;	
			/* Make text unselectable in browsers that support that */
			-webkit-touch-callout: none;
			-webkit-user-select: none;
			-khtml-user-select: none;
			-moz-user-select: none;
			-ms-user-select: none;
			user-select: none;			
			&:hover{
				color:lighten($color-text-dark, 30%);	
				color:rgba($color-text-dark,0.7);								
			}	
			span{
				@include box-sizing('border-box');
				@include hide-text-overflow;
				display:inline-block;
				padding:0 10px;
			}
		}
		input {
			opacity: 0;
			filter: alpha(opacity = 0);
			visibility:none;	
			position: absolute;			
			&:checked + label {
				@include transition(all 0.3s ease-out 0s); 	
				color: #fff;
				text-shadow: 0 -1px 0 darken($color-menu-button,10%);
			}
		}
		.slide-button{
			@include background-image(linear-gradient(
				#2b9c32,
				#64ab36
			));		
			@include border-radius(3px);
			@include box-shadow(inset 0 2px 6px rgba(0, 0, 0, 0.3), 0 1px 0px rgba(255, 255, 255, 0.2));
			@include text-shadow(0 1px 0 rgba(255,255,255,0.5));
			@include transition(all 0.3s ease-out 0s); 	
			background-color: #2b9c32; 
			display:block;
			height: 100%;
			left:0;
			padding: 0;
			position: absolute;
			top: 0;	
			z-index: 1;	
		}
	}

	/*	
		Produce css for up to 5 states.

		Note: with a little adjustment the switch can take more than 5 items, 
		but a dropdown would probably be more appropriate
	*/
	@for $i from 1 through 5 {
		&.size_#{$i} {
			label, .slide-button { 
				width:  100% / $i;				
			}	  			
			@if $i == 1{
				label span{
					padding-right:0; //even up the padding for a single item
				}
			}
			input:checked:nth-of-type(2) ~ .slide-button {	
				left: 100% / $i;
			}
			input:checked:nth-of-type(3) ~ .slide-button {	
				left: (100% / $i) * 2;
			}
			input:checked:nth-of-type(4) ~ .slide-button {	
				left: (100% / $i) * 3;
			}
			input:checked:nth-of-type(5) ~ .slide-button {	
				left: (100% / $i) * 4;
			}
		} 
	}		
} 
//old web-kit browser fix	
@-webkit-keyframes bugfix { from { position: relative; } to { position: relative; } }