From c11a0db954a3f71c28dce956e7d9f08ccb356358 Mon Sep 17 00:00:00 2001 From: DianaXWiki Date: Thu, 27 Aug 2026 12:37:33 +0200 Subject: [PATCH] Implement review changes --- customize.dist/messages.js | 1 + .../src/less2/include/creation.less | 57 +++++++++++-------- www/common/common-ui-elements.js | 37 ++++++++---- www/form/app-form.less | 9 +++ www/form/inner.js | 18 ++++-- 5 files changed, 83 insertions(+), 39 deletions(-) diff --git a/customize.dist/messages.js b/customize.dist/messages.js index 2856350c4..aef5e749e 100755 --- a/customize.dist/messages.js +++ b/customize.dist/messages.js @@ -163,6 +163,7 @@ define(req, function(AppConfig, Default, Language) { Messages.form_guestAuthorBody = "This author link is currently not stored anywhere since you are not logged in. To avoid loosing access in future please save this link now:"; Messages.form_guestAuthorBodyStored = "This author link is currently only stored on this device, please save it to avoid loosing access to your form."; Messages.form_guestAuthorCopied = "Author link copied"; + Messages.form_guestAuthorCopy = "Copy author link"; Messages.form_guestAuthorContinuePublic = "Continue to public link"; Messages.form_guestPublicTitle = "Copy your public link"; Messages.form_guestPublicBody = "Share this link with participants so they can fill out your form."; diff --git a/customize.dist/src/less2/include/creation.less b/customize.dist/src/less2/include/creation.less index dcb721c88..03e0392ac 100644 --- a/customize.dist/src/less2/include/creation.less +++ b/customize.dist/src/less2/include/creation.less @@ -268,55 +268,64 @@ .cp-creation-help { flex: none; } + .cp-creation-team-avatar { + .avatar_main(20px); + flex: none; + display: inline-flex; + align-items: center; + justify-content: center; + svg, .lucide { + margin: 0; + } + } + .cp-creation-team-name { + flex: 1 1 0; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + text-align: left; + } .cp-dropdown-container { flex: 1 1 0; width: 0; min-width: 0; - display: block; button.btn { width: 100%; - max-width: 100%; - box-sizing: border-box; justify-content: flex-start; - text-align: left; overflow: hidden; + color: @cp_creation-fg; + background: @cp_forms-bg; + border: 1px solid @cp_forms-border; + text-transform: none; .cp-dropdown-button-title { flex: 1 1 0; min-width: 0; + display: flex; + align-items: center; + justify-content: flex-start; + gap: 0.5rem; overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; text-align: left; } } .cp-dropdown-content { left: 0; right: 0; - width: auto; + width: 100%; min-width: 0; max-width: 100%; + box-sizing: border-box; overflow-x: hidden; - li[role="menuitem"] > a { - display: flex; - align-items: center; - gap: 0.5rem; + li[role="menuitem"] { overflow: hidden; - .cp-creation-team-avatar { - .avatar_main(20px); - flex: none; - display: inline-flex; + > a { + display: flex; align-items: center; - justify-content: center; - svg, .lucide { - margin: 0; - } - } - .cp-creation-team-name { - flex: 1 1 0; + gap: 0.5rem; min-width: 0; + max-width: 100%; overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; } } } diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index ef9f257a4..ed5a21cbb 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2822,26 +2822,38 @@ define([ if (!val || val === 'none') { return Messages.autostore_hide; } return privateData.teams?.[val]?.name || val; }; + var getTeamAvatar = function (val) { + if (val === '-1') { + return h('span.cp-creation-team-avatar', Icons.get('drive')); + } + if (!val || val === 'none') { + return h('span.cp-creation-team-avatar', Icons.get('close')); + } + var data = privateData.teams?.[val]; + var avatar = h('span.cp-creation-team-avatar.cp-avatar'); + if (data) { + common.displayAvatar($(avatar), data.avatar, data.name); + } + return avatar; + }; var teamOptions = [{ tag: 'a', attributes: { 'data-value': '-1' }, - content: [h('span.cp-creation-team-avatar', Icons.get('drive')), h('span.cp-creation-team-name', Messages.settings_cat_drive)] + content: [getTeamAvatar('-1'), h('span.cp-creation-team-name', Messages.settings_cat_drive)] }]; Object.keys(privateData.teams || {}).forEach(function (id) { var data = privateData.teams[id]; if (!data) { return; } - var avatar = h('span.cp-creation-team-avatar.cp-avatar'); - common.displayAvatar($(avatar), data.avatar, data.name); teamOptions.push({ tag: 'a', attributes: { 'data-value': id }, - content: [avatar, h('span.cp-creation-team-name', data.name)] + content: [getTeamAvatar(id), h('span.cp-creation-team-name', data.name)] }); }); teamOptions.push({ tag: 'a', attributes: { 'data-value': 'none' }, - content: [h('span.cp-creation-team-avatar', Icons.get('close')), h('span.cp-creation-team-name', Messages.autostore_hide)] + content: [getTeamAvatar('none'), h('span.cp-creation-team-name', Messages.autostore_hide)] }); var $teamSelect = UIElements.createDropdown({ text: getTeamLabel(teamValue), @@ -2853,16 +2865,19 @@ define([ common: common }); var $teamBtn = $teamSelect.find('button').addClass('btn'); - var setTeamTitle = function (label) { + var setTeamButton = function (val) { + var label = getTeamLabel(val); $teamBtn[0]?._tippy?.destroy(); - $teamBtn.attr('title', label).find('.cp-dropdown-button-title').removeAttr('title'); + $teamBtn.attr('title', label); + $teamBtn.find('.cp-dropdown-button-title').empty().append([ + getTeamAvatar(val), + h('span.cp-creation-team-name', label) + ]).removeAttr('title'); }; - setTeamTitle(getTeamLabel(teamValue)); + setTeamButton(teamValue); $teamSelect.onChange.reg(function (text, value) { teamValue = value == null ? 'none' : String(value); - var label = getTeamLabel(teamValue); - $teamBtn.find('.cp-dropdown-button-title').text(label); - setTeamTitle(label); + setTeamButton(teamValue); }); team = h('div.cp-creation-teams', [ h('span.cp-creation-store-label', Messages.team_pcsSelectLabel), diff --git a/www/form/app-form.less b/www/form/app-form.less index 37cd22686..29c0d1066 100644 --- a/www/form/app-form.less +++ b/www/form/app-form.less @@ -1553,3 +1553,12 @@ .charts_main(); } +.alertify .cp-form-guest-share-modal { + h4, h5, h6, p { + color: @cryptpad_text_col; + } + textarea { + color: @cryptpad_text_col; + } +} + diff --git a/www/form/inner.js b/www/form/inner.js index 35433c004..9527dba95 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -4921,7 +4921,7 @@ define([ rows: 2, 'aria-label': Messages.form_guestPublicTitle }); - var content = h('div', [ + var content = h('div.cp-form-guest-share-modal', [ h('h4', Messages.form_guestPublicTitle), h('p', Messages.form_guestPublicBody), linkInput @@ -4929,8 +4929,13 @@ define([ var frame; var modal = UI.dialog.customModal(content, { buttons: [{ + className: 'cancel', + name: Messages.cancel, + onClick: function () {}, + keys: [27] + }, { className: 'primary', - name: Messages.share_linkCopy, + name: Messages.form_geturl, iconClass: 'copy', onClick: function () { Clipboard.copy(viewUrl, function (copyErr) { @@ -4966,7 +4971,7 @@ define([ rows: 2, 'aria-label': Messages.form_guestAuthorTitle }); - var content = h('div', [ + var content = h('div.cp-form-guest-share-modal', [ h('h4', Messages.form_guestAuthorTitle), h('p', Messages.form_guestEditLinkDefinition), h('p', bodyMsg), @@ -4974,8 +4979,13 @@ define([ ]); var modal = UI.dialog.customModal(content, { buttons: [{ + className: 'cancel', + name: Messages.cancel, + onClick: function () {}, + keys: [27] + }, { className: 'secondary', - name: Messages.share_linkCopy, + name: Messages.form_guestAuthorCopy, iconClass: 'copy', onClick: function () { Clipboard.copy(editUrl, function (copyErr) {