From 864fb3fe637cbc87b3576b8335cad3c2ee719817 Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Mon, 6 Mar 2023 11:09:44 -0800 Subject: [PATCH] Add label and switch ocdialog close button to button element Signed-off-by: Christopher Ng --- core/src/jquery/css/jquery.ocdialog.scss | 6 ++++-- core/src/jquery/ocdialog.js | 3 ++- dist/core-main.js | 4 ++-- dist/core-main.js.map | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/core/src/jquery/css/jquery.ocdialog.scss b/core/src/jquery/css/jquery.ocdialog.scss index 8755e1d7a74..1911dd29dc4 100644 --- a/core/src/jquery/css/jquery.ocdialog.scss +++ b/core/src/jquery/css/jquery.ocdialog.scss @@ -50,8 +50,10 @@ .oc-dialog-close { position: absolute; - top: 0; - right: 0; + width: 44px !important; + height: 44px !important; + top: 4px; + right: 4px; padding: 25px; background: var(--icon-close-dark) no-repeat center; opacity: .5; diff --git a/core/src/jquery/ocdialog.js b/core/src/jquery/ocdialog.js index c8ea065d3c0..9ba54d868c3 100644 --- a/core/src/jquery/ocdialog.js +++ b/core/src/jquery/ocdialog.js @@ -177,7 +177,8 @@ $.widget('oc.ocdialog', { break case 'closeButton': if (value) { - const $closeButton = $('') + const $closeButton = $('') + $closeButton.attr('aria-label', t('core', 'Close "{dialogTitle}" dialog', { dialogTitle: this.$title || this.options.title })) this.$dialog.prepend($closeButton) $closeButton.on('click keydown', function(event) { if (isA11yActivation(event)) { diff --git a/dist/core-main.js b/dist/core-main.js index c0ee90a7765..aaa8a395d60 100644 --- a/dist/core-main.js +++ b/dist/core-main.js @@ -1,3 +1,3 @@ /*! For license information please see core-main.js.LICENSE.txt */ -!function(){var e,i={82777:function(e,i,o){"use strict";var a={};o.r(a),o.d(a,{deleteKey:function(){return B},getApps:function(){return x},getKeys:function(){return k},getValue:function(){return P},setValue:function(){return E}});var r={};o.r(r),o.d(r,{formatLinksPlain:function(){return dn},formatLinksRich:function(){return un},plainToRich:function(){return ln},richToPlain:function(){return cn}});var s={};o.r(s),o.d(s,{dismiss:function(){return fn},query:function(){return pn}});var l=o(19755),c=o.n(l),u=(o(28594),o(35666),o(35202),o(78595)),d=o(79753),A=o(25108),p={},f=[],h=o(18181),m=o(64024),g=o(25108),v={updatableNotification:null,getDefaultNotificationFunction:null,setDefault:function(t){this.getDefaultNotificationFunction=t},hide:function(t,e){h.ZP.isFunction(t)&&(e=t,t=void 0),t?(t.each((function(){c()(this)[0].toastify?c()(this)[0].toastify.hideToast():g.error("cannot hide toast because object is not set"),this===this.updatableNotification&&(this.updatableNotification=null)})),e&&e.call(),this.getDefaultNotificationFunction&&this.getDefaultNotificationFunction()):g.error("Missing argument $row in OC.Notification.hide() call, caller needs to be adjusted to only dismiss its own notification")},showHtml:function(t,e){(e=e||{}).isHTML=!0,e.timeout=e.timeout?e.timeout:m.Rl;var n=(0,m.PV)(t,e);return n.toastElement.toastify=n,c()(n.toastElement)},show:function(t,e){(e=e||{}).timeout=e.timeout?e.timeout:m.Rl;var n=(0,m.PV)(function(t){return t.toString().split("&").join("&").split("<").join("<").split(">").join(">").split('"').join(""").split("'").join("'")}(t),e);return n.toastElement.toastify=n,c()(n.toastElement)},showUpdate:function(t){return this.updatableNotification&&this.updatableNotification.hideToast(),this.updatableNotification=(0,m.PV)(t,{timeout:m.Rl}),this.updatableNotification.toastElement.toastify=this.updatableNotification,c()(this.updatableNotification.toastElement)},showTemporary:function(t,e){(e=e||{}).timeout=e.timeout||m.TN;var n=(0,m.PV)(t,e);return n.toastElement.toastify=n,c()(n.toastElement)},isHidden:function(){return!c()("#content").find(".toastify").length}},C=h.ZP.throttle((function(){v.showTemporary(t("core","Connection to server lost"))}),7e3,{trailing:!1}),b=!1,w={enableDynamicSlideToggle:function(){b=!0},showAppSidebar:function(t){(t||c()("#app-sidebar")).removeClass("disappear").show(),c()("#app-content").trigger(new(c().Event)("appresized"))},hideAppSidebar:function(t){(t||c()("#app-sidebar")).hide().addClass("disappear"),c()("#app-content").trigger(new(c().Event)("appresized"))}};function y(t,e,n){"post"!==t&&"delete"!==t||!Jt.PasswordConfirmation.requiresPasswordConfirmation()?(n=n||{},c().ajax({type:t.toUpperCase(),url:(0,d.generateOcsUrl)("apps/provisioning_api/api/v1/config/apps")+e,data:n.data||{},success:n.success,error:n.error})):Jt.PasswordConfirmation.requirePasswordConfirmation(_.bind(y,this,t,e,n))}function x(t){y("get","",t)}function k(t,e){y("get","/"+t,e)}function P(t,e,n,i){(i=i||{}).data={defaultValue:n},y("get","/"+t+"/"+e,i)}function E(t,e,n,i){(i=i||{}).data={value:n},y("post","/"+t+"/"+e,i)}function B(t,e,n){y("delete","/"+t+"/"+e,n)}var O=window.oc_appconfig||{},D={getValue:function(t,e,n,i){P(t,e,n,{success:i})},setValue:function(t,e,n){E(t,e,n)},getApps:function(t){x({success:t})},getKeys:function(t,e){k(t,{success:e})},deleteKey:function(t,e){B(t,e)}},T=o(25108),I=void 0!==window._oc_appswebroots&&window._oc_appswebroots,j=o(72316),z=o.n(j),S=o(76591),N=o(25108),U={create:"POST",update:"PROPPATCH",patch:"PROPPATCH",delete:"DELETE",read:"PROPFIND"};function M(t,e){if(h.ZP.isArray(t))return h.ZP.map(t,(function(t){return M(t,e)}));var n={href:t.href};return h.ZP.each(t.propStat,(function(t){if("HTTP/1.1 200 OK"===t.status)for(var i in t.properties){var o=i;i in e&&(o=e[i]),n[o]=t.properties[i]}})),n.id||(n.id=L(n.href)),n}function L(t){var e=t.indexOf("?");e>0&&(t=t.substr(0,e));var n,i=t.split("/");do{n=i[i.length-1],i.pop()}while(!n&&i.length>0);return n}function F(t){return t>=200&&t<=299}function R(t,e,n,i){return t.propPatch(e.url,function(t,e){var n,i={};for(n in t){var o=e[n],a=t[n];o||(N.warn('No matching DAV property for property "'+n),o=n),(h.ZP.isBoolean(a)||h.ZP.isNumber(a))&&(a=""+a),i[o]=a}return i}(n.changed,e.davProperties),i).then((function(t){F(t.status)?h.ZP.isFunction(e.success)&&e.success(n.toJSON()):h.ZP.isFunction(e.error)&&e.error(t)}))}var Q=z().noConflict();Object.assign(Q,{davCall:function(t,e){var n=new S.dav.Client({baseUrl:t.url,xmlNamespaces:h.ZP.extend({"DAV:":"d","http://owncloud.org/ns":"oc"},t.xmlNamespaces||{})});n.resolveUrl=function(){return t.url};var i=h.ZP.extend({"X-Requested-With":"XMLHttpRequest",requesttoken:OC.requestToken},t.headers);return"PROPFIND"===t.type?function(t,e,n,i){return t.propFind(e.url,h.ZP.values(e.davProperties)||[],e.depth,i).then((function(t){if(F(t.status)){if(h.ZP.isFunction(e.success)){var n=h.ZP.invert(e.davProperties),i=M(t.body,n);e.depth>0&&i.shift(),e.success(i)}}else h.ZP.isFunction(e.error)&&e.error(t)}))}(n,t,0,i):"PROPPATCH"===t.type?R(n,t,e,i):"MKCOL"===t.type?function(t,e,n,i){return t.request(e.type,e.url,i,null).then((function(o){F(o.status)?R(t,e,n,i):h.ZP.isFunction(e.error)&&e.error(o)}))}(n,t,e,i):function(t,e,n,i){return i["Content-Type"]="application/json",t.request(e.type,e.url,i,e.data).then((function(t){if(F(t.status)){if(h.ZP.isFunction(e.success)){if("PUT"===e.type||"POST"===e.type||"MKCOL"===e.type){var i=t.body||n.toJSON(),o=t.xhr.getResponseHeader("Content-Location");return"POST"===e.type&&o&&(i.id=L(o)),void e.success(i)}if(207===t.status){var a=h.ZP.invert(e.davProperties);e.success(M(t.body,a))}else e.success(t.body)}}else h.ZP.isFunction(e.error)&&e.error(t)}))}(n,t,e,i)},davSync:function(t){return function(e,n,i){var o={type:U[e]||e},a=n instanceof t.Collection;if("update"===e&&(n.hasInnerCollection?o.type="MKCOL":(n.usePUT||n.collection&&n.collection.usePUT)&&(o.type="PUT")),i.url||(o.url=h.ZP.result(n,"url")||function(){throw new Error('A "url" property or function must be specified')}()),null!=i.data||!n||"create"!==e&&"update"!==e&&"patch"!==e||(o.data=JSON.stringify(i.attrs||n.toJSON(i))),"PROPFIND"!==o.type&&(o.processData=!1),"PROPFIND"===o.type||"PROPPATCH"===o.type){var r=n.davProperties;!r&&n.model&&(r=n.model.prototype.davProperties),r&&(h.ZP.isFunction(r)?o.davProperties=r.call(n):o.davProperties=r),o.davProperties=h.ZP.extend(o.davProperties||{},i.davProperties),h.ZP.isUndefined(i.depth)&&(i.depth=a?1:0)}var s=i.error;i.error=function(t,e,n){i.textStatus=e,i.errorThrown=n,s&&s.call(i.context,t,e,n)};var l=i.xhr=t.davCall(h.ZP.extend(o,i),n);return n.trigger("request",n,l,i),l}}(Q)});var G=Q,H=o(65358),K=window._oc_config||{},Z=o(25108),Y=j.Model.extend({defaults:{fullName:"",lastMessage:"",actions:[],hasOneAction:!1,hasTwoActions:!1,hasManyActions:!1},initialize:function(){0===this.get("actions").length?this.set("hasOneAction",!0):1===this.get("actions").length?(this.set("hasTwoActions",!0),this.set("secondAction",this.get("actions")[0])):this.set("hasManyActions",!0);var e=this.get("fullName");this.get("avatar")&&e&&this.set("avatarLabel",t("core","Avatar of {fullName}",{fullName:e}))}}),q=j.Collection.extend({model:Y}),W=j.View.extend({_collection:void 0,_subViews:[],initialize:function(t){this._collection=t.collection},render:function(){var t=this;return t.$el.html(""),t._subViews=[],t._collection.forEach((function(e){var n=new J({model:e});n.render(),t.$el.append(n.$el),n.on("toggle:actionmenu",t._onChildActionMenuToggle,t),t._subViews.push(n)})),t},_onChildActionMenuToggle:function(t){this._subViews.forEach((function(e){e.trigger("parent:toggle:actionmenu",t)}))}}),J=j.View.extend({className:"contact",_template:void 0,_model:void 0,_actionMenuShown:!1,events:{"click .icon-more":"_onToggleActionsMenu"},contactTemplate:o(10944),template:function(t){return this.contactTemplate(t)},initialize:function(t){this._model=t.model,this.on("parent:toggle:actionmenu",this._onOtherActionMenuOpened,this)},render:function(){return this.$el.html(this.template({contact:this._model.toJSON()})),this.delegateEvents(),this.$("div.avatar").imageplaceholder(this._model.get("fullName")),this.$(".top-action").tooltip({placement:"left"}),this.$(".second-action").tooltip({placement:"left"}),this},_onToggleActionsMenu:function(){this._actionMenuShown=!this._actionMenuShown,this._actionMenuShown?this.$(".menu").show():this.$(".menu").hide(),this.trigger("toggle:actionmenu",this.$el)},_onOtherActionMenuOpened:function(t){this.$el.is(t)||(this._actionMenuShown=!1,this.$(".menu").hide())}}),V=j.View.extend({_loadingTemplate:void 0,_errorTemplate:void 0,_contentTemplate:void 0,_contactsTemplate:void 0,_contacts:void 0,_searchTerm:"",events:{"input #contactsmenu-search":"_onSearch"},templates:{loading:o(95386),error:o(20421),menu:o(66115),list:o(34083)},_onSearch:h.ZP.debounce((function(t){var e=this.$("#contactsmenu-search").val();e!==this._searchTerm&&(this.trigger("search",this.$("#contactsmenu-search").val()),this._searchTerm=e)}),700),loadingTemplate:function(t){return this.templates.loading(t)},errorTemplate:function(e){return this.templates.error(h.ZP.extend({couldNotLoadText:t("core","Could not load your contacts")},e))},contentTemplate:function(e){return this.templates.menu(h.ZP.extend({searchContactsText:t("core","Search contacts …")},e))},contactsTemplate:function(e){return this.templates.list(h.ZP.extend({noContactsFoundText:t("core","No contacts found"),showAllContactsText:t("core","Show all contacts …"),contactsAppMgmtText:t("core","Install the Contacts app")},e))},initialize:function(t){this.options=t},showLoading:function(t){this.render(),this._contacts=void 0,this.$(".content").html(this.loadingTemplate({loadingText:t}))},showError:function(){this.render(),this._contacts=void 0,this.$(".content").html(this.errorTemplate())},showContacts:function(t,e){this._contacts=t.contacts,this.render({contacts:t.contacts});var n=new W({collection:t.contacts});n.render(),this.$(".content").html(this.contactsTemplate({contacts:t.contacts,searchTerm:e,contactsAppEnabled:t.contactsAppEnabled,contactsAppURL:Jt.generateUrl("/apps/contacts"),canInstallApp:Jt.isUserAdmin(),contactsAppMgmtURL:Jt.generateUrl("/settings/apps/social/contacts")})),this.$("#contactsmenu-contacts").html(n.$el)},render:function(t){var e=this.$("#contactsmenu-search").val();return this.$el.html(this.contentTemplate(t)),this.$("#contactsmenu-search").val(e),this.$("#contactsmenu-search").focus(),this}}),X=function(t){this.initialize(t)};X.prototype={$el:void 0,_view:void 0,_contactsPromise:void 0,initialize:function(t){this.$el=c()(t.el),this._view=new V({el:this.$el}),this._view.on("search",(function(t){this.loadContacts(t)}),this)},_getContacts:function(t){var e=Jt.generateUrl("/contactsmenu/contacts");return Promise.resolve(c().ajax(e,{method:"POST",data:{filter:t}}))},loadContacts:function(e){var n=this;return n._contactsPromise||(n._contactsPromise=n._getContacts(e)),h.ZP.isUndefined(e)||""===e?n._view.showLoading(t("core","Loading your contacts …")):n._view.showLoading(t("core","Looking for {term} …",{term:e})),n._contactsPromise.then((function(t){t.contacts=new q(t.contacts),n._view.showContacts(t,e)}),(function(t){n._view.showError(),Z.error("There was an error loading your contacts",t)})).then((function(){delete n._contactsPromise})).catch(Z.error.bind(this))}};var $=X,tt=document.getElementsByTagName("head")[0].getAttribute("data-user"),et=document.getElementsByTagName("head")[0].getAttribute("data-user-displayname"),nt=void 0!==tt&&tt,it=o(25108);function ot(t){return ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ot(t)}function at(t,e){for(var n=0;n");A.attr("type",r?"password":"text").attr("id",l+"-input").attr("placeholder",a);var p=c()("