Skip to content

Commit

Permalink
refactor: signup customisations
Browse files Browse the repository at this point in the history
  • Loading branch information
pateljannat committed Sep 23, 2024
1 parent bc4b17c commit ab039db
Show file tree
Hide file tree
Showing 5 changed files with 2,256 additions and 39 deletions.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@editorjs/paragraph": "^2.11.3",
"@editorjs/simple-image": "^1.6.0",
"chart.js": "^4.4.1",
"codemirror-editor-vue3": "^2.8.0",
"dayjs": "^1.11.6",
"feather-icons": "^4.28.0",
"frappe-ui": "^0.1.69",
Expand Down
32 changes: 32 additions & 0 deletions frontend/src/components/Controls/HTMLEditor.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<template>
<div class="p-5 max-w-3xl mx-auto">
<!-- Content Editable Area -->
<div
ref="editor"
class="border border-gray-300 p-3 rounded-md min-h-[200px] bg-white"
contenteditable="true"
@input="onInput"
></div>
</div>
</template>

<script setup>
import { ref } from 'vue'
const editor = ref(null)
const htmlContent = ref('')
// Function to execute formatting commands
const execCommand = (command) => {
document.execCommand(command, false, null)
}
// Watch for input changes
const onInput = () => {
htmlContent.value = editor.value.innerHTML
}
</script>

<style scoped>
/* You can add custom styles here if needed */
</style>
43 changes: 6 additions & 37 deletions frontend/src/components/Modals/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,47 +208,16 @@ const tabs = computed(() => {
{
label: 'Signup',
icon: 'LogIn',
description:
'Customize the signup page to inform users about your terms and policies',
fields: [
{
label: 'Show terms of use on signup',
name: 'terms_of_use',
type: 'checkbox',
},
{
label: 'Terms of Use Page',
name: 'terms_page',
type: 'Link',
doctype: 'Web Page',
},
{
label: 'Show privacy policy on signup',
name: 'privacy_policy',
type: 'checkbox',
},
{
label: 'Privacy Policy Page',
name: 'privacy_policy_page',
type: 'Link',
doctype: 'Web Page',
},
{
type: 'Column Break',
},
{
label: 'Show cookie policy on signup',
name: 'cookie_policy',
type: 'checkbox',
},
{
label: 'Cookie Policy Page',
name: 'cookie_policy_page',
type: 'Link',
doctype: 'Web Page',
label: 'Custom Content',
name: 'custom_signup_content',
type: 'Code',
mode: 'htmlmixed',
rows: 10,
},
{
label: 'Ask user category during signup',
label: 'Ask user category',
name: 'user_category',
type: 'checkbox',
},
Expand Down
36 changes: 34 additions & 2 deletions frontend/src/components/SettingDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,41 @@
{{ __(description) }}
</div>
</div>
<div class="flex justify-between my-5">
<div
class="my-5"
:class="{ 'flex justify-between w-full': columns.length > 1 }"
>
<div v-for="(column, index) in columns" :key="index">
<div class="flex flex-col space-y-5 w-72">
<div
class="flex flex-col space-y-5"
:class="columns.length > 1 ? 'w-72' : 'w-full'"
>
<div v-for="field in column">
<Link
v-if="field.type == 'Link'"
v-model="field.value"
:doctype="field.doctype"
:label="field.label"
/>

<Codemirror
v-else-if="field.type == 'Code'"
v-model:value="field.value"
:label="field.label"
:height="200"
:options="{
mode: field.mode,
theme: 'seti',
}"
/>

<FormControl
v-else
:key="field.name"
v-model="field.value"
:label="field.label"
:type="field.type"
:rows="field.rows"
/>
</div>
</div>
Expand All @@ -41,6 +60,9 @@
import { FormControl, Button } from 'frappe-ui'
import { computed } from 'vue'
import Link from '@/components/Controls/Link.vue'
import Codemirror from 'codemirror-editor-vue3'
import 'codemirror/theme/seti.css'
import 'codemirror/mode/htmlmixed/htmlmixed.js'
const props = defineProps({
fields: {
Expand Down Expand Up @@ -94,3 +116,13 @@ const update = () => {
props.data.save.submit()
}
</script>
<style>
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
font-family: revert;
}
.CodeMirror {
border-radius: 12px;
}
</style>
Loading

0 comments on commit ab039db

Please sign in to comment.