Metadata screen on EES

I've got two metadata schemas applied to a group of assets and we want clients to be able to update the contents of only one schema.


The first schema (applied to the site) is called Contents and the one specific to the client task is called Features. Is there a way to get the Features metadata section to appear above the Contents section, when viewing the Metadata screen via Easy Edit? Or even hide one of the schemas? As far as I can tell, the schemas appear in alphabetical order so I guess the obvious change would be to add a number or something at the start to get it to appear higher up.



This would be good so that the client wouldn't need to scroll to the bottom of the page to make changes, and would hopefully not see/alter the other details.



Also with metadata, can I get a field to be automatically populated with the name of it's parent asset? Can't really see what keyword might fit this, if any.

Each schema is populated with a CSS class you could use to hide out what you don't want editors to see (or even use javascript customisation to remove it from the dom all together). If you wanted to hide out the first schema applied in CSS:

    
    .schemaHeading_0,
    .sectionHeading_0,
    .section_0 {
       display: none;
    }


or using jQuery:

    
    jQuery('.schemaHeading_0,.sectionHeading_0,.section_0','#ees_editMetadata').remove();


You can have a look at the manuals for more info on customising EES: http://manuals.matrix.squizsuite.net/ees/chapters/javascript-plugins/

I started to build my first plugin just after I wrote that post, so I'm glad to hear that I was on the right track.


I'm not getting any errors when this is applied, but it's not removing the content either:

    EasyEdit.plugins.hideMetadataSchema = {
    	init: function() {
    		var self = this;
    		//Add a function to the screen load event
    		EasyEditEventManager.bind('EasyEditScreenLoad',self.addHideMetadataSchema);
    	},
    	addHideMetadataSchema: function(){
    		//Get the current asset
    		EasyEditAssetManager.getCurrentAsset(function(asset){
    			//Hide the div
    			jQuery('.schemaHeading_0,.sectionHeading_0,.section_0','#ees_editMetadata').remove();
    		});
    	}
    };

The code was taken from manuals site example and I’ve added in what you wrote below. Previously the line of code under ‘//Hide the div’ was:

    $(’.editSection,.section_0’).css(‘display’,‘none’);
But that did not work either.



I’ve added the read permission, urls, and script ref in the parse file of the design, but am I forgetting an extra spot? Currently the js file is called EasyEdit.plugins.hideMetadataSchemas.js, is the naming of the file important?

Hey


The JS file naming is not important.



Looks like your almost there. Couple of things to point out. The example in the manuals uses the 'getCurrentAsset' method of the EasyEditAssetManager object to gain cached data about the current asset. The use of this function is not required for what you're trying to achieve here, so you can remove it from your code.



Add some troubleshooting code to ensure everything is firing correctly and that there are no other conflicts causing any issues, for you're code that would be something like…


    
    EasyEdit.plugins.hideMetadataSchema = {
    init: function() {
        var self = this;
        //Add a function to the screen load event
        EasyEditEventManager.bind('EasyEditScreenLoad',self.addHideMetadataSchema);
    },
    addHideMetadataSchema: function(){
        // Test to make sure my code is working and we're on the metadata screen...
        console.log('Hello world! Is this the metadata screen? 1 = Yes, 0 = No. Drum roll, the answer is: ' + jQuery('#ees_editMetadata').length);
    }
    };


Once you know you've gotten that far the rest comes down to what you are trying to do to traverse and manipulate elements within the #ees_editMetadata parent. Take a step by step process to ensure the elements you are trying to manipulate actually exists, it will only be one of a few things for what you are trying to accomplish: coding error(s) (even if silently failing) or the elements that you are trying to manipulate don't exist.

By the way, try and lock your screen load code down to only execute in the right places, have a look inside the EES download package in ees/Examples/Plugins/EasyEditScreenLoadCustomisation.js for a basic guide on how this can be done with simple re-use of existing EES object methods combined with screen detection conditions.

Cheers

Scotty

Cheers Scott. It all makes sense and I've got it working fine now so thanks. The examples are pretty useful so I've based it all off that.


We just upgraded one of our EES installs and I've noticed now that all standard pages have a default child of 'Page Contents'. This cannot be selected in the asset finder and we wouldn't want it to anyway. Is there a reason it is appearing? I'd like to remove it from the asset finder but this also means I need to make sure the number next to the parent asset gets decreased by 1 so that it doesn't become misleading to the users.



Any one know why this was included?





*EES Build 1087


The asset finder was rewritten in the newer version and we had to use a different method to display the assets. One of the major reasons we show it by default is because of the new pagination options, the example being if you set the maximum number of assets to something very low the pagination experience is quite confusing if the dependant assets are hidden, so we decided to display them in the asset finder but remove any interaction. You easily add customisation that hides these through CSS and/or javascript if you don't want them shown to the user at all.

I would suggest educating the users to quietly ignore the dependant children that now appear in the asset finder, this may save you some headaches in customising this yourself or if this changes in future upgrades.


Cheers



Scotty

Hi


Anthony - I did try to remove the items with some scripting, but it proved to be a little more difficult than expected.



So…



Scott - I think that your suggestion is what we had originally planned, and it's the direction we will be going.



Thanks for the responses :slight_smile:

Sort of a follow up question - I know I can remove the 'Use default' check box from being automatically checked on an EES screen, but is there a way to have the 'Use default' box unchecked as the default in the admin interface?