mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
Remove trailing spaces in the source code
This commit is contained in:
parent
9c5a2c2b5d
commit
c44453c369
@ -69,5 +69,5 @@ Redistribution and use in source and binary forms, with or without modification,
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Thierry Francois, colymba nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
@ -3,14 +3,14 @@ Perform actions on multiple records straight from the GridField. Comes with *unl
|
||||
|
||||
## Usage
|
||||
Simply add component to your `GridFieldConfig`
|
||||
|
||||
|
||||
$config->addComponent(new GridFieldBulkManager());
|
||||
|
||||
|
||||
## Configuration
|
||||
The component's options can be configurated individually or in bulk through the 'config' functions like this:
|
||||
|
||||
$config->getComponentByType('GridFieldBulkManager')->setConfig($reference, $value);
|
||||
|
||||
|
||||
### $config overview
|
||||
The available configuration options are:
|
||||
* 'editableFields' : array of string referencing specific CMS fields available for editing
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Bulk action handler for deleting records.
|
||||
*
|
||||
*
|
||||
* @author colymba
|
||||
*/
|
||||
class GridFieldBulkActionDeleteHandler extends GridFieldBulkActionHandler
|
||||
@ -24,7 +24,7 @@ class GridFieldBulkActionDeleteHandler extends GridFieldBulkActionHandler
|
||||
|
||||
/**
|
||||
* Delete the selected records passed from the delete bulk action.
|
||||
*
|
||||
*
|
||||
* @param SS_HTTPRequest $request
|
||||
*
|
||||
* @return SS_HTTPResponse List of deleted records ID
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Bulk action handler for editing records.
|
||||
*
|
||||
*
|
||||
* @author colymba
|
||||
*/
|
||||
class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
||||
@ -43,7 +43,7 @@ class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
||||
/**
|
||||
* Return a form for all the selected DataObjects
|
||||
* with their respective editable fields.
|
||||
*
|
||||
*
|
||||
* @return Form Selected DataObjects editable fields
|
||||
*/
|
||||
public function bulkEditForm()
|
||||
@ -99,7 +99,7 @@ class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
||||
$toggle = LiteralField::create('bulkEditToggle', '<span id="bulkEditToggle">'._t('GRIDFIELD_BULKMANAGER_EDIT_HANDLER.TOGGLE_ALL_LINK', 'Show/Hide all').'</span>');
|
||||
$recordsFieldList->push($toggle);
|
||||
|
||||
//fetch fields for each record and push to fieldList
|
||||
//fetch fields for each record and push to fieldList
|
||||
foreach ($recordList as $id) {
|
||||
$record = DataObject::get_by_id($modelClass, $id);
|
||||
$recordEditingFields = $this->getRecordEditingFields($record);
|
||||
@ -128,7 +128,7 @@ class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
||||
}
|
||||
|
||||
//override form action URL back to bulkEditForm
|
||||
//and add record ids GET var
|
||||
//and add record ids GET var
|
||||
$bulkEditForm->setAttribute(
|
||||
'action',
|
||||
$this->Link('bulkEditForm?records[]='.implode('&', $recordList))
|
||||
@ -140,7 +140,7 @@ class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
||||
/**
|
||||
* Return's a form with only one record's fields
|
||||
* Used for bulkEditForm subForm requests via ajax.
|
||||
*
|
||||
*
|
||||
* @return Form Currently being edited form
|
||||
*/
|
||||
public function recordEditForm()
|
||||
@ -184,7 +184,7 @@ class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
||||
* with all filtering done ready to be included in the main form.
|
||||
*
|
||||
* @uses DataObject::getCMSFields()
|
||||
*
|
||||
*
|
||||
* @param DataObject $record The record to get the fields from
|
||||
*
|
||||
* @return array The record's editable fields
|
||||
@ -211,7 +211,7 @@ class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
||||
* and escape each field with unique name.
|
||||
*
|
||||
* See {@link GridFieldBulkManager} component for filtering config.
|
||||
*
|
||||
*
|
||||
* @param FieldList $fields Record's CMS Fields
|
||||
* @param int $id Record's ID, used fir unique name
|
||||
*
|
||||
@ -244,7 +244,7 @@ class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
||||
|
||||
/**
|
||||
* Escape a fieldName with a unique prefix.
|
||||
*
|
||||
*
|
||||
* @param int $recordID Record id from who the field belongs
|
||||
* @param string $name Field name
|
||||
*
|
||||
@ -257,7 +257,7 @@ class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
||||
|
||||
/**
|
||||
* Un-escape a previously escaped field name.
|
||||
*
|
||||
*
|
||||
* @param string $fieldName Escaped field name
|
||||
*
|
||||
* @return array|false Fasle if the fieldName was not escaped. Or Array map with record 'id' and field 'name'
|
||||
@ -279,7 +279,7 @@ class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
||||
|
||||
/**
|
||||
* Creates and return the bulk editing interface.
|
||||
*
|
||||
*
|
||||
* @return string Form's HTML
|
||||
*/
|
||||
public function index()
|
||||
@ -312,7 +312,7 @@ class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
||||
/**
|
||||
* Handles bulkEditForm submission
|
||||
* and parses and saves each records data.
|
||||
*
|
||||
*
|
||||
* @param array $data Sumitted form data
|
||||
* @param Form $form Form
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Base class to extend for all custom bulk action handlers
|
||||
* Gives access to the GridField, Component and Controller
|
||||
* and implements useful functions like {@link getRecordIDList()} and {@link getRecords()}.
|
||||
*
|
||||
*
|
||||
* @author colymba
|
||||
*/
|
||||
class GridFieldBulkActionHandler extends RequestHandler
|
||||
@ -44,7 +44,7 @@ class GridFieldBulkActionHandler extends RequestHandler
|
||||
|
||||
/**
|
||||
* Returns the URL for this RequestHandler.
|
||||
*
|
||||
*
|
||||
* @author SilverStripe
|
||||
*
|
||||
* @see GridFieldDetailForm_ItemRequest
|
||||
@ -62,7 +62,7 @@ class GridFieldBulkActionHandler extends RequestHandler
|
||||
* Traverse up nested requests until we reach the first that's not a GridFieldDetailForm or GridFieldDetailForm_ItemRequest.
|
||||
* The opposite of {@link Controller::curr()}, required because
|
||||
* Controller::$controller_stack is not directly accessible.
|
||||
*
|
||||
*
|
||||
* @return Controller
|
||||
*/
|
||||
protected function getToplevelController()
|
||||
@ -78,11 +78,11 @@ class GridFieldBulkActionHandler extends RequestHandler
|
||||
/**
|
||||
* Edited version of the GridFieldEditForm function
|
||||
* adds the 'Bulk Upload' at the end of the crums.
|
||||
*
|
||||
*
|
||||
* CMS-specific functionality: Passes through navigation breadcrumbs
|
||||
* to the template, and includes the currently edited record (if any).
|
||||
* see {@link LeftAndMain->Breadcrumbs()} for details.
|
||||
*
|
||||
*
|
||||
* @author SilverStripe original Breadcrumbs() method
|
||||
*
|
||||
* @see GridFieldDetailForm_ItemRequest
|
||||
@ -108,7 +108,7 @@ class GridFieldBulkActionHandler extends RequestHandler
|
||||
|
||||
/**
|
||||
* Returns the list of record IDs selected in the front-end.
|
||||
*
|
||||
*
|
||||
* @return array List of IDs
|
||||
*/
|
||||
public function getRecordIDList()
|
||||
@ -120,7 +120,7 @@ class GridFieldBulkActionHandler extends RequestHandler
|
||||
|
||||
/**
|
||||
* Returns a DataList of the records selected in the front-end.
|
||||
*
|
||||
*
|
||||
* @return DataList List of records
|
||||
*/
|
||||
public function getRecords()
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Bulk action handler for unlinking records.
|
||||
*
|
||||
*
|
||||
* @author colymba
|
||||
*/
|
||||
class GridFieldBulkActionUnlinkHandler extends GridFieldBulkActionHandler
|
||||
@ -24,7 +24,7 @@ class GridFieldBulkActionUnlinkHandler extends GridFieldBulkActionHandler
|
||||
|
||||
/**
|
||||
* Unlink the selected records passed from the unlink bulk action.
|
||||
*
|
||||
*
|
||||
* @param SS_HTTPRequest $request
|
||||
*
|
||||
* @return SS_HTTPResponse List of affected records ID
|
||||
|
@ -8,10 +8,10 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
{
|
||||
/**
|
||||
* component configuration.
|
||||
*
|
||||
*
|
||||
* 'editableFields' => fields editable on the Model
|
||||
* 'actions' => maps of action name and configuration
|
||||
*
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $config = array(
|
||||
@ -21,7 +21,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
|
||||
/**
|
||||
* GridFieldBulkManager component constructor.
|
||||
*
|
||||
*
|
||||
* @param array $editableFields List of editable fields
|
||||
* @param bool $defaultActions Use default actions list. False to start fresh.
|
||||
*/
|
||||
@ -70,7 +70,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
|
||||
/**
|
||||
* Sets the component configuration parameter.
|
||||
*
|
||||
*
|
||||
* @param string $reference
|
||||
* @param mixed $value
|
||||
*/
|
||||
@ -95,7 +95,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
|
||||
/**
|
||||
* Returns one $config parameter of the full $config.
|
||||
*
|
||||
*
|
||||
* @param string $reference $congif parameter to return
|
||||
*
|
||||
* @return mixed
|
||||
@ -113,7 +113,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
* Lets you add custom bulk actions to the bulk manager interface.
|
||||
*
|
||||
* @todo add config options for front-end: isAjax, icon
|
||||
*
|
||||
*
|
||||
* @param string $name Bulk action's name. Used by RequestHandler.
|
||||
* @param string $label Dropdown menu action's label. Default to ucfirst($name).
|
||||
* @param string $handler RequestHandler class name for this action. Default to 'GridFieldBulkAction'.ucfirst($name).'Handler'
|
||||
@ -160,7 +160,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
|
||||
/**
|
||||
* Removes a bulk actions from the bulk manager interface.
|
||||
*
|
||||
*
|
||||
* @param string $name Bulk action's name
|
||||
*
|
||||
* @return GridFieldBulkManager Current GridFieldBulkManager instance
|
||||
@ -182,7 +182,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
|
||||
/**
|
||||
* Add bulk select column.
|
||||
*
|
||||
*
|
||||
* @param GridField $gridField Current GridField instance
|
||||
* @param array $columns Columns list
|
||||
*/
|
||||
@ -195,7 +195,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
|
||||
/**
|
||||
* Which columns are handled by the component.
|
||||
*
|
||||
*
|
||||
* @param GridField $gridField Current GridField instance
|
||||
*
|
||||
* @return array List of handled column names
|
||||
@ -207,7 +207,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
|
||||
/**
|
||||
* Sets the column's content.
|
||||
*
|
||||
*
|
||||
* @param GridField $gridField Current GridField instance
|
||||
* @param DataObject $record Record intance for this row
|
||||
* @param string $columnName Column's name for which we need content
|
||||
@ -225,7 +225,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
|
||||
/**
|
||||
* Set the column's HTML attributes.
|
||||
*
|
||||
*
|
||||
* @param GridField $gridField Current GridField instance
|
||||
* @param DataObject $record Record intance for this row
|
||||
* @param string $columnName Column's name for which we need attributes
|
||||
@ -239,7 +239,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
|
||||
/**
|
||||
* Set the column's meta data.
|
||||
*
|
||||
*
|
||||
* @param GridField $gridField Current GridField instance
|
||||
* @param string $columnName Column's name for which we need meta data
|
||||
*
|
||||
@ -314,7 +314,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
|
||||
/**
|
||||
* Returns an action => handler list.
|
||||
*
|
||||
*
|
||||
* @param GridField $gridField
|
||||
*
|
||||
* @return array
|
||||
@ -333,7 +333,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
*
|
||||
* $url_handlers rule should not use wildcards like '$Action' => '$Action'
|
||||
* but have more specific path defined
|
||||
*
|
||||
*
|
||||
* @param GridField $gridField
|
||||
* @param SS_HTTPRequest $request
|
||||
*
|
||||
|
@ -32,7 +32,7 @@
|
||||
&.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%);
|
||||
@ -50,7 +50,7 @@
|
||||
&.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%);
|
||||
|
@ -1,4 +1,4 @@
|
||||
.cms table.ss-gridfield-table
|
||||
.cms table.ss-gridfield-table
|
||||
{
|
||||
tr.bulkManagerOptions
|
||||
{
|
||||
@ -17,7 +17,7 @@
|
||||
margin: 0 0 2px 2px;
|
||||
}
|
||||
|
||||
.dropdown
|
||||
.dropdown
|
||||
{
|
||||
display: inline-block;
|
||||
border: none;
|
||||
|
@ -25,7 +25,7 @@
|
||||
toggleFields.each(function()
|
||||
{
|
||||
var $this = $(this);
|
||||
|
||||
|
||||
if ( state === 'open' && !$this.hasClass('ui-state-active') )
|
||||
{
|
||||
$this.click();
|
||||
@ -34,14 +34,14 @@
|
||||
if ( state === 'close' && $this.hasClass('ui-state-active') )
|
||||
{
|
||||
$this.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.data('state', state);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Contains each rocrds editing fields,
|
||||
* tracks changes and updates...
|
||||
@ -57,6 +57,6 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}(jQuery));
|
@ -1,5 +1,5 @@
|
||||
(function($) {
|
||||
$.entwine('ss', function($) {
|
||||
(function($) {
|
||||
$.entwine('ss', function($) {
|
||||
|
||||
$.entwine('colymba', function($) {
|
||||
|
||||
@ -34,14 +34,14 @@
|
||||
onunmatch: function(){}
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Bulkselect table cell behaviours
|
||||
*/
|
||||
$('td.col-bulkSelect').entwine({
|
||||
onmatch: function(){
|
||||
},
|
||||
onunmatch: function(){
|
||||
onunmatch: function(){
|
||||
},
|
||||
onmouseover: function(){
|
||||
//disable default row click behaviour -> avoid navigation to edit form when clicking the checkbox
|
||||
@ -59,20 +59,20 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Individual select checkbox behaviour
|
||||
*/
|
||||
$('td.col-bulkSelect input').entwine({
|
||||
onmatch: function(){
|
||||
},
|
||||
onunmatch: function(){
|
||||
onunmatch: function(){
|
||||
},
|
||||
onclick: function(e) {
|
||||
$(this).parents('.ss-gridfield-table').find('input.bulkSelectAll').prop('checked', '');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Bulkselect checkbox behaviours
|
||||
@ -80,7 +80,7 @@
|
||||
$('input.bulkSelectAll').entwine({
|
||||
onmatch: function(){
|
||||
},
|
||||
onunmatch: function(){
|
||||
onunmatch: function(){
|
||||
},
|
||||
onclick: function()
|
||||
{
|
||||
@ -94,21 +94,21 @@
|
||||
{
|
||||
return $(this).parents('.ss-gridfield-table')
|
||||
.find('td.col-bulkSelect input:checked')
|
||||
.map(function() {
|
||||
.map(function() {
|
||||
return parseInt( $(this).data('record') )
|
||||
})
|
||||
.get();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Bulk action dropdown behaviours
|
||||
*/
|
||||
$('select.bulkActionName').entwine({
|
||||
onmatch: function(){
|
||||
},
|
||||
onunmatch: function(){
|
||||
onunmatch: function(){
|
||||
},
|
||||
onchange: function(e)
|
||||
{
|
||||
@ -136,10 +136,10 @@
|
||||
else{
|
||||
$btn.removeClass('ss-ui-action-destructive');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* bulk action button behaviours
|
||||
@ -147,7 +147,7 @@
|
||||
$('.doBulkActionButton').entwine({
|
||||
onmatch: function(){
|
||||
},
|
||||
onunmatch: function(){
|
||||
onunmatch: function(){
|
||||
},
|
||||
getActionURL: function(action, url)
|
||||
{
|
||||
@ -176,13 +176,13 @@
|
||||
var $parent = $(this).parents('.bulkManagerOptions'),
|
||||
action = $parent.find('select.bulkActionName').val(),
|
||||
ids = $(this).parents('.bulkManagerOptions').find('input.bulkSelectAll:first').getSelectRecordsID()
|
||||
;
|
||||
;
|
||||
|
||||
this.doBulkAction(action, ids);
|
||||
this.doBulkAction(action, ids);
|
||||
},
|
||||
|
||||
doBulkAction: function(action, ids, callbackFunction, callbackContext)
|
||||
{
|
||||
{
|
||||
var $parent = $(this).parents('.bulkManagerOptions'),
|
||||
$btn = $parent.find('a.doBulkActionButton'),
|
||||
|
||||
@ -190,7 +190,7 @@
|
||||
url = this.getActionURL(action, $(this).data('url')),
|
||||
data = { records: ids }
|
||||
;
|
||||
|
||||
|
||||
if ( ids.length <= 0 )
|
||||
{
|
||||
alert( ss.i18n._t('GRIDFIELD_BULK_MANAGER.BULKACTION_EMPTY_SELECT') );
|
||||
@ -207,10 +207,10 @@
|
||||
callbackFunction.call(callbackContext, false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$btn.addClass('loading');
|
||||
$btn.addClass('loading');
|
||||
|
||||
if ( config[action]['isAjax'] )
|
||||
{
|
||||
@ -219,7 +219,7 @@
|
||||
data: data,
|
||||
type: "POST",
|
||||
context: $(this)
|
||||
}).done(function(data, textStatus, jqXHR) {
|
||||
}).done(function(data, textStatus, jqXHR) {
|
||||
$btn.removeClass('loading');
|
||||
if ( callbackFunction && callbackContext )
|
||||
{
|
||||
@ -239,7 +239,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}(jQuery));
|
||||
|
@ -1,6 +1,6 @@
|
||||
<tr class="bulkManagerOptions">
|
||||
<th class="main bulkmanagerheading" colspan="$Colspan">
|
||||
|
||||
|
||||
<p class="title"><% _t('GRIDFIELD_BULK_MANAGER.COMPONENT_TITLE', 'Modify one or more entry at a time.') %></p>
|
||||
|
||||
$Menu
|
||||
|
@ -12,7 +12,7 @@ class GridFieldBulkImageUpload extends GridFieldBulkUpload
|
||||
* Component constructor.
|
||||
*
|
||||
* @deprecated 2.0 "GridFieldBulkImageUpload" is deprecated, use {@link GridFieldBulkUpload} class instead.
|
||||
*
|
||||
*
|
||||
* @param string $fileRelationName
|
||||
*/
|
||||
public function __construct($fileRelationName = null)
|
||||
|
@ -18,7 +18,7 @@
|
||||
background: #98aab6;
|
||||
|
||||
border-top: 1px solid #a4b4bf;
|
||||
border-left: 1px solid #a4b4bf;
|
||||
border-left: 1px solid #a4b4bf;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
|
||||
div.ss-uploadfield
|
||||
@ -48,7 +48,7 @@
|
||||
|
||||
width: 98%;
|
||||
padding: 5px 1% 5px 1%;
|
||||
|
||||
|
||||
border: none;
|
||||
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
||||
|
||||
@ -109,7 +109,7 @@
|
||||
}
|
||||
}// .ss-uploadfield-item-status
|
||||
}// .ss-uploadfield-item-name
|
||||
|
||||
|
||||
.ss-uploadfield-item-actions
|
||||
{
|
||||
position: absolute;
|
||||
@ -166,7 +166,7 @@
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}// .ss-uploadfield-files
|
||||
|
||||
// upload tools
|
||||
@ -179,7 +179,7 @@
|
||||
|
||||
padding: 1%;
|
||||
|
||||
&.borderTop
|
||||
&.borderTop
|
||||
{
|
||||
border: none;
|
||||
}
|
||||
@ -228,7 +228,7 @@
|
||||
{
|
||||
padding: 0px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ss-uploadfield-fromcomputer
|
||||
@ -280,7 +280,7 @@
|
||||
{
|
||||
float: left;
|
||||
margin: 0 6px 0 6px;
|
||||
line-height: 28px;
|
||||
line-height: 28px;
|
||||
height: 28px;
|
||||
color: #ffffff;
|
||||
|
||||
@ -288,7 +288,7 @@
|
||||
background-position: 0 -50px;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
overflow: hidden;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&.loading
|
||||
@ -297,7 +297,7 @@
|
||||
{
|
||||
padding-left: 20px;
|
||||
background-position: 0 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
(function($) {
|
||||
(function($) {
|
||||
$.entwine('ss', function($) {
|
||||
|
||||
|
||||
|
||||
$.entwine('colymba', function($) {
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
{
|
||||
$component.insertAfter($tr.eq(0));
|
||||
this.remove();
|
||||
}
|
||||
}
|
||||
},
|
||||
onunmatch: function(){}
|
||||
});
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
/**
|
||||
* Track upload progress...
|
||||
*/
|
||||
*/
|
||||
$('ul.ss-uploadfield-files').entwine({
|
||||
onmatch: function(){},
|
||||
onunmatch: function(){},
|
||||
@ -38,7 +38,7 @@
|
||||
$errors = $li.not($done).find('.ui-state-warning-text,.ui-state-error-text'),
|
||||
errors = $errors.length
|
||||
;
|
||||
|
||||
|
||||
this.parents('.ss-uploadfield').find('.colymba-bulkupload-buttons').refresh(total, done, errors);
|
||||
}
|
||||
});
|
||||
@ -71,7 +71,7 @@
|
||||
|
||||
/**
|
||||
* Update buttons state and progress info...
|
||||
*/
|
||||
*/
|
||||
$('.colymba-bulkupload-buttons').entwine({
|
||||
onmatch: function(){},
|
||||
onunmatch: function(){},
|
||||
@ -104,12 +104,12 @@
|
||||
{
|
||||
this.addClass('loading');
|
||||
$finishBtn.addClass('ui-state-disabled ssui-button-disabled').attr('aria-disabled', 'true').attr('disabled', 'disabled');
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.removeClass('loading');
|
||||
$finishBtn.removeClass('ui-state-disabled ssui-button-disabled').attr('aria-disabled', 'false').removeAttr('disabled');
|
||||
}
|
||||
}
|
||||
|
||||
//if all done and OK, enable edit
|
||||
if ( total === done )
|
||||
@ -136,7 +136,7 @@
|
||||
$cancelBtn.addClass('ui-state-disabled ssui-button-disabled').attr('aria-disabled', 'true').attr('disabled', 'true');
|
||||
$finishBtn.addClass('ui-state-disabled ssui-button-disabled').attr('aria-disabled', 'true').attr('disabled', 'true');
|
||||
$clearErrorBtn.addClass('ui-state-disabled ssui-button-disabled').attr('aria-disabled', 'true').attr('disabled', 'true');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -155,7 +155,7 @@
|
||||
$errors = $bulkUpload.find('li.ss-uploadfield-item .ui-state-warning-text,li.ss-uploadfield-item .ui-state-error-text').parents('li')
|
||||
;
|
||||
|
||||
$($errors.get().reverse()).each(function(index, Element){
|
||||
$($errors.get().reverse()).each(function(index, Element){
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
@ -177,18 +177,18 @@
|
||||
$li = $bulkUpload.find('li.ss-uploadfield-item'),
|
||||
$records = $li.filter('[data-recordid]'),
|
||||
$other = $li.not($records),
|
||||
$doBulkActionButton = $bulkUpload.parents('.ss-gridfield-table').find('.doBulkActionButton'),
|
||||
$doBulkActionButton = $bulkUpload.parents('.ss-gridfield-table').find('.doBulkActionButton'),
|
||||
recordsID
|
||||
;
|
||||
|
||||
$other.each(function(index, Element){
|
||||
// skip in progress
|
||||
// skip in progress
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
if ( $doBulkActionButton.length > 0 )
|
||||
{
|
||||
recordsID = $records.map(function() {
|
||||
recordsID = $records.map(function() {
|
||||
return parseInt( $(this).data('recordid') )
|
||||
}).get();
|
||||
|
||||
@ -225,7 +225,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Clear all the warning/error/finished uploads
|
||||
*/
|
||||
@ -235,19 +235,19 @@
|
||||
},
|
||||
onunmatch: function(){},
|
||||
onclick: function()
|
||||
{
|
||||
{
|
||||
var $bulkUpload = this.parents('.bulkUpload'),
|
||||
$li = $bulkUpload.find('li.ss-uploadfield-item')
|
||||
;
|
||||
|
||||
this.addClass('loading');
|
||||
$li.each(function(index, Element){
|
||||
// skip in progress
|
||||
// skip in progress
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
$(this).parents('.ss-gridfield').entwine('.').entwine('ss').reload();
|
||||
|
||||
|
||||
this.removeClass('loading');
|
||||
}
|
||||
});
|
||||
@ -261,7 +261,7 @@
|
||||
{
|
||||
var $bulkUpload = this.parents('.bulkUpload'),
|
||||
$li = $bulkUpload.find('li.ss-uploadfield-item'),
|
||||
$records = $li.filter('[data-recordid]'),
|
||||
$records = $li.filter('[data-recordid]'),
|
||||
recordsID,
|
||||
$doBulkActionButton = $bulkUpload.parents('.ss-gridfield-table').find('.doBulkActionButton')
|
||||
;
|
||||
@ -270,7 +270,7 @@
|
||||
{
|
||||
this.addClass('loading');
|
||||
|
||||
recordsID = $records.map(function() {
|
||||
recordsID = $records.map(function() {
|
||||
return parseInt( $(this).data('recordid') )
|
||||
}).get();
|
||||
|
||||
|
@ -1,30 +1,30 @@
|
||||
window.tmpl.cache['colymba-bulkuploaddownloadtemplate'] = tmpl(
|
||||
'{% for (var i=0, files=o.files, l=files.length, file=files[0]; i<l; file=files[++i]) { %}' +
|
||||
'<li class="ss-uploadfield-item template-download{% if (file.error) { %} ui-state-error{% }else{ %} done{% } %}" data-fileid="{%=file.id%}" data-recordid="{%=file.record.id%}">' +
|
||||
'<li class="ss-uploadfield-item template-download{% if (file.error) { %} ui-state-error{% }else{ %} done{% } %}" data-fileid="{%=file.id%}" data-recordid="{%=file.record.id%}">' +
|
||||
'<div class="ss-uploadfield-item-preview preview"><span>' +
|
||||
'<img src="{%=file.thumbnail_url%}" alt="" />' +
|
||||
'</span></div>' +
|
||||
'<div class="ss-uploadfield-item-info">' +
|
||||
'{% if (!file.error) { %}' +
|
||||
'<input type="hidden" name="{%=file.fieldname%}[Files][]" value="{%=file.id%}" />' +
|
||||
'{% } %}' +
|
||||
'<label class="ss-uploadfield-item-name">' +
|
||||
'<span class="name" title="{%=file.name%}">{%=file.name%}</span> ' +
|
||||
'<input type="hidden" name="{%=file.fieldname%}[Files][]" value="{%=file.id%}" />' +
|
||||
'{% } %}' +
|
||||
'<label class="ss-uploadfield-item-name">' +
|
||||
'<span class="name" title="{%=file.name%}">{%=file.name%}</span> ' +
|
||||
'<span class="size">{%=o.formatFileSize(file.size)%}</span>' +
|
||||
'{% if (!file.error) { %}' +
|
||||
'<div class="ss-uploadfield-item-status ui-state-success-text" title="'+ss.i18n._t('UploadField.Uploaded', 'Uploaded')+'">'+ss.i18n._t('UploadField.Uploaded', 'Uploaded')+'</div>' +
|
||||
'<div class="ss-uploadfield-item-status ui-state-success-text" title="'+ss.i18n._t('UploadField.Uploaded', 'Uploaded')+'">'+ss.i18n._t('UploadField.Uploaded', 'Uploaded')+'</div>' +
|
||||
'{% } else { %}' +
|
||||
'<div class="ss-uploadfield-item-status ui-state-error-text" title="{%=o.options.errorMessages[file.error] || file.error%}">{%=o.options.errorMessages[file.error] || file.error%}</div>' +
|
||||
'{% } %}' +
|
||||
'<div class="clear"><!-- --></div>' +
|
||||
'<div class="ss-uploadfield-item-status ui-state-error-text" title="{%=o.options.errorMessages[file.error] || file.error%}">{%=o.options.errorMessages[file.error] || file.error%}</div>' +
|
||||
'{% } %}' +
|
||||
'<div class="clear"><!-- --></div>' +
|
||||
'</label>' +
|
||||
'{% if (file.error) { %}' +
|
||||
'<div class="ss-uploadfield-item-actions">' +
|
||||
'<div class="ss-uploadfield-item-actions">' +
|
||||
'<div class="ss-uploadfield-item-cancel ss-uploadfield-item-cancelfailed delete"><button class="icon icon-16" data-icon="delete" title="' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '">' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '</button></div>' +
|
||||
'</div>' +
|
||||
'{% } else { %}' +
|
||||
'{% } %}' +
|
||||
'{% } %}' +
|
||||
'</div>' +
|
||||
'</li>' +
|
||||
'</li>' +
|
||||
'{% } %}'
|
||||
);
|
Loading…
Reference in New Issue
Block a user