Skip to content

Commit

Permalink
Merge pull request #936 from pateljannat/image-pasting
Browse files Browse the repository at this point in the history
fix: batch filters on desk
  • Loading branch information
pateljannat committed Jul 19, 2024
2 parents e0de9d7 + cbc4b8c commit 98a56f9
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 25 deletions.
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"@editorjs/editorjs": "^2.29.0",
"@editorjs/embed": "^2.7.0",
"@editorjs/header": "^2.8.1",
"@editorjs/image": "^2.9.0",
"@editorjs/inline-code": "^1.5.0",
"@editorjs/nested-list": "^1.4.2",
"@editorjs/paragraph": "^2.11.3",
"@editorjs/simple-image": "^1.6.0",
"chart.js": "^4.4.1",
"dayjs": "^1.11.6",
"feather-icons": "^4.28.0",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/AppSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
>
<div
v-if="!isSidebarCollapsed"
class="flex items-center text-sm font-medium text-gray-600"
class="flex items-center text-sm text-gray-600 my-1"
>
<span class="grid h-5 w-6 flex-shrink-0 place-items-center">
<ChevronRight
Expand Down
22 changes: 11 additions & 11 deletions frontend/src/components/BatchCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
class="flex flex-col shadow hover:bg-gray-100 rounded-md p-4 h-full"
style="min-height: 150px"
>
<div class="text-xl font-semibold mb-2">
{{ batch.title }}
</div>
<Badge
v-if="batch.seat_count && batch.seats_left > 0"
theme="green"
Expand All @@ -19,33 +22,30 @@
>
{{ __('Sold Out') }}
</Badge>
<div class="text-xl font-semibold mb-1">
{{ batch.title }}
</div>
<div class="short-introduction">
{{ batch.description }}
</div>
<div class="flex flex-col space-y-2 mt-auto">
<div v-if="batch.amount" class="font-semibold text-lg">
{{ batch.price }}
</div>
<div class="flex items-center">
<BookOpen class="h-4 w-4 stroke-1.5 mr-2 text-gray-700" />
<span> {{ batch.courses.length }} {{ __('Courses') }} </span>
</div>

