Skip to content

Commit

Permalink
Copy URL action in pop-up form header
Browse files Browse the repository at this point in the history
  • Loading branch information
r3-gabriel committed Nov 26, 2024
1 parent 6bd9d26 commit ff482f5
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 17 deletions.
31 changes: 23 additions & 8 deletions www/comps/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ import {getFieldOverwritesDefault} from './shared/field.js';
import {jsFunctionRun} from './shared/jsFunction.js';
import {srcBase64} from './shared/image.js';
import {getCaption} from './shared/language.js';
import {
isAttributeRelationship,
isAttributeRelationshipN1,
getAttributeValueFromString,
getDetailsFromIndexAttributeId,
getGetterFromAttributeValues,
getIndexAttributeId,
getIndexAttributeIdByField
} from './shared/attribute.js';
import {
aesGcmDecryptBase64WithPhrase,
aesGcmEncryptBase64WithPhrase,
Expand All @@ -31,14 +40,6 @@ import {
getResolvedPlaceholders,
getRowsDecrypted
} from './shared/form.js';
import {
isAttributeRelationship,
isAttributeRelationshipN1,
getAttributeValueFromString,
getDetailsFromIndexAttributeId,
getIndexAttributeId,
getIndexAttributeIdByField
} from './shared/attribute.js';
import {
fillRelationRecordIds,
getJoinIndexMapExpanded,
Expand Down Expand Up @@ -146,6 +147,12 @@ let MyForm = {
/>
</template>
<my-button image="link.png"
v-if="isPopUp && !isBulkUpdate && !isMobile"
@trigger="copyFormUrlToClipboard(false)"
@trigger-middle="copyFormUrlToClipboard(true)"
:captionTitle="capApp.button.urlHint"
/>
<my-button image="question.png"
v-if="hasHelp"
@trigger="showHelp = !showHelp"
Expand Down Expand Up @@ -798,6 +805,7 @@ let MyForm = {
getFieldOverwritesDefault,
getFormPopUpConfig,
getFormRoute,
getGetterFromAttributeValues,
getIndexAttributeId,
getIndexAttributeIdByField,
getJoinIndexMapExpanded,
Expand Down Expand Up @@ -1062,6 +1070,13 @@ let MyForm = {
this.popUp = null;
this.$store.commit('pageTitle',this.title);
},
copyFormUrlToClipboard(middleClick) {
const path = this.getFormRoute(this.form.id,(this.isNew ? 0 : this.recordIds[0]),
true,this.getGetterFromAttributeValues(this.attributeIdMapDef));

if(!middleClick) navigator.clipboard.writeText(`${location.protocol}//${location.host}/#${path}`);
else window.open(`${location.protocol}//${location.host}/#${path}`);
},
openBuilder(middle) {
if(!middle) {
this.$router.push('/builder/form/'+this.form.id);
Expand Down
7 changes: 7 additions & 0 deletions www/comps/shared/attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ export function getAttributeValuesFromGetter(getter) {
}
return map;
};
export function getGetterFromAttributeValues(attributeIdMap) {
let out = [];
for(const k in attributeIdMap) {
out.push(`${k}_${attributeIdMap[k]}`);
}
return out.length === 0 ? [] : [`attributes=${out.join(',')}`];
};

export function getAttributeIcon(content,contentUse,outsideIn,isNm) {
if(isAttributeString(content)) {
Expand Down
3 changes: 2 additions & 1 deletion www/langs/ar_eg
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,8 @@
"help": "يساعد",
"helpHint": "عرض صفحات المساعدة",
"log": "سجلات",
"logHint": "فتح سجلات التغيير"
"logHint": "فتح سجلات التغيير",
"urlHint": "Copy URL to clipboard"
},
"dialog": {
"bulkEncrypted": "التحديث المجمع للبيانات المشفرة غير مدعوم حاليًا.",
Expand Down
3 changes: 2 additions & 1 deletion www/langs/de_de
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,8 @@
"help": "Hilfe",
"helpHint": "Hilfeseiten anzeigen",
"log": "Historie",
"logHint": "Änderungshistorie anzeigen"
"logHint": "Änderungshistorie anzeigen",
"urlHint": "URL in Zwischenablage kopieren"
},
"dialog": {
"bulkEncrypted": "Massenaktualisierung für verschlüsselte Daten wird aktuell nicht unterstützt.",
Expand Down
3 changes: 2 additions & 1 deletion www/langs/en_us
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,8 @@
"help": "Help",
"helpHint": "Show help pages",
"log": "Logs",
"logHint": "Open change logs"
"logHint": "Open change logs",
"urlHint": "Copy URL to clipboard"
},
"dialog": {
"bulkEncrypted": "Bulk update for encrypted data is currently not supported.",
Expand Down
3 changes: 2 additions & 1 deletion www/langs/fr_fr
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,8 @@
"help": "Aide",
"helpHint": "Afficher les pages d'aide",
"log": "Journaux",
"logHint": "Ouvrir les journaux des modifications"
"logHint": "Ouvrir les journaux des modifications",
"urlHint": "Copy URL to clipboard"
},
"dialog": {
"bulkEncrypted": "La mise à jour en masse des données chiffrées n'est actuellement pas prise en charge.",
Expand Down
3 changes: 2 additions & 1 deletion www/langs/hu_hu
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,8 @@
"help": "Súgó",
"helpHint": "Súgóoldalak megjelenítése",
"log": "Előzmények",
"logHint": "Módosítástörténet megjelenítése"
"logHint": "Módosítástörténet megjelenítése",
"urlHint": "Copy URL to clipboard"
},
"dialog": {
"bulkEncrypted": "A tömeges titkosított adatfrissítés jelenleg nem támogatott.",
Expand Down
3 changes: 2 additions & 1 deletion www/langs/it_it
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,8 @@
"help": "Aiuto",
"helpHint": "Mostra pagine aiuto",
"log": "Log",
"logHint": "Apri log modifiche"
"logHint": "Apri log modifiche",
"urlHint": "Copy URL to clipboard"
},
"dialog": {
"bulkEncrypted": "Bulk update for encrypted data is currently not supported.",
Expand Down
3 changes: 2 additions & 1 deletion www/langs/lv_lv
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,8 @@
"help": "Help",
"helpHint": "Show help pages",
"log": "Logs",
"logHint": "Open change logs"
"logHint": "Open change logs",
"urlHint": "Copy URL to clipboard"
},
"dialog": {
"bulkEncrypted": "Bulk update for encrypted data is currently not supported.",
Expand Down
3 changes: 2 additions & 1 deletion www/langs/ro_ro
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,8 @@
"help": "Ajutor",
"helpHint": "Afișați paginile de ajutor",
"log": "Jurnale",
"logHint": "Deschideți jurnalele de modificări"
"logHint": "Deschideți jurnalele de modificări",
"urlHint": "Copy URL to clipboard"
},
"dialog": {
"bulkEncrypted": "Bulk update for encrypted data is currently not supported.",
Expand Down
3 changes: 2 additions & 1 deletion www/langs/zh_cn
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,8 @@
"help": "帮助",
"helpHint": "显示帮助页面",
"log": "日志",
"logHint": "打开变更日志"
"logHint": "打开变更日志",
"urlHint": "Copy URL to clipboard"
},
"dialog": {
"bulkEncrypted": "当前不支持加密数据的批量更新。",
Expand Down

0 comments on commit ff482f5

Please sign in to comment.