Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

9.0 KB
Raw Blame
//-- copyright
// OpenProject is an open source project management software.
// Copyright (C) the OpenProject GmbH
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License version 3.
//
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
// Copyright (C) 2006-2013 Jean-Philippe Lang
// Copyright (C) 2010-2013 the ChiliProject Team
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//
// See COPYRIGHT and LICENSE files for more details.
//++

// NOTE: these are demo ski

//nm - toaster messages
//pb - progress bar

$nm-font-size: var(--body-font-size)
$nm-border-radius: rem-calc(2px)
$nm-box-padding: rem-calc(10px 35px 10px 35px)
$nm-toaster-width: rem-calc(550)

$nm-color-success-border: var(--borderColor-success-muted)
$nm-color-success-icon: var(--fgColor-success)
$nm-color-success-background: var(--bgColor-success-muted)

$nm-color-warning-border: var(--borderColor-attention-muted)
$nm-color-warning-icon: var(--fgColor-attention)
$nm-color-warning-background: var(--bgColor-attention-muted)

$nm-color-error-icon: var(--fgColor-danger)
$nm-color-error-background: var(--bgColor-danger-muted)
$nm-color-error-border: var(--borderColor-danger-muted)

$nm-color-info-icon: var(--fgColor-accent)
$nm-color-border: var(--borderColor-accent-muted)
$nm-color-background: var(--bgColor-accent-muted)

$nm-padding-box: rem-calc(10px)
$nm-pb-border-color: $nm-color-border
$nm-pb-regress-color: whiteSmoke
$nm-pb-regress-fill-color: #00558b
$nm-pb-border-radius: rem-calc(6)
$nm-pb-height: rem-calc(20)
$nm-pb-background-color: #155282

$nm-upload-status-font-size: rem-calc(18)
$nm-upload-file-status-icon-size: rem-calc(12)

$nm-upload-box-padding: rem-calc(15) rem-calc(25)

%nm-icon-error
  @include icon-mixin-error

%nm-icon-success
  @include icon-mixin-checkmark

%nm-icon-warning
  @include icon-mixin-warning

%nm-icon-info
  @include icon-mixin-info1

%error-placeholder
  background-color: $nm-color-error-background
  border-color: var(--content-form-danger-zone-bg-color)

%success-placeholder
  background-color: $nm-color-success-background
  border-color: $nm-color-success-border

%warning-placeholder
  background-color: $nm-color-warning-background
  border-color: $nm-color-warning-border

%info-placeholder
  background-color: $nm-color-background
  border-color: $nm-color-border

@mixin messages-icon($top:rem-calc(11), $left:rem-calc(10), $size:rem-calc(18))
  @include icon-font-common
  position: absolute
  top: $top
  left: $left
  font-size: $size



.op-toast
  @include spot-z-index("toast")

  display: flex
  box-shadow: rem-calc(1px 2px 3px) rgba(0, 0, 0, 0.2)
  border: rem-calc(1px) solid $nm-color-border
  font-size: $nm-font-size
  word-wrap: break-word
  position: relative

  &--wrapper
    background-color: var(--body-background)

  & .button
    margin: rem-calc(10px 10px 0 0)

  .op-toast--close
    position: absolute
    color: var(--button-invisible-iconColor-rest)
    top: $spot-spacing-0_75
    right: $spot-spacing-0_5

    &:hover
      text-decoration: none

  &.-error,
  &.-success,
  &.-warning,
  &.-info,
  &.-loading
    padding: $nm-box-padding

  &.-left-margin
    margin-left: 20px

  &.-top-margin
    margin-top: 1rem

  &.-error
    @extend %error-placeholder

    &::before
      color: $nm-color-error-icon

    &:not(.toast-icon)::before
      @include messages-icon
      @extend %nm-icon-error

  &.-success
    @extend %success-placeholder

    &::before
      color: $nm-color-success-icon

    &:not(.toast-icon)::before
      @include messages-icon
      @extend %nm-icon-success

  &.-warning
    @extend %warning-placeholder

    &::before
      color: $nm-color-warning-icon

    &:not(.toast-icon)::before
      @include messages-icon
      @extend %nm-icon-warning

  &.-info
    @extend %info-placeholder

    &::before
      color: $nm-color-info-icon

    &:not(.toast-icon)::before
      @include messages-icon
      @extend %nm-icon-info

  &.toast-icon
    &::before
      @include messages-icon

  &.-loading
    @extend %info-placeholder

    &::before
      @include messages-icon

  &.-upload
    @extend %info-placeholder
    padding: $nm-upload-box-padding

  //@hack adapting to provided styles
  //messy I dont have all the details for a magic resolve, this might change
  & p, & div, & ul
    margin-bottom: 0

  & p, & div, & ul > li, & .button
    font-size: $nm-font-size

  &.-with-bottom-spacing
    margin-bottom: 2rem