<DateRange
:startDate="batch.start_date"
:endDate="batch.end_date"
class="mb-3"
class="text-sm text-gray-700 mb-3"
/>
<div class="flex items-center">
<div class="flex items-center text-sm text-gray-700">
<Clock class="h-4 w-4 stroke-1.5 mr-2 text-gray-700" />
<span>
{{ formatTime(batch.start_time) }} - {{ formatTime(batch.end_time) }}
</span>
</div>
<div v-if="batch.timezone" class="flex items-center">
<Globe class="h-4 w-4 stroke-1.5 mr-2 text-gray-700" />
<div
v-if="batch.timezone"
class="flex items-center text-sm text-gray-700"
>
<Globe class="h-4 w-4 stroke-1.5 mr-2 text-gray-600" />
<span>
{{ batch.timezone }}
</span>
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/pages/CreateLesson.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<div
v-show="openInstructorEditor"
id="instructor-notes"
class="ProseMirror prose prose-table:table-fixed prose-td:p-2 prose-th:p-2 prose-td:border prose-th:border prose-td:border-gray-300 prose-th:border-gray-300 prose-td:relative prose-th:relative prose-th:bg-gray-100 prose-sm max-w-none !whitespace-normal mt-6 py-3"
class="ProseMirror prose prose-table:table-fixed prose-td:p-2 prose-th:p-2 prose-td:border prose-th:border prose-td:border-gray-300 prose-th:border-gray-300 prose-td:relative prose-th:relative prose-th:bg-gray-100 prose-sm max-w-none !whitespace-normal py-3"
></div>
</div>
</div>
Expand All @@ -54,7 +54,7 @@
</label>
<div
id="content"
class="ProseMirror prose prose-table:table-fixed prose-td:p-2 prose-th:p-2 prose-td:border prose-th:border prose-td:border-gray-300 prose-th:border-gray-300 prose-td:relative prose-th:relative prose-th:bg-gray-100 prose-sm max-w-none !whitespace-normal mt-6 py-3"
class="ProseMirror prose prose-table:table-fixed prose-td:p-2 prose-th:p-2 prose-td:border prose-th:border prose-td:border-gray-300 prose-th:border-gray-300 prose-td:relative prose-th:relative prose-th:bg-gray-100 prose-sm max-w-none !whitespace-normal py-3"
></div>
</div>
</div>
Expand Down Expand Up @@ -439,7 +439,8 @@ const pageMeta = computed(() => {
updateDocumentTitle(pageMeta)
</script>
<style>
.embed-tool__caption {
.embed-tool__caption,
.cdx-simple-image__caption {
display: none;
}
Expand Down
64 changes: 62 additions & 2 deletions frontend/src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import InlineCode from '@editorjs/inline-code'
import { watch } from 'vue'
import dayjs from '@/utils/dayjs'
import Embed from '@editorjs/embed'
import SimpleImage from '@editorjs/simple-image'

export function createToast(options) {
toast({
Expand Down Expand Up @@ -136,6 +137,7 @@ export function getEditorTools() {
header: Header,
quiz: Quiz,
upload: Upload,
image: SimpleImage,
paragraph: {
class: Paragraph,
inlineToolbar: true,
Expand Down Expand Up @@ -167,10 +169,68 @@ export function getEditorTools() {
inlineToolbar: false,
config: {
services: {
youtube: true,
youtube: {
regex: /(?:https?:\/\/)?(?:www\.)?(?:(?:youtu\.be\/)|(?:youtube\.com)\/(?:v\/|u\/\w\/|embed\/|watch))(?:(?:\?v=)?([^#&?=]*))?((?:[?&]\w*=\w*)*)/,
embedUrl:
'https://www.youtube.com/embed/<%= remote_id %>',
html: '<iframe style="width:100%; height: 30rem;" frameborder="0" allowfullscreen></iframe>',
height: 320,
width: 580,
id: ([id, params]) => {
if (!params && id) {
return id
}

const paramsMap = {
start: 'start',
end: 'end',
t: 'start',
// eslint-disable-next-line camelcase
time_continue: 'start',
list: 'list',
}

let newParams = params
.slice(1)
.split('&')
.map((param) => {
const [name, value] = param.split('=')

if (!id && name === 'v') {
id = value

return null
}

if (!paramsMap[name]) {
return null
}

if (
value === 'LL' ||
value.startsWith('RDMM') ||
value.startsWith('FL')
) {
return null
}

return `${paramsMap[name]}=${value}`
})
.filter((param) => !!param)

return id + '?' + newParams.join('&')
},
},
vimeo: true,
codepen: true,
aparat: true,
aparat: {
regex: /(?:http[s]?:\/\/)?(?:www.)?aparat\.com\/v\/([^\/\?\&]+)\/?/,
embedUrl:
'https://www.aparat.com/video/video/embed/videohash/<%= remote_id %>/vt/frame',
html: '<iframe style="margin: 0 auto; width: 100%; height: 25rem;" frameborder="0" scrolling="no" allowtransparency="true"></iframe>',
height: 300,
width: 600,
},
github: true,
slides: {
regex: /https:\/\/docs\.google\.com\/presentation\/d\/e\/([A-Za-z0-9_-]+)\/pub/,
Expand Down
17 changes: 12 additions & 5 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@
dependencies:
"@codexteam/icons" "^0.0.5"

"@editorjs/image@^2.9.0":
version "2.9.0"
resolved "https://registry.yarnpkg.com/@editorjs/image/-/image-2.9.0.tgz#0c83252d569a0dc3af14c3f7d16b6df033b9c37b"
integrity sha512-xItihKJFiWJ06SMtLWQZvzHv4LRPNAFZYaHAXesBFzXvWwUrtVaVMcNSf0eNnw3InrPO3Po1vZRRgpsT+Ya3Bg==
"@editorjs/image@^2.9.2":
version "2.9.2"
resolved "https://registry.yarnpkg.com/@editorjs/image/-/image-2.9.2.tgz#c8bea65a578fab65a1a75df1223b4fd8f06b57d5"
integrity sha512-n09sMieGW8cksoeflpplzvbmFH2bdVzVTWbnidPWAHaeU467HRteoXU9yfGBB7+eeHZLnmCulQ2dr6ae+G2niw==
dependencies:
"@codexteam/icons" "^0.0.6"
"@codexteam/icons" "^0.3.0"

"@editorjs/inline-code@^1.5.0":
version "1.5.0"
Expand All @@ -96,6 +96,13 @@
dependencies:
"@codexteam/icons" "^0.0.4"

"@editorjs/simple-image@^1.6.0":
version "1.6.0"
resolved "https://registry.yarnpkg.com/@editorjs/simple-image/-/simple-image-1.6.0.tgz#711c3900e17845331d6667cf0fe91793a5557f84"
integrity sha512-WvdGfQPlozwZd3PXQrJnRXk6gEYbv1U2vRupYJ6lTd3/UsLInXYUX5jSFcnGB5ZMH3bd0JDZfcb4d4Sv1/1big==
dependencies:
"@codexteam/icons" "^0.0.6"

"@esbuild/aix-ppc64@0.20.2":
version "0.20.2"
resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz#a70f4ac11c6a1dfc18b8bbb13284155d933b9537"
Expand Down
5 changes: 4 additions & 1 deletion lms/lms/doctype/lms_batch/lms_batch.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"fieldname": "start_date",
"fieldtype": "Date",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Start Date",
"reqd": 1
},
Expand All @@ -127,6 +128,7 @@
{
"fieldname": "start_time",
"fieldtype": "Time",
"in_list_view": 1,
"label": "Start Time",
"reqd": 1
},
Expand Down Expand Up @@ -165,6 +167,7 @@
{
"fieldname": "category",
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Category",
"options": "LMS Category"
},
Expand Down Expand Up @@ -325,7 +328,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-06-24 16:24:45.536453",
"modified": "2024-07-18 18:06:37.229885",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Batch",
Expand Down
1 change: 1 addition & 0 deletions lms/lms/doctype/lms_batch/lms_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def send_mail(self, student):
)

args = {
"title": self.title,
"student_name": student.student_name,
"start_time": self.start_time,
"start_date": self.start_date,
Expand Down
3 changes: 2 additions & 1 deletion lms/templates/emails/batch_confirmation.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
<br>
<p>
<b>
{{ _("Important Details:") }}
{{ title }}
</b>
</p>


<p>
<b>{{ _("Batch Start Date:") }}</b> {{ frappe.utils.format_date(start_date, "medium") }}
</p>
Expand Down

0 comments on commit 98a56f9

Please sign in to comment.