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

start extracting d&d classes into separate file

ulferts2ffb488505e9
diff --git a/app/assets/stylesheets/content/_grid.sass b/app/assets/stylesheets/content/_grid.sass
index 65dd15be375..f84de069ebf 100644
--- a/app/assets/stylesheets/content/_grid.sass
+++ b/app/assets/stylesheets/content/_grid.sass
@@ -5,20 +5,13 @@ $grid--widget-padding: 20px
@import openproject/mixins
-@mixin modifying_placeholder
- border: 1px dashed $primary-color
- pointer-events: none
-
-@mixin d_n_d_preview
- box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.1)
-
@mixin grid--commons
display: grid
.grid--container
@include grid--commons
-.grid--area, .cdk-drag-preview
+.grid--area
overflow: hidden
min-height: 30px
@@ -38,7 +31,7 @@ $grid--widget-padding: 20px
visibility: visible
&.-resizing
- @include modifying_placeholder
+ @include modifying--placeholder
z-index: 1000
&.-addable
@@ -48,7 +41,7 @@ $grid--widget-padding: 20px
align-items: center
&.-placeholder
- @include modifying_placeholder
+ @include modifying--placeholder
z-index: 30
&.-dragged
@@ -67,11 +60,6 @@ $grid--widget-padding: 20px
&.-column
width: $grid--gap-width
- .cdk-drag-handle
- cursor: grab
- float: left
- padding-top: 5px
-
.widget-box--header
display: flex
@@ -109,9 +97,11 @@ $grid--widget-padding: 20px
.grid--area-drag-handle
margin-left: -19px
padding-right: 1px
+ padding-top: 5px
margin-top: 3px
opacity: 0
cursor: grab
+ float: left
&:before
padding: 0
@@ -131,6 +121,14 @@ $grid--widget-padding: 20px
input[type="text"].toolbar--editable-toolbar
font-weight: normal
+ &.cdk-drag-preview
+ overflow: hidden
+ background: white
+ padding: $grid--widget-padding
+ @include widget-box--style
+ margin-left: -$grid--widget-padding
+ margin-top: -$grid--widget-padding
+
.grid--widget-content
height: 100%
overflow-x: auto
@@ -239,11 +237,3 @@ $grid--widget-padding: 20px
&:last-of-type
border-bottom: none
-
-.cdk-drag-preview
- background: white
- padding: $grid--widget-padding
- @include widget-box--style
- margin-left: -$grid--widget-padding
- margin-top: -$grid--widget-padding
- @include d_n_d_preview
diff --git a/app/assets/stylesheets/content/_index.sass b/app/assets/stylesheets/content/_index.sass
index 5f756741a0b..0815ed99ff2 100644
--- a/app/assets/stylesheets/content/_index.sass
+++ b/app/assets/stylesheets/content/_index.sass
@@ -24,6 +24,7 @@
@import content/news
@import content/buttons
@import content/icon_control
+@import content/drag_and_drop
@import content/boxes
@import content/headings
@import content/watchers
diff --git a/app/assets/stylesheets/content/drag_and_drop.sass b/app/assets/stylesheets/content/drag_and_drop.sass
new file mode 100644
index 00000000000..e02df81ceb0
--- /dev/null
+++ b/app/assets/stylesheets/content/drag_and_drop.sass
@@ -0,0 +1,43 @@
+//-- copyright
+// OpenProject is a project management system.
+// Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
+//
+// 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-2017 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 docs/COPYRIGHT.rdoc for more details.
+//++
+
+// The intend for this file is to become the place where all drag&drop styles are placed.
+// As there will hopefully also be a shared style for resizing, and as those two will hopefully also share some styles
+// there is also the 'modifying' grouping, which could serve as the basis for the two.
+
+@mixin modifying--placeholder
+ border: 1px dashed $primary-color
+ pointer-events: none
+
+@mixin d_n_d--preview
+ box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.1)
+
+// There does not seem to be a way to add a class to the preview element
+// added by cdk drag.
+.cdk-drag-preview
+ @include d_n_d--preview