"create a new block" button is not visible in some content areas

Vote:
 

Hi,

I am working with EpiServer 8 and I can't understand why in some pages the "create a new block" button is not visible.

Visible:

https://drive.google.com/file/d/0B9PWtogMZCplRUlPNDZpcjV5c2M/view?usp=sharing

Not visible:

https://drive.google.com/file/d/0B9PWtogMZCpldjgzQ2FQeDN4REU/view?usp=sharing

#144150
Feb 08, 2016 16:16
Vote:
 

Might want to check what restrictions you have set on the content area?

http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/Content/Properties/Property-types/Restricting-content-types-in-properties/

#144159
Feb 08, 2016 17:26
Vote:
 

Hi daniel,

Thanks for the reply. Unfortunately that's not it.

The allowed types are simple and the same for both content areas. The only difference is the page that they are showing in.

#144218
Feb 09, 2016 11:29
Vote:
 

Hi, Ashkan,

When searching through Episerver packages folder, I could trace this to:

        isCreateLinkVisible: function () {
            // summary:
            //      Overridden mixin class, depend on currentMode will show/not create link
            // tags:
            //      protected

            return this.model.canCreateBlock(this.allowedTypes, this.restrictedTypes);
        },

Then, you can look into ContentAreaViewModel.js.uncompressed.js and check canCreateBlock, might be that hasCreatePermission is false or similar, see the body:

canCreateBlock: function (allowedTypes, restrictedTypes) {
            // summary:
            //      Deteremines whether the user can create blocks on this content area.
            // tags:
            //      internal

            var contentTypeservice = this.contentTypeService;
            return all([this.getCurrentContext(), this.getCurrentContent()])
                .then(function (results) {
                    var context = results[0],
                        contentData = results[1];

                    // If there is no context or content data then it shouldn't be possible
                    // to create a block for this content area. So return false.
                    if (!context || !contentData) {
                        return false;
                    }

                    var hasCreatePermission = ContentActionSupport.isActionAvailable(
                        contentData,
                        ContentActionSupport.action.Create,
                        ContentActionSupport.providerCapabilities.Create,
                        true);

                    // Check whether the current user has create permission. Also check if the current content is
                    // resourcable and finally check whether we are in a mode where create should not be available.
                    if (!hasCreatePermission ||
                        !context.capabilities.resourceable ||
                        context.currentMode === "create" || context.currentMode === "translate") {
                        return false;
                    }


                    return when(contentTypeservice.getAcceptedChildTypes(contentData.contentLink, true, ["episerver.core.blockdata"], allowedTypes, restrictedTypes)).then(function (availableTypes) {
                        return !!availableTypes.length;
                    });

                });
        },

Hope this helps,

Marija

#144220
Feb 09, 2016 12:06
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.