2017 © Pedro Peláez
 

silverstripe-module kickassets

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

image

silverstripe/kickassets

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  • Saturday, January 6, 2018
  • by unclecheese
  • Repository
  • 9 Watchers
  • 51 Stars
  • 1,250 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 24 Forks
  • 35 Open issues
  • 21 Versions
  • 2 % Grown

The README.md

KickAssets 3 for SilverStripe

KickAssets is a replacement for the Files & Images section (AssetAdmin) in SilverStripe CMS. It adds drag-and-drop uploading, mouse and keyboard selection, and a variety of other desktop-like file UI features., (*1)

See it. In 49 Seconds of Superfluous Flair.

, (*2)

Demo

Try it out., (*3)

(User: kickassets / Pass: kickassets), (*4)

Installation

composer require unclecheese/silverstripe-kickassets, (*5)

Dependencies

Screenshots

, (*6)

, (*7)

, (*8)

, (*9)

, (*10)

, (*11)

, (*12)

, (*13)

JavaScript API

An API is exposed to the entire CMS that allows you to prompt the user to select a file in the KickAssets UI. The following, (*14)

$('.select-files').entwine({
    onclick: function(e) {  
        e.preventDefault();
        var $t = this;
        KickAssets.requestFile(function(file) {
            $t.next('ul').append('<li><img src="'+file.iconURL+'"> '+file.filename+'</li>');
        });
    }
});

Also available is KickAssets.requestFiles, which returns an array of file objects., (*15)

Optionally, you can pass list of permissions as a first parameter to requestFile or requestFiles., (*16)

$('.select-files').entwine({
    onclick: function(e) {  
        e.preventDefault();
        var $t = this;
        var permissions = {
            folderID: 123, 
            canUpload: false        
        };
        KickAssets.requestFile(permissions, function(file) {
            $t.next('ul').append('<li><img src="'+file.iconURL+'"> '+file.filename+'</li>');
        });
    }
});

A full list of permissions:, (*17)

Name Description Default value
maxSelection The maximum number of files that can be selected and returned. 0 for unlimited. 0
folderID The ID of the folder to start in 0
canUpload Whether the user should be able to upload in the window true
canDelete Whether the user should be able to delete files or folders in the window true
canEdit Whether the user should be able to edit files in the window true
canCreateFolder Whether the user should be able to add folders in the window true
allowedTypes A comma-separated list of file types that can be selected 'file,image,folder'

Usage with UploadField and Dropzone

By default, the unclecheese/silverstripe-dropzone module will detect KickAssets and use it on FileAttachmentField for selecting existing files., (*18)

To get the same behaviour on UploadField, ensure the use_on_uploadfield setting is set to true. (It is by default)., (*19)

KickAssets:
  use_on_uploadfield: true

Most settings, such as max files, allowed extensions, and and upload folder will transfer over to the KickAssets window., (*20)

Usage with HTMLEditorField

In addition to the "Insert Media" button that comes with the default configuration of the CMS, KickAssets adds a "Browse files..." buttton that opens the KickAssets window, allowing you to upload, move, edit, and delete files and insert them into the editor at the position of the cursor., (*21)

If you select one or many images, they will be appended to the the editor in the order in which they were selected. If you select a file, it will link any text that is selected in the editor to the URL of that file. If no text is selected and you choose a file, it will insert a link to the file using the title of the file as the clickable text., (*22)

Browser support

Everyone can come to the party except IE9. Sorry., (*23)

(I'm not really sorry.), (*24)

Contributing

KickAssets is written in React JS, and requires transpiling from ES6 and JSX. This is done using Webpack and Babel. You will need to install Webpack on your system., (*25)

npm install -g webpack, (*26)

Then, run npm install in your kickassets module directory to install all of the dependencies., (*27)

To start writing code, run: webpack --watch, (*28)

When finished, create a production bundle by setting an environment file and turning on minification., (*29)

PROD=1 webpack -p., (*30)

If you would prefer not to install webpack globally, there are these handy npm scripts:, (*31)

  • npm run build - Does a one time webpack build
  • npm run build:watch - Equivalent to webpack --watch
  • npm run build:prod - Equivalent to PROD=1 webpack -p

Troubleshooting

While in a developer environment and/or while PHP E_NOTICE is enabled, KickAssets will malfunction if your files aren't in sync., (*32)

Thankfully, SilverStripe ships with a BuildTask that can resolve this. Head to dev/tasks and run the "Sync Files & Image Assets"., (*33)

or, (*34)

Ring Uncle Cheese., (*35)

The Versions

06/01 2018

dev-master

9999999-dev

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

06/01 2018

3.3.3

3.3.3.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

10/05 2017

3.3.2

3.3.2.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

12/04 2017

3.3.1

3.3.1.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

10/02 2017

3.3.0

3.3.0.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

16/11 2016

3.2.6

3.2.6.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

16/11 2016

3.2.5

3.2.5.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

16/11 2016

3.2.4

3.2.4.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

28/09 2016

3.2.3

3.2.3.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

07/09 2016

3.2.2

3.2.2.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

06/09 2016

3.2.1

3.2.1.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

03/08 2016

3.2.0

3.2.0.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

30/05 2016

3.1.6

3.1.6.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

26/05 2016

3.1.5

3.1.5.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

05/02 2016

3.1.4

3.1.4.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

04/02 2016

3.1.3

3.1.3.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

20/11 2015

3.1.2

3.1.2.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

20/11 2015

3.1.1

3.1.1.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

18/11 2015

3.1.0

3.1.0.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

12/11 2015

3.0.0

3.0.0.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin

05/01 2015

2.0.0

2.0.0.0

Provides an alternative file management interface for SilverStripe CMS with drag-and-drop, multi-selection, and several other desktop-like UI conventions.

  Sources   Download

BSD-3-Clause

The Requires

 

upload assets files silverstripe assetadmin