Your IP : 18.224.62.198


Current Path : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/landing/ui/card/
Upload File :
Current File : /var/www/www-root/data/www/info.monolith-realty.ru/bitrix/js/landing/ui/card/add_page_card.min.js

(function(){"use strict";BX.namespace("BX.Landing.UI.Card");BX.Landing.UI.Card.AddPageCard=function(e){BX.Landing.UI.Card.BaseCard.apply(this,arguments);this.layout.classList.add("landing-ui-card-add-page");this.cache=new BX.Cache.MemoryCache;this.onSaveHandler=e.onSave||function(){};this.siteId=e.siteId;var t=BX.create("span",{props:{className:"landing-ui-card-add-page-icon"}});var a=BX.create("span",{props:{className:"landing-ui-card-add-page-text"},text:BX.Landing.Loc.getMessage("LANDING_LINK_PLACEHOLDER_NEW_PAGE")});var n=BX.create("div",{props:{className:"landing-ui-card-add-page-inner"},children:[t,a]});this.body.appendChild(n);BX.bind(this.layout,"click",this.onLayoutClick.bind(this))};BX.Landing.UI.Card.AddPageCard.prototype={constructor:BX.Landing.UI.Card.AddPageCard,__proto__:BX.Landing.UI.Card.BaseCard.prototype,onLayoutClick:function(e){e.preventDefault();BX.replace(this.layout,this.getFormLayout());var t=this.getTitleField();t.setValue("");setTimeout(function(){t.enableEdit();t.input.focus()})},getFormLayout:function(){return this.cache.remember("formLayout",function(){var e=BX.create("span",{props:{className:"ui-btn ui-btn-primary ui-btn-sm"},text:BX.Landing.Loc.getMessage("LANDING_LINK_NEW_PAGE_SAVE_BUTTON_LABEL"),events:{click:this.onSaveClick.bind(this)}});var t=BX.create("span",{props:{className:"ui-btn ui-btn-link ui-btn-sm"},text:BX.Landing.Loc.getMessage("LANDING_LINK_NEW_PAGE_CANCEL_BUTTON_LABEL"),events:{click:this.onCancelClick.bind(this)}});var a=BX.create("div",{props:{className:"landing-ui-card-add-page-form-buttons"},children:[e,t]});return BX.create("div",{props:{className:"landing-ui-card-add-page-form"},children:[this.getForm().layout,a]})}.bind(this))},onSaveClick:function(e){e.preventDefault();var t=BX.Landing.Backend.getInstance();var a=this.getTitleField().getValue();var n=BX.translit(a,{change_case:"L",replace_space:"-",replace_other:""});void t.createPage({title:a,code:n,siteId:this.siteId}).then(function(e){this.onSaveHandler(e);BX.replace(this.getFormLayout(),this.layout)}.bind(this))},onCancelClick:function(e){e.preventDefault();BX.replace(this.getFormLayout(),this.layout)},getTitleField:function(){return this.cache.remember("titleField",function(){return new BX.Landing.UI.Field.Text({title:BX.Landing.Loc.getMessage("LANDING_CREATE_PAGE_PANEL_FIELD_PAGE_TITLE"),textOnly:true})})},getForm:function(){return this.cache.remember("form",function(){return new BX.Landing.UI.Form.BaseForm({title:BX.Landing.Loc.getMessage("LANDING_LINK_PLACEHOLDER_NEW_PAGE"),fields:[this.getTitleField()]})}.bind(this))}}})();
//# sourceMappingURL=add_page_card.map.js