Clean up 🚿

This commit is contained in:
Thierry François 2018-02-27 16:48:02 +02:00
parent a0a5c11d0a
commit d4726cb5fe
6 changed files with 5 additions and 519 deletions

View File

@ -7,4 +7,4 @@ mappings:
BulkUploadField: Colymba\BulkUpload\BulkUploadField
GridFieldBulkImageUpload: Colymba\BulkUpload\GridFieldBulkImageUpload
GridFieldBulkUpload: Colymba\BulkUpload\BulkUploader
GridFieldBulkUpload_Request: Colymba\BulkUpload\BulkUploadRequest
GridFieldBulkUpload_Request: Colymba\BulkUpload\BulkUploadHandler

View File

@ -12,10 +12,8 @@ Set of SilverStripe 4 GridField components to facilitate bulk file upload & reco
* [Bulk Upload](#bulk-upload): Upload multiple images or files at once into DataObjects
* [Bulk Manager](#bulk-manager): Delete, Unlink, Edit (and more) multiple records at once
[More screenshots here.](screenshots)
## Requirements
* SilverStripe 4.0 (3.+)
* SilverStripe 4.0 (master / 3.+)
* SilverStripe 3.1 (version 2.+ / 1.+)
* Silverstripe 3.0 (version 0.5)

View File

@ -1,8 +1 @@
<?php
//define global path to Components' root folder
if (!defined('BULKEDITTOOLS_PATH')) {
$folder = rtrim(basename(dirname(__FILE__)));
define('BULKEDITTOOLS_PATH', $folder);
define('BULKEDITTOOLS_UPLOAD_PATH', $folder . '/bulkUpload');
define('BULKEDITTOOLS_MANAGER_PATH', $folder . '/bulkManager');
}

View File

@ -1,435 +1 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(1);
__webpack_require__(2);
module.exports = __webpack_require__(3);
/***/ }),
/* 1 */
/***/ (function(module, exports) {
(function($) {
$.entwine('ss', function($) {
$.entwine('colymba', function($) {
/**
* Makes sure the component is above the headers
*/
$('.bulkManagerOptions').entwine({
onmatch: function(){
var $parent = this.parents('thead'),
$tr = $parent.find('tr'),
targets = ['.filter-header', '.sortable-header'],
$target = $parent.find(targets.join(',')),
index = $tr.index(this),
newIndex = $tr.length - 1
;
$target.each(function(index, Element){
var idx = $tr.index(Element);
if ( idx < newIndex )
{
newIndex = idx;
}
});
if ( index > newIndex )
{
$tr.eq(newIndex).insertAfter($(this));
}
},
onunmatch: function(){}
});
/**
* Bulkselect table cell behaviours
*/
$('td.col-bulkSelect').entwine({
onmatch: function(){
},
onunmatch: function(){
},
onmouseover: function(){
//disable default row click behaviour -> avoid navigation to edit form when clicking the checkbox
$(this).parents('.ss-gridfield-item').find('.edit-link').removeClass('edit-link').addClass('tempDisabledEditLink');
},
onmouseout: function(){
//re-enable default row click behaviour
$(this).parents('.ss-gridfield-item').find('.tempDisabledEditLink').addClass('edit-link').removeClass('tempDisabledEditLink');
},
onclick: function(e) {
//check/uncheck checkbox when clicking cell
var cb = $(e.target).find('input');
if ( !$(cb).prop('checked') ) $(cb).prop('checked', true);
else $(cb).prop('checked', false);
}
});
/**
* Individual select checkbox behaviour
*/
$('td.col-bulkSelect input').entwine({
onmatch: function(){
},
onunmatch: function(){
},
onclick: function(e) {
$(this).parents('.grid-field__table').find('input.bulkSelectAll').prop('checked', '');
}
});
/**
* Bulkselect checkbox behaviours
*/
$('input.bulkSelectAll').entwine({
onmatch: function(){
},
onunmatch: function(){
},
onclick: function()
{
var state = $(this).prop('checked');
$(this).parents('.grid-field__table')
.find('td.col-bulkSelect input')
.prop('checked', state)
.trigger('change');
},
getSelectRecordsID: function()
{
return $(this).parents('.grid-field__table')
.find('td.col-bulkSelect input:checked')
.map(function() {
return parseInt( $(this).data('record') )
})
.get();
}
});
/**
* Bulk action dropdown behaviours
*/
$('select.bulkActionName').entwine({
onmatch: function(){
},
onunmatch: function(){
},
onchange: function(e)
{
var value = $(this).val(),
$parent = $(this).parents('.bulkManagerOptions'),
$btn = $parent.find('.doBulkActionButton'),
config = $btn.data('config');
$.each( config, function( configKey, configData )
{
if ( configKey != value )
{
$btn.removeClass(configData['buttonClasses']);
}
});
if(!value)
{
$btn.addClass('disabled');
return;
}
else {
$btn.removeClass('disabled');
}
$btn.addClass(config[value]['buttonClasses']).addClass('btn-outline-secondary');
if ( config[value]['icon'] )
{
var $img = $btn.find('img');
if ($img.length)
{
$img.attr('src', config[value]['icon']);
}
else{
$btn.prepend('<img src="'+config[value]['icon']+'" alt="" />');
}
}
else{
$btn.find('img').remove();
}
if ( config[value]['destructive'] )
{
$btn.addClass('btn-outline-danger');
}
else{
$btn.removeClass('btn-outline-danger');
}
}
});
/**
* bulk action button behaviours
*/
$('.doBulkActionButton').entwine({
onmatch: function(){
},
onunmatch: function(){
},
getActionURL: function(action, url)
{
var cacheBuster = new Date().getTime();
url = url.split('?');
if ( action )
{
action = '/' + action;
}
else{
action = '';
}
if ( url[1] )
{
url = url[0] + action + '?' + url[1] + '&' + 'cacheBuster=' + cacheBuster;
}
else{
url = url[0] + action + '?' + 'cacheBuster=' + cacheBuster;
}
return url;
},
onclick: function(e)
{
var $parent = $(this).parents('.bulkManagerOptions'),
action = $parent.find('select.bulkActionName').val(),
ids = $(this).parents('.bulkManagerOptions').find('input.bulkSelectAll:first').getSelectRecordsID()
;
this.doBulkAction(action, ids);
},
doBulkAction: function(action, ids, callbackFunction, callbackContext)
{
var $parent = $(this).parents('.bulkManagerOptions'),
$btn = $parent.find('a.doBulkActionButton'),
config = $btn.data('config'),
url = this.getActionURL(action, $(this).data('url')),
data = { records: ids }
;
if ( ids.length <= 0 )
{
alert( ss.i18n._t('GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT') );
return;
}
//if ( $btn.hasClass('ss-ui-action-destructive') )
if ( config[action]['destructive'] )
{
if( !confirm(ss.i18n._t('GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION')) )
{
if ( callbackFunction && callbackContext )
{
callbackFunction.call(callbackContext, false);
}
return false;
}
}
$btn.addClass('loading');
if ( config[action]['xhr'] )
{
$.ajax({
url: url,
data: data,
type: "POST",
context: $(this)
}).done(function(data, textStatus, jqXHR) {
$btn.removeClass('loading');
if ( callbackFunction && callbackContext )
{
callbackFunction.call(callbackContext, data);
}
else{
$(this).parents('.ss-gridfield').entwine('.').entwine('ss').reload();
}
});
}
else{
var records = 'records[]='+ids.join('&records[]=');
url = url + '&' + records;
window.location.href = url;
}
}
});
});
});
}(jQuery));
/***/ }),
/* 2 */
/***/ (function(module, exports) {
(function($) {
$.entwine('colymba', function($) {
/**
* Toggle all accordion forms
* open or closed
*/
$('#bulkEditToggle') .entwine({
onmatch: function(){},
onunmatch: function(){},
onclick: function(e)
{
var toggleFields = this.parents('form').find('.ss-toggle .ui-accordion-header'),
state = this.data('state')
;
if ( !state || state === 'close' )
{
state = 'open';
}
else {
state = 'close';
}
toggleFields.each(function()
{
var $this = $(this);
if ( state === 'open' && !$this.hasClass('ui-state-active') )
{
$this.click();
}
if ( state === 'close' && $this.hasClass('ui-state-active') )
{
$this.click();
}
});
this.data('state', state);
}
});
/**
* Contains each rocrds editing fields,
* tracks changes and updates...
*/
$('.bulkEditingFieldHolder').entwine({
onmatch: function(){},
onunmatch: function(){},
onchange: function(){
this.removeClass('updated');
if ( !this.hasClass('hasUpdate') )
{
this.addClass('hasUpdate');
}
}
});
});
}(jQuery));
/***/ }),
/* 3 */
/***/ (function(module, exports) {
/*
(function($) {
$.entwine('ss', function($) {
$.entwine('colymba', function($) {
}); // colymba namespace
}); // ss namespace
}(jQuery));
*/
/***/ })
/******/ ]);
//# sourceMappingURL=bulkTools.js.map
!function(n){function t(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return n[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var e={};t.m=n,t.c=e,t.d=function(n,e,i){t.o(n,e)||Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:i})},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},t.p="",t(t.s=0)}([function(n,t,e){e(1),e(2),n.exports=e(3)},function(n,t){!function(n){n.entwine("ss",function(n){n.entwine("colymba",function(n){n(".bulkManagerOptions").entwine({onmatch:function(){var t=this.parents("thead"),e=t.find("tr"),i=[".filter-header",".sortable-header"],o=t.find(i.join(",")),c=e.index(this),a=e.length-1;o.each(function(n,t){var i=e.index(t);i<a&&(a=i)}),c>a&&e.eq(a).insertAfter(n(this))},onunmatch:function(){}}),n("td.col-bulkSelect").entwine({onmatch:function(){},onunmatch:function(){},onmouseover:function(){n(this).parents(".ss-gridfield-item").find(".edit-link").removeClass("edit-link").addClass("tempDisabledEditLink")},onmouseout:function(){n(this).parents(".ss-gridfield-item").find(".tempDisabledEditLink").addClass("edit-link").removeClass("tempDisabledEditLink")},onclick:function(t){var e=n(t.target).find("input");n(e).prop("checked")?n(e).prop("checked",!1):n(e).prop("checked",!0)}}),n("td.col-bulkSelect input").entwine({onmatch:function(){},onunmatch:function(){},onclick:function(t){n(this).parents(".grid-field__table").find("input.bulkSelectAll").prop("checked","")}}),n("input.bulkSelectAll").entwine({onmatch:function(){},onunmatch:function(){},onclick:function(){var t=n(this).prop("checked");n(this).parents(".grid-field__table").find("td.col-bulkSelect input").prop("checked",t).trigger("change")},getSelectRecordsID:function(){return n(this).parents(".grid-field__table").find("td.col-bulkSelect input:checked").map(function(){return parseInt(n(this).data("record"))}).get()}}),n("select.bulkActionName").entwine({onmatch:function(){},onunmatch:function(){},onchange:function(t){var e=n(this).val(),i=n(this).parents(".bulkManagerOptions"),o=i.find(".doBulkActionButton"),c=o.data("config");if(n.each(c,function(n,t){n!=e&&o.removeClass(t.buttonClasses)}),!e)return void o.addClass("disabled");if(o.removeClass("disabled"),o.addClass(c[e].buttonClasses).addClass("btn-outline-secondary"),c[e].icon){var a=o.find("img");a.length?a.attr("src",c[e].icon):o.prepend('<img src="'+c[e].icon+'" alt="" />')}else o.find("img").remove();c[e].destructive?o.addClass("btn-outline-danger"):o.removeClass("btn-outline-danger")}}),n(".doBulkActionButton").entwine({onmatch:function(){},onunmatch:function(){},getActionURL:function(n,t){var e=(new Date).getTime();return t=t.split("?"),n=n?"/"+n:"",t=t[1]?t[0]+n+"?"+t[1]+"&cacheBuster="+e:t[0]+n+"?cacheBuster="+e},onclick:function(t){var e=n(this).parents(".bulkManagerOptions"),i=e.find("select.bulkActionName").val(),o=n(this).parents(".bulkManagerOptions").find("input.bulkSelectAll:first").getSelectRecordsID();this.doBulkAction(i,o)},doBulkAction:function(t,e,i,o){var c=n(this).parents(".bulkManagerOptions"),a=c.find("a.doBulkActionButton"),s=a.data("config"),r=this.getActionURL(t,n(this).data("url")),l={records:e};if(e.length<=0)return void alert(ss.i18n._t("GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT"));if(s[t].destructive&&!confirm(ss.i18n._t("GRIDFIELD_BULK_MANAGER.CONFIRM_DESTRUCTIVE_ACTION")))return i&&o&&i.call(o,!1),!1;if(a.addClass("loading"),s[t].xhr)n.ajax({url:r,data:l,type:"POST",context:n(this)}).done(function(t,e,c){a.removeClass("loading"),i&&o?i.call(o,t):n(this).parents(".ss-gridfield").entwine(".").entwine("ss").reload()});else{r=r+"&"+("records[]="+e.join("&records[]=")),window.location.href=r}}})})})}(jQuery)},function(n,t){!function(n){n.entwine("colymba",function(n){n("#bulkEditToggle").entwine({onmatch:function(){},onunmatch:function(){},onclick:function(t){var e=this.parents("form").find(".ss-toggle .ui-accordion-header"),i=this.data("state");i=i&&"close"!==i?"close":"open",e.each(function(){var t=n(this);"open"!==i||t.hasClass("ui-state-active")||t.click(),"close"===i&&t.hasClass("ui-state-active")&&t.click()}),this.data("state",i)}}),n(".bulkEditingFieldHolder").entwine({onmatch:function(){},onunmatch:function(){},onchange:function(){this.removeClass("updated"),this.hasClass("hasUpdate")||this.addClass("hasUpdate")}})})}(jQuery)},function(n,t){}]);

