BUG Fix race condition with change detection / loading animation

Fixes #1859
This commit is contained in:
Damian Mooyman 2017-09-05 16:36:20 +12:00 committed by Christopher Joe
parent 62ea34c0cb
commit 3669f30e4e
3 changed files with 65 additions and 52 deletions

View File

@ -1 +1 @@
!function(t){function e(a){if(n[a])return n[a].exports;var i=n[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,a){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:a})},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 a=n(0);n.n(a).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"),a=this.find("input[name=ParentModeField]:checked").val(),i=n.data("metadata"),s=i&&"child"===a?n.getValue():null,r=i?i.ClassName:null,o=r&&"child"===a&&s?r:"Root",d=void 0!==e[o]?e[o]: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 a=null;if(this.find("#Form_AddForm_PageType div.radio").each(function(){var n=t(this).find("input").val(),i=-1===t.inArray(n,e);t(this).setEnabled(i),i||t(this).setSelected(!1),a=null===a?i:a&&i}),n)var i=this.find("#Form_AddForm_PageType div.radio input[value="+n+"]").parents("li:first");else var i=this.find("#Form_AddForm_PageType div.radio:not(.disabled):first");i.setSelected(!0),i.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")[a?"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,a=t(".cms-tree"),i=t(".cms-list"),s=0;if(a.is(":visible")){var r=a.jstree("get_selected");s=r?t(r[0]).data("id"):null}else{var o=i.find('input[name="Page[GridState]"]').val();o&&(s=parseInt(JSON.parse(o).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 a=n(0),i=n.n(a),s=n(1),r=n.n(s);i.a.entwine("ss",function(t){t(".cms-edit-form :input[name=ClassName]").entwine({onchange:function(){alert(r.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"),a=t("input:text[name=URLSegment]",n),i=t("input[name=LiveLink]",n);a.length>0&&(e._addActions(),this.bind("change",function(n){var s=e.data("OrigVal"),r=e.val();e.data("OrigVal",r),0===a.val().indexOf(a.data("defaultUrl"))&&""==i.val()?e.updateURLSegment(r):t(".update",e.parent()).show(),e.updateRelatedFields(r,s),e.updateBreadcrumbLabel(r)})),this._super()},onunmatch:function(){this._super()},updateRelatedFields:function(e,n){this.parents("form").find("input[name=MetaTitle], input[name=MenuTitle]").each(function(){var a=t(this);a.val()==n&&(a.val(e),a.updatedRelatedFields&&a.updatedRelatedFields())})},updateURLSegment:function(e){var n=t("input:text[name=URLSegment]",this.closest("form")),a=n.closest(".field.urlsegment"),i=t(".update",this.parent());a.update(e),i.is(":visible")&&i.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("<button />",{class:"btn btn-primary btn-sm update",text:r.a._t("CMS.UpdateURL"),type:"button",click:function(t){t.preventDefault(),n.updateURLSegment(n.val())}}),e.insertAfter(n),e.hide()}}),t(".cms-edit-form .parentTypeSelector").entwine({onmatch:function(){var t=this;this.find(":input[name=ParentType]").bind("click",function(e){t._toggleSelection(e)}),this.find(".TreeDropdownField").bind("change",function(e){t._changeParentId(e)}),this._changeParentId(),this._toggleSelection(),this._super()},onunmatch:function(){this._super()},_toggleSelection:function(e){var n=this.find(":input[name=ParentType]:checked").val(),a=this.find("#Form_EditForm_ParentID_Holder");"root"==n?this.find(":input[name=ParentID]").val(0):this.find(":input[name=ParentID]").val(this.find("#Form_EditForm_ParentType_subpage").data("parentIdValue")),"root"!=n?a.slideDown(400,function(){t(this).css("overflow","visible")}):a.slideUp()},_changeParentId:function(t){var e=this.find(":input[name=ParentID]").val();this.find("#Form_EditForm_ParentType_subpage").data("parentIdValue",e)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_print").entwine({onclick:function(e){var n=t(this[0].form).attr("action").replace(/\?.*$/,"")+"/printable/"+t(":input[name=ID]",this[0].form).val();return"http://"!=n.substr(0,7)&&(n=t("base").attr("href")+n),window.open(n,"printable"),!1}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_rollback").entwine({onclick:function(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),a="";return a=n?r.a.sprintf(r.a._t("CMS.RollbackToVersion"),n):r.a._t("CMS.ConfirmRestoreFromLive"),!!confirm(a)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_archive").entwine({onclick:function(t){var e=this.parents("form:first"),n="";return n=e.find("input[name=ArchiveWarningMessage]").val().replace(/\\n/g,"\n"),!!confirm(n)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_restore").entwine({onclick:function(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),a="",i=this.data("toRoot");return a=r.a.sprintf(r.a._t(i?"CMS.RestoreToRoot":"CMS.Restore"),n),!!confirm(a)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_unpublish").entwine({onclick:function(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),a="";return a=r.a.sprintf(r.a._t("CMS.Unpublish"),n),!!confirm(a)&&this._super(t)}}),t(".cms-edit-form.changed").entwine({onmatch:function(t){var e=this.find("button[name=action_save]");e.attr("data-text-alternate")&&(e.attr("data-text-standard",e.find("span").text()),e.find("span").text(e.attr("data-text-alternate"))),e.attr("data-btn-alternate")&&(e.attr("data-btn-standard",e.attr("class")),e.attr("class",e.attr("data-btn-alternate"))),e.removeClass("btn-outline-secondary").addClass("btn-primary");var n=this.find("button[name=action_publish]");n.attr("data-text-alternate")&&(n.attr("data-text-standard",n.find("span").text()),n.find("span").text(n.attr("data-text-alternate"))),n.attr("data-btn-alternate")&&(n.attr("data-btn-standard",n.attr("class")),n.attr("class",n.attr("data-btn-alternate"))),n.removeClass("btn-outline-secondary").addClass("btn-primary"),this._super(t)},onunmatch:function(t){var e=this.find("button[name=action_save]");e.attr("data-text-standard")&&e.text(e.attr("data-text-standard")),e.attr("data-btn-standard")&&e.attr("class",e.attr("data-btn-standard"));var n=this.find("button[name=action_publish]");n.attr("data-text-standard")&&n.text(n.attr("data-text-standard")),n.attr("data-btn-standard")&&n.attr("class",n.attr("data-btn-standard")),this._super(t)}}),t(".cms-edit-form .btn-toolbar button[name=action_publish]").entwine({onbuttonafterrefreshalternate:function(){this.data("showingAlternate")?(this.addClass("btn-primary"),this.removeClass("btn-secondary")):(this.removeClass("btn-primary"),this.addClass("btn-secondary"))}}),t(".cms-edit-form .btn-toolbar button[name=action_save]").entwine({onbuttonafterrefreshalternate:function(){this.data("showingAlternate")?(this.addClass("btn-primary"),this.removeClass("btn-secondary")):(this.removeClass("btn-primary"),this.addClass("btn-secondary"))}}),t('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').entwine({onmatch:function(){this.redraw(),this._super()},onunmatch:function(){this._super()},redraw:function(){var e=t(".cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder");"Form_EditForm_ParentType_root"==t(this).attr("id")?e.slideUp():e.slideDown()},onclick:function(){this.redraw()}}),"Form_EditForm_ParentType_root"==t('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').attr("id")&&t(".cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder").hide()})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),i=n.n(a),s=n(1),r=n.n(s);i.a.entwine("ss.tree",function(t){t(".cms-tree").entwine({fromDocument:{"oncontext_show.vakata":function(t){this.adjustContextClass()}},adjustContextClass:function(){var e=t("#vakata-contextmenu").find("ul ul");e.each(function(n){var a="1",i=t(e[n]).find("li").length;i>20?a="3":i>10&&(a="2"),t(e[n]).addClass("col-"+a).removeClass("right"),t(e[n]).find("li").on("mouseenter",function(e){t(this).parent("ul").removeClass("right")})})},getTreeConfig:function(){var e=this,n=this._super();return this.getHints(),n.plugins.push("contextmenu"),n.contextmenu={items:function(n){var a={edit:{label:n.hasClass("edit-disabled")?r.a._t("CMS.EditPage","Edit page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"):r.a._t("CMS.ViewPage","View page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),action:function(n){t(".cms-container").entwine(".ss").loadPanel(r.a.sprintf(e.data("urlEditpage"),n.data("id")))}}};n.hasClass("nochildren")||(a.showaslist={label:r.a._t("CMS.ShowAsList"),action:function(n){t(".cms-container").entwine(".ss").loadPanel(e.data("urlListview")+"&ParentID="+n.data("id"),null,{tabState:{"pages-controller-cms-content":{tabSelector:".content-listview"}}})}});var i=(n.data("pagetype"),n.data("id")),s=n.find(">a .item").data("allowedchildren"),o={},d=!1;return t.each(s,function(n,a){d=!0,o["allowedchildren-"+n]={label:'<span class="jstree-pageicon"></span>'+a,_class:"class-"+n.replace(/[^a-zA-Z0-9\-_:.]+/g,"_"),action:function(a){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r.a.sprintf(e.data("urlAddpage"),i,n),e.data("extraParams")))}}}),d&&(a.addsubpage={label:r.a._t("CMS.AddSubPage","Add page under this page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),submenu:o}),n.hasClass("edit-disabled")||(a.duplicate={label:r.a._t("CMS.Duplicate"),submenu:[{label:r.a._t("CMS.ThisPageOnly"),action:function(n){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r.a.sprintf(e.data("urlDuplicate"),n.data("id")),e.data("extraParams")))}},{label:r.a._t("CMS.ThisPageAndSubpages"),action:function(n){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r.a.sprintf(e.data("urlDuplicatewithchildren"),n.data("id")),e.data("extraParams")))}}]}),a}},n}}),t(".cms-tree a.jstree-clicked").entwine({onmatch:function(){var t,e=this,n=e.parents(".cms-panel-content");(e.offset().top<0||e.offset().top>n.height()-e.height())&&(t=n.scrollTop()+e.offset().top+n.height()/2,n.animate({scrollTop:t},"slow"))}}),t(".cms-tree-filtered .clear-filter").entwine({onclick:function(){window.location=location.protocol+"//"+location.host+location.pathname}})})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=n(0);n.n(a).a.entwine("ss",function(t){t(".cms-content-header-info").entwine({"from .cms-panel":{ontoggle:function(t){var e=this.closest(".cms-content").find(t.target);0!==e.length&&this.parent()[e.hasClass("collapsed")?"addClass":"removeClass"]("collapsed")}}}),t(".cms .cms-panel-link.page-view-link").entwine({onclick:function(e){return this.siblings().removeClass("active"),this.addClass("active"),t(".cms-content-filters input[type='hidden'][name='view']").val(t(this).data("view")),this._super(e)}}),t(".cms-content-toolbar").entwine({onmatch:function(){var e=this;this._super(),t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var n=t(this),a=n.data("toolid");n.hasClass("active"),void 0!==a&&(n.data("active",!1).removeClass("active"),t("#"+a).hide(),e.bindActionButtonEvents(n))})},onunmatch:function(){var e=this;this._super(),t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var n=t(this);e.unbindActionButtonEvents(n)})},bindActionButtonEvents:function(t){var e=this;t.on("click.cmsContentToolbar",function(n){e.showHideTool(t)})},unbindActionButtonEvents:function(t){t.off(".cmsContentToolbar")},showHideTool:function(e){var n=e.data("active"),a=e.data("toolid"),i=t("#"+a);t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var e=t(this),n=t("#"+e.data("toolid"));e.data("toolid")!==a&&(n.hide(),e.data("active",!1))}),e[n?"removeClass":"addClass"]("active"),i[n?"hide":"show"](),e.data("active",!n)}})})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),i=n.n(a),s=n(1),r=n.n(s);i.a.entwine("ss",function(t){t("#Form_VersionsForm").entwine({onmatch:function(){this._super()},onunmatch:function(){this._super()},onsubmit:function(e){e.preventDefault();var n=this.find(":input[name=ID]").val();if(!n)return!1;var a=null,i=null,s=null,o=this.find(":input[name=CompareMode]").is(":checked"),d=this.find("table input[type=checkbox]").filter(":checked");if(o){if(2!==d.length)return!1;i=d.eq(0).val(),s=d.eq(1).val(),a=r.a.sprintf(this.data("linkTmplCompare"),n,s,i)}else i=d.eq(0).val(),a=r.a.sprintf(this.data("linkTmplShow"),n,i);return t(".cms-container").loadPanel(a,"",{pjax:"CurrentForm"}),!0}}),t("#Form_VersionsForm input[name=ShowUnpublished]").entwine({onmatch:function(){this.toggle(),this._super()},onunmatch:function(){this._super()},onchange:function(){this.toggle()},toggle:function(){var e=t(this),n=e.parents("form").find("tr[data-published=false]");e.attr("checked")?n.removeClass("ui-helper-hidden").show():n.addClass("ui-helper-hidden").hide()._unselect()}}),t("#Form_VersionsForm tbody tr").entwine({onclick:function(){var t=this.parents("form").find(":input[name=CompareMode]").attr("checked"),e=this.siblings(".active");return t&&this.hasClass("active")?void this._unselect():t?e.length>1?void alert(r.a._t("CMS.ONLYSELECTTWO","You can only compare two versions at this time.")):(this._select(),void(1===e.length&&this.parents("form").submit())):(this._select(),e._unselect(),void this.parents("form").submit())},_unselect:function(){this.removeClass("active"),this.find(":input[type=checkbox]").attr("checked",!1)},_select:function(){this.addClass("active"),this.find(":input[type=checkbox]").attr("checked",!0)}})})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=n(0);n.n(a).a.entwine("ss",function(t){t("#Form_EditForm_RedirectionType input").entwine({onmatch:function(){t(this).attr("checked")&&this.toggle(),this._super()},onunmatch:function(){this._super()},onclick:function(){this.toggle()},toggle:function(){"Internal"==t(this).attr("value")?(t("#Form_EditForm_ExternalURL_Holder").hide(),t("#Form_EditForm_LinkToID_Holder").show()):(t("#Form_EditForm_ExternalURL_Holder").show(),t("#Form_EditForm_LinkToID_Holder").hide())}})})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=n(0);n.n(a).a.entwine("ss",function(t){t(".field.urlsegment:not(.readonly)").entwine({MaxPreviewLength:55,Ellipsis:"...",onmatch:function(){this.find(":text").length&&this.toggleEdit(!1),this.redraw(),this._super()},redraw:function(){var t=this.find(":text"),e=decodeURI(t.data("prefix")+t.val()),n=e;e.length>this.getMaxPreviewLength()&&(n=this.getEllipsis()+e.substr(e.length-this.getMaxPreviewLength(),e.length)),this.find(".URL-link").attr("href",encodeURI(e+t.data("suffix"))).text(n)},toggleEdit:function(t){var e=this.find(":text");this.find(".preview-holder")[t?"hide":"show"](),this.find(".edit-holder")[t?"show":"hide"](),t&&(e.data("origval",e.val()),e.focus())},update:function(){var t=this,e=this.find(":text"),n=e.data("origval"),a=arguments[0],i=a&&""!==a?a:e.val();n!=i?(this.addClass("loading"),this.suggest(i,function(n){e.val(decodeURIComponent(n.value)),t.toggleEdit(!1),t.removeClass("loading"),t.redraw()})):(this.toggleEdit(!1),this.redraw())},cancel:function(){var t=this.find(":text");t.val(t.data("origval")),this.toggleEdit(!1)},suggest:function(e,n){var a=this,i=a.find(":text"),s=t.path.parseUrl(a.closest("form").attr("action")),r=s.hrefNoSearch+"/field/"+i.attr("name")+"/suggest/?value="+encodeURIComponent(e);s.search&&(r+="&"+s.search.replace(/^\?/,"")),t.ajax({url:r,success:function(t){n.apply(this,arguments)},error:function(t,e){t.statusText=t.responseText},complete:function(){a.removeClass("loading")}})}}),t(".field.urlsegment .edit").entwine({onclick:function(t){t.preventDefault(),this.closest(".field").toggleEdit(!0)}}),t(".field.urlsegment .update").entwine({onclick:function(t){t.preventDefault(),this.closest(".field").update()}}),t(".field.urlsegment .cancel").entwine({onclick:function(t){t.preventDefault(),this.closest(".field").cancel()}})})},,,,,,,,function(t,e,n){n(2),n(3),n(5),n(4),n(6),n(7),n(8)}]); !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("<button />",{class:"btn btn-primary btn-sm update",text:o.a._t("CMS.UpdateURL"),type:"button",click:function(t){t.preventDefault(),n.updateURLSegment(n.val())}}),e.insertAfter(n),e.hide()}}),t(".cms-edit-form .parentTypeSelector").entwine({onmatch:function(){var t=this;this.find(":input[name=ParentType]").bind("click",function(e){t._toggleSelection(e)}),this.find(".TreeDropdownField").bind("change",function(e){t._changeParentId(e)}),this._changeParentId(),this._toggleSelection(),this._super()},onunmatch:function(){this._super()},_toggleSelection:function(e){var n=this.find(":input[name=ParentType]:checked").val(),i=this.find("#Form_EditForm_ParentID_Holder");"root"==n?this.find(":input[name=ParentID]").val(0):this.find(":input[name=ParentID]").val(this.find("#Form_EditForm_ParentType_subpage").data("parentIdValue")),"root"!=n?i.slideDown(400,function(){t(this).css("overflow","visible")}):i.slideUp()},_changeParentId:function(t){var e=this.find(":input[name=ParentID]").val();this.find("#Form_EditForm_ParentType_subpage").data("parentIdValue",e)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_print").entwine({onclick:function(e){var n=t(this[0].form).attr("action").replace(/\?.*$/,"")+"/printable/"+t(":input[name=ID]",this[0].form).val();return"http://"!=n.substr(0,7)&&(n=t("base").attr("href")+n),window.open(n,"printable"),!1}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_rollback").entwine({onclick:function(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i="";return i=n?o.a.sprintf(o.a._t("CMS.RollbackToVersion"),n):o.a._t("CMS.ConfirmRestoreFromLive"),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_archive").entwine({onclick:function(t){var e=this.parents("form:first"),n="";return n=e.find("input[name=ArchiveWarningMessage]").val().replace(/\\n/g,"\n"),!!confirm(n)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_restore").entwine({onclick:function(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i="",a=this.data("toRoot");return i=o.a.sprintf(o.a._t(a?"CMS.RestoreToRoot":"CMS.Restore"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_unpublish").entwine({onclick:function(t){var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i="";return i=o.a.sprintf(o.a._t("CMS.Unpublish"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form.changed").entwine({onmatch:function(e){this.find("button[data-text-alternate]").each(function(){var e=t(this),n=e.find(".btn__title"),i=e.data("textAlternate");i&&(e.data("textStandard",n.text()),n.text(i));var a=e.data("btnAlternate");a&&(e.data("btnStandard",e.attr("class")),e.attr("class",a),e.removeClass("btn-outline-secondary").addClass("btn-primary"));var s=e.data("btnAlternateAdd");s&&e.addClass(s);var o=e.data("btnAlternateRemove");o&&e.removeClass(o)}),this._super(e)},onunmatch:function(e){this.find("button[data-text-alternate]").each(function(){var e=t(this),n=e.find(".btn__title"),i=e.data("textStandard");i&&n.text(i);var a=e.data("btnStandard");a&&(e.attr("class",a),e.addClass("btn-outline-secondary").removeClass("btn-primary"));var s=e.data("btnAlternateAdd");s&&e.removeClass(s);var o=e.data("btnAlternateRemove");o&&e.addClass(o)}),this._super(e)}}),t(".cms-edit-form .btn-toolbar button[name=action_publish]").entwine({onbuttonafterrefreshalternate:function(){this.data("showingAlternate")?(this.addClass("btn-primary"),this.removeClass("btn-secondary")):(this.removeClass("btn-primary"),this.addClass("btn-secondary"))}}),t(".cms-edit-form .btn-toolbar button[name=action_save]").entwine({onbuttonafterrefreshalternate:function(){this.data("showingAlternate")?(this.addClass("btn-primary"),this.removeClass("btn-secondary")):(this.removeClass("btn-primary"),this.addClass("btn-secondary"))}}),t('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').entwine({onmatch:function(){this.redraw(),this._super()},onunmatch:function(){this._super()},redraw:function(){var e=t(".cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder");"Form_EditForm_ParentType_root"==t(this).attr("id")?e.slideUp():e.slideDown()},onclick:function(){this.redraw()}}),"Form_EditForm_ParentType_root"==t('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').attr("id")&&t(".cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder").hide()})},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.tree",function(t){t(".cms-tree").entwine({fromDocument:{"oncontext_show.vakata":function(t){this.adjustContextClass()}},adjustContextClass:function(){var e=t("#vakata-contextmenu").find("ul ul");e.each(function(n){var i="1",a=t(e[n]).find("li").length;a>20?i="3":a>10&&(i="2"),t(e[n]).addClass("col-"+i).removeClass("right"),t(e[n]).find("li").on("mouseenter",function(e){t(this).parent("ul").removeClass("right")})})},getTreeConfig:function(){var e=this,n=this._super();return this.getHints(),n.plugins.push("contextmenu"),n.contextmenu={items:function(n){var i={edit:{label:n.hasClass("edit-disabled")?o.a._t("CMS.EditPage","Edit page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"):o.a._t("CMS.ViewPage","View page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),action:function(n){t(".cms-container").entwine(".ss").loadPanel(o.a.sprintf(e.data("urlEditpage"),n.data("id")))}}};n.hasClass("nochildren")||(i.showaslist={label:o.a._t("CMS.ShowAsList"),action:function(n){t(".cms-container").entwine(".ss").loadPanel(e.data("urlListview")+"&ParentID="+n.data("id"),null,{tabState:{"pages-controller-cms-content":{tabSelector:".content-listview"}}})}});var a=(n.data("pagetype"),n.data("id")),s=n.find(">a .item").data("allowedchildren"),r={},d=!1;return t.each(s,function(n,i){d=!0,r["allowedchildren-"+n]={label:'<span class="jstree-pageicon"></span>'+i,_class:"class-"+n.replace(/[^a-zA-Z0-9\-_:.]+/g,"_"),action:function(i){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(o.a.sprintf(e.data("urlAddpage"),a,n),e.data("extraParams")))}}}),d&&(i.addsubpage={label:o.a._t("CMS.AddSubPage","Add page under this page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),submenu:r}),n.hasClass("edit-disabled")||(i.duplicate={label:o.a._t("CMS.Duplicate"),submenu:[{label:o.a._t("CMS.ThisPageOnly"),action:function(n){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(o.a.sprintf(e.data("urlDuplicate"),n.data("id")),e.data("extraParams")))}},{label:o.a._t("CMS.ThisPageAndSubpages"),action:function(n){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(o.a.sprintf(e.data("urlDuplicatewithchildren"),n.data("id")),e.data("extraParams")))}}]}),i}},n}}),t(".cms-tree a.jstree-clicked").entwine({onmatch:function(){var t,e=this,n=e.parents(".cms-panel-content");(e.offset().top<0||e.offset().top>n.height()-e.height())&&(t=n.scrollTop()+e.offset().top+n.height()/2,n.animate({scrollTop:t},"slow"))}}),t(".cms-tree-filtered .clear-filter").entwine({onclick:function(){window.location=location.protocol+"//"+location.host+location.pathname}})})},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(".cms-content-header-info").entwine({"from .cms-panel":{ontoggle:function(t){var e=this.closest(".cms-content").find(t.target);0!==e.length&&this.parent()[e.hasClass("collapsed")?"addClass":"removeClass"]("collapsed")}}}),t(".cms .cms-panel-link.page-view-link").entwine({onclick:function(e){return this.siblings().removeClass("active"),this.addClass("active"),t(".cms-content-filters input[type='hidden'][name='view']").val(t(this).data("view")),this._super(e)}}),t(".cms-content-toolbar").entwine({onmatch:function(){var e=this;this._super(),t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var n=t(this),i=n.data("toolid");n.hasClass("active"),void 0!==i&&(n.data("active",!1).removeClass("active"),t("#"+i).hide(),e.bindActionButtonEvents(n))})},onunmatch:function(){var e=this;this._super(),t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var n=t(this);e.unbindActionButtonEvents(n)})},bindActionButtonEvents:function(t){var e=this;t.on("click.cmsContentToolbar",function(n){e.showHideTool(t)})},unbindActionButtonEvents:function(t){t.off(".cmsContentToolbar")},showHideTool:function(e){var n=e.data("active"),i=e.data("toolid"),a=t("#"+i);t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var e=t(this),n=t("#"+e.data("toolid"));e.data("toolid")!==i&&(n.hide(),e.data("active",!1))}),e[n?"removeClass":"addClass"]("active"),a[n?"hide":"show"](),e.data("active",!n)}})})},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("#Form_VersionsForm").entwine({onmatch:function(){this._super()},onunmatch:function(){this._super()},onsubmit:function(e){e.preventDefault();var n=this.find(":input[name=ID]").val();if(!n)return!1;var i=null,a=null,s=null,r=this.find(":input[name=CompareMode]").is(":checked"),d=this.find("table input[type=checkbox]").filter(":checked");if(r){if(2!==d.length)return!1;a=d.eq(0).val(),s=d.eq(1).val(),i=o.a.sprintf(this.data("linkTmplCompare"),n,s,a)}else a=d.eq(0).val(),i=o.a.sprintf(this.data("linkTmplShow"),n,a);return t(".cms-container").loadPanel(i,"",{pjax:"CurrentForm"}),!0}}),t("#Form_VersionsForm input[name=ShowUnpublished]").entwine({onmatch:function(){this.toggle(),this._super()},onunmatch:function(){this._super()},onchange:function(){this.toggle()},toggle:function(){var e=t(this),n=e.parents("form").find("tr[data-published=false]");e.attr("checked")?n.removeClass("ui-helper-hidden").show():n.addClass("ui-helper-hidden").hide()._unselect()}}),t("#Form_VersionsForm tbody tr").entwine({onclick:function(){var t=this.parents("form").find(":input[name=CompareMode]").attr("checked"),e=this.siblings(".active");return t&&this.hasClass("active")?void this._unselect():t?e.length>1?void alert(o.a._t("CMS.ONLYSELECTTWO","You can only compare two versions at this time.")):(this._select(),void(1===e.length&&this.parents("form").submit())):(this._select(),e._unselect(),void this.parents("form").submit())},_unselect:function(){this.removeClass("active"),this.find(":input[type=checkbox]").attr("checked",!1)},_select:function(){this.addClass("active"),this.find(":input[type=checkbox]").attr("checked",!0)}})})},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("#Form_EditForm_RedirectionType input").entwine({onmatch:function(){t(this).attr("checked")&&this.toggle(),this._super()},onunmatch:function(){this._super()},onclick:function(){this.toggle()},toggle:function(){"Internal"==t(this).attr("value")?(t("#Form_EditForm_ExternalURL_Holder").hide(),t("#Form_EditForm_LinkToID_Holder").show()):(t("#Form_EditForm_ExternalURL_Holder").show(),t("#Form_EditForm_LinkToID_Holder").hide())}})})},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(".field.urlsegment:not(.readonly)").entwine({MaxPreviewLength:55,Ellipsis:"...",onmatch:function(){this.find(":text").length&&this.toggleEdit(!1),this.redraw(),this._super()},redraw:function(){var t=this.find(":text"),e=decodeURI(t.data("prefix")+t.val()),n=e;e.length>this.getMaxPreviewLength()&&(n=this.getEllipsis()+e.substr(e.length-this.getMaxPreviewLength(),e.length)),this.find(".URL-link").attr("href",encodeURI(e+t.data("suffix"))).text(n)},toggleEdit:function(t){var e=this.find(":text");this.find(".preview-holder")[t?"hide":"show"](),this.find(".edit-holder")[t?"show":"hide"](),t&&(e.data("origval",e.val()),e.focus())},update:function(){var t=this,e=this.find(":text"),n=e.data("origval"),i=arguments[0],a=i&&""!==i?i:e.val();n!=a?(this.addClass("loading"),this.suggest(a,function(n){e.val(decodeURIComponent(n.value)),t.toggleEdit(!1),t.removeClass("loading"),t.redraw()})):(this.toggleEdit(!1),this.redraw())},cancel:function(){var t=this.find(":text");t.val(t.data("origval")),this.toggleEdit(!1)},suggest:function(e,n){var i=this,a=i.find(":text"),s=t.path.parseUrl(i.closest("form").attr("action")),o=s.hrefNoSearch+"/field/"+a.attr("name")+"/suggest/?value="+encodeURIComponent(e);s.search&&(o+="&"+s.search.replace(/^\?/,"")),t.ajax({url:o,success:function(t){n.apply(this,arguments)},error:function(t,e){t.statusText=t.responseText},complete:function(){i.removeClass("loading")}})}}),t(".field.urlsegment .edit").entwine({onclick:function(t){t.preventDefault(),this.closest(".field").toggleEdit(!0)}}),t(".field.urlsegment .update").entwine({onclick:function(t){t.preventDefault(),this.closest(".field").update()}}),t(".field.urlsegment .cancel").entwine({onclick:function(t){t.preventDefault(),this.closest(".field").cancel()}})})},,,,,,,,function(t,e,n){n(2),n(3),n(5),n(4),n(6),n(7),n(8)}]);

