Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: removed delivery parameter from batch feedback #1244

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 14 additions & 40 deletions frontend/src/components/BatchFeedback.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,9 @@
<div class="space-y-8">
<div class="flex items-center justify-between">
<Rating
v-model="feedback.content"
:label="__('Content')"
:readonly="readOnly"
/>
<Rating
v-model="feedback.delivery"
:label="__('Delivery')"
:readonly="readOnly"
/>
<Rating
v-model="feedback.instructors"
:label="__('Instructors')"
:readonly="readOnly"
/>
<Rating
v-model="feedback.value"
:label="__('Value')"
v-for="key in ratingKeys"
v-model="feedback[key]"
:label="__(convertToTitleCase(key))"
:readonly="readOnly"
/>
</div>
Expand All @@ -54,21 +40,11 @@

<div class="flex items-center justify-between mb-10">
<Rating
v-model="average.content"
:label="__('Content')"
:readonly="true"
/>
<Rating
v-model="average.delivery"
:label="__('Delivery')"
:readonly="true"
/>
<Rating
v-model="average.instructors"
:label="__('Instructors')"
v-for="key in ratingKeys"
v-model="average[key]"
:label="__(convertToTitleCase(key))"
:readonly="true"
/>
<Rating v-model="average.value" :label="__('Value')" :readonly="true" />
</div>

<div class="text-lg font-semibold mb-5">
Expand Down Expand Up @@ -121,9 +97,13 @@
</ListRows>
</ListView>
</div>
<div v-else class="text-sm italic text-center text-gray-700 mt-5">
{{ __('No feedback received yet.') }}
</div>
</template>
<script setup>
import { computed, inject, onMounted, reactive, ref, watch } from 'vue'
import { convertToTitleCase } from '@/utils'
import {
Avatar,
Button,
Expand All @@ -139,7 +119,7 @@ import {
} from 'frappe-ui'

const user = inject('$user')
const ratingKeys = ['content', 'delivery', 'instructors', 'value']
const ratingKeys = ['content', 'instructors', 'value']
const readOnly = ref(false)
const average = reactive({})
const feedback = reactive({})
Expand Down Expand Up @@ -171,7 +151,6 @@ const feedbackList = createListResource({
},
fields: [
'content',
'delivery',
'instructors',
'value',
'feedback',
Expand Down Expand Up @@ -243,22 +222,17 @@ const feedbackColumns = computed(() => {
{
label: 'Content',
key: 'content',
width: '10rem',
},
{
label: 'Delivery',
key: 'delivery',
width: '10rem',
width: '9rem',
},
{
label: 'Instructors',
key: 'instructors',
width: '10rem',
width: '9rem',
},
{
label: 'Value',
key: 'value',
width: '10rem',
width: '9rem',
},
]
})
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/Modals/EditProfile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ import {
} from 'frappe-ui'
import { reactive, watch, defineModel } from 'vue'
import { FileText, X } from 'lucide-vue-next'
import { getFileSize, showToast } from '@/utils'
import { getFileSize, showToast, escapeHTML } from '@/utils'

const reloadProfile = defineModel('reloadProfile')

Expand Down Expand Up @@ -131,6 +131,7 @@ const imageResource = createResource({
const updateProfile = createResource({
url: 'frappe.client.set_value',
makeParams(values) {
profile.bio = escapeHTML(profile.bio)
return {
doctype: 'User',
name: props.profile.data.name,
Expand Down
18 changes: 18 additions & 0 deletions frontend/src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,3 +533,21 @@ export const validateFile = (file) => {
return __('Only image file is allowed.')
}
}

export const escapeHTML = (text) => {
if (!text) return ''
let escape_html_mapping = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
'`': '&#x60;',
'=': '&#x3D;',
}

return String(text).replace(
/[&<>"'`=]/g,
(char) => escape_html_mapping[char] || char
)
}
8 changes: 1 addition & 7 deletions lms/lms/doctype/lms_batch_feedback/lms_batch_feedback.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"batch",
"column_break_swst",
"content",
"delivery",
"instructors",
"value",
"feedback"
Expand Down Expand Up @@ -49,11 +48,6 @@
"fieldtype": "Rating",
"label": "Content"
},
{
"fieldname": "delivery",
"fieldtype": "Rating",
"label": "Delivery"
},
{
"fieldname": "instructors",
"fieldtype": "Rating",
Expand Down Expand Up @@ -81,7 +75,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2025-01-10 19:39:04.143783",
"modified": "2025-01-13 19:02:58.259908",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Batch Feedback",
Expand Down
Loading