[BUGFIX] Do not create default export of AjaxDataHandler class 49/57749/7
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Tue, 31 Jul 2018 18:11:12 +0000 (20:11 +0200)
committerTymoteusz Motylewski <t.motylewski@gmail.com>
Thu, 2 Aug 2018 11:01:42 +0000 (13:01 +0200)
Resolves: #85611
Related: #84168
Releases: master
Change-Id: If6003015d0c300566781856cc8351e2b60468573
Reviewed-on: https://review.typo3.org/57749
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Riccardo De Contardi <erredeco@gmail.com>
Reviewed-by: Paweł Rogowicz <rogowicz.pawel@gmail.com>
Tested-by: Paweł Rogowicz <rogowicz.pawel@gmail.com>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
typo3/sysext/backend/Resources/Private/TypeScript/AjaxDataHandler.ts
typo3/sysext/backend/Resources/Private/TypeScript/LayoutModule/DragDrop.ts
typo3/sysext/backend/Resources/Private/TypeScript/PageActions.ts
typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler.js
typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/DragDrop.js
typo3/sysext/backend/Resources/Public/JavaScript/PageActions.js
typo3/sysext/core/Tests/Acceptance/Backend/Page/PageModuleCest.php

index 7e83c4b..d814e79 100644 (file)
@@ -18,7 +18,7 @@
  */
 import * as $ from 'jquery';
 import 'jquery-ui/droppable';
-import DataHandler from 'TYPO3/CMS/Backend/AjaxDataHandler';
+import DataHandler = require('../AjaxDataHandler');
 import ResponseInterface from 'TYPO3/CMS/Backend/AjaxDataHandler/ResponseInterface';
 
 
