From 2dde77713206f6709a5ffa6a5b758a3c1abd7a5f Mon Sep 17 00:00:00 2001 From: Sacha Judd Date: Thu, 7 Sep 2017 10:07:53 +1200 Subject: [PATCH 1/3] FIX Add styles for url segment field --- client/dist/js/bundle.js | 2 +- client/dist/styles/bundle.css | 2 +- client/src/legacy/CMSMain.EditForm.js | 3 ++- client/src/styles/legacy/_CMSMain.scss | 15 +++++++++++++-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/client/dist/js/bundle.js b/client/dist/js/bundle.js index ae1bf378..508aec33 100644 --- a/client/dist/js/bundle.js +++ b/client/dist/js/bundle.js @@ -1 +1 @@ -!function(t){function e(i){if(n[i])return n[i].exports;var a=n[i]={i:i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=16)}([function(t,e){t.exports=jQuery},function(t,e){t.exports=i18n},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0);n.n(i).a.entwine("ss",function(t){t(".TreeDropdownField").entwine({OldValue:null}),t("#Form_AddForm_ParentID_Holder .treedropdownfield").entwine({onmatch:function(){this._super(),t(".cms-add-form").updateTypeList()}}),t(".cms-add-form .parent-mode :input").entwine({onclick:function(t){var e=this.closest("form").find("#Form_AddForm_ParentID_Holder .TreeDropdownField");"top"==this.val()?(e.setOldValue(e.getValue()),e.setValue(0)):(e.setValue(e.getOldValue()||0),e.setOldValue(null)),e.refresh(),e.trigger("change")}}),t(".cms-add-form").entwine({ParentCache:{},onadd:function(){var e=this;this.find("#Form_AddForm_ParentID_Holder .TreeDropdownField").bind("change",function(){e.updateTypeList()}),this.find(".SelectionGroup.parent-mode").bind("change",function(){e.updateTypeList()}),"top"==t(".cms-add-form .parent-mode :input").val()&&this.updateTypeList()},loadCachedChildren:function(t){var e=this.getParentCache();return void 0!==e[t]?e[t]:null},saveCachedChildren:function(t,e){var n=this.getParentCache();n[t]=e,this.setParentCache(n)},updateTypeList:function(){var e=this.data("hints"),n=this.find("#Form_AddForm_ParentID_Holder .TreeDropdownField"),i=this.find("input[name=ParentModeField]:checked").val(),a=n.data("metadata"),s=a&&"child"===i?n.getValue():null,o=a?a.ClassName:null,r=o&&"child"===i&&s?o:"Root",d=void 0!==e[r]?e[r]:null,l=this,c=d&&void 0!==d.defaultChild?d.defaultChild:null,u=[];if(s){if(this.hasClass("loading"))return;return this.addClass("loading"),null!==(u=this.loadCachedChildren(s))?(this.updateSelectionFilter(u,c),void this.removeClass("loading")):(t.ajax({url:l.data("childfilter"),data:{ParentID:s},success:function(t){l.saveCachedChildren(s,t),l.updateSelectionFilter(t,c)},complete:function(){l.removeClass("loading")}}),!1)}u=d&&void 0!==d.disallowedChildren?d.disallowedChildren:[],this.updateSelectionFilter(u,c)},updateSelectionFilter:function(e,n){var i=null;if(this.find("#Form_AddForm_PageType div.radio").each(function(){var n=t(this).find("input").val(),a=-1===t.inArray(n,e);t(this).setEnabled(a),a||t(this).setSelected(!1),i=null===i?a:i&&a}),n)var a=this.find("#Form_AddForm_PageType div.radio input[value="+n+"]").parents("li:first");else var a=this.find("#Form_AddForm_PageType div.radio:not(.disabled):first");a.setSelected(!0),a.siblings().setSelected(!1),this.find("#Form_AddForm_PageType div.radio:not(.disabled)").length?this.find("button[name=action_doAdd]").removeAttr("disabled"):this.find("button[name=action_doAdd]").attr("disabled","disabled"),this.find(".message-restricted")[i?"hide":"show"]()}}),t(".cms-add-form #Form_AddForm_PageType div.radio").entwine({onclick:function(t){this.setSelected(!0)},setSelected:function(t){var e=this.find("input");t&&!e.is(":disabled")?(this.siblings().setSelected(!1),this.toggleClass("selected",!0),e.prop("checked",!0)):(this.toggleClass("selected",!1),e.prop("checked",!1))},setEnabled:function(e){t(this).toggleClass("disabled",!e),e?t(this).find("input").removeAttr("disabled"):t(this).find("input").attr("disabled","disabled").removeAttr("checked")}}),t(".cms-content-addpage-button").entwine({onclick:function(e){var n,i=t(".cms-tree"),a=t(".cms-list"),s=0;if(i.is(":visible")){var o=i.jstree("get_selected");s=o?t(o[0]).data("id"):null}else{var r=a.find('input[name="Page[GridState]"]').val();r&&(s=parseInt(JSON.parse(r).ParentID,10))}var d,l={selector:this.data("targetPanel"),pjax:this.data("pjax")};s?(n=this.data("extraParams")?this.data("extraParams"):"",d=t.path.addSearchParams(i18n.sprintf(this.data("urlAddpage"),s),n)):d=this.attr("href"),t(".cms-container").loadPanel(d,null,l),e.preventDefault(),this.blur()}})})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n.n(i),s=n(1),o=n.n(s);a.a.entwine("ss",function(t){t(".cms-edit-form :input[name=ClassName]").entwine({onchange:function(){alert(o.a._t("CMS.ALERTCLASSNAME"))}}),t(".cms-edit-form input[name=Title]").entwine({onmatch:function(){var e=this;e.data("OrigVal",e.val());var n=e.closest("form"),i=t("input:text[name=URLSegment]",n),a=t("input[name=LiveLink]",n);i.length>0&&(e._addActions(),this.bind("change",function(n){var s=e.data("OrigVal"),o=e.val();e.data("OrigVal",o),0===i.val().indexOf(i.data("defaultUrl"))&&""==a.val()?e.updateURLSegment(o):t(".update",e.parent()).show(),e.updateRelatedFields(o,s),e.updateBreadcrumbLabel(o)})),this._super()},onunmatch:function(){this._super()},updateRelatedFields:function(e,n){this.parents("form").find("input[name=MetaTitle], input[name=MenuTitle]").each(function(){var i=t(this);i.val()==n&&(i.val(e),i.updatedRelatedFields&&i.updatedRelatedFields())})},updateURLSegment:function(e){var n=t("input:text[name=URLSegment]",this.closest("form")),i=n.closest(".field.urlsegment"),a=t(".update",this.parent());i.update(e),a.is(":visible")&&a.hide()},updateBreadcrumbLabel:function(e){var n=(t(".cms-edit-form input[name=ID]").val(),t("span.cms-panel-link.crumb"));e&&""!=e&&n.text(e)},_addActions:function(){var e,n=this;e=t("