Skip to content

Commit

Permalink
Apply eslint
Browse files Browse the repository at this point in the history
+ one attribute per line
+ removed unecessary props from return
+ attribute ordering
  • Loading branch information
Severino committed Oct 24, 2023
1 parent 378f8f3 commit cf5dee1
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 10 deletions.
132 changes: 132 additions & 0 deletions resources/js/components/CommentList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@
<div :class="classes">
<div :class="listClasses">
<div v-show="!state.commentsHidden">
<div
v-for="comment in comments"
:key="comment.id"
class="mt-2 d-flex"
>
<slot
name="avatar"
:user="comment.author"
>
<a
href="#"
@click.prevent="showUserInfo(comment.author)"
>
<user-avatar
:user="comment.author"
:size="avatar"
/>
<div
v-for="comment in comments"
:key="comment.id"
Expand All @@ -23,11 +40,24 @@
</slot>
<div class="ms-3 flex-grow-1">
<div class="card">
<div
class="card-header d-flex flex-row justify-content-between py-2 px-3"
:class="{'border-0': !comment.content}"
>
<div
class="card-header d-flex flex-row justify-content-between py-2 px-3"
:class="{'border-0': !comment.content}"
>
<div>
<slot
name="author"
:comment="comment.author"
>
<a
href="#"
class="text-body text-decoration-none"
@click.prevent="showUserInfo(comment.author)"
>
<slot
name="author"
:comment="comment.author"
Expand All @@ -48,6 +78,11 @@
</slot>
</div>
<div class="small">
<slot
name="metadata"
class="me-2"
:comment="comment"
/>
<slot
name="metadata"
class="me-2"
Expand All @@ -59,12 +94,28 @@
</span>
&bull;
</template>
<span
class="text-muted fw-light"
:title="datestring(comment.updated_at)"
>
<span
class="text-muted fw-light"
:title="datestring(comment.updated_at)"
>
{{ ago(comment.updated_at) }}
</span>
<span
v-if="!comment.deleted_at && (showEditButton(comment) || showDeleteButton(comment) || state.showReplyTo)"
class="dropdown ms-1"
>
<span
:id="`edit-comment-dropdown-${comment.id}`"
class="clickable"
data-bs-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
>
<i class="fas fa-fw fa-ellipsis-h" />
<span
v-if="!comment.deleted_at && (showEditButton(comment) || showDeleteButton(comment) || state.showReplyTo)"
class="dropdown ms-1"
Expand All @@ -78,6 +129,17 @@
>
<i class="fas fa-fw fa-ellipsis-h" />
</span>
<div
class="dropdown-menu"
:aria-labelledby="`edit-comment-dropdown-${comment.id}`"
>
<a
v-if="showEditButton(comment)"
class="dropdown-item"
href="#"
@click.prevent="enableEditing(comment)"
>
<i class="fas fa-fw fa-edit text-info" /> {{ t('global.edit') }}
<div
class="dropdown-menu"
:aria-labelledby="`edit-comment-dropdown-${comment.id}`"
Expand All @@ -90,6 +152,13 @@
>
<i class="fas fa-fw fa-edit text-info" /> {{ t('global.edit') }}
</a>
<a
v-if="state.showReplyTo"
class="dropdown-item"
href="#"
@click.prevent="setReplyTo(comment)"
>
<i class="fas fa-fw fa-reply text-success" /> {{ t('global.reply_to') }}
<a
v-if="state.showReplyTo"
class="dropdown-item"
Expand All @@ -98,6 +167,13 @@
>
<i class="fas fa-fw fa-reply text-success" /> {{ t('global.reply_to') }}
</a>
<a
v-if="showDeleteButton(comment)"
class="dropdown-item"
href="#"
@click.prevent="handleDelete(comment)"
>
<i class="fas fa-fw fa-trash text-danger" /> {{ t('global.delete') }}
<a
v-if="showDeleteButton(comment)"
class="dropdown-item"
Expand All @@ -111,18 +187,35 @@
</div>
</div>
<div v-if="!emptyMetadata(comment)">
<slot
v-if="!isDeleted(comment) && state.editing.id == comment.id"
name="body-editing"
:comment="comment"
:content="state.editing.content"
>
<slot
v-if="!isDeleted(comment) && state.editing.id == comment.id"
name="body-editing"
:comment="comment"
:content="state.editing.content"
>
<div class="card-body px-3 py-2">
<textarea
v-model="state.editing.content"
class="form-control"
/>
<textarea
v-model="state.editing.content"
class="form-control"
/>
<div class="mt-1 d-flex flex-row justify-content-end">
<button
type="button"
class="btn btn-success btn-sm me-2"
:disabled="state.editing.content == comment.content"
@click="handleEdit(comment, state.editing.content)"
>
<i class="fas fa-fw fa-save" /> {{ t('global.save') }}
<button
type="button"
class="btn btn-success btn-sm me-2"
Expand All @@ -131,6 +224,12 @@
>
<i class="fas fa-fw fa-save" /> {{ t('global.save') }}
</button>
<button
type="button"
class="btn btn-danger btn-sm"
@click="disableEditing()"
>
<i class="fas fa-fw fa-times" /> {{ t('global.cancel') }}
<button
type="button"
class="btn btn-danger btn-sm"
Expand Down Expand Up @@ -158,6 +257,15 @@
<!-- eslint-enable -->
</div>
</slot>
<slot
v-else
name="body-deleted"
:comment="comment"
>
<div
class="card-body bg-warning px-3 py-2"
style="opacity: 0.75;"
>
<slot
v-else
name="body-deleted"
Expand All @@ -174,6 +282,15 @@
</slot>
</div>
</div>
<div
v-if="comment.replies_count > 0"
class="d-flex flex-row justify-content-end"
>
<a
href="#"
class="small text-body"
@click.prevent="toggleReplies(comment)"
>
<div
v-if="comment.replies_count > 0"
class="d-flex flex-row justify-content-end"
Expand Down Expand Up @@ -207,12 +324,27 @@
:edit-url="editUrl"
:delete-url="deleteUrl"
:reply-url="replyUrl"
:post-url="postUrl"
:edit-url="editUrl"
:delete-url="deleteUrl"
:reply-url="replyUrl"
:classes="classes"
:list-classes="listClasses"
/>
:list-classes="listClasses"
/>
</div>
</div>
</div>
<div
v-show="state.displayHideButton"
class="text-center mt-2"
>
<button
class="btn btn-sm btn-outline-primary"
@click="toggleHideState()"
>
<i class="fas fa-fw fa-comments me-1" />
<div
v-show="state.displayHideButton"
class="text-center mt-2"
Expand Down
11 changes: 1 addition & 10 deletions resources/js/components/EntityDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,7 @@ export default {
const saveEntity = _ => {
if(!can('entity_data_write')) return;
const dirtyValues = attrRef.value.getDirtyValues();
const patches = [];
const moderations = [];
var patches = [];
for(let v in dirtyValues) {
const aid = v;
Expand Down Expand Up @@ -771,7 +770,6 @@ export default {
}
}
patches.push(patch);
moderations.push(aid);
}
return patchAttributes(state.entity.id, patches).then(data => {
state.formDirty = false;
Expand All @@ -781,13 +779,6 @@ export default {
data: dirtyValues,
eid: state.entity.id,
});
if(isModerated()) {
store.dispatch('updateEntityDataModerations', {
entity_id: state.entity.id,
attribute_ids: moderations,
state: 'pending',
});
}
toast.$toast(
t('main.entity.toasts.updated.msg', {
Expand Down
17 changes: 17 additions & 0 deletions resources/js/components/UserPreferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
<small class="text-muted">
{{ getUser().name }}
</small>
<button
type="button"
class="btn btn-outline-success btn-sm"
@click="savePreferences()"
>
<i class="fas fa-fw fa-save" />
<button
type="button"
class="btn btn-outline-success btn-sm"
Expand All @@ -15,6 +21,11 @@
</button>
</h3>
<div class="table-responsive scroll-x-hidden">
<table
v-if="state.prefsLoaded"
v-dcan="'preferences_read'"
class="table table-light table-striped table-hover mb-0"
>
<table
v-if="state.prefsLoaded"
v-dcan="'preferences_read'"
Expand All @@ -29,6 +40,12 @@
>
{{ t('global.value') }}
</th>
<th
style="width: 99%;"
class="text-end"
>
{{ t('global.value') }}
</th>
</tr>
</thead>
<tbody>
Expand Down
29 changes: 29 additions & 0 deletions resources/js/components/attribute/Iconclass.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@
:disabled="disabled"
@input="onInput()"
>
<button
type="button"
class="btn btn-outline-secondary"
:disabled="v.noContent"
@click="loadIconclassInfo()"
>
<i class="fas fa-fw fa-eye" />
<input
v-model="v.value"
type="text"
class="form-control"
:disabled="disabled"
@input="onInput()"
>
<button
type="button"
class="btn btn-outline-secondary"
Expand All @@ -17,6 +31,10 @@
<i class="fas fa-fw fa-eye" />
</button>
</div>
<div
v-if="state.infoLoaded"
class="bg-light mt-2 p-2 border rounded"
>
<div
v-if="state.infoLoaded"
class="bg-light mt-2 p-2 border rounded"
Expand All @@ -31,8 +49,15 @@
aria-label="Close"
@click="closeInfoBox()"
/>
<button
type="button"
class="btn-close"
aria-label="Close"
@click="closeInfoBox()"
/>
</div>
<hr class="my-2">
<hr class="my-2">
<div>
<span>{{ state.keywords.join(' &bull; ') }}</span>
</div>
Expand All @@ -41,6 +66,10 @@
<span v-html="t('main.entity.attributes.iconclass.cite_info', {class: v.value})" />
</footer>
</div>
<p
v-if="state.infoErrored"
class="alert alert-danger my-2"
>
<p
v-if="state.infoErrored"
class="alert alert-danger my-2"
Expand Down
3 changes: 3 additions & 0 deletions resources/js/components/attribute/MultiChoice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
:closeOnSelect="false"
:placeholder="t('global.select.placeholder')"
@change="value => v.handleChange(value)"
>
<template #option="{ option }">
@change="value => v.handleChange(value)"
>
<template #option="{ option }">
{{ translateConcept(option.concept_url) }}
Expand Down
Loading

0 comments on commit cf5dee1

Please sign in to comment.