index 8cfb5c9..b34c3e5 100644 (file)
@@ -137,7 +137,7 @@ class PageActions {
       '<form>' +
       '<div class="form-group">' +
       '<div class="input-group input-group-lg">' +
-      '<input class="form-control">' +
+      '<input class="form-control t3js-title-edit-input">' +
       '<span class="input-group-btn">' +
       '<button class="btn btn-default" type="button" data-action="submit"><span class="t3-icon fa fa-floppy-o"></span></button> ' +
       '</span>' +
@@ -150,17 +150,17 @@ class PageActions {
       ),
       $inputField = $inputFieldWrap.find('input');
 
-    $inputFieldWrap.find('[data-action=cancel]').on('click', (): void => {
+    $inputFieldWrap.find('[data-action="cancel"]').on('click', (): void => {
       $inputFieldWrap.replaceWith(this.$pageTitle);
       this.initializePageTitleRenaming();
     });
 
-    $inputFieldWrap.find('[data-action=submit]').on('click', (): void => {
+    $inputFieldWrap.find('[data-action="submit"]').on('click', (): void => {
       const newPageTitle = $.trim($inputField.val());
       if (newPageTitle !== '' && this.$pageTitle.text() !== newPageTitle) {
         this.saveChanges($inputField);
       } else {
-        $inputFieldWrap.find('[data-action=cancel]').trigger('click');
+        $inputFieldWrap.find('[data-action="cancel"]').trigger('click');
       }
     });
 
index 10d40a8..0c2b510 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","./Enum/Severity","jquery","./Icons","./Modal","./Notification","./Viewport"],function(e,t,a,n,i,o,r,l){"use strict";var d,s;Object.defineProperty(t,"__esModule",{value:!0}),(s=d||(d={})).hide=".t3js-record-hide",s.delete=".t3js-record-delete",s.icon=".t3js-icon";var c=function(){function e(){var e=this;n(function(){e.initialize()})}return e.refreshPageTree=function(){l.NavigationContainer&&l.NavigationContainer.PageTree&&l.NavigationContainer.PageTree.refreshTree()},e.prototype.process=function(e){var t=this;return this._call(e).done(function(e){e.hasErrors&&t.handleErrors(e)})},e.prototype.initialize=function(){var e=this;n(document).on("click",d.hide,function(t){t.preventDefault();var a=n(t.currentTarget),i=a.find(d.icon),o=a.closest("tr[data-uid]"),r=a.data("params");e._showSpinnerIcon(i),e._call(r).done(function(t){t.hasErrors?e.handleErrors(t):e.toggleRow(o)})}),n(document).on("click",d.delete,function(t){t.preventDefault();var i=n(t.currentTarget);o.confirm(i.data("title"),i.data("message"),a.SeverityEnum.warning,[{text:i.data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:i.data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",function(t){"cancel"===t.target.getAttribute("name")?o.dismiss():"delete"===t.target.getAttribute("name")&&(o.dismiss(),e.deleteRecord(i))})})},e.prototype.toggleRow=function(t){var a,o,r,l=t.find(d.hide),s=l.closest("table[data-table]").data("table"),c=l.data("params");"hidden"===l.data("state")?(o="visible",a=c.replace("=0","=1"),r="actions-edit-hide"):(o="hidden",a=c.replace("=1","=0"),r="actions-edit-unhide"),l.data("state",o).data("params",a),l.tooltip("hide").one("hidden.bs.tooltip",function(){var e=l.data("toggleTitle");l.data("toggleTitle",l.attr("data-original-title")).attr("data-original-title",e).tooltip("show")});var f=l.find(d.icon);i.getIcon(r,i.sizes.small).done(function(e){f.replaceWith(e)});var u=t.find(".col-icon "+d.icon);"hidden"===o?i.getIcon("miscellaneous-placeholder",i.sizes.small,"overlay-hidden").done(function(e){u.append(n(e).find(".icon-overlay"))}):u.find(".icon-overlay").remove(),t.fadeTo("fast",.4,function(){t.fadeTo("fast",1)}),"pages"===s&&e.refreshPageTree()},e.prototype.deleteRecord=function(t){var a=this,n=t.data("params"),o=t.find(d.icon);this._showSpinnerIcon(o),this._call(n).done(function(n){if(i.getIcon("actions-edit-delete",i.sizes.small).done(function(e){(o=t.find(d.icon)).replaceWith(e)}),n.hasErrors)a.handleErrors(n);else{var r=t.closest("table[data-table]"),l=t.closest(".panel"),s=l.find(".panel-heading"),c=r.data("table"),f=t.closest("tr[data-uid]"),u=f.data("uid"),p=r.find("[data-l10nparent="+u+"]").closest("tr[data-uid]");if((f=f.add(p)).fadeTo("slow",.4,function(){f.slideUp("slow",function(){f.remove(),0===r.find("tbody tr").length&&l.slideUp("slow")})}),"0"===t.data("l10parent")||""===t.data("l10parent")){var h=Number(s.find(".t3js-table-total-items").html());s.find(".t3js-table-total-items").text(h-1)}"pages"===c&&e.refreshPageTree()}})},e.prototype.handleErrors=function(e){n.each(e.messages,function(e,t){r.error(t.title,t.message)})},e.prototype._call=function(e){return n.getJSON(TYPO3.settings.ajaxUrls.record_process,e)},e.prototype._showSpinnerIcon=function(e){i.getIcon("spinner-circle-dark",i.sizes.small).done(function(t){e.replaceWith(t)})},e}();t.default=new c});
\ No newline at end of file
+define(["require","exports","./Enum/Severity","jquery","./Icons","./Modal","./Notification","./Viewport"],function(e,t,n,a,i,o,r,s){"use strict";var l,d;return(d=l||(l={})).hide=".t3js-record-hide",d.delete=".t3js-record-delete",d.icon=".t3js-icon",new(function(){function e(){var e=this;a(function(){e.initialize()})}return e.refreshPageTree=function(){s.NavigationContainer&&s.NavigationContainer.PageTree&&s.NavigationContainer.PageTree.refreshTree()},e.prototype.process=function(e){var t=this;return this._call(e).done(function(e){e.hasErrors&&t.handleErrors(e)})},e.prototype.initialize=function(){var e=this;a(document).on("click",l.hide,function(t){t.preventDefault();var n=a(t.currentTarget),i=n.find(l.icon),o=n.closest("tr[data-uid]"),r=n.data("params");e._showSpinnerIcon(i),e._call(r).done(function(t){t.hasErrors?e.handleErrors(t):e.toggleRow(o)})}),a(document).on("click",l.delete,function(t){t.preventDefault();var i=a(t.currentTarget);o.confirm(i.data("title"),i.data("message"),n.SeverityEnum.warning,[{text:i.data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:i.data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",function(t){"cancel"===t.target.getAttribute("name")?o.dismiss():"delete"===t.target.getAttribute("name")&&(o.dismiss(),e.deleteRecord(i))})})},e.prototype.toggleRow=function(t){var n,o,r,s=t.find(l.hide),d=s.closest("table[data-table]").data("table"),c=s.data("params");"hidden"===s.data("state")?(o="visible",n=c.replace("=0","=1"),r="actions-edit-hide"):(o="hidden",n=c.replace("=1","=0"),r="actions-edit-unhide"),s.data("state",o).data("params",n),s.tooltip("hide").one("hidden.bs.tooltip",function(){var e=s.data("toggleTitle");s.data("toggleTitle",s.attr("data-original-title")).attr("data-original-title",e).tooltip("show")});var f=s.find(l.icon);i.getIcon(r,i.sizes.small).done(function(e){f.replaceWith(e)});var u=t.find(".col-icon "+l.icon);"hidden"===o?i.getIcon("miscellaneous-placeholder",i.sizes.small,"overlay-hidden").done(function(e){u.append(a(e).find(".icon-overlay"))}):u.find(".icon-overlay").remove(),t.fadeTo("fast",.4,function(){t.fadeTo("fast",1)}),"pages"===d&&e.refreshPageTree()},e.prototype.deleteRecord=function(t){var n=this,a=t.data("params"),o=t.find(l.icon);this._showSpinnerIcon(o),this._call(a).done(function(a){if(i.getIcon("actions-edit-delete",i.sizes.small).done(function(e){(o=t.find(l.icon)).replaceWith(e)}),a.hasErrors)n.handleErrors(a);else{var r=t.closest("table[data-table]"),s=t.closest(".panel"),d=s.find(".panel-heading"),c=r.data("table"),f=t.closest("tr[data-uid]"),u=f.data("uid"),p=r.find("[data-l10nparent="+u+"]").closest("tr[data-uid]");if((f=f.add(p)).fadeTo("slow",.4,function(){f.slideUp("slow",function(){f.remove(),0===r.find("tbody tr").length&&s.slideUp("slow")})}),"0"===t.data("l10parent")||""===t.data("l10parent")){var h=Number(d.find(".t3js-table-total-items").html());d.find(".t3js-table-total-items").text(h-1)}"pages"===c&&e.refreshPageTree()}})},e.prototype.handleErrors=function(e){a.each(e.messages,function(e,t){r.error(t.title,t.message)})},e.prototype._call=function(e){return a.getJSON(TYPO3.settings.ajaxUrls.record_process,e)},e.prototype._showSpinnerIcon=function(e){i.getIcon("spinner-circle-dark",i.sizes.small).done(function(t){e.replaceWith(t)})},e}())});
\ No newline at end of file
index 95c97e2..fcb59a9 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","TYPO3/CMS/Backend/AjaxDataHandler","jquery-ui/droppable"],function(e,t,n,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(){}return e.initialize=function(){n(e.contentIdentifier).draggable({handle:e.dragHeaderIdentifier,scope:"tt_content",cursor:"move",distance:20,revert:"invalid",zIndex:100,start:function(t,a){e.onDragStart(n(t.target))},stop:function(t,a){e.onDragStop(n(t.target))}}),n(e.dropZoneIdentifier).droppable({accept:this.contentIdentifier,scope:"tt_content",tolerance:"pointer",over:function(t,a){e.onDropHoverOver(n(a.draggable),n(t.target))},out:function(t,a){e.onDropHoverOut(n(a.draggable),n(t.target))},drop:function(t,a){e.onDrop(n(a.draggable),n(t.target),t)}})},e.onDragStart=function(t){e.originalStyles=t.get(0).style.cssText,t.children(e.dragIdentifier).addClass("dragitem-shadow"),t.append('<div class="ui-draggable-copy-message">'+TYPO3.lang["dragdrop.copy.message"]+"</div>"),t.children(e.dropZoneIdentifier).addClass("drag-start"),t.closest(e.columnIdentifier).removeClass("active"),t.find(e.dropZoneIdentifier).hide(),n(e.dropZoneIdentifier).each(function(t,a){var o=n(a);o.parent().find(".t3js-toggle-new-content-element-wizard").length?o.addClass(e.validDropZoneClass):o.closest(e.contentIdentifier).find("> "+e.addContentIdentifier+", > > "+e.addContentIdentifier).show()})},e.onDragStop=function(t){t.children(e.dragIdentifier).removeClass("dragitem-shadow"),t.children(e.dropZoneIdentifier).removeClass("drag-start"),t.closest(e.columnIdentifier).addClass("active"),t.find(e.dropZoneIdentifier).show(),t.find(".ui-draggable-copy-message").remove(),t.get(0).style.cssText=e.originalStyles,n(e.dropZoneIdentifier+"."+e.validDropZoneClass).removeClass(e.validDropZoneClass)},e.onDropHoverOver=function(t,n){n.hasClass(e.validDropZoneClass)&&n.addClass(e.dropPossibleHoverClass)},e.onDropHoverOut=function(t,n){n.removeClass(e.dropPossibleHoverClass)},e.onDrop=function(t,a,o){var r=e.getColumnPositionForElement(a);a.removeClass(e.dropPossibleHoverClass);var i="number"==typeof t,s=!0===i?t:parseInt(t.data("uid"),10);if("number"==typeof s&&s>0){var d={},l=a.closest(e.contentIdentifier).data("uid"),c=0;c=void 0===l?n("[data-page]").first().data("page"):0-parseInt(l,10);var p=parseInt(a.closest("[data-language-uid]").data("language-uid"),10),g=0;0!==c&&(g=r),d.cmd={tt_content:{}},d.data={tt_content:{}};var f=o&&o.originalEvent.ctrlKey||a.hasClass("t3js-paste-copy");f?(d.cmd.tt_content[s]={copy:{action:"paste",target:c,update:{colPos:g,sys_language_uid:p}}},e.ajaxAction(a,t,d,f,i)):(d.data.tt_content[s]={colPos:g,sys_language_uid:p},i?d={CB:{paste:"tt_content|"+c,update:{colPos:g,sys_language_uid:p}}}:d.cmd.tt_content[s]={move:c},e.ajaxAction(a,t,d,f,i))}},e.ajaxAction=function(t,n,o,r,i){a.default.process(o).done(function(a){a.hasErrors||(i||(t.parent().hasClass(e.contentIdentifier.substring(1))?n.detach().css({top:0,left:0}).insertAfter(t.closest(e.contentIdentifier)):n.detach().css({top:0,left:0}).insertAfter(t.closest(e.dropZoneIdentifier))),self.location.reload(!0))})},e.getColumnPositionForElement=function(e){var t=e.closest("[data-colpos]");return!(!t.length||"undefined"===t.data("colpos"))&&t.data("colpos")},e.contentIdentifier=".t3js-page-ce",e.dragIdentifier=".t3-page-ce-dragitem",e.dragHeaderIdentifier=".t3js-page-ce-draghandle",e.dropZoneIdentifier=".t3js-page-ce-dropzone-available",e.columnIdentifier=".t3js-page-column",e.validDropZoneClass="active",e.dropPossibleHoverClass="t3-page-ce-dropzone-possible",e.addContentIdentifier=".t3js-page-new-ce",e.originalStyles="",e}();t.default=o,n(o.initialize)});
\ No newline at end of file
+define(["require","exports","jquery","../AjaxDataHandler","jquery-ui/droppable"],function(e,t,n,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){}return e.initialize=function(){n(e.contentIdentifier).draggable({handle:e.dragHeaderIdentifier,scope:"tt_content",cursor:"move",distance:20,revert:"invalid",zIndex:100,start:function(t,o){e.onDragStart(n(t.target))},stop:function(t,o){e.onDragStop(n(t.target))}}),n(e.dropZoneIdentifier).droppable({accept:this.contentIdentifier,scope:"tt_content",tolerance:"pointer",over:function(t,o){e.onDropHoverOver(n(o.draggable),n(t.target))},out:function(t,o){e.onDropHoverOut(n(o.draggable),n(t.target))},drop:function(t,o){e.onDrop(n(o.draggable),n(t.target),t)}})},e.onDragStart=function(t){e.originalStyles=t.get(0).style.cssText,t.children(e.dragIdentifier).addClass("dragitem-shadow"),t.append('<div class="ui-draggable-copy-message">'+TYPO3.lang["dragdrop.copy.message"]+"</div>"),t.children(e.dropZoneIdentifier).addClass("drag-start"),t.closest(e.columnIdentifier).removeClass("active"),t.find(e.dropZoneIdentifier).hide(),n(e.dropZoneIdentifier).each(function(t,o){var a=n(o);a.parent().find(".t3js-toggle-new-content-element-wizard").length?a.addClass(e.validDropZoneClass):a.closest(e.contentIdentifier).find("> "+e.addContentIdentifier+", > > "+e.addContentIdentifier).show()})},e.onDragStop=function(t){t.children(e.dragIdentifier).removeClass("dragitem-shadow"),t.children(e.dropZoneIdentifier).removeClass("drag-start"),t.closest(e.columnIdentifier).addClass("active"),t.find(e.dropZoneIdentifier).show(),t.find(".ui-draggable-copy-message").remove(),t.get(0).style.cssText=e.originalStyles,n(e.dropZoneIdentifier+"."+e.validDropZoneClass).removeClass(e.validDropZoneClass)},e.onDropHoverOver=function(t,n){n.hasClass(e.validDropZoneClass)&&n.addClass(e.dropPossibleHoverClass)},e.onDropHoverOut=function(t,n){n.removeClass(e.dropPossibleHoverClass)},e.onDrop=function(t,o,a){var r=e.getColumnPositionForElement(o);o.removeClass(e.dropPossibleHoverClass);var i="number"==typeof t,s=!0===i?t:parseInt(t.data("uid"),10);if("number"==typeof s&&s>0){var d={},l=o.closest(e.contentIdentifier).data("uid"),c=0;c=void 0===l?n("[data-page]").first().data("page"):0-parseInt(l,10);var p=parseInt(o.closest("[data-language-uid]").data("language-uid"),10),g=0;0!==c&&(g=r),d.cmd={tt_content:{}},d.data={tt_content:{}};var f=a&&a.originalEvent.ctrlKey||o.hasClass("t3js-paste-copy");f?(d.cmd.tt_content[s]={copy:{action:"paste",target:c,update:{colPos:g,sys_language_uid:p}}},e.ajaxAction(o,t,d,f,i)):(d.data.tt_content[s]={colPos:g,sys_language_uid:p},i?d={CB:{paste:"tt_content|"+c,update:{colPos:g,sys_language_uid:p}}}:d.cmd.tt_content[s]={move:c},e.ajaxAction(o,t,d,f,i))}},e.ajaxAction=function(t,n,a,r,i){o.process(a).done(function(o){o.hasErrors||(i||(t.parent().hasClass(e.contentIdentifier.substring(1))?n.detach().css({top:0,left:0}).insertAfter(t.closest(e.contentIdentifier)):n.detach().css({top:0,left:0}).insertAfter(t.closest(e.dropZoneIdentifier))),self.location.reload(!0))})},e.getColumnPositionForElement=function(e){var t=e.closest("[data-colpos]");return!(!t.length||"undefined"===t.data("colpos"))&&t.data("colpos")},e.contentIdentifier=".t3js-page-ce",e.dragIdentifier=".t3-page-ce-dragitem",e.dragHeaderIdentifier=".t3js-page-ce-draghandle",e.dropZoneIdentifier=".t3js-page-ce-dropzone-available",e.columnIdentifier=".t3js-page-column",e.validDropZoneClass="active",e.dropPossibleHoverClass="t3-page-ce-dropzone-possible",e.addContentIdentifier=".t3js-page-new-ce",e.originalStyles="",e}();t.default=a,n(a.initialize)});
\ No newline at end of file
index 7a3d7dc..75a3176 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","./Enum/KeyTypes","jquery","./Storage/Persistent","./Wizard/NewContentElement"],function(t,e,n,i,a,o){"use strict";var s,c;return(c=s||(s={})).pageTitle=".t3js-title-inlineedit",c.hiddenElements=".t3js-hidden-record",c.newButton=".t3js-toggle-new-content-element-wizard",new(function(){function e(){var t=this;this.pageId=0,this.pageOverlayId=0,this.$pageTitle=null,this.$showHiddenElementsCheckbox=null,i(function(){t.initializeElements(),t.initializeEvents(),t.initializeNewContentElementWizard(),t.initializePageTitleRenaming()})}return e.prototype.setPageId=function(t){this.pageId=t},e.prototype.setLanguageOverlayId=function(t){this.pageOverlayId=t},e.prototype.initializePageTitleRenaming=function(){var t=this;if(i.isReady){if(!(this.pageId<=0)){var e=i('<a class="hidden" href="#" data-action="edit"><span class="t3-icon fa fa-pencil"></span></a>');e.on("click",function(e){e.preventDefault(),t.editPageTitle()}),this.$pageTitle.on("dblclick",function(){t.editPageTitle()}).on("mouseover",function(){e.removeClass("hidden")}).on("mouseout",function(){e.addClass("hidden")}).append(e)}}else i(function(){t.initializePageTitleRenaming()})},e.prototype.initializeElements=function(){this.$pageTitle=i(s.pageTitle+":first"),this.$showHiddenElementsCheckbox=i("#checkTt_content_showHidden")},e.prototype.initializeEvents=function(){this.$showHiddenElementsCheckbox.on("change",this.toggleContentElementVisibility)},e.prototype.toggleContentElementVisibility=function(t){var e=i(t.currentTarget),n=i(s.hiddenElements),o=i("<span />",{class:"checkbox-spinner fa fa-circle-o-notch fa-spin"});e.hide().after(o),e.prop("checked")?n.slideDown():n.slideUp(),a.set("moduleData.web_layout.tt_content_showHidden",e.prop("checked")?"1":"0").done(function(){o.remove(),e.show()})},e.prototype.editPageTitle=function(){var t=this,e=i('<form><div class="form-group"><div class="input-group input-group-lg"><input class="form-control"><span class="input-group-btn"><button class="btn btn-default" type="button" data-action="submit"><span class="t3-icon fa fa-floppy-o"></span></button> </span><span class="input-group-btn"><button class="btn btn-default" type="button" data-action="cancel"><span class="t3-icon fa fa-times"></span></button> </span></div></div></form>'),a=e.find("input");e.find("[data-action=cancel]").on("click",function(){e.replaceWith(t.$pageTitle),t.initializePageTitleRenaming()}),e.find("[data-action=submit]").on("click",function(){var n=i.trim(a.val());""!==n&&t.$pageTitle.text()!==n?t.saveChanges(a):e.find("[data-action=cancel]").trigger("click")}),a.parents("form").on("submit",function(t){return t.preventDefault(),!1});var o=this.$pageTitle;o.children().last().remove(),o.replaceWith(e),a.val(o.text()).focus(),a.on("keyup",function(t){switch(t.which){case n.KeyTypesEnum.ENTER:e.find('[data-action="submit"]').trigger("click");break;case n.KeyTypesEnum.ESCAPE:e.find('[data-action="cancel"]').trigger("click")}})},e.prototype.saveChanges=function(e){var n=this,i=e.parents("form");i.find("button").addClass("disabled"),e.attr("disabled","disabled");var a,o={};a=this.pageOverlayId>0?this.pageOverlayId:this.pageId,o.data={},o.data.pages={},o.data.pages[a]={title:e.val()},t(["TYPO3/CMS/Backend/AjaxDataHandler"],function(t){t.process(o).done(function(){i.find("[data-action=cancel]").trigger("click"),n.$pageTitle.text(e.val()),n.initializePageTitleRenaming(),top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree()}).fail(function(){i.find("[data-action=cancel]").trigger("click")})})},e.prototype.initializeNewContentElementWizard=function(){i(s.newButton).click(function(t){var e=i(t.currentTarget);o.wizard(e.data("url"),e.data("title"))})},e}())});
\ No newline at end of file
+define(["require","exports","./Enum/KeyTypes","jquery","./Storage/Persistent","./Wizard/NewContentElement"],function(t,e,i,n,a,o){"use strict";var s,l;return(l=s||(s={})).pageTitle=".t3js-title-inlineedit",l.hiddenElements=".t3js-hidden-record",l.newButton=".t3js-toggle-new-content-element-wizard",new(function(){function e(){var t=this;this.pageId=0,this.pageOverlayId=0,this.$pageTitle=null,this.$showHiddenElementsCheckbox=null,n(function(){t.initializeElements(),t.initializeEvents(),t.initializeNewContentElementWizard(),t.initializePageTitleRenaming()})}return e.prototype.setPageId=function(t){this.pageId=t},e.prototype.setLanguageOverlayId=function(t){this.pageOverlayId=t},e.prototype.initializePageTitleRenaming=function(){var t=this;if(n.isReady){if(!(this.pageId<=0)){var e=n('<a class="hidden" href="#" data-action="edit"><span class="t3-icon fa fa-pencil"></span></a>');e.on("click",function(e){e.preventDefault(),t.editPageTitle()}),this.$pageTitle.on("dblclick",function(){t.editPageTitle()}).on("mouseover",function(){e.removeClass("hidden")}).on("mouseout",function(){e.addClass("hidden")}).append(e)}}else n(function(){t.initializePageTitleRenaming()})},e.prototype.initializeElements=function(){this.$pageTitle=n(s.pageTitle+":first"),this.$showHiddenElementsCheckbox=n("#checkTt_content_showHidden")},e.prototype.initializeEvents=function(){this.$showHiddenElementsCheckbox.on("change",this.toggleContentElementVisibility)},e.prototype.toggleContentElementVisibility=function(t){var e=n(t.currentTarget),i=n(s.hiddenElements),o=n("<span />",{class:"checkbox-spinner fa fa-circle-o-notch fa-spin"});e.hide().after(o),e.prop("checked")?i.slideDown():i.slideUp(),a.set("moduleData.web_layout.tt_content_showHidden",e.prop("checked")?"1":"0").done(function(){o.remove(),e.show()})},e.prototype.editPageTitle=function(){var t=this,e=n('<form><div class="form-group"><div class="input-group input-group-lg"><input class="form-control t3js-title-edit-input"><span class="input-group-btn"><button class="btn btn-default" type="button" data-action="submit"><span class="t3-icon fa fa-floppy-o"></span></button> </span><span class="input-group-btn"><button class="btn btn-default" type="button" data-action="cancel"><span class="t3-icon fa fa-times"></span></button> </span></div></div></form>'),a=e.find("input");e.find('[data-action="cancel"]').on("click",function(){e.replaceWith(t.$pageTitle),t.initializePageTitleRenaming()}),e.find('[data-action="submit"]').on("click",function(){var i=n.trim(a.val());""!==i&&t.$pageTitle.text()!==i?t.saveChanges(a):e.find('[data-action="cancel"]').trigger("click")}),a.parents("form").on("submit",function(t){return t.preventDefault(),!1});var o=this.$pageTitle;o.children().last().remove(),o.replaceWith(e),a.val(o.text()).focus(),a.on("keyup",function(t){switch(t.which){case i.KeyTypesEnum.ENTER:e.find('[data-action="submit"]').trigger("click");break;case i.KeyTypesEnum.ESCAPE:e.find('[data-action="cancel"]').trigger("click")}})},e.prototype.saveChanges=function(e){var i=this,n=e.parents("form");n.find("button").addClass("disabled"),e.attr("disabled","disabled");var a,o={};a=this.pageOverlayId>0?this.pageOverlayId:this.pageId,o.data={},o.data.pages={},o.data.pages[a]={title:e.val()},t(["TYPO3/CMS/Backend/AjaxDataHandler"],function(t){t.process(o).done(function(){n.find("[data-action=cancel]").trigger("click"),i.$pageTitle.text(e.val()),i.initializePageTitleRenaming(),top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree()}).fail(function(){n.find("[data-action=cancel]").trigger("click")})})},e.prototype.initializeNewContentElementWizard=function(){n(s.newButton).click(function(t){var e=n(t.currentTarget);o.wizard(e.data("url"),e.data("title"))})},e}())});
\ No newline at end of file
index bff0f57..1687218 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Page;
  */
 
 use TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester;
+use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree;
 
 /**
  * This testcase is used to check if the expected information is found when
@@ -40,4 +41,51 @@ class PageModuleCest
         $I->switchToContentFrame();
         $I->canSee('Web>Page module', 'h4');
     }
+
+    /**
+     * @param BackendTester $I
+     * @param PageTree $pageTree
+     */
+    public function editPageTitle(BackendTester $I, PageTree $pageTree): void
+    {
+        $currentPageTitle = 'styleguide TCA demo';
+        $newPageTitle = 'styleguide TCA demo page';
+
+        $I->click('Page');
+        $pageTree->openPath([$currentPageTitle]);
+        $I->switchToContentFrame();
+
+        // Rename the page
+        $this->renamePage($I, $currentPageTitle, $newPageTitle);
+
+        // Now recover the old page title
+        $this->renamePage($I, $newPageTitle, $currentPageTitle);
+    }
+
+    /**
+     * @param BackendTester $I
+     * @param string $oldTitle
+     * @param string $newTitle
+     */
+    private function renamePage(BackendTester $I, string $oldTitle, string $newTitle)
+    {
+        $editLinkSelector = 'a[data-action="edit"]';
+        $inputFieldSelector = 'input[class*="t3js-title-edit-input"]';
+
+        $I->canSee($oldTitle, 'h1');
+        $I->moveMouseOver('.t3js-title-inlineedit');
+
+        $I->comment('Activate inline edit of page title');
+        $I->seeElement($editLinkSelector);
+        $I->click($editLinkSelector);
+        $I->seeElement($inputFieldSelector);
+
+        $I->comment('Set new value and save');
+        $I->fillField($inputFieldSelector, $newTitle);
+        $I->click('button[data-action="submit"]');
+
+        $I->comment('See the new page title');
+        $I->waitForElementNotVisible($inputFieldSelector);
+        $I->canSee($newTitle, 'h1');
+    }
 }