Skip to content

Commit

Permalink
v3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Dec 10, 2015
2 parents 25ea683 + cbb89e8 commit b6d4c8d
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 13 deletions.
2 changes: 1 addition & 1 deletion AlterDialogWindow/AlterDialogWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ CKFinder.define( function() {
finder.on( 'dialog:RenameFile:ok', function( evt ) {
// Read if the checkbox is checked
// when the user confirms overwriting file update listenerData.
evt.listenerData.overwrite = evt.data.dialog.$el.find( '[name="overwrite"]' ).is( ':checked' );
evt.listenerData.overwrite = evt.data.view.$el.find( '[name="overwrite"]' ).is( ':checked' );
}, null, listenerData );

// Alters command params and adds an 'overwrite' parameter which will be passed to the server connector.
Expand Down
23 changes: 14 additions & 9 deletions CustomButton/CustomButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,22 @@ CKFinder.define( [ 'jquery' ], function( jQuery ) {
// Add a context menu item.
// See also events: contextMenu:file, contextMenu:folder.
finder.on( 'contextMenu', function( evt ) {
evt.data.groups.addGroup( 'default', [
{
name: 'Feedback',
label: 'Send Feedback',
icon: 'feedback',
isActive: true,
action: sendFeedback
}
] );
evt.data.groups.add( { name: 'default' } );
} );

finder.on( 'contextMenu:file:default', onContextMenuGroup );
finder.on( 'contextMenu:folder:default', onContextMenuGroup );

function onContextMenuGroup( evt ) {
evt.data.items.add( {
name: 'Feedback',
label: 'Send Feedback',
icon: 'feedback',
isActive: true,
action: sendFeedback
} );
}

function sendFeedback() {
finder.request( 'dialog:info', {
msg: 'If you have any comments or suggestions, please <a href="http://cksource.com/contact">contact us</a>.'
Expand Down
77 changes: 77 additions & 0 deletions CustomColumn/CustomColumn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* CKFinder - Sample Plugins
* ==========================
* http://cksource.com/ckfinder
* Copyright (C) 2007-2015, CKSource - Frederico Knabben. All rights reserved.
*
* This file and its contents are subject to the MIT License.
* Please read the LICENSE.md file before using, installing, copying,
* modifying or distribute this file or part of its contents.
*/

CKFinder.define( [ 'marionette' ], function( Marionette ) {
'use strict';

/**
* Plugin that adds a custom column to list view.
*/
var CustomColumn = {
init: function( finder ) {
finder.on( 'listView:columns', function( evt ) {
var sizeColumn = evt.data.columns.findWhere( { name: 'size' } );

if ( sizeColumn ) {
sizeColumn.set( 'priority', 40 );
}

var dateColumn = evt.data.columns.findWhere( { name: 'date' } );

if ( dateColumn ) {
dateColumn.set( 'priority', 30 );
}
} );

finder.on( 'listView:columns', function( evt ) {
evt.data.columns.push( {
name: 'type',
label: 'Type',
priority: 25 // Column will be displayed after name column
} );
} );

// Add a view for file
finder.on( 'listView:file:column:type', function( evt ) {
evt.data.view = Marionette.ItemView.extend( {
tagName: 'td',
// The it variable contains file's attributes and template helpers
template: finder.doT.template( '{{= it.getType( it.name ) }}' ),
templateHelpers: {
getType: function( name ) {
var extension = name.substr( name.lastIndexOf( '.' ) + 1 ).toLowerCase();

if ( /(jpg|jpeg|gif|png)/.test( extension ) ) {
return 'Image';
}

if ( /(doc|docx|pdf)/.test( extension ) ) {
return 'Document';
}

return 'Other';
}
}
} );
} );

// Add a view for folder
finder.on( 'listView:folder:column:type', function( evt ) {
evt.data.view = Marionette.ItemView.extend( {
tagName: 'td',
template: finder.doT.template( 'Folder' )
} );
} );
}
};

return CustomColumn;
} );
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ Sample plugin that illustrates how to:
* Add a [context menu](http://docs.cksource.com/ckfinder3/#!/guide/dev_contextmenu) item.
* Add a [toolbar button](http://docs.cksource.com/ckfinder3/#!/guide/dev_toolbar).

### CustomColumn

Sample plugin that illustrates how to add a custom column to list view.

### CustomDialog

Sample plugin which adds a "Share" button that opens a [dialog window](http://docs.cksource.com/ckfinder3/#!/guide/dev_dialogs).
Expand Down
5 changes: 3 additions & 2 deletions SettingsDemo/SettingsDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CKFinder.define( function() {
* Plugin that adds all possible types of settings to the Settings Panel.
*/
var SettingsDemo = {
init: function settingsDataTypes( finder ) {
init: function ( finder ) {
function logChange( evt ) {
/* global console: false */
console.log( 'Changed setting: ', evt.data );
Expand All @@ -29,7 +29,7 @@ CKFinder.define( function() {
finder.on( 'setting:change:mySettings:select1', logChange );
finder.on( 'setting:change:mySettings:radio1', logChange );

finder.on( 'app:loaded', function() {
finder.on( 'app:ready', function() {
finder.request( 'settings:define', {
group: 'mySettings',
label: 'Settings demo',
Expand Down Expand Up @@ -90,6 +90,7 @@ CKFinder.define( function() {
]
} );
} );

// Disable range element in mobile view.
finder.on( 'ui:resize', function( evt ) {
if ( evt.data.modeChanged ) {
Expand Down
3 changes: 2 additions & 1 deletion StatusBarInfo/StatusBarInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ CKFinder.define( [ 'underscore', 'backbone', 'marionette', 'doT' ], function( _,
// Create a status bar named 'MyStatusBar' for the 'Main' page which contains the files pane.
finder.request( 'statusBar:create', {
name: 'MyStatusBar',
page: 'Main'
page: 'Main',
label: 'My Status Bar'
} );

// Add a region inside the 'MyStatusBar' status bar. By default the status bar is empty.
Expand Down

0 comments on commit b6d4c8d

Please sign in to comment.