diff --git a/CHANGELOG.md b/CHANGELOG.md index 07005e513d9..cd6d607ed77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,14 @@ More information is available in the [VersionCake README](https://github.com/bwillis/versioncake) +* Bootstrap 4.0.0-alpha.2 is included into the admin. + +* Pagination now uses an admin-specific kaminari theme, which uses the + bootstrap4 styles. If you have a custom admin page with pagination you can + use this style with the following. + + <%= paginate @collection, theme: "solidus_admin" %> + ## Solidus 1.2.0 (2016-01-26) * Admin menu has been moved from top of the page to the left side. diff --git a/backend/app/assets/javascripts/spree/backend.js b/backend/app/assets/javascripts/spree/backend.js index 8d21d3b9678..66edd0b1b52 100644 --- a/backend/app/assets/javascripts/spree/backend.js +++ b/backend/app/assets/javascripts/spree/backend.js @@ -9,6 +9,8 @@ //= require jquery.sticky-kit.min //= require underscore-min //= require backbone +//= require solidus_admin/tether +//= require solidus_admin/bootstrap //= require prism //= require spree //= require ./backend/backbone-overrides diff --git a/backend/app/assets/stylesheets/spree/backend/_bootstrap_custom.scss b/backend/app/assets/stylesheets/spree/backend/_bootstrap_custom.scss new file mode 100644 index 00000000000..3e872fa3484 --- /dev/null +++ b/backend/app/assets/stylesheets/spree/backend/_bootstrap_custom.scss @@ -0,0 +1,666 @@ +// Variables +// +// Copy settings from this file into the provided `_custom.scss` to override +// the Bootstrap defaults without modifying key, versioned files. + + +// Table of Contents +// +// Colors +// Options +// Spacing +// Body +// Links +// Grid breakpoints +// Grid containers +// Grid columns +// Fonts +// Components + +// General variable structure +// +// Variable format should follow the `$component-modifier-state-property` order. + + +// Colors +// +// Grayscale and brand colors for use across Bootstrap. + +$gray-dark: #373a3c !default; +$gray: #55595c !default; +$gray-light: #818a91 !default; +$gray-lighter: #eceeef !default; +$gray-lightest: #f7f7f9 !default; + +$brand-primary: $color-3 !default; +$brand-success: $color-2 !default; +$brand-info: #5bc0de !default; +$brand-warning: $color-6 !default; +$brand-danger: $color-5 !default; + + +// Options +// +// Quickly modify global styling by enabling or disabling optional features. + +$enable-flex: true !default; +$enable-rounded: true !default; +$enable-shadows: false !default; +$enable-gradients: false !default; +$enable-transitions: false !default; +$enable-hover-media-query: false !default; +$enable-grid-classes: false !default; + + +// Spacing +// +// Control the default styling of most Bootstrap elements by modifying these +// variables. Mostly focused on spacing. + +$spacer: 1rem !default; +$spacer-x: $spacer !default; +$spacer-y: $spacer !default; +$spacers: ( + 0: ( + x: 0, + y: 0 + ), + 1: ( + x: $spacer-x, + y: $spacer-y + ), + 2: ( + x: ($spacer-x * 1.5), + y: ($spacer-y * 1.5) + ), + 3: ( + x: ($spacer-x * 3), + y: ($spacer-y * 3) + ) +) !default; +$border-width: 1px !default; + + +// Body +// +// Settings for the `
`s get reset. However, we also reset the +// bottom margin to use `rem` units instead of `em`. +p { + margin-top: 0; + margin-bottom: 1rem; +} + +// Abbreviations and acronyms +abbr[title], +// Add data-* attribute to help out our tooltip plugin, per https://github.com/twbs/bootstrap/issues/5257 +abbr[data-original-title] { + cursor: help; + border-bottom: 1px dotted $abbr-border-color; +} + +address { + margin-bottom: 1rem; + font-style: normal; + line-height: inherit; +} + +ol, +ul, +dl { + margin-top: 0; + margin-bottom: 1rem; +} + +ol ol, +ul ul, +ol ul, +ul ol { + margin-bottom: 0; +} + +dt { + font-weight: $dt-font-weight; +} + +dd { + margin-bottom: .5rem; + margin-left: 0; // Undo browser default +} + +blockquote { + margin: 0 0 1rem; +} + + +// +// Links +// + +a { + color: $link-color; + text-decoration: $link-decoration; + + @include hover-focus { + color: $link-hover-color; + text-decoration: $link-hover-decoration; + } + + &:focus { + @include tab-focus(); + } +} + + +// +// Code +// + +pre { + // Remove browser default top margin + margin-top: 0; + // Reset browser default of `1em` to use `rem`s + margin-bottom: 1rem; +} + + +// +// Figures +// + +figure { + // Normalize adds `margin` to `figure`s as browsers apply it inconsistently. + // We reset that to create a better flow in-page. + margin: 0 0 1rem; +} + + +// +// Images +// + +img { + // By default, ``s are `inline-block`. This assumes that, and vertically + // centers them. This won't apply should you reset them to `block` level. + vertical-align: middle; + // Note: ``s are deliberately not made responsive by default. + // For the rationale behind this, see the comments on the `.img-fluid` class. +} + + +// iOS "clickable elements" fix for role="button" +// +// Fixes "clickability" issue (and more generally, the firing of events such as focus as well) +// for traditionally non-focusable elements with role="button" +// see https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile + +[role="button"] { + cursor: pointer; +} + + +// Avoid 300ms click delay on touch devices that support the `touch-action` CSS property. +// +// In particular, unlike most other browsers, IE11+Edge on Windows 10 on touch devices and IE Mobile 10-11 +// DON'T remove the click delay when `` is present. +// However, they DO support removing the click delay via `touch-action: manipulation`. +// See: +// * http://v4-alpha.getbootstrap.com/content/reboot/#click-delay-optimization-for-touch +// * http://caniuse.com/#feat=css-touch-action +// * http://patrickhlauke.github.io/touch/tests/results/#suppressing-300ms-delay + +a, +area, +button, +[role="button"], +input, +label, +select, +summary, +textarea { + touch-action: manipulation; +} + + +// +// Tables +// + +table { + // Reset for nesting within parents with `background-color`. + background-color: $table-bg; +} + +caption { + padding-top: $table-cell-padding; + padding-bottom: $table-cell-padding; + color: $text-muted; + text-align: left; + caption-side: bottom; +} + +th { + // Centered by default, but left-align-ed to match the `td`s below. + text-align: left; +} + + +// +// Forms +// + +label { + // Allow labels to use `margin` for spacing. + display: inline-block; + margin-bottom: .5rem; +} + +// Work around a Firefox/IE bug where the transparent `button` background +// results in a loss of the default `button` focus styles. +// +// Credit: https://github.com/suitcss/base/ +button:focus { + outline: 1px dotted; + outline: 5px auto -webkit-focus-ring-color; +} + +input, +button, +select, +textarea { + // Remove all `margin`s so our classes don't have to do it themselves. + margin: 0; + // Normalize includes `font: inherit;`, so `font-family`. `font-size`, etc are + // properly inherited. However, `line-height` isn't addressed there. Using this + // ensures we don't need to unnecessarily redeclare the global font stack. + line-height: inherit; + // iOS adds rounded borders by default + border-radius: 0; +} + +textarea { + // Textareas should really only resize vertically so they don't break their (horizontal) containers. + resize: vertical; +} + +fieldset { + // Chrome and Firefox set a `min-width: min-content;` on fieldsets, + // so we reset that to ensure it behaves more like a standard block element. + // See https://github.com/twbs/bootstrap/issues/12359. + min-width: 0; + // Reset the default outline behavior of fieldsets so they don't affect page layout. + padding: 0; + margin: 0; + border: 0; +} + +legend { + // Reset the entire legend element to match the `fieldset` + display: block; + width: 100%; + padding: 0; + margin-bottom: .5rem; + font-size: 1.5rem; + line-height: inherit; +// border: 0; +} + +input[type="search"] { + // Undo Normalize's default here to match our global overrides. + box-sizing: inherit; + // This overrides the extra rounded corners on search inputs in iOS so that our + // `.form-control` class can properly style them. Note that this cannot simply + // be added to `.form-control` as it's not specific enough. For details, see + // https://github.com/twbs/bootstrap/issues/11586. + -webkit-appearance: none; +} + +// todo: needed? +output { + display: inline-block; +// font-size: $font-size-base; +// line-height: $line-height; +// color: $input-color; +} + +// Always hide an element with the `hidden` HTML attribute (from PureCSS). +[hidden] { + display: none !important; +} diff --git a/backend/vendor/assets/stylesheets/solidus_admin/bootstrap/_responsive-embed.scss b/backend/vendor/assets/stylesheets/solidus_admin/bootstrap/_responsive-embed.scss new file mode 100644 index 00000000000..24432195912 --- /dev/null +++ b/backend/vendor/assets/stylesheets/solidus_admin/bootstrap/_responsive-embed.scss @@ -0,0 +1,39 @@ +// Credit: Nicolas Gallagher and SUIT CSS. + +.embed-responsive { + position: relative; + display: block; + height: 0; + padding: 0; + overflow: hidden; + + .embed-responsive-item, + iframe, + embed, + object, + video { + position: absolute; + top: 0; + bottom: 0; + left: 0; + width: 100%; + height: 100%; + border: 0; + } +} + +.embed-responsive-21by9 { + padding-bottom: percentage(9 / 21); +} + +.embed-responsive-16by9 { + padding-bottom: percentage(9 / 16); +} + +.embed-responsive-4by3 { + padding-bottom: percentage(3 / 4); +} + +.embed-responsive-1by1 { + padding-bottom: percentage(1 / 1); +} diff --git a/backend/vendor/assets/stylesheets/solidus_admin/bootstrap/_tables.scss b/backend/vendor/assets/stylesheets/solidus_admin/bootstrap/_tables.scss new file mode 100644 index 00000000000..8ec35b9d407 --- /dev/null +++ b/backend/vendor/assets/stylesheets/solidus_admin/bootstrap/_tables.scss @@ -0,0 +1,193 @@ +// +// Basic Bootstrap table +// + +.table { + width: 100%; + max-width: 100%; + margin-bottom: $spacer; + + th, + td { + padding: $table-cell-padding; + line-height: $line-height; + vertical-align: top; + border-top: $table-border-width solid $table-border-color; + } + + thead th { + vertical-align: bottom; + border-bottom: (2 * $table-border-width) solid $table-border-color; + } + + tbody + tbody { + border-top: (2 * $table-border-width) solid $table-border-color; + } + + .table { + background-color: $body-bg; + } +} + + +// +// Condensed table w/ half padding +// + +.table-sm { + th, + td { + padding: $table-sm-cell-padding; + } +} + + +// Bordered version +// +// Add borders all around the table and between all the columns. + +.table-bordered { + border: $table-border-width solid $table-border-color; + + th, + td { + border: $table-border-width solid $table-border-color; + } + + thead { + th, + td { + border-bottom-width: (2 * $table-border-width); + } + } +} + + +// Zebra-striping +// +// Default zebra-stripe styles (alternating gray and transparent backgrounds) + +.table-striped { + tbody tr:nth-of-type(odd) { + background-color: $table-bg-accent; + } +} + + +// Hover effect +// +// Placed here since it has to come after the potential zebra striping + +.table-hover { + tbody tr { + @include hover { + background-color: $table-bg-hover; + } + } +} + + +// Table backgrounds +// +// Exact selectors below required to override `.table-striped` and prevent +// inheritance to nested tables. + +// Generate the contextual variants +@include table-row-variant(active, $table-bg-active); +@include table-row-variant(success, $state-success-bg); +@include table-row-variant(info, $state-info-bg); +@include table-row-variant(warning, $state-warning-bg); +@include table-row-variant(danger, $state-danger-bg); + + +// Responsive tables +// +// Wrap your tables in `.table-responsive` and we'll make them mobile friendly +// by enabling horizontal scrolling. Only applies <768px. Everything above that +// will display normally. + +.table-responsive { + display: block; + width: 100%; + min-height: 0.01%; // Workaround for IE9 bug (see https://github.com/twbs/bootstrap/issues/14837) + overflow-x: auto; + + // TODO: find out if we need this still. + // + // border: $table-border-width solid $table-border-color; + // -ms-overflow-style: -ms-autohiding-scrollbar; // See https://github.com/twbs/bootstrap/pull/10057 +} + + +.thead-inverse { + th { + color: #fff; + background-color: $gray-dark; + } +} +.thead-default { + th { + color: $gray; + background-color: $gray-lighter; + } +} + +.table-inverse { + color: $gray-lighter; + background-color: $gray-dark; + + &.table-bordered { + border: 0; + } + + th, + td, + thead th { + border-color: $gray; + } +} + + +.table-reflow { + thead { + float: left; + } + + tbody { + display: block; + white-space: nowrap; + } + + th, + td { + border-top: $table-border-width solid $table-border-color; + border-left: $table-border-width solid $table-border-color; + + &:last-child { + border-right: $table-border-width solid $table-border-color; + } + } + + thead, + tbody, + tfoot { + &:last-child { + tr:last-child { + th, + td { + border-bottom: $table-border-width solid $table-border-color; + } + } + } + } + + tr { + float: left; + + th, + td { + display: block !important; + border: $table-border-width solid $table-border-color; + } + } +} diff --git a/backend/vendor/assets/stylesheets/solidus_admin/bootstrap/_tooltip.scss b/backend/vendor/assets/stylesheets/solidus_admin/bootstrap/_tooltip.scss new file mode 100644 index 00000000000..941579ec975 --- /dev/null +++ b/backend/vendor/assets/stylesheets/solidus_admin/bootstrap/_tooltip.scss @@ -0,0 +1,85 @@ +// Base class +.tooltip { + position: absolute; + z-index: $zindex-tooltip; + display: block; + // Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element. + // So reset our font and text properties to avoid inheriting weird values. + @include reset-text(); + font-size: $font-size-sm; + opacity: 0; + + &.in { opacity: $tooltip-opacity; } + + &.tooltip-top, + &.bs-tether-element-attached-bottom { + padding: $tooltip-arrow-width 0; + margin-top: -3px; + + .tooltip-arrow { + bottom: 0; + left: 50%; + margin-left: -$tooltip-arrow-width; + border-width: $tooltip-arrow-width $tooltip-arrow-width 0; + border-top-color: $tooltip-arrow-color; + } + } + &.tooltip-right, + &.bs-tether-element-attached-left { + padding: 0 $tooltip-arrow-width; + margin-left: 3px; + + .tooltip-arrow { + top: 50%; + left: 0; + margin-top: -$tooltip-arrow-width; + border-width: $tooltip-arrow-width $tooltip-arrow-width $tooltip-arrow-width 0; + border-right-color: $tooltip-arrow-color; + } + } + &.tooltip-bottom, + &.bs-tether-element-attached-top { + padding: $tooltip-arrow-width 0; + margin-top: 3px; + + .tooltip-arrow { + top: 0; + left: 50%; + margin-left: -$tooltip-arrow-width; + border-width: 0 $tooltip-arrow-width $tooltip-arrow-width; + border-bottom-color: $tooltip-arrow-color; + } + } + &.tooltip-left, + &.bs-tether-element-attached-right { + padding: 0 $tooltip-arrow-width; + margin-left: -3px; + + .tooltip-arrow { + top: 50%; + right: 0; + margin-top: -$tooltip-arrow-width; + border-width: $tooltip-arrow-width 0 $tooltip-arrow-width $tooltip-arrow-width; + border-left-color: $tooltip-arrow-color; + } + } +} + +// Wrapper for the tooltip content +.tooltip-inner { + max-width: $tooltip-max-width; + padding: 3px 8px; + color: $tooltip-color; + text-align: center; + background-color: $tooltip-bg; + @include border-radius($border-radius); +} + +// Arrows +.tooltip-arrow { + position: absolute; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} diff --git a/backend/vendor/assets/stylesheets/solidus_admin/bootstrap/_type.scss b/backend/vendor/assets/stylesheets/solidus_admin/bootstrap/_type.scss new file mode 100644 index 00000000000..f770d20ed8f --- /dev/null +++ b/backend/vendor/assets/stylesheets/solidus_admin/bootstrap/_type.scss @@ -0,0 +1,157 @@ +// +// Headings +// + +h1, h2, h3, h4, h5, h6, +.h1, .h2, .h3, .h4, .h5, .h6 { + margin-bottom: $headings-margin-bottom; + font-family: $headings-font-family; + font-weight: $headings-font-weight; + line-height: $headings-line-height; + color: $headings-color; +} + +h1 { font-size: $font-size-h1; } +h2 { font-size: $font-size-h2; } +h3 { font-size: $font-size-h3; } +h4 { font-size: $font-size-h4; } +h5 { font-size: $font-size-h5; } +h6 { font-size: $font-size-h6; } + +// These declarations are kept separate from and placed after +// the previous tag-based declarations so that the classes beat the tags in +// the CSS cascade, and thus