View File

@ -1,71 +1 @@
.cms table.grid-field__table tr.bulkManagerOptions th {
text-transform: none; }
.cms table.grid-field__table tr.bulkManagerOptions th .bulkActionName {
float: left; }
.cms table.grid-field__table tr.bulkManagerOptions th .bulkActionName .form__field-holder {
min-width: 200px;
margin-left: 0; }
.cms table.grid-field__table tr.bulkManagerOptions th .bulkActionName .chosen-container {
min-width: 120px; }
.cms table.grid-field__table tr.bulkManagerOptions th .bulkActionName .chosen-container-single .chosen-single {
border-top-right-radius: 0;
border-bottom-right-radius: 0; }
.cms table.grid-field__table tr.bulkManagerOptions th .doBulkActionButton {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
height: 36px;
line-height: 26px;
margin-left: -1px; }
.cms table.grid-field__table tr.bulkManagerOptions th .doBulkActionButton img {
height: 20px; }
.cms table.grid-field__table tbody .col-bulkSelect {
width: 25px;
text-align: center; }
#bulkEditHeader {
float: left;
width: 70%;
margin: 40px 0 20px 0;
font-size: 30px;
font-weight: bold; }
#bulkEditToggle {
float: right;
clear: right;
width: 25%;
margin: 40px 0 20px 0;
text-decoration: underline;
text-align: right;
cursor: pointer; }
.bulkEditingFieldHolder {
position: relative;
float: left;
width: 100%; }
.bulkEditingFieldHolder.hasUpdate .ui-accordion-header {
background-color: #f2ba11;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #f2ba11), color-stop(100%, #df6e00));
background-image: -webkit-linear-gradient(top, #f2ba11 0%, #df6e00 100%);
background-image: -moz-linear-gradient(top, #f2ba11 0%, #df6e00 100%);
background-image: -o-linear-gradient(top, #f2ba11 0%, #df6e00 100%);
background-image: -ms-linear-gradient(top, #f2ba11 0%, #df6e00 100%);
background-image: linear-gradient(top, #f2ba11 0%, #df6e00 100%); }
.bulkEditingFieldHolder.hasUpdate .ui-accordion-header a {
color: #fff;
text-shadow: none; }
.bulkEditingFieldHolder.updated .ui-accordion-header {
background-color: #a4ca3a;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #a4ca3a), color-stop(100%, #59781D));
background-image: -webkit-linear-gradient(top, #a4ca3a 0%, #59781D 100%);
background-image: -moz-linear-gradient(top, #a4ca3a 0%, #59781D 100%);
background-image: -o-linear-gradient(top, #a4ca3a 0%, #59781D 100%);
background-image: -ms-linear-gradient(top, #a4ca3a 0%, #59781D 100%);
background-image: linear-gradient(top, #a4ca3a 0%, #59781D 100%); }
.bulkEditingFieldHolder.updated .ui-accordion-header a {
color: #fff;
text-shadow: none; }
.bulkUploader .uploadfield__droptext::before {
text-transform: none;
content: "b"; }
/*# sourceMappingURL=bulkTools.css.map*/
.cms table.grid-field__table tr.bulkManagerOptions th{text-transform:none}.cms table.grid-field__table tr.bulkManagerOptions th .bulkActionName{float:left}.cms table.grid-field__table tr.bulkManagerOptions th .bulkActionName .form__field-holder{min-width:200px;margin-left:0}.cms table.grid-field__table tr.bulkManagerOptions th .bulkActionName .chosen-container{min-width:120px}.cms table.grid-field__table tr.bulkManagerOptions th .bulkActionName .chosen-container-single .chosen-single{border-top-right-radius:0;border-bottom-right-radius:0}.cms table.grid-field__table tr.bulkManagerOptions th .doBulkActionButton{border-top-left-radius:0;border-bottom-left-radius:0;height:36px;line-height:26px;margin-left:-1px}.cms table.grid-field__table tr.bulkManagerOptions th .doBulkActionButton img{height:20px}.cms table.grid-field__table tbody .col-bulkSelect{width:25px;text-align:center}#bulkEditHeader{float:left;width:70%;margin:40px 0 20px;font-size:30px;font-weight:700}#bulkEditToggle{float:right;clear:right;width:25%;margin:40px 0 20px;text-decoration:underline;text-align:right;cursor:pointer}.bulkEditingFieldHolder{position:relative;float:left;width:100%}.bulkEditingFieldHolder.hasUpdate .ui-accordion-header{background-color:#f2ba11;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(0,#f2ba11),color-stop(100%,#df6e00));background-image:-webkit-linear-gradient(top,#f2ba11,#df6e00);background-image:-moz-linear-gradient(top,#f2ba11 0,#df6e00 100%);background-image:-o-linear-gradient(top,#f2ba11 0,#df6e00 100%);background-image:-ms-linear-gradient(top,#f2ba11 0,#df6e00 100%);background-image:linear-gradient(top,#f2ba11,#df6e00)}.bulkEditingFieldHolder.hasUpdate .ui-accordion-header a{color:#fff;text-shadow:none}.bulkEditingFieldHolder.updated .ui-accordion-header{background-color:#a4ca3a;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(0,#a4ca3a),color-stop(100%,#59781d));background-image:-webkit-linear-gradient(top,#a4ca3a,#59781d);background-image:-moz-linear-gradient(top,#a4ca3a 0,#59781d 100%);background-image:-o-linear-gradient(top,#a4ca3a 0,#59781d 100%);background-image:-ms-linear-gradient(top,#a4ca3a 0,#59781d 100%);background-image:linear-gradient(top,#a4ca3a,#59781d)}.bulkEditingFieldHolder.updated .ui-accordion-header a{color:#fff;text-shadow:none}.bulkUploader .uploadfield__droptext:before{text-transform:none;content:"b"}

View File

@ -91,5 +91,4 @@ module.exports = __webpack_require__(3);
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);
/*# sourceMappingURL=bundle.css.map*/
/******/ ]);