Skip to content

Commit

Permalink
Generate airtable URL using a function
Browse files Browse the repository at this point in the history
  • Loading branch information
duckduckgrayduck committed Jul 25, 2024
1 parent 26c31a5 commit 57a9795
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/pages/app/Documents.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@
let preUploadFiles = [];
let anonymousClosed = false;
function constructPrefillUrl() {
const baseUrl = "https://airtable.com/app93Yt5cwdVWTnqn/pagogIhgB1jZTzq00/form";
const email = encodeURIComponent(orgsAndUsers.me.email);
const username = encodeURIComponent(orgsAndUsers.me.username);
const accountUrl = `https://accounts.muckrock.com/users/${username}/`;
const orgSlug = encodeURIComponent(orgsAndUsers.me.organization.slug);
const orgAccountUrl = `https://accounts.muckrock.com/organizations/${orgSlug}`;
return `${baseUrl}?prefill_MR+User+Email=${email}&prefill_MR+User+Name=${username}&prefill_MR+User+Account+URL=${accountUrl}&prefill_MR+Organization+Name=${orgSlug}&prefill_MR+Organization+Account+URL=${orgAccountUrl}`;
}
function showUploadModal({ detail: files }) {
if (files != null) {
preUploadFiles = Array.from(files);
Expand Down Expand Up @@ -181,7 +192,7 @@
>
{/if}
{#if $orgsAndUsers.loggedIn && !$orgsAndUsers.isVerified}
<a href="https://airtable.com/app93Yt5cwdVWTnqn/pagogIhgB1jZTzq00/form?prefill_MR+User+Name={$orgsAndUsers.me.username}&prefill_MR+User+Account+URL=https://accounts.muckrock.com/users/{$orgsAndUsers.me.username}/&prefill_MR+Organization+Name={$orgsAndUsers.me.organization.slug}&prefill_MR+Organization+Account+URL=https://accounts.muckrock.com/organizations/{$orgsAndUsers.me.organization.slug}" target="_new">
<a href="{constructPrefillUrl()}" target="_new">
<Button>{$_("noDocuments.requestVerificationAction")}</Button>
</a>
{/if}
Expand Down

0 comments on commit 57a9795

Please sign in to comment.