View File

@ -340,62 +340,72 @@ $.entwine('ss', function($){
*/ */
$('.cms-edit-form.changed').entwine({ $('.cms-edit-form.changed').entwine({
onmatch: function(e) { onmatch: function(e) {
const save = this.find('button[name=action_save]'); // Update all buttons with alternate text
this.find('button[data-text-alternate]').each(function() {
const button = $(this);
const buttonTitle = button.find('.btn__title');
if(save.attr('data-text-alternate')) { // Set alternate-text
save.attr('data-text-standard', save.find('span').text()); const alternateText = button.data('textAlternate');
save.find('span').text(save.attr('data-text-alternate')); if (alternateText) {
} button.data('textStandard', buttonTitle.text());
buttonTitle.text(alternateText);
}
if(save.attr('data-btn-alternate')) { // Extra classes can be declared explicitly (legacy)
save.attr('data-btn-standard', save.attr('class')); const alternateClasses = button.data('btnAlternate');
save.attr('class', save.attr('data-btn-alternate')); if (alternateClasses) {
} button.data('btnStandard', button.attr('class'));
button.attr('class', alternateClasses);
button
save .removeClass('btn-outline-secondary')
.removeClass('btn-outline-secondary') .addClass('btn-primary');
.addClass('btn-primary'); }
const publish = this.find('button[name=action_publish]');
if(publish.attr('data-text-alternate')) {
publish.attr('data-text-standard', publish.find('span').text());
publish.find('span').text(publish.attr('data-text-alternate'));
}
if(publish.attr('data-btn-alternate')) {
publish.attr('data-btn-standard', publish.attr('class'));
publish.attr('class', publish.attr('data-btn-alternate'));
}
publish
.removeClass('btn-outline-secondary')
.addClass('btn-primary');
// Extra classes can also be specified as add / remove
const alternateClassesAdd = button.data('btnAlternateAdd');
if (alternateClassesAdd) {
button.addClass(alternateClassesAdd);
}
const alternateClassesRemove = button.data('btnAlternateRemove');
if (alternateClassesRemove) {
button.removeClass(alternateClassesRemove);
}
});
this._super(e); this._super(e);
}, },
onunmatch: function(e) { onunmatch: function(e) {
var save = this.find('button[name=action_save]') this.find('button[data-text-alternate]').each(function() {
const button = $(this);
const buttonTitle = button.find('.btn__title');
if(save.attr('data-text-standard')) { // Revert extra classes
save.text(save.attr('data-text-standard')); const standardText = button.data('textStandard');
} if (standardText) {
buttonTitle.text(standardText);
}
if(save.attr('data-btn-standard')) { // Extra classes can be declared explicitly (legacy)
save.attr('class', save.attr('data-btn-standard')); const standardClasses = button.data('btnStandard');
} if (standardClasses) {
button.attr('class', standardClasses);
button
.addClass('btn-outline-secondary')
.removeClass('btn-primary');
}
var publish = this.find('button[name=action_publish]'); // Extra classes can also be specified as add / remove
// Note: Reverse of onMatch
if(publish.attr('data-text-standard')) { const alternateClassesAdd = button.data('btnAlternateAdd');
publish.text(publish.attr('data-text-standard')); if (alternateClassesAdd) {
} button.removeClass(alternateClassesAdd);
}
if(publish.attr('data-btn-standard')) { const alternateClassesRemove = button.data('btnAlternateRemove');
publish.attr('class', publish.attr('data-btn-standard')); if (alternateClassesRemove) {
} button.addClass(alternateClassesRemove);
}
});
this._super(e); this._super(e);
} }

View File

@ -2253,11 +2253,13 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
} }
// "save", supports an alternate state that is still clickable, but notifies the user that the action is not needed. // "save", supports an alternate state that is still clickable, but notifies the user that the action is not needed.
$noChangesClasses = 'btn-outline-secondary font-icon-check-mark';
if ($canEdit && $isOnDraft) { if ($canEdit && $isOnDraft) {
$majorActions->push( $majorActions->push(
FormAction::create('save', _t(__CLASS__.'.BUTTONSAVED', 'Saved')) FormAction::create('save', _t(__CLASS__.'.BUTTONSAVED', 'Saved'))
->addExtraClass('btn-outline-secondary font-icon-check-mark') ->addExtraClass($noChangesClasses)
->setAttribute('data-btn-alternate', 'btn action btn-primary font-icon-save') ->setAttribute('data-btn-alternate-add', 'btn-primary font-icon-save')
->setAttribute('data-btn-alternate-remove', $noChangesClasses)
->setUseButtonTag(true) ->setUseButtonTag(true)
->setAttribute('data-text-alternate', _t('SilverStripe\\CMS\\Controllers\\CMSMain.SAVEDRAFT', 'Save draft')) ->setAttribute('data-text-alternate', _t('SilverStripe\\CMS\\Controllers\\CMSMain.SAVEDRAFT', 'Save draft'))
); );
@ -2267,8 +2269,9 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
// "publish", as with "save", it supports an alternate state to show when action is needed. // "publish", as with "save", it supports an alternate state to show when action is needed.
$majorActions->push( $majorActions->push(
$publish = FormAction::create('publish', _t(__CLASS__.'.BUTTONPUBLISHED', 'Published')) $publish = FormAction::create('publish', _t(__CLASS__.'.BUTTONPUBLISHED', 'Published'))
->addExtraClass('btn-outline-secondary font-icon-check-mark') ->addExtraClass($noChangesClasses)
->setAttribute('data-btn-alternate', 'btn action btn-primary font-icon-rocket') ->setAttribute('data-btn-alternate-add', 'btn-primary font-icon-rocket')
->setAttribute('data-btn-alternate-remove', $noChangesClasses)
->setUseButtonTag(true) ->setUseButtonTag(true)
->setAttribute('data-text-alternate', _t(__CLASS__.'.BUTTONSAVEPUBLISH', 'Save & publish')) ->setAttribute('data-text-alternate', _t(__CLASS__.'.BUTTONSAVEPUBLISH', 'Save & publish'))
); );
@ -2277,7 +2280,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
if ($stagesDiffer) { if ($stagesDiffer) {
$publish->addExtraClass('btn-primary font-icon-rocket'); $publish->addExtraClass('btn-primary font-icon-rocket');
$publish->setTitle(_t(__CLASS__.'.BUTTONSAVEPUBLISH', 'Save & publish')); $publish->setTitle(_t(__CLASS__.'.BUTTONSAVEPUBLISH', 'Save & publish'));
$publish->removeExtraClass('btn-outline-secondary font-icon-check-mark'); $publish->removeExtraClass($noChangesClasses);
} }
} }