Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ You can change the follow options:
* `scrollSpeed` speed of the scroll (default: `5`)
* `scrollTriggers` distance from the border where scrolling become active (default: `{ top: 40, left: 40, right: -40, bottom: -40 }`)
* `effect` removing items animation effect (default: `{ animation: 'none', time: 'slow'}`). To fadeout elements set 'animation' value to 'fade', during initialization the plugin.
* `dd3` Separate the structures of `dd-handle` and `dd-content` (default: `false`). Add `dd3-*` to the `dd-handle`, `dd-content`, `dd-item` classname.

These advanced config options are also available:

Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.nestable.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/jquery.nestable.min.js

Large diffs are not rendered by default.

67 changes: 38 additions & 29 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,50 @@
const gulp = require('gulp');
const uglify = require("gulp-uglify");
const cleanCss = require("gulp-clean-css");
const eslint = require("gulp-eslint");
const rename = require("gulp-rename");
const sass = require('gulp-sass');

const { series, parallel, src, dest } = require('gulp');
const file = 'jquery.nestable';

// compress js
gulp.task('js', function () {
gulp.src(file + '.js')
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('dist/'));
});
function javascript (cb) {
src(file + '.js')
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(dest('dist/'));
cb();
}

// compile SASS to CSS
gulp.task('sass', function () {
return gulp.src(file + '.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('.'));
});
function sassTask (cb) {
src(file + '.scss')
.pipe(sass().on('error', sass.logError))
.pipe(dest('.'))
cb();
}

// compress css
gulp.task('css', ['sass'], function () {
gulp.src(file + '.css')
.pipe(cleanCss())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('dist/'));
});
function css (cb) {
src(file + '.css')
.pipe(cleanCss())
.pipe(rename({suffix: '.min'}))
.pipe(dest('dist/'));
cb();
};

