Tidy up publish and save buttons.

This commit is contained in:
Will Rossiter 2016-12-01 17:38:06 +13:00 committed by Damian Mooyman
parent 5bb430ef43
commit 2d17f2f33b
3 changed files with 111 additions and 62 deletions

View File

@ -3,8 +3,8 @@ var a=n[i]={exports:{},id:i,loaded:!1}
return t[i].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var n={}
return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict"
n(3),n(4),n(6),n(7),n(8),n(9),n(10),n(11)},,function(t,e){t.exports=jQuery},function(t,e,n){"use strict"
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a)
o["default"].entwine("ss",function(t){t(".cms-add-form .parent-mode :input").entwine({onclick:function e(t){if("top"==this.val()){var e=this.closest("form").find("#Form_AddForm_ParentID_Holder .TreeDropdownField")
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),s=i(a)
s["default"].entwine("ss",function(t){t(".cms-add-form .parent-mode :input").entwine({onclick:function e(t){if("top"==this.val()){var e=this.closest("form").find("#Form_AddForm_ParentID_Holder .TreeDropdownField")
e.setValue(""),e.setTitle("")}}}),t(".cms-add-form").entwine({ParentID:0,ParentCache:{},onadd:function n(){var t=this
@ -12,42 +12,41 @@ this.find("#Form_AddForm_ParentID_Holder .TreeDropdownField").bind("change",func
},loadCachedChildren:function i(t){var e=this.getParentCache()
return"undefined"!=typeof e[t]?e[t]:null},saveCachedChildren:function a(t,e){var n=this.getParentCache()
n[t]=e,this.setParentCache(n)},updateTypeList:function o(){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"),o=a&&"child"===i?n.getValue()||this.getParentID():null,s=a?a.ClassName:null,r=s&&"child"===i&&o?s:"Root",d="undefined"!=typeof e[r]?e[r]:null,l=this,c=d&&"undefined"!=typeof d.defaultChild?d.defaultChild:null,u=[]
n[t]=e,this.setParentCache(n)},updateTypeList:function s(){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()||this.getParentID():null,o=a?a.ClassName:null,r=o&&"child"===i&&s?o:"Root",d="undefined"!=typeof e[r]?e[r]:null,l=this,c=d&&"undefined"!=typeof d.defaultChild?d.defaultChild:null,u=[]
if(o){if(this.hasClass("loading"))return
return this.addClass("loading"),this.setParentID(o),n.getValue()||n.setValue(o),u=this.loadCachedChildren(o),null!==u?(this.updateSelectionFilter(u,c),void this.removeClass("loading")):(t.ajax({url:l.data("childfilter"),
data:{ParentID:o},success:function h(t){l.saveCachedChildren(o,t),l.updateSelectionFilter(t,c)},complete:function f(){l.removeClass("loading")}}),!1)}u=d&&"undefined"!=typeof d.disallowedChildren?d.disallowedChildren:[],
this.updateSelectionFilter(u,c)},updateSelectionFilter:function s(e,n){var i=null
if(s){if(this.hasClass("loading"))return
return this.addClass("loading"),this.setParentID(s),n.getValue()||n.setValue(s),u=this.loadCachedChildren(s),null!==u?(this.updateSelectionFilter(u,c),void this.removeClass("loading")):(t.ajax({url:l.data("childfilter"),
data:{ParentID:s},success:function h(t){l.saveCachedChildren(s,t),l.updateSelectionFilter(t,c)},complete:function f(){l.removeClass("loading")}}),!1)}u=d&&"undefined"!=typeof d.disallowedChildren?d.disallowedChildren:[],
this.updateSelectionFilter(u,c)},updateSelectionFilter:function o(e,n){var i=null
if(this.find("#Form_AddForm_PageType div.radio").each(function(){var n=t(this).find("input").val(),a=t.inArray(n,e)===-1
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)
var o=this.find("#Form_AddForm_PageType div.radio:not(.disabled)").length?"enable":"disable"
this.find("button[name=action_doAdd]").button(o),this.find(".message-restricted")[i?"hide":"show"]()}}),t(".cms-add-form #Form_AddForm_PageType div.radio").entwine({onclick:function r(t){this.setSelected(!0)
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]").addAttr("disabled"),
this.find(".message-restricted")[i?"hide":"show"]()}}),t(".cms-add-form #Form_AddForm_PageType div.radio").entwine({onclick:function r(t){this.setSelected(!0)},setSelected:function d(t){var e=this.find("input")
},setSelected:function d(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 l(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 c(e){var n=t(".cms-tree"),i=t(".cms-list"),a=0,o
e?t(this).find("input").removeAttr("disabled"):t(this).find("input").attr("disabled","disabled").removeAttr("checked")}}),t(".cms-content-addpage-button").entwine({onclick:function c(e){var n=t(".cms-tree"),i=t(".cms-list"),a=0,s
if(n.is(":visible")){var s=n.jstree("get_selected")
a=s?t(s[0]).data("id"):null}else{var r=i.find('input[name="Page[GridState]"]').val()
if(n.is(":visible")){var o=n.jstree("get_selected")
a=o?t(o[0]).data("id"):null}else{var r=i.find('input[name="Page[GridState]"]').val()
r&&(a=parseInt(JSON.parse(r).ParentID,10))}var d={selector:this.data("targetPanel"),pjax:this.data("pjax")},l
a?(o=this.data("extraParams")?this.data("extraParams"):"",l=t.path.addSearchParams(i18n.sprintf(this.data("urlAddpage"),a),o)):l=this.attr("href"),t(".cms-container").loadPanel(l,null,d),e.preventDefault(),
a?(s=this.data("extraParams")?this.data("extraParams"):"",l=t.path.addSearchParams(i18n.sprintf(this.data("urlAddpage"),a),s)):l=this.attr("href"),t(".cms-container").loadPanel(l,null,d),e.preventDefault(),
this.blur()}})})},function(t,e,n){"use strict"
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a),s=n(5),r=i(s)
o["default"].entwine("ss",function(t){t(".cms-edit-form :input[name=ClassName]").entwine({onchange:function e(){alert(r["default"]._t("CMSMAIN.ALERTCLASSNAME"))}}),t(".cms-edit-form input[name=Title]").entwine({
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),s=i(a),o=n(5),r=i(o)
s["default"].entwine("ss",function(t){t(".cms-edit-form :input[name=ClassName]").entwine({onchange:function e(){alert(r["default"]._t("CMSMAIN.ALERTCLASSNAME"))}}),t(".cms-edit-form input[name=Title]").entwine({
onmatch:function n(){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 o=e.data("OrigVal"),s=e.val()
e.data("OrigVal",s),0===i.val().indexOf(i.data("defaultUrl"))&&""==a.val()?e.updateURLSegment(s):t(".update",e.parent()).show(),e.updateRelatedFields(s,o),e.updateBreadcrumbLabel(s)})),this._super()},onunmatch:function i(){
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 i(){
this._super()},updateRelatedFields:function a(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 o(e){var n=t("input:text[name=URLSegment]",this.closest("form")),i=n.closest(".field.urlsegment"),a=t(".update",this.parent())
i.val()==n&&(i.val(e),i.updatedRelatedFields&&i.updatedRelatedFields())})},updateURLSegment:function s(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 s(e){var n=t(".cms-edit-form input[name=ID]").val(),i=t("span.cms-panel-link.crumb")
i.update(e),a.is(":visible")&&a.hide()},updateBreadcrumbLabel:function o(e){var n=t(".cms-edit-form input[name=ID]").val(),i=t("span.cms-panel-link.crumb")
e&&""!=e&&i.text(e)},_addActions:function d(){var e=this,n
n=t("<button />",{"class":"update ss-ui-button-small",text:r["default"]._t("URLSEGMENT.UpdateURL"),type:"button",click:function i(t){t.preventDefault(),e.updateURLSegment(e.val())}}),n.insertAfter(e),n.hide()
@ -76,22 +75,28 @@ return i=r["default"].sprintf(r["default"]._t("CMSMain.Archive"),n),!!confirm(i)
return i=r["default"].sprintf(r["default"]._t(a?"CMSMain.RestoreToRoot":"CMSMain.Restore"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form .btn-toolbar #Form_EditForm_action_unpublish").entwine({onclick:function b(t){
var e=this.parents("form:first"),n=e.find(":input[name=Version]").val(),i=""
return i=r["default"].sprintf(r["default"]._t("CMSMain.Unpublish"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form.changed").entwine({onmatch:function w(t){this.find("button[name=action_save]").button("option","showingAlternate",!0),
this.find("button[name=action_publish]").button("option","showingAlternate",!0),this._super(t)},onunmatch:function C(t){var e=this.find("button[name=action_save]")
e.data("button")&&e.button("option","showingAlternate",!1)
return i=r["default"].sprintf(r["default"]._t("CMSMain.Unpublish"),n),!!confirm(i)&&this._super(t)}}),t(".cms-edit-form.changed").entwine({onmatch:function C(t){var e=this.find("button[name=action_save]")
e.removeClass("btn-secondary-outline").addClass("btn-primary"),e.attr("data-text-alternate")&&(e.attr("data-text-standard",e.attr("data-text-alternate")),e.text(e.attr("data-text-alternate")))
var n=this.find("button[name=action_publish]")
n.data("button")&&n.button("option","showingAlternate",!1),this._super(t)}}),t(".cms-edit-form .btn-toolbar button[name=action_publish]").entwine({onbuttonafterrefreshalternate:function F(){this.button("option","showingAlternate")?this.addClass("ss-ui-action-constructive"):this.removeClass("ss-ui-action-constructive")
n.removeClass("btn-secondary-outline").addClass("btn-primary"),n.attr("data-text-alternate")&&(n.attr("data-text-standard",n.attr("data-text-alternate")),n.text(n.attr("data-text-alternate"))),this._super(t)
}}),t(".cms-edit-form .btn-toolbar button[name=action_save]").entwine({onbuttonafterrefreshalternate:function P(){this.button("option","showingAlternate")?this.addClass("ss-ui-action-constructive"):this.removeClass("ss-ui-action-constructive")
},onunmatch:function w(t){var e=this.find("button[name=action_save]")
e.addClass("btn-secondary-outline").removeClass("btn-primary"),e.attr("data-text-standard")&&e.text(e.attr("data-text-standard"))
var n=this.find("button[name=action_publish]")
n.addClass("btn-secondary-outline").removeClass("btn-primary"),n.attr("data-text-standard")&&n.text(n.attr("data-text-standard")),this._super(t)}}),t(".cms-edit-form .btn-toolbar button[name=action_publish]").entwine({
onbuttonafterrefreshalternate:function F(){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 T(){this.redraw(),this._super()},onunmatch:function S(){this._super()},redraw:function k(){var e=t(".cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder")
}}),t(".cms-edit-form .btn-toolbar button[name=action_save]").entwine({onbuttonafterrefreshalternate:function x(){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 P(){this.redraw(),this._super()},onunmatch:function T(){this._super()
"Form_EditForm_ParentType_root"==t(this).attr("id")?e.slideUp():e.slideDown()},onclick:function x(){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()
},redraw:function y(){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 S(){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){t.exports=i18n},function(t,e,n){"use strict"
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a)
o["default"].entwine("ss",function(t){t(".cms-content-header-info").entwine({"from .cms-panel":{ontoggle:function e(t){var e=this.closest(".cms-content").find(t.target)
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),s=i(a)
s["default"].entwine("ss",function(t){t(".cms-content-header-info").entwine({"from .cms-panel":{ontoggle:function e(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 n(e){this.siblings().removeClass("active"),
this.addClass("active")
var n=t(".cms-content-filters input[type='hidden'][name='view']")
@ -99,14 +104,14 @@ return n.val(t(this).data("view")),this._super(e)}}),t(".cms-content-toolbar").e
this._super(),t.each(this.find(".cms-actions-buttons-row .tool-button"),function(){var n=t(this),i=n.data("toolid"),a=n.hasClass("active")
void 0!==i&&(n.data("active",!1).removeClass("active"),t("#"+i).hide(),e.bindActionButtonEvents(n))})},onunmatch:function a(){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 o(t){var e=this
t.on("click.cmsContentToolbar",function(n){e.showHideTool(t)})},unbindActionButtonEvents:function s(t){t.off(".cmsContentToolbar")},showHideTool:function r(e){var n=e.data("active"),i=e.data("toolid"),a=t("#"+i)
e.unbindActionButtonEvents(n)})},bindActionButtonEvents:function s(t){var e=this
t.on("click.cmsContentToolbar",function(n){e.showHideTool(t)})},unbindActionButtonEvents:function o(t){t.off(".cmsContentToolbar")},showHideTool:function r(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"
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a),s=n(5),r=i(s)
o["default"].entwine("ss.tree",function(t){t(".cms-tree").entwine({fromDocument:{"oncontext_show.vakata":function e(t){this.adjustContextClass()}},adjustContextClass:function n(){var e=t("#vakata-contextmenu").find("ul ul")
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),s=i(a),o=n(5),r=i(o)
s["default"].entwine("ss.tree",function(t){t(".cms-tree").entwine({fromDocument:{"oncontext_show.vakata":function e(t){this.adjustContextClass()}},adjustContextClass:function n(){var e=t("#vakata-contextmenu").find("ul ul")
e.each(function(n){var i="1",a=t(e[n]).find("li").length
@ -117,8 +122,8 @@ return n.plugins.push("contextmenu"),n.contextmenu={items:function a(n){var i={e
action:function c(n){t(".cms-container").entwine(".ss").loadPanel(r["default"].sprintf(e.data("urlEditpage"),n.data("id")))}}}
n.hasClass("nochildren")||(i.showaslist={label:r["default"]._t("Tree.ShowAsList"),action:function u(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"),o=n.data("id"),s=n.find(">a .item").data("allowedchildren"),d={},l=!1
return t.each(s,function(n,i){l=!0,d["allowedchildren-"+n]={label:'<span class="jstree-pageicon"></span>'+i,_class:"class-"+n,action:function a(i){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r["default"].sprintf(e.data("urlAddpage"),o,n),e.data("extraParams")))
var a=n.data("pagetype"),s=n.data("id"),o=n.find(">a .item").data("allowedchildren"),d={},l=!1
return t.each(o,function(n,i){l=!0,d["allowedchildren-"+n]={label:'<span class="jstree-pageicon"></span>'+i,_class:"class-"+n,action:function a(i){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r["default"].sprintf(e.data("urlAddpage"),s,n),e.data("extraParams")))
}}}),l&&(i.addsubpage={label:r["default"]._t("Tree.AddSubPage","Add page under this page",100,"Used in the context menu when right-clicking on a page node in the CMS tree"),submenu:d}),n.hasClass("edit-disabled")||(i.duplicate={
label:r["default"]._t("Tree.Duplicate"),submenu:[{label:r["default"]._t("Tree.ThisPageOnly"),action:function h(n){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r["default"].sprintf(e.data("urlDuplicate"),n.data("id")),e.data("extraParams")))
@ -126,44 +131,44 @@ label:r["default"]._t("Tree.Duplicate"),submenu:[{label:r["default"]._t("Tree.Th
}},{label:r["default"]._t("Tree.ThisPageAndSubpages"),action:function f(n){t(".cms-container").entwine(".ss").loadPanel(t.path.addSearchParams(r["default"].sprintf(e.data("urlDuplicatewithchildren"),n.data("id")),e.data("extraParams")))
}}]}),i}},n}}),t(".cms-tree a.jstree-clicked").entwine({onmatch:function a(){var t=this,e=t.parents(".cms-panel-content"),n;(t.offset().top<0||t.offset().top>e.height()-t.height())&&(n=e.scrollTop()+t.offset().top+e.height()/2,
e.animate({scrollTop:n},"slow"))}}),t(".cms-tree-filtered .clear-filter").entwine({onclick:function o(){window.location=location.protocol+"//"+location.host+location.pathname}})})},function(t,e,n){"use strict"
e.animate({scrollTop:n},"slow"))}}),t(".cms-tree-filtered .clear-filter").entwine({onclick:function s(){window.location=location.protocol+"//"+location.host+location.pathname}})})},function(t,e,n){"use strict"
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a),s=n(5),r=i(s)
o["default"].entwine("ss",function(t){t("#Form_VersionsForm").entwine({onmatch:function e(){this._super()},onunmatch:function n(){this._super()},onsubmit:function i(e,n){e.preventDefault()
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),s=i(a),o=n(5),r=i(o)
s["default"].entwine("ss",function(t){t("#Form_VersionsForm").entwine({onmatch:function e(){this._super()},onunmatch:function n(){this._super()},onsubmit:function i(e,n){e.preventDefault()
var i,a=this
if(i=this.find(":input[name=ID]").val(),!i)return!1
var o,s,d,l,c,u,h
var s,o,d,l,c,u,h
if(u=this.find(":input[name=CompareMode]").is(":checked"),d=this.find("table input[type=checkbox]").filter(":checked"),u){if(2!=d.length)return!1
l=d.eq(0).val(),c=d.eq(1).val(),o=this.find(":submit[name=action_doCompare]"),s=r["default"].sprintf(this.data("linkTmplCompare"),i,c,l)}else l=d.eq(0).val(),o=this.find(":submit[name=action_doShowVersion]"),
s=r["default"].sprintf(this.data("linkTmplShow"),i,l)
t(".cms-container").loadPanel(s,"",{pjax:"CurrentForm"})}}),t("#Form_VersionsForm input[name=ShowUnpublished]").entwine({onmatch:function a(){this.toggle(),this._super()},onunmatch:function o(){this._super()
l=d.eq(0).val(),c=d.eq(1).val(),s=this.find(":submit[name=action_doCompare]"),o=r["default"].sprintf(this.data("linkTmplCompare"),i,c,l)}else l=d.eq(0).val(),s=this.find(":submit[name=action_doShowVersion]"),
o=r["default"].sprintf(this.data("linkTmplShow"),i,l)
t(".cms-container").loadPanel(o,"",{pjax:"CurrentForm"})}}),t("#Form_VersionsForm input[name=ShowUnpublished]").entwine({onmatch:function a(){this.toggle(),this._super()},onunmatch:function s(){this._super()
},onchange:function s(){this.toggle()},toggle:function d(){var e=t(this),n=e.parents("form")
},onchange:function o(){this.toggle()},toggle:function d(){var e=t(this),n=e.parents("form")
e.attr("checked")?n.find("tr[data-published=false]").css("display",""):n.find("tr[data-published=false]").css("display","none")._unselect()}}),t("#Form_VersionsForm tbody tr").entwine({onclick:function l(t){
var e,n
return e=this.parents("form").find(":input[name=CompareMode]").attr("checked"),n=this.siblings(".active"),e&&this.hasClass("active")?void this._unselect():e?n.length>1?alert(r["default"]._t("ONLYSELECTTWO","You can only compare two versions at this time.")):(this._select(),
void(1==n.length&&this.parents("form").submit())):(this._select(),n._unselect(),this.parents("form").submit(),void 0)},_unselect:function c(){this.removeClass("active"),this.find(":input[type=checkbox]").attr("checked",!1)
},_select:function u(){this.addClass("active"),this.find(":input[type=checkbox]").attr("checked",!0)}})})},function(t,e,n){"use strict"
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a)
o["default"].entwine("ss",function(t){t("#Form_EditForm_RedirectionType input").entwine({onmatch:function e(){var e=t(this)
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),s=i(a)
s["default"].entwine("ss",function(t){t("#Form_EditForm_RedirectionType input").entwine({onmatch:function e(){var e=t(this)
e.attr("checked")&&this.toggle(),this._super()},onunmatch:function n(){this._super()},onclick:function i(){this.toggle()},toggle:function a(){"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"
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),o=i(a)
o["default"].entwine("ss",function(t){t(".field.urlsegment:not(.readonly)").entwine({MaxPreviewLength:55,Ellipsis:"...",onmatch:function e(){this.find(":text").length&&this.toggleEdit(!1),this.redraw(),
function i(t){return t&&t.__esModule?t:{"default":t}}var a=n(2),s=i(a)
s["default"].entwine("ss",function(t){t(".field.urlsegment:not(.readonly)").entwine({MaxPreviewLength:55,Ellipsis:"...",onmatch:function e(){this.find(":text").length&&this.toggleEdit(!1),this.redraw(),
this._super()},redraw:function n(){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 i(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 a(){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 o(){
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 s(){
var t=this.find(":text")
t.val(t.data("origval")),this.toggleEdit(!1)},suggest:function s(e,n){var i=this,a=i.find(":text"),o=t.path.parseUrl(i.closest("form").attr("action")),s=o.hrefNoSearch+"/field/"+a.attr("name")+"/suggest/?value="+encodeURIComponent(e)
t.val(t.data("origval")),this.toggleEdit(!1)},suggest:function o(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)
o.search&&(s+="&"+o.search.replace(/^\?/,"")),t.ajax({url:s,success:function r(t){n.apply(this,arguments)},error:function d(t,e){t.statusText=t.responseText},complete:function l(){i.removeClass("loading")
s.search&&(o+="&"+s.search.replace(/^\?/,"")),t.ajax({url:o,success:function r(t){n.apply(this,arguments)},error:function d(t,e){t.statusText=t.responseText},complete:function l(){i.removeClass("loading")
}})}}),t(".field.urlsegment .edit").entwine({onclick:function r(t){t.preventDefault(),this.closest(".field").toggleEdit(!0)}}),t(".field.urlsegment .update").entwine({onclick:function d(t){t.preventDefault(),
this.closest(".field").update()}}),t(".field.urlsegment .cancel").entwine({onclick:function l(t){t.preventDefault(),this.closest(".field").cancel()}})})},function(t,e){}])

View File

@ -379,15 +379,51 @@ $.entwine('ss', function($){
*/
$('.cms-edit-form.changed').entwine({
onmatch: function(e) {
this.find('button[name=action_save]').attr('data-showingAlternate', true);
this.find('button[name=action_publish]').attr('data-showingAlternate', true);
var save = this.find('button[name=action_save]');
save
.removeClass('btn-secondary-outline')
.addClass('btn-primary');
if(save.attr('data-text-alternate')) {
save.attr('data-text-standard', save.attr('data-text-alternate'));
save.text(save.attr('data-text-alternate'));
}
var publish = this.find('button[name=action_publish]')
publish
.removeClass('btn-secondary-outline')
.addClass('btn-primary');
if(publish.attr('data-text-alternate')) {
publish.attr('data-text-standard', publish.attr('data-text-alternate'));
publish.text(publish.attr('data-text-alternate'));
}
this._super(e);
},
onunmatch: function(e) {
var saveButton = this.find('button[name=action_save]');
if(saveButton.data('button')) saveButton.attr('data-showingAlternate', false);
var publishButton = this.find('button[name=action_publish]');
if(publishButton.data('button')) publishButton.attr('data-showingAlternate', false);
var save = this.find('button[name=action_save]')
save
.addClass('btn-secondary-outline')
.removeClass('btn-primary');
if(save.attr('data-text-standard')) {
save.text(save.attr('data-text-standard'));
}
var publish = this.find('button[name=action_publish]');
publish
.addClass('btn-secondary-outline')
.removeClass('btn-primary');
if(publish.attr('data-text-standard')) {
publish.text(publish.attr('data-text-standard'));
}
this._super(e);
}
});

View File

@ -2253,7 +2253,11 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
// Add to campaign option if not-archived and has publish permission
if (($isPublished || $isOnDraft) && $canPublish) {
$moreOptions->push(AddToCampaignHandler_FormAction::create());
$moreOptions->push(
AddToCampaignHandler_FormAction::create()
->removeExtraClass('btn-primary')
->addExtraClass('btn-secondary')
);
}
// "readonly"/viewing version that isn't the current version of the record
@ -2274,7 +2278,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
$moreOptions->push(
FormAction::create('unpublish', _t('SiteTree.BUTTONUNPUBLISH', 'Unpublish'), 'delete')
->setDescription(_t('SiteTree.BUTTONUNPUBLISHDESC', 'Remove this page from the published site'))
->addExtraClass('ss-ui-action-destructive')
->addExtraClass('btn-secondary')
);
}
@ -2286,6 +2290,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
'SiteTree.BUTTONCANCELDRAFTDESC',
'Delete your draft and revert to the currently published page'
))
->addExtraClass('btn-secondary')
);
}
@ -2334,7 +2339,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
if ($canEdit && $isOnDraft) {
$majorActions->push(
FormAction::create('save', _t('SiteTree.BUTTONSAVED', 'Saved'))
->addExtraClass('btn-primary font-icon-check-mark')
->addExtraClass('btn-secondary-outline font-icon-save')
->setUseButtonTag(true)
->setAttribute('data-text-alternate', _t('CMSMain.SAVEDRAFT','Save draft'))
);
@ -2344,7 +2349,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
// "publish", as with "save", it supports an alternate state to show when action is needed.
$majorActions->push(
$publish = FormAction::create('publish', _t('SiteTree.BUTTONPUBLISHED', 'Published'))
->addExtraClass('font-icon-check-mark-2')
->addExtraClass('btn-secondary-outline font-icon-rocket')
->setAttribute('data-btn-alternative', 'btn-primary')
->setUseButtonTag(true)
->setAttribute('data-text-alternate', _t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'))
);
@ -2352,6 +2358,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
// Set up the initial state of the button to reflect the state of the underlying SiteTree object.
if($stagesDiffer) {
$publish->addExtraClass('btn-primary');
$publish->setTitle(_t('SiteTree.BUTTONSAVEPUBLISH', 'Save & publish'));
$publish->removeExtraClass('btn-secondary-outline');
}
}