Skip to content

Commit

Permalink
Added presentation-settings page in slide
Browse files Browse the repository at this point in the history
  • Loading branch information
Arpita-Jaiswal committed Nov 27, 2023
1 parent 3699aa7 commit 65c4460
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 0 deletions.
1 change: 1 addition & 0 deletions slides/index.ftd
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
- [All Templates](slides/all-templates/)
- [Editor](slides/editor/)
- [Folders](slides/folders/)
- [Presentation Settings](slides/presentation-settings/)

-- end: ds.page
96 changes: 96 additions & 0 deletions slides/presentation-settings.ftd
Original file line number Diff line number Diff line change
@@ -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
158 changes: 158 additions & 0 deletions slides/ui/presentation-settings.ftd
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 65c4460

Please sign in to comment.