RichFilemanager icon indicating copy to clipboard operation
RichFilemanager copied to clipboard

Custom tree folder/file icons

Open qyloxe opened this issue 8 years ago • 2 comments

I changed slightly iconClass function:

			this.iconClass = ko.pureComputed(function() {
				var cssClass,
					extraClass = ['ico'];
				if(this.cdo.isFolder === true) {
					cssClass = this.rdo.icon_class || 'ico_folder'; // HERE
					if(this.isLoading() === true) {
						extraClass.push('loading');
					} else {
						extraClass.push('folder');
						if(!this.rdo.attributes.readable) {
							extraClass.push('lock');
						} else if(this.isExpanded() || !this.isExpanded() && this.isSliding()) {
							extraClass.push('open');
						}
					}
				} else {
					cssClass = this.rdo.icon_class || 'ico_file';  // AND HERE
					if(this.rdo.attributes.readable) {
                        extraClass.push('ext', this.rdo.attributes.extension);
					} else {
                        extraClass.push('file', 'lock');
					}
				}
				return cssClass + ' ' + extraClass.join('_');
			}, this);

and now, I can return my own icons for folders/files by setting in file/folder return struct:

     icon_class: 'silk_folder_bug',

Example CSS - it is the same icor with _lock and _open modifiers, but hey - it's just a simple hack with a lot of visual potential :-)

     .silk_folder_bug, .silk_folder_bug_lock, .silk_folder_bug_open {
         background: url(/images/icons/silk/icons/folder_bug.png) left top no-repeat !important;
     }

If it would be possible to integrate above with filemanager by someone who knows what he's doing, I would be totally happy.

qyloxe avatar Apr 07 '17 13:04 qyloxe

This solution is too specific. There is another, more general, idea to handle this case. The concept of themes will be reworked, so that each theme will include own css files, images and, perhaps, index html file, so you will be able to replace icons easily by changing a theme.

psolom avatar Apr 07 '17 17:04 psolom

Yep. I can see a theme with custom folder types and custom index file with own event fired when the icon is determined for every folder. Because I need to change icons for specific folders. Thanks for reply.

qyloxe avatar Apr 08 '17 01:04 qyloxe