From 65c446050a9099f7cc65e6a9e2138bc5a011cbd6 Mon Sep 17 00:00:00 2001 From: Arpita-Jaiswal Date: Tue, 28 Nov 2023 01:44:19 +0530 Subject: [PATCH] Added presentation-settings page in slide --- slides/index.ftd | 1 + slides/presentation-settings.ftd | 96 +++++++++++++++++ slides/ui/presentation-settings.ftd | 158 ++++++++++++++++++++++++++++ 3 files changed, 255 insertions(+) create mode 100644 slides/presentation-settings.ftd create mode 100644 slides/ui/presentation-settings.ftd diff --git a/slides/index.ftd b/slides/index.ftd index 4b605699..3b91504d 100644 --- a/slides/index.ftd +++ b/slides/index.ftd @@ -5,5 +5,6 @@ - [All Templates](slides/all-templates/) - [Editor](slides/editor/) - [Folders](slides/folders/) +- [Presentation Settings](slides/presentation-settings/) -- end: ds.page diff --git a/slides/presentation-settings.ftd b/slides/presentation-settings.ftd new file mode 100644 index 00000000..63314730 --- /dev/null +++ b/slides/presentation-settings.ftd @@ -0,0 +1,96 @@ +-- optional boolean $is-template: +-- string $fastn-conf: Not fetched +-- string $settings-conf: Not fetched +-- optional boolean $save-status: +-- boolean debug: false + + +-- slide-ds.page: + +-- ftd.text: Presentation Settings +color: $inherited.colors.text-strong +role: $inherited.types.heading-large + +-- slide-ds.button: Go back to editor +button-icon: $assets.files.slides.ui.assets.go-back.svg +icon-width.fixed.px: 20 +icon-height.fixed.px: 20 +$on-click$: $slide-ds.go-back() + +-- ftd.row: +width: hug-content +spacing.fixed.px: 20 +align-content: center + +-- ftd.text: Is this a template presentation: +color: $inherited.colors.text-strong +role: $inherited.types.copy-regular + +-- ftd.text: Yes +width.fixed.px: 30 +if: { is-template != NULL } +text if { !is-template }: No +color: red +color if { is-template }: green +role: $inherited.types.copy-regular + +-- slide-ds.button: Convert into Template Presentation +title if { is-template }: Revert Back to Normal Presentation +button-icon: $assets.files.slides.ui.assets.convert.svg +;; $on-click$: $convert-template-http(url = toggle-template/, method = post, id = $id) +icon-width.fixed.px: 20 +icon-height.fixed.px: 20 + +-- end: ftd.row + +-- ftd.text: fastn.ftd +color: $inherited.colors.text-strong +role: $inherited.types.heading-medium + +-- ftd.text-input: +padding.px: 10 +default-value: $fastn-conf +multiline: true +width.fixed.px: 600 +height.fixed.px: 200 +white-space: nowrap + +-- ftd.text: settings.ftd +color: $inherited.colors.text-strong +role: $inherited.types.heading-medium + +-- ftd.text-input: +padding.px: 10 +default-value: $settings-conf +multiline: true +width.fixed.px: 600 +height.fixed.px: 200 +white-space: nowrap + +-- ftd.text: Save +border-width.px: 2 +border-radius.px: 15 +padding-vertical.px: 5 +padding-horizontal.px: 10 +color: $inherited.colors.text-strong +role: $inherited.types.copy-regular +;; $on-click$: $save-settings-http(url = save-settings/, method = post, settings = $settings-conf, fastn = $fastn-conf, id = $id) + +-- ftd.row: +if: { save-status != NULL && debug } +width.fixed.px: 200 + +-- ftd.text: Success: +color: $inherited.colors.text +role: $inherited.types.copy-regular +margin-right.px: 20 + +-- ftd.boolean: $save-status +color: red +color if { save-status }: green +role: $inherited.types.copy-regular + +-- end: ftd.row + + +-- end: slide-ds.page diff --git a/slides/ui/presentation-settings.ftd b/slides/ui/presentation-settings.ftd new file mode 100644 index 00000000..7de10b90 --- /dev/null +++ b/slides/ui/presentation-settings.ftd @@ -0,0 +1,158 @@ +-- import: fastn/processors as pr + +-- integer id: +$processor$: pr.request-data + +-- optional boolean $is-template: +-- string $fastn-conf: Not fetched +-- string $settings-conf: Not fetched +-- optional boolean $save-status: +-- boolean debug: false + +-- boolean $is-loaded: false + +-- string settings-url: $construct-settings-url(id = $id, order = $order) + + + +-- loader-component: +url: $settings-url + + +-- slide-ds.page: + +-- ftd.column: +if: { is-loaded } +width: fill-container +height: fill-container + +-- ftd.text: Presentation Settings +color: $inherited.colors.text-strong +role: $inherited.types.heading-large +/margin-vertical.px: 10 + +-- ds.button: Go back to editor +button-icon: $assets.files.slides.ui.assets.go-back.svg +icon-width.fixed.px: 20 +icon-height.fixed.px: 20 +$on-click$: $ds.go-back() + +-- ftd.row: +width: hug-content +/margin-vertical.px: 20 +spacing.fixed.px: 20 +align-content: center + +-- ftd.text: Is this a template presentation: +color: $inherited.colors.text-strong +role: $inherited.types.copy-regular + +-- ftd.text: Yes +width.fixed.px: 30 +if: { is-template != NULL } +text if { !is-template }: No +color: red +color if { is-template }: green +role: $inherited.types.copy-regular + +-- ds.button: Convert into Template Presentation +title if { is-template }: Revert Back to Normal Presentation +button-icon: $assets.files.slides.ui.assets.convert.svg +$on-click$: $convert-template-http(url = toggle-template/, method = post, id = $id) +icon-width.fixed.px: 20 +icon-height.fixed.px: 20 + +-- end: ftd.row + +-- ftd.text: fastn.ftd +color: $inherited.colors.text-strong +role: $inherited.types.heading-medium +/margin-vertical.px: 10 + +-- ftd.text-input: +padding.px: 10 +default-value: $fastn-conf +multiline: true +width.fixed.px: 600 +height.fixed.px: 200 +white-space: nowrap + +-- ftd.text: settings.ftd +color: $inherited.colors.text-strong +role: $inherited.types.heading-medium +/margin-vertical.px: 10 + +-- ftd.text-input: +padding.px: 10 +default-value: $settings-conf +multiline: true +width.fixed.px: 600 +height.fixed.px: 200 +white-space: nowrap + +-- ftd.text: Save +/margin-vertical.px: 20 +border-width.px: 2 +border-radius.px: 15 +padding-vertical.px: 5 +padding-horizontal.px: 10 +color: $inherited.colors.text-strong +role: $inherited.types.copy-regular +$on-click$: $save-settings-http(url = save-settings/, method = post, settings = $settings-conf, fastn = $fastn-conf, id = $id) + +-- ftd.row: +if: { save-status != NULL && debug } +width.fixed.px: 200 + +-- ftd.text: Success: +color: $inherited.colors.text +role: $inherited.types.copy-regular +margin-right.px: 20 + +-- ftd.boolean: $save-status +color: red +color if { save-status }: green +role: $inherited.types.copy-regular + +-- end: ftd.row + +-- end: ftd.column + +-- end: slide-ds.page + + + + + + + + + +;; --------------------- FUNCTIONS + WEB COMPONENTS --------------------------- +-- string construct-settings-url(id): +integer id: +js: $assets.files.slides.ui.functions.js + +"settings/" + id + "/" + +-- void save-settings-http(id,url,method): +integer id: +string url: +string method: +string fastn: +string settings: +js: $assets.files.slides.ui.functions.js + +http(url, method, null, ("settings-ftd", settings), ("fastn-ftd", fastn), ("id", id)) + +-- void convert-template-http(url,method,id): +integer id: +string url: +string method: +js: $assets.files.slides.ui.functions.js + +http(url, method, null, ("id", id)) + +-- web-component loader-component: +string url: +js: $assets.files.slides.ui.loader-component.js