HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/RMourik/bassol.nl/CMS/CMSScripts/CMSModules/CMS.Blogs/BlogsGrid.js
cmsdefine(['CMS/EventHub', 'CMS/GridActions', 'CMS/AppList'], function (eventHub, GridActions, AppList) {

    var appList = new AppList(),

        BlogsGrid = function (data) {
            var that = this,
                gridActions;

            this.pagesApplicationHash = data.pagesApplicationHash;
            this.blogPostClassId = data.blogPostClassId;

            gridActions = new GridActions({
                gridSelector: data.gridSelector,
                actionButtonsActions: {
                    '.js-edit': function (actionData) {
                        that.openBlogInPages(actionData.nodeId, actionData.documentCulture);
                    },
                    '.js-newpost': function (actionData) {
                        that.createNewBlogPost(actionData.nodeId, actionData.documentCulture);
                    }
                }
            });
        };

    BlogsGrid.prototype.openBlogInPages = function (blogId, blogCulture) {
        if (blogId !== 0) {
            appList.openApplication(undefined, undefined, '?action=edit&nodeid=' + blogId + '&culture=' + blogCulture, this.pagesApplicationHash);
        }
    };

    BlogsGrid.prototype.createNewBlogPost = function (blogId, culture) {
        if (blogId !== 0) {
            appList.openApplication(undefined, undefined, '?action=new&nodeid=' + blogId + '&classid=' + this.blogPostClassId + '&culture=' + culture, this.pagesApplicationHash);
        }
    }

    return BlogsGrid;
});