gulp.task('test', function () {
return gulp.src([file + '.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
function test (cb) {
src([file + '.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
cb();
}

// build assets
gulp.task('default', ['js', 'css']);
function clean(cb) {
// body omitted
cb();
}

const build = parallel(series(sassTask, css), javascript)

exports.test = test;
exports.build = build;
exports.default = series(clean, build);
62 changes: 62 additions & 0 deletions jquery.nestable.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,65 @@

.dd-nochildren .dd-placeholder {
display: none; }

.dd3-content {
display: block;
height: 30px;
margin: 5px 0;
padding: 5px 10px 5px 40px;
color: #333;
text-decoration: none;
font-weight: bold;
border: 1px solid #ccc;
background: #fafafa;
background: -webkit-linear-gradient(top, #fafafa 0%, #eee 100%);
background: -moz-linear-gradient(top, #fafafa 0%, #eee 100%);
background: linear-gradient(top, #fafafa 0%, #eee 100%);
-webkit-border-radius: 3px;
border-radius: 3px;
box-sizing: border-box;
-moz-box-sizing: border-box; }
.dd3-content:hover {
color: #2ea8e5;
background: #fff; }
.dd3-content:hover .operator {
display: block !important; }

.dd-dragel > .dd3-item > .dd3-content {
margin: 0; }

.dd3-item > button {
margin-left: 30px; }

.dd3-handle {
position: absolute;
margin: 0;
left: 0;
top: 0;
cursor: pointer;
width: 30px;
text-indent: 30px;
white-space: nowrap;
overflow: hidden;
border: 1px solid #aaa;
background: #ddd;
background: -webkit-linear-gradient(top, #ddd 0%, #bbb 100%);
background: -moz-linear-gradient(top, #ddd 0%, #bbb 100%);
background: linear-gradient(top, #ddd 0%, #bbb 100%);
border-top-right-radius: 0;
border-bottom-right-radius: 0;
font: normal normal normal 14px/1 FontAwesome; }
.dd3-handle:before {
content: "\f0c9";
display: block;
position: absolute;
left: 0;
top: 3px;
width: 100%;
text-align: center;
text-indent: 0;
color: #fff;
font-size: 20px;
font-weight: normal; }
.dd3-handle:hover {
background: #ddd; }
19 changes: 16 additions & 3 deletions jquery.nestable.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Nestable jQuery Plugin - Copyright (c) 2014 Ramon Smit - https://github.com/RamonSmit/Nestable
*/

(function($, window, document, undefined) {
(function($, window, document) {
var hasTouch = 'ontouchstart' in document;

/**
Expand Down Expand Up @@ -79,15 +79,22 @@

var html = '<' + options.itemNodeName + item_attrs_string + '>';
html += '<' + options.handleNodeName + ' class="' + options.handleClass + '">';
if (options.dd3) {
html += 'Drop';
html += '</' + options.handleNodeName + '>';
}
html += '<' + options.contentNodeName + ' class="' + options.contentClass + '">';
html += content;
html += '</' + options.contentNodeName + '>';
html += '</' + options.handleNodeName + '>';
if (!options.dd3) {
html += '</' + options.handleNodeName + '>';
}
html += children;
html += '</' + options.itemNodeName + '>';

return html;
}
},
dd3: false
};

function Plugin(element, options) {
Expand All @@ -109,6 +116,12 @@

this.options = $.extend({}, defaults, options);

if (this.options.dd3) {
this.options.itemClass += ' dd3-item';
this.options.handleClass += ' dd3-handle';
this.options.contentClass += ' dd3-content';
}

// build HTML from serialized JSON if passed
if (this.options.json !== undefined) {
this._build();
Expand Down
76 changes: 76 additions & 0 deletions jquery.nestable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ $nestable-collapsed-class: dd-collapsed;
$nestable-placeholder-class: dd-placeholder;
$nestable-no-children-class: dd-nochildren;
$nestable-empty-class: dd-empty;
$nestable-item-class3: dd3-item;
$nestable-content-class3: dd3-content;
$nestable-handle-class3: dd3-handle;

.#{$nestable-root-class} {
position: relative;
Expand Down Expand Up @@ -144,3 +147,76 @@ $nestable-empty-class: dd-empty;
.#{$nestable-no-children-class} .#{$nestable-placeholder-class} {
display: none;
}

.#{$nestable-content-class3} {
display: block;
height: 30px;
margin: 5px 0;
padding: 5px 10px 5px 40px;
color: #333;
text-decoration: none;
font-weight: bold;
border: 1px solid #ccc;
background: #fafafa;
background: -webkit-linear-gradient(top, #fafafa 0%, #eee 100%);
background: -moz-linear-gradient(top, #fafafa 0%, #eee 100%);
background: linear-gradient(top, #fafafa 0%, #eee 100%);
-webkit-border-radius: 3px;
border-radius: 3px;
box-sizing: border-box;
-moz-box-sizing: border-box;
&:hover {
color: #2ea8e5;
background: #fff;
.operator {
display: block !important;
}
}
}
.#{$nestable-drag-class} {
>.#{$nestable-item-class3} {
>.#{$nestable-content-class3} {
margin: 0;
}
}
}
.#{$nestable-item-class3} {
>button {
margin-left: 30px;
}
}
.#{$nestable-handle-class3} {
position: absolute;
margin: 0;
left: 0;
top: 0;
cursor: pointer;
width: 30px;
text-indent: 30px;
white-space: nowrap;
overflow: hidden;
border: 1px solid #aaa;
background: #ddd;
background: -webkit-linear-gradient(top, #ddd 0%, #bbb 100%);
background: -moz-linear-gradient(top, #ddd 0%, #bbb 100%);
background: linear-gradient(top, #ddd 0%, #bbb 100%);
border-top-right-radius: 0;
border-bottom-right-radius: 0;
font: normal normal normal 14px/1 FontAwesome;
&:before {
content: "\f0c9";
display: block;
position: absolute;
left: 0;
top: 3px;
width: 100%;
text-align: center;
text-indent: 0;
color: #fff;
font-size: 20px;
font-weight: normal;
}
&:hover {
background: #ddd;
}
}
Loading