Skip to content

Commit

Permalink
fix: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
asuworks committed May 17, 2024
1 parent 03d878e commit b051254
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 31 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/form/ResearchOrgListField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<small>Set primary</small>
</button>
</span>
<input :value="element.name" class="form-control w-25" readonly :disabled="disabled"/>
<input :value="element.name" class="form-control w-25" readonly :disabled="disabled" />
<span class="input-group-text bg-white flex-grow-1 flex-shrink-1 w-25 overflow-hidden">
<a :href="element.url" target="_blank">{{ element.url }}</a>
</span>
Expand Down
12 changes: 9 additions & 3 deletions frontend/src/components/releaseEditor/ContributorAddModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
class="btn btn-primary"
:class="{ disabled: disabled }"
rel="nofollow"
@click="resetForm();editContributorModal?.show()"
@click="
resetForm();
editContributorModal?.show();
"
>
<i class="fas fa-plus-square me-1"></i> Add a Contributor
</button>
Expand All @@ -20,7 +23,10 @@
<div class="modal-body pb-0">
<div v-if="!showCustomInput" class="d-flex align-items-end justify-content-between mb-3">
<div class="flex-grow-1">
<ContributorSearch ref="contributorSearchRef" @select="populateFromContributor($event)" />
<ContributorSearch
ref="contributorSearchRef"
@select="populateFromContributor($event)"
/>
</div>
<div class="text-center mb-2 mx-3">
<small class="text-muted">OR</small>
Expand Down Expand Up @@ -85,7 +91,7 @@ function populateFromContributor(contributor: Contributor) {
}
function createNewContributor() {
resetForm()
resetForm();
if (editFormRef.value) {
showCustomInput.value = true;
}
Expand Down
55 changes: 42 additions & 13 deletions frontend/src/components/releaseEditor/ContributorEditForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@
show-affiliation
/>
</div>
<div style="position: relative;"> <!-- Container element with relative positioning -->
<div v-if="fromUser" class="position-absolute top-0 start-0 w-100 h-100 bg-light opacity-50" style="z-index: 3;"></div>
<div style="position: relative">
<!-- Container element with relative positioning -->
<div
v-if="fromUser"
class="position-absolute top-0 start-0 w-100 h-100 bg-light opacity-50"
style="z-index: 3"
></div>
<div class="card-body">
<TextField
v-if="!isPerson"
Expand All @@ -34,16 +39,40 @@
/>
<div v-else class="row">
<div class="col-4 pe-0">
<TextField class="mb-3" name="givenName" label="First Name" required :disabled="fromUser"/>
<TextField
class="mb-3"
name="givenName"
label="First Name"
required
:disabled="fromUser"
/>
</div>
<div class="col-3 pe-0">
<TextField class="mb-3" name="middleName" label="Middle Name" :disabled="fromUser" />
<TextField
class="mb-3"
name="middleName"
label="Middle Name"
:disabled="fromUser"
/>
</div>
<div class="col-5">
<TextField class="mb-3" name="familyName" label="Last Name" required :disabled="fromUser" />
<TextField
class="mb-3"
name="familyName"
label="Last Name"
required
:disabled="fromUser"
/>
</div>
</div>
<TextField v-if="isPerson" class="mb-3" name="email" label="Email" required :disabled="fromUser"/>
<TextField
v-if="isPerson"
class="mb-3"
name="email"
label="Email"
required
:disabled="fromUser"
/>
<ResearchOrgListField
name="jsonAffiliations"
placeholder="Type to find organizations"
Expand Down Expand Up @@ -207,7 +236,7 @@ const { errors, handleSubmit, handleReset, values, setValues } = useForm<Contrib
familyName: values.familyName,
middleName: values.middleName,
affiliations: values.affiliations,
jsonAffiliations: values.jsonAffiliations
jsonAffiliations: values.jsonAffiliations,
},
roles: values.roles,
includeInCitation: values.includeInCitation,
Expand Down Expand Up @@ -242,11 +271,11 @@ const hasName = computed(() => values.user || values.givenName);
const fromUser = computed(() => !!values.user || !values.mutable);
function populateFromReleaseContributor(contributor: ReleaseContributor) {
const user = contributor.contributor.user
const user = contributor.contributor.user;
// Contributor has an associated user! Take values from the user.
const givenName = user ? user.memberProfile.givenName : contributor.contributor.givenName
const familyName = user ? user.memberProfile.familyName : contributor.contributor.familyName
const givenName = user ? user.memberProfile.givenName : contributor.contributor.givenName;
const familyName = user ? user.memberProfile.familyName : contributor.contributor.familyName;
setValues({
// set this to get the id from autocomplete contributor
Expand Down Expand Up @@ -274,8 +303,8 @@ function populateFromContributor(contributor: Contributor | null) {
function resetContributor() {
setValues(initialValues);
serverErrors.value = []
handleReset()
serverErrors.value = [];
handleReset();
}
function populateFromUser(user: any) {
Expand All @@ -286,7 +315,7 @@ function populateFromUser(user: any) {
familyName: user.familyName,
middleName: "",
email: user.email,
jsonAffiliations: user.affiliations
jsonAffiliations: user.affiliations,
});
}
Expand Down
41 changes: 27 additions & 14 deletions frontend/src/components/releaseEditor/ContributorsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,28 @@
<i class="fas fa-grip-vertical text-muted"></i>
</div>
<div class="col">
<h5 class="m-0">
<a :href="element.profileUrl" target="_blank" data-bs-toggle="tooltip" :title="element.contributor.name + '\'s User Profile'">
<span v-if="element.contributor.user">
<i class="fas fa-user fa-xs"></i>
{{ element.contributor.name }}
</span>
<span v-else>
{{ element.contributor.name }}
</span>
</a>
</h5>
<h5 class="m-0">
<a
:href="element.profileUrl"
target="_blank"
data-bs-toggle="tooltip"
:title="element.contributor.name + '\'s User Profile'"
>
<span v-if="element.contributor.user">
<i class="fas fa-user fa-xs"></i>
{{ element.contributor.name }}
</span>
<span v-else>
{{ element.contributor.name }}
</span>
</a>
</h5>
<div>
<small class="text-muted"> ({{ roleDisplay(element) }})</small>
</div>
</div>
</div>
</div>
</div>
<div class="col-1 d-flex align-items-center">
<span v-if="element.includeInCitation" class="badge bg-info">citable</span>
</div>
Expand All @@ -84,15 +89,23 @@
type="button"
class="btn btn-link btn-sm me-2"
:class="{ disabled: reordered }"
@click="editCandidate = element;editModal?.show();">
@click="
editCandidate = element;
editModal?.show();
"
>
<small><i class="fas fa-edit"></i> Edit</small>
</button>
<button
v-if="releaseContributors.length > 1"
type="button"
class="btn btn-link text-danger btn-sm"
:class="{ disabled: reordered || releaseContributors.length === 1 }"
@click="removalCondidate = element;removeConfirmationModal?.show();">
@click="
removalCondidate = element;
removeConfirmationModal?.show();
"
>
<small><i class="fas fa-trash"></i> Remove</small>
</button>
</div>
Expand Down

0 comments on commit b051254

Please sign in to comment.