Minor: Format code - refs BT#21620

pull/5636/head
Angel Fernando Quiroz Campos 1 year ago
parent 188a149831
commit ff7fbc4974
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 13
      assets/vue/components/basecomponents/BaseRouteTabs.vue
  2. 13
      assets/vue/components/course/CourseTool.vue
  3. 108
      assets/vue/components/social/SocialGroupMenu.vue
  4. 4
      assets/vue/components/social/SocialWallPost.vue
  5. 24
      assets/vue/composables/sidebarMenu.js
  6. 2
      assets/vue/views/message/MessageList.vue

@ -6,7 +6,8 @@
class="px-4 py-2 font-semibold"
:class="{
'text-primary border-b-2 border-primary': selectedTab === index,
'text-gray-50 border-b-2 border-gray-50 hover:text-primary hover:border-b-2 hover:border-primary': selectedTab !== index,
'text-gray-50 border-b-2 border-gray-50 hover:text-primary hover:border-b-2 hover:border-primary':
selectedTab !== index,
}"
:to="tab.to"
role="tab"
@ -27,17 +28,17 @@ defineProps({
type: Array,
required: true,
validator: (value) => {
let isTabsCorrect = value.every(e => Object.hasOwn(e, 'title') && Object.hasOwn(e, 'to'))
let isTabsCorrect = value.every((e) => Object.hasOwn(e, "title") && Object.hasOwn(e, "to"))
if (!isTabsCorrect) {
return false
}
let titles = value.map(e => e.title)
return (new Set(titles)).size === titles.length
}
let titles = value.map((e) => e.title)
return new Set(titles).size === titles.length
},
},
selectedTab: {
type: Number,
required: true,
}
},
})
</script>

