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

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

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

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

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

@ -330,7 +330,7 @@ const rowClass = (data) => {
let fetchPayload = {} let fetchPayload = {}
const filteredItems = computed(() => { 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) { function loadMessages(reset = true) {

Loading…
Cancel
Save