af83/chouette-core

View on GitHub
app/packs/stylesheets/modules/_vj_collection.scss

Summary

Maintainability
Test Coverage
//-----------------//
//  VJ Collection  //
//-----------------//

#vehicle_journeys_wip,
.consolidated-view {
  $selection-background-color: $smooth-green;
  .selection-mode {
    * {
      -webkit-user-select: none !important;
      -khtml-user-select: none !important;
      -moz-user-select: none !important;
      -ms-user-select: none !important;
      user-select: none !important;
    }
    .t2e-item-list {
      .td {
        transition: background-color 0.5s;
        .cellwrap {
          pointer-events: none;
          &.headlined:before {
            transition-delay: 0.5s;
            transition-property: background-color;
          }
        }
        & > .selection-size-helper {
          position: absolute;
          bottom: 0%;
          right: 0%;
          color: $selection-background-color;
          border-top: 2px solid $selection-background-color;
          border-left: 2px solid $selection-background-color;
          padding: 5px 10px;
          background-color: white;
          height: auto;
          z-index: 10;
        }
      }
      .selected {
        background-color: transparentize($selection-background-color, 0.5);
        .cellwrap.headlined {
          &:before {
            transition-delay: 0s;
          }
        }
      }
      .td:hover {
        cursor: pointer;
        background-color: transparentize($selection-background-color, 0.5);
        &:not(.selected) {
          .cellwrap.headlined {
            &:before {
              background-color: white;
              transition-delay: 0s;
              transition-property: background-color;
            }
          }
        }
      }
    }
  }
  .selection-locked .t2e-item-list {
    .td.selected {
      background-color: $selection-background-color;
    }
  }
  .table-2entries {
    .t2e-head {
      > .td {
        position: relative;
        padding-left: 25px;

        .fa {
          margin-left: 5px;
        }
        > .headlined {
          &:before {
            margin-left: -25px;
            padding-left: 25px;
          }
        }
        > div > span {
          position: relative;
          display: block;
          height: 100%;

          > span:not(.small) {
            position: absolute;
            display: block;
            line-height: 1em;
            top: 50%;
            transform: translateY(-50%);
            margin-top: -2px;
          }
          &:before {
            content: '';
            display: block;
            width: 10px;
            height: 10px;
            background-color: #fff;
            border: 2px solid $darkgrey;
            border-radius: 50%;
            position: absolute;
            z-index: 5;
            left: -20px;
            top: 50%;
            margin-top: -5px;
          }
          &:after {
            content: '';
            display: block;
            width: 4px;
            margin: 0 3px;
            background-color: rgba($grey, 0.5);
            position: absolute;
            z-index: 3;
            top: -6px;
            left: -20px;
            bottom: 0;
          }
        }
        > .headlined > span {
          height: calc(100% - (1.4em + 12px));

          &:after {
            top: calc((1.4em + 18px) * -1);
          }
        }
        &:last-child > div > span {
          &:after {
            bottom: 50%;
          }
        }
        &:nth-child(2) > div > span {
          &:after {
            top: 50%;
          }
        }
      }
    }
    .t2e-item {
      > .th {
        max-width: 230px;
        overflow-x: auto;
      }
    }
    &.no_result {
      .t2e-head > .td > div > span,
      .t2e-head > .td > .headlined > span {
        > span {
          position: relative;
          top: 0;
          transform: none;
          margin-top: 0;
        }
        &:after {
          bottom: -6px;
        }
      }
      .t2e-head > .td:last-child > div > span {
        &:after {
          bottom: 50%;
        }
      }
    }
  }
  .table-2entries .t2e-head {
    .detailed-timetables {
      &:after {
        left: 0;
      }
      .fa {
        margin-right: 5px;
      }
    }
    .detailed-timetables-bt {
      text-decoration: none;
      .fa {
        margin-right: 5px;
        color: $red;
        transition: transform 0.1s;
      }
      &.active .fa {
        transform: rotate(180deg);
      }
    }
  }
  .table-2entries .t2e-head > .td:nth-child(2) > div,
  .table-2entries .t2e-head > .td:last-child > div,
  .table-2entries.no_result .t2e-head > .td:last-child > div {
    > span:before {
      content: '•';
      color: $darkgrey;
      text-align: center;
      font-size: 28px;
      letter-spacing: 0;
      text-indent: -0.01em;
      line-height: 12px;
      width: 15px;
      height: 15px;
      left: -23px;
      top: 50%;
      margin-top: -8px;
    }
  }
  .detailed-timetables {
    padding-top: 10px;
    text-align: left;
    margin-bottom: -5px;

    & > div {
      position: relative;
      border-left: 1px solid $lightgrey;
      padding-left: 10px;
      a {
        text-decoration: none;
        border: none;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
        margin: 0;
        line-height: 1em;
        max-width: 100%;
      }
      &:before {
        position: absolute;
        left: 0px;
        top: 0;
        right: -8px;
        content: "";
        border-top: 1px solid $lightgrey;
      }
      font-size: 0.8em;
      height: 44px;
      position: relative;
      padding-bottom: 5px;

      p {
        margin: 0;
      }
      p:first-child {
        padding-top: 8px;
        font-weight: bold;
      }
    }
  }
  .t2e-item-list .detailed-timetables > div {
    border-left: none;
    &:after {
      top: 50%;
      left: 50%;
      content: "";
      border: 1px solid black;
      width: 20px;
      height: 20px;
      margin-left: -10px;
      margin-top: -10px;
      position: absolute;
      border-radius: 20px;
    }
    &.active:after {
      background: black;
    }
    &:before {
      left: -8px;
    }
  }
  // Errors
  .table-2entries .t2e-item-list {
    .t2e-item {
      position: relative;

      .th .vj_tt {
        display: inline-block;
        vertical-align: top;

        + .vj_tt {
          margin-left: 5px;
        }
      }
      &.has-error {
        .errors {
          color: $red;
          font-size: 0.8em;
        }
        &:before {
          content: '';
          position: absolute;
          top: 0;
          left: 0;
          right: 0;
          bottom: 0;
          border: 2px solid $red;
        }
        > .th {
          > div:first-child,
          > div:first-child + div {
            color: $red;
          }
        // Reset default behaviour
        }
        .form-control {
          border-color: #ccc;
        }
      }
    }
  }
}
.consolidated-view {
  $highlighted: #d4ba32;
  .togglable {
    &.ready {
      transition: all 0.5s;
      &:not(.open) {
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none;
      }
    }
  }
  .line {
    & > .head {
      font-size: 1.3em;
      text-transform: capitalize;
      border-top: 3px solid black;
      border-bottom: 3px solid black;
      padding: 10px;
    }
    .routes {
      .route {
        background: #F9F9F9;
        & > .head {
          &.highlighted {
            .pull-right,
            span.fa {
              color: $highlighted !important;
            }
          }
          a {
            padding: 15px;
            color: black;
            font-size: 1.2em;
            text-transform: capitalize;
            display: block;
            text-decoration: none;
            &:hover {
              background-color: #F0F0F0;
            }
            .fa {
              color: $red;
              transition: transform 0.1s;
            }
            &.active .fa {
              transform: rotate(180deg);
            }
            .pull-right {
              font-size: 0.9em;
              text-transform: lowercase;
            }
          }
        }
        .vehicle-journeys {
          display: block;
          overflow: hidden;
          margin-bottom: 0px;
          & > * {
            display: inline-block;
          }
          .t2e-item-list {
            overflow: scroll;
            & > * {
              overflow: hidden;
              min-width: 0;
              max-width: none;
            }
          }
          &.open {
            margin-bottom: 40px;
          }
          .highlighted {
            background-color: lighten($highlighted, 20%) !important;
          }
          .disabled {
            color: #bbb;
          }
          .t2e-item-list .t2e-item {
            .th {
              min-width: 100px;
              max-width: 150px;
              & > div {
                text-overflow: ellipsis;
                overflow: hidden;
                white-space: nowrap;
              }
            }
            .td {
              text-align: center;
              &:hover:after {
                position: absolute;
                height: 100%;
                bottom: 0;
                left: -10000px;
                right: -10000px;
                content: "";
                background-color: $red;
                opacity: 0.1;
                z-index: 10;
              }
              &.headlined:hover:after {
                height: 50%;
              }
            }
          }
        }
      }
    }
  }
  .table-2entries > .t2e-head > .td > div > span::after {
    bottom: -6px !important;
  }
  .table-2entries > .t2e-head > .td > div > span {
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }
  .table.table-2entries .t2e-item-list .t2e-item {
    background-color: #F9F9F9;
  }
  .table.table-2entries .td > div.headlined::before {
    border-right: none;
  }
  .left-span {
    margin-right: 15px;
    padding: 1px 5px;
    font-size: 12px;
    line-height: 1.5;
    border-adius: 3px;
  }
}