[class^="icon-"]
  &.-error
    color: $nm-color-error-background


  &.-warning
    color: $nm-color-warning-icon

  &.-info
    color: $nm-color-info-icon

.op-toast--wrapper
  position: absolute
  max-width: $nm-toaster-width
  margin: 0 auto
  left: 10%
  right: 10%

.op-toast--wrapper
  // Higher than loading indicator and modal wrapper!
  z-index: 10000
  top: 4rem

  .op-toast--casing
    position: relative

    .op-toast
      margin-bottom: rem-calc(3px)


// awesome animations
.op-toast
  &.ng-enter
    transition: opacity 0.5s ease
    opacity: 0

  &.ng-enter.ng-enter-active
    opacity: 1

  &.ng-leave
    transition: opacity 2s ease
    opacity: 1

  &.ng-leave.ng-leave-active
    opacity: 0

  .op-toast--content
    width: 100%

    > div,
    > p
      margin-bottom: 0
      color: var(--body-font-color)

      &.-with-inline-links
        display: flex
        align-items: center

    progress[value]
      @extend %progress-styles

      &::-moz-progress-bar
        border-radius: $nm-pb-border-radius

      &::-webkit-progress-bar
        background-color: $nm-pb-regress-color
        border-radius: $nm-pb-border-radius

      &::-webkit-progress-value
        border-radius: $nm-pb-border-radius

.op-toast.-loading
  width: 275px
  .op-toast--content
    display: flex
    align-items: center

// upload toaster styles
%progress-styles
  appearance: none
  border-radius: $nm-pb-border-radius
  height: $nm-pb-height
  animation: animate-stripes 5s linear infinite
  background-color: $nm-pb-regress-color
  border: rem-calc(1) solid $nm-pb-border-color
  color: $nm-pb-background-color
  margin: 0
  width: 100%

  &::-webkit-progress-bar
    background: $nm-pb-regress-color

  &::-webkit-progress-value
    background: $nm-pb-regress-fill-color

  &::-moz-progress-bar
    background: $nm-pb-regress-fill-color

.op-toast--toggle-message
  font-size: rem-calc(16)
  margin: rem-calc(5 0 15 0)

.op-toast--uploads
  list-style: none
  padding: 0
  margin: 0

.op-toast--uploads-element
  margin: rem-calc(5 0)

  .filename
    font-weight: var(--base-text-weight-bold)

  [class^="icon-"]
    font-size: $nm-upload-file-status-icon-size

.op-toast--upload-status
  font-size: $nm-upload-status-font-size !important
  line-height: $nm-upload-status-font-size !important

.op-toast--notice
  border-radius: $nm-border-radius
  border-style: solid
  border-width: rem-calc(1)
  padding: rem-calc(5)
  margin: rem-calc(5 0)

  &.-error
    @extend %error-placeholder


  &.-warning
    @extend %warning-placeholder

// Use same styles for flash messages
#errorExplanation
  // Always above the toast
  @include spot-z-index("toast", 1)
  border-radius: $nm-border-radius
  border-style: solid
  border-width: rem-calc(1)
  font-size: $nm-font-size
  line-height: 1.6
  padding: $nm-box-padding
  box-shadow: rem-calc(1px 2px 3px) rgba(0, 0, 0, 0.2)
  margin-bottom: 0.1875rem

  &.ng-leave
    @include animation(0.5s fade-out)

  a
    text-decoration: none
    cursor: default

  ul
    font-size: $nm-font-size
    margin: 0 0 0 30px

  .close-handler
    float: none
    position: absolute
    right: rem-calc(11)
    top: rem-calc(11)
    cursor: pointer

  &::before
    @include messages-icon
    padding: 0 !important

  &.error, &.nodata
    @extend %error-placeholder

    &::before
      @extend %nm-icon-error
      color: $nm-color-error-icon

  &.info
    @extend %info-placeholder

    &::before
      @include messages-icon
      @extend %nm-icon-info

    &::before
      @extend %nm-icon-info
      color: $nm-color-info-icon

  &.warning
    @extend %warning-placeholder

    &::before
      @extend %nm-icon-warning
      color: $nm-color-warning-icon

.op-toast + .op-toast
  margin-top: 3rem

a.op-toast--target-link
  cursor: pointer
  text-decoration: underline

#errorExplanation
  &::before
    color: $nm-color-error-icon !important

  &.-inline
    position: relative
    top: 0
    left: 0