<commit_before>/**
 * Created by <NAME> from Ubrainians for imCode
 * 10.08.17.
 */
Imcms.define("imcms-menu-editor-builder",
    [
        "imcms-bem-builder", "imcms-components-builder", "imcms-document-editor-builder", "imcms-modal-window-builder",
        "imcms-window-builder", "imcms-menus-rest-api", "imcms-controls-builder", "imcms-page-info-builder", "jquery",
        "imcms-primitives-builder"
    ],
    function (BEM, components, documentEditorBuilder, imcmsModalWindow, WindowBuilder, menusRestApi,
              controls, pageInfoBuilder, $, primitivesBuilder) {

        var $title, $menuElementsContainer, $documentsContainer;
        var docId, menuId;

        function saveAndClose() {
            // fixme: just closing now, should be save and close
            menuWindowBuilder.closeWindow();
        }

        function buildHead() {
            var $head = menuWindowBuilder.buildHead("menu editor");
            $title = $head.find(".imcms-title");

            return $head;
        }

        function buildBody() {
            return new BEM({
                block: "imcms-menu-editor-body",
                elements: {
                    "left-side": $menuElementsContainer = $("<div>", {"class": "imcms-left-side"}),
                    "right-side": $documentsContainer = $("<div>", {"class": "imcms-right-side"})
                }
            }).buildBlockStructure("<div>");
        }

        function createItem() {
            var $dataInput = $("#dataInput"),
                menuElementsTree = {
                    documentId: $dataInput.attr("data-id"),
                    title: $dataInput.attr("data-title")
                },
                $menuElement = buildMenuItemTree(menuElementsTree, 1);

            $menuElementsContainer.find(".imcms-menu-items-tree").append($menuElement);
        }

        function buildFooter() {
            var $saveAndClose = components.buttons.saveButton({
                    text: "Save and close",
                    click: saveAndClose
                }),
                $dataInput = primitivesBuilder.imcmsInput({
                    "type": "hidden",
                    "id": "dataInput",
                    change: createItem
                });<commit_msg>IMCMS-233 - Apply new UI to the admin panel and editors: - Menu Editor refactored.<commit_after>/**
 * Created by <NAME> from Ubrainians for imCode
 * 10.08.17.
 */
Imcms.define("imcms-menu-editor-builder",
    [
        "imcms-bem-builder", "imcms-components-builder", "imcms-document-editor-builder", "imcms-modal-window-builder",
        "imcms-window-builder", "imcms-menus-rest-api", "imcms-controls-builder", "imcms-page-info-builder", "jquery",
        "imcms-primitives-builder"
    ],
    function (BEM, components, documentEditorBuilder, imcmsModalWindow, WindowBuilder, menusRestApi,
              controls, pageInfoBuilder, $, primitivesBuilder) {

        var $title, $menuElementsContainer, $documentsContainer;
        var docId, menuId;

        function saveAndClose() {
            // fixme: just closing now, should be save and close
            menuWindowBuilder.closeWindow();
        }

        function buildHead() {
            var $head = menuWindowBuilder.buildHead("menu editor");
            $title = $head.find(".imcms-title");

            return $head;
        }

        function buildBody() {
            return new BEM({
                block: "imcms-menu-editor-body",
                elements: {
                    "left-side": $menuElementsContainer = $("<div>", {"class": "imcms-left-side"}),
                    "right-side": $documentsContainer = $("<div>", {"class": "imcms-right-side"})
                }
            }).buildBlockStructure("<div>");
        }

        function createItem() {
            var $dataInput = $(this),
                menuElementsTree = {
                    documentId: $dataInput.attr("data-id"),
                    title: $dataInput.attr("data-title")
                },
                $menuElement = buildMenuItemTree(menuElementsTree, 1);

            $menuElementsContainer.find(".imcms-menu-items-tree").append($menuElement);
        }

        function buildFooter() {
            var $saveAndClose = components.buttons.saveButton({
                    text: "Save and close",
                    click: saveAndClose
                }),
                $dataInput = primitivesBuilder.imcmsInput({
                    "type": "hidden",
                    "id": "dataInput",
                    change: createItem
                });
{'fraction_non_alphanumeric': 0.13225312021020363, 'fraction_numerical': 0.0037223560324063936, 'mean_word_length': 1.8355058969584108, 'pattern_counts': {'":': 12, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1922518', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1167, 'n_words': 234}