@ -47,7 +47,12 @@
<div class="course-tool__options">
<button
v-if="(isAllowedToEdit) && !isSorting && !isCustomizing && (session?.id ? 'true' === getSetting('course.allow_edit_tool_visibility_in_session') : true)"
v-if="
isAllowedToEdit &&
!isSorting &&
!isCustomizing &&
(session?.id ? 'true' === getSetting('course.allow_edit_tool_visibility_in_session') : true)
"
@click="changeVisibility(tool)"
>
<BaseIcon
@ -85,9 +90,9 @@
</template>
<script setup>
import { computed, inject, onMounted, ref } from "vue"
import { computed, inject } from "vue"
import BaseIcon from "../basecomponents/BaseIcon.vue"
import {useSecurityStore} from "../../store/securityStore";
import { useSecurityStore } from "../../store/securityStore"
import { usePlatformConfig } from "../../store/platformConfig"
import { storeToRefs } from "pinia"
import { useCidReqStore } from "../../store/cidReq"
@ -106,7 +111,7 @@ const isCustomizing = inject("isCustomizing")
const props = defineProps({
isAllowedToEdit: {
type: Boolean,
required: true
required: true,
},
tool: {
type: Object,

@ -2,44 +2,65 @@
<BaseCard class="social-side-menu mt-4">
<template #header>
<div class="px-4 py-2 -mb-2 bg-gray-15">
<h2 class="text-h5">{{ t('Social Group') }}</h2>
<h2 class="text-h5">{{ t("Social Group") }}</h2>
</div>
</template>
<hr class="-mt-2 mb-4 -mx-4">
<ul v-if="groupInfo.isMember" class="menu-list">
<li class="menu-item">
<router-link to="/social">
<i class="mdi mdi-home" aria-hidden="true"></i>
{{ t("Home") }}
</router-link>
</li>
<li class="menu-item">
<router-link :to="{ name: '', params: { group_id: groupInfo.id } }">
<i class="mdi mdi-account-multiple-outline" aria-hidden="true"></i>
{{ t("Waiting list") }}
</router-link>
</li>
<li class="menu-item">
<router-link :to="{ name: 'UserGroupInvite', params: { group_id: groupInfo.id } }">
<i class="mdi mdi-account-plus" aria-hidden="true"></i>
{{ t("Invite friends") }}
</router-link>
</li>
<li class="menu-item" v-if="groupInfo.isAllowedToLeave">
<button @click="leaveGroup">
<i class="mdi mdi-exit-to-app" aria-hidden="true"></i>
{{ t("Leave group") }}
</button>
</li>
</ul>
<ul v-else>
<li class="menu-item">
<router-link to="/social">
<i class="mdi mdi-home" aria-hidden="true"></i>
{{ t("Home") }}
</router-link>
</li>
</ul>
<hr class="-mt-2 mb-4 -mx-4" />
<ul
v-if="groupInfo.isMember"
class="menu-list"
>
<li class="menu-item">
<router-link to="/social">
<i
class="mdi mdi-home"
aria-hidden="true"
></i>
{{ t("Home") }}
</router-link>
</li>
<li class="menu-item">
<router-link :to="{ name: '', params: { group_id: groupInfo.id } }">
<i
class="mdi mdi-account-multiple-outline"
aria-hidden="true"
></i>
{{ t("Waiting list") }}
</router-link>
</li>
<li class="menu-item">
<router-link :to="{ name: 'UserGroupInvite', params: { group_id: groupInfo.id } }">
<i
class="mdi mdi-account-plus"
aria-hidden="true"
></i>
{{ t("Invite friends") }}
</router-link>
</li>
<li
v-if="groupInfo.isAllowedToLeave"
class="menu-item"
>
<button @click="leaveGroup">
<i
class="mdi mdi-exit-to-app"
aria-hidden="true"
></i>
{{ t("Leave group") }}
</button>
</li>
</ul>
<ul v-else>
<li class="menu-item">
<router-link to="/social">
<i
class="mdi mdi-home"
aria-hidden="true"
></i>
{{ t("Home") }}
</router-link>
</li>
</ul>
</BaseCard>
</template>
@ -48,11 +69,10 @@ import BaseCard from "../basecomponents/BaseCard.vue"
import { useRoute, useRouter } from "vue-router"
import { useI18n } from "vue-i18n"
import { useSecurityStore } from "../../store/securityStore"
import axios from 'axios'
import axios from "axios"
import { useNotification } from "../../composables/notification"
import { useSocialInfo } from "../../composables/useSocialInfo"
const { t } = useI18n()
const route = useRoute()
const router = useRouter()
@ -62,23 +82,23 @@ const notification = useNotification()
const { user, groupInfo, isGroup, loadGroup, isLoading } = useSocialInfo()
const leaveGroup = async () => {
try {
const response = await axios.post('/social-network/group-action', {
const response = await axios.post("/social-network/group-action", {
userId: user.value.id,
groupId: groupInfo.value.id,
action: 'leave'
action: "leave",
})
if (response.data.success) {
notification.showSuccessNotification(t('You have left the group successfully'))
router.push('/social')
notification.showSuccessNotification(t("You have left the group successfully"))
router.push("/social")
}
} catch (error) {
console.error('Error leaving the group:', error)
console.error("Error leaving the group:", error)
}
}
const isActive = (path, filterType = null) => {
const pathMatch = route.path.startsWith(path)
const hasQueryParams = Object.keys(route.query).length > 0
const filterMatch = filterType ? (route.query.filterType === filterType && hasQueryParams) : !hasQueryParams
const filterMatch = filterType ? route.query.filterType === filterType && hasQueryParams : !hasQueryParams
return pathMatch && filterMatch
}
</script>

@ -93,7 +93,7 @@
<script setup>
import WallCommentForm from "./SocialWallCommentForm.vue"
import { computed, inject, onMounted, reactive, ref } from "vue"
import { computed, onMounted, reactive, ref } from "vue"
import WallComment from "./SocialWallComment.vue"
import WallActions from "./Actions"
import axios from "axios"
@ -116,7 +116,7 @@ const { relativeDatetime } = useFormatDate()
let comments = reactive([])
const attachments = ref([])
const securityStore = useSecurityStore()
const currentUser = securityStore.user;
const currentUser = securityStore.user
const isOwner = computed(() => currentUser["@id"] === props.post.sender["@id"])

@ -1,5 +1,5 @@
import { useI18n } from "vue-i18n"
import { computed, ref } from "vue"
import { computed } from "vue"
import { useSecurityStore } from "../store/securityStore"
import { usePlatformConfig } from "../store/platformConfig"
import { useEnrolledStore } from "../store/enrolledStore"
@ -13,7 +13,7 @@ export function useSidebarMenu() {
const securityStore = useSecurityStore()
const platformConfigStore = usePlatformConfig()
const enrolledStore = useEnrolledStore()
const { items: socialItems } = useSocialMenuItems();
const { items: socialItems } = useSocialMenuItems()
const showTabsSetting = platformConfigStore.getSetting("platform.show_tabs")
const showCatalogue = platformConfigStore.getSetting("platform.catalog_show_courses_sessions")
@ -21,10 +21,10 @@ export function useSidebarMenu() {
if (item.route) {
return route.path === item.route || (item.route.name && route.name === item.route.name)
} else if (item.items) {
return item.items.some(subItem => isActive(subItem))
return item.items.some((subItem) => isActive(subItem))
}
return false
};
}
const menuItemsBeforeMyCourse = computed(() => {
const items = []
@ -130,29 +130,29 @@ export function useSidebarMenu() {
}
if (showTabsSetting.indexOf("social") > -1) {
const styledSocialItems = socialItems.value.map(item => {
const styledSocialItems = socialItems.value.map((item) => {
const newItem = {
...item,
class: `sub-item-indent${isActive(item) ? ' active' : ''}`
};
class: `sub-item-indent${isActive(item) ? " active" : ""}`,
}
if (newItem.isLink && newItem.route) {
newItem.command = () => window.location.href = newItem.route
newItem.command = () => (window.location.href = newItem.route)
} else if (newItem.route) {
newItem.command = () => router.push(newItem.route)
} else if (newItem.link) {
newItem.command = () => window.location.href = newItem.link
newItem.command = () => (window.location.href = newItem.link)
}
return newItem
});
})
items.push({
icon: "mdi mdi-sitemap-outline",
label: t("Social network"),
items: styledSocialItems,
expanded: isActive({ items: styledSocialItems })
});
expanded: isActive({ items: styledSocialItems }),
})
}
if (platformConfigStore.plugins?.bbb?.show_global_conference_link) {

@ -330,7 +330,7 @@ const rowClass = (data) => {
let fetchPayload = {}
const filteredItems = computed(() => {
return items.value.filter(item => item.status !== MESSAGE_STATUS_DELETED)
return items.value.filter((item) => item.status !== MESSAGE_STATUS_DELETED)
})
function loadMessages(reset = true) {

Loading…
Cancel
Save