diff --git a/actions/create-site-action.ftd b/actions/create-site-action.ftd index 0ef112c4..9b7d38e3 100644 --- a/actions/create-site-action.ftd +++ b/actions/create-site-action.ftd @@ -10,4 +10,14 @@ ftd.string-field $site_slug: ftd.boolean-field public_source: js: $assets.files.assets.functions.js -callAlert("creating site: " + site_slug.value + ", under org: " + org_slash_username + " is public: ", public_source.value) +callAlert("creating site: " + site_slug.value + ", under org: " + org_slash_username + " is public: " + public_source.value) + + +-- void submit-with-templ(org_slash_username, site_slug, public_source, sample_site_id): +string org_slash_username: +ftd.string-field $site_slug: +ftd.boolean-field public_source: +ftd.integer-field sample_site_id: +js: $assets.files.assets.functions.js + +callAlert("creating site with templ: " + site_slug.value + ", under org: " + org_slash_username + " is public: " + public_source.value + " sample site: " + sample_site_id.value) diff --git a/components/featured/page.ftd b/components/featured/page.ftd index 201e8ed9..29f672a7 100644 --- a/components/featured/page.ftd +++ b/components/featured/page.ftd @@ -11,7 +11,7 @@ ud.user-data user-data: template-record.template list templates: children children: --- ds.page: FifthTry | Better way To Build Websites +-- ds.page: Templates spacing: $ds.spaces.vertical-gap.small.gap margin: $ds.spaces.vertical-gap.zero diff --git a/components/sites/create-site.ftd b/components/sites/create-site.ftd index 89fe1c2a..e3d1fe2c 100644 --- a/components/sites/create-site.ftd +++ b/components/sites/create-site.ftd @@ -2,12 +2,15 @@ -- import: ui.fifthtry.com/components/label as l -- import: ui.fifthtry.com/actions/create-site-action -- import: ui.fifthtry.com/utils as u +-- import: ui.fifthtry.com/records/sites as site-records -- component create-site: -string org-slash-username: +string org-slug: module create-site-action: create-site-action string dashboard-url: +optional site-records.sample-site-data sample-site: + -- ds.section-column: @@ -59,6 +62,28 @@ string dashboard-url: -- end: ds.column + -- ds.row: + align-content: left + spacing: $ds.spaces.horizontal-gap.small + if: { create-site.sample-site } + + -- ds.copy-small: $use-template-text(title=$create-site.sample-site.title, link=$create-site.sample-site.ide-link) + + -- end: ds.row + + -- ds.row: + align-content: left + spacing: $ds.spaces.horizontal-gap.small + if: { !create-site.sample-site } + + -- ds.copy-small: $featured-page-msg(org = $create-site.org-slug) + if: { create-site.org-slug != "" } + + -- ds.copy-small: This site will be created using a Blog template. Browse [community templates](/featured/) for more. + if: { create-site.org-slug == "" } + + -- end: ds.row + -- ds.column: align-content: top-left @@ -82,10 +107,17 @@ string dashboard-url: -- ds.row: spacing: $ds.spaces.horizontal-gap.medium + -- ds.primary-button: Create Site With Template + if: { create-site.sample-site } + width: full + radius: curved + $on-click$: $create-site.create-site-action.submit-with-templ(org_slash_username = $create-site.org-slug, $site_slug = $create-site.create-site-action.site-slug, public_source = $create-site.create-site-action.public-source, sample_site_id = $create-site.sample-site.id) + -- ds.primary-button: Create Site + if: { !create-site.sample-site } width: full radius: curved - $on-click$: $create-site.create-site-action.submit(org_slash_username = $create-site.org-slash-username, $site_slug = $create-site.create-site-action.site-slug, public_source = $create-site.create-site-action.public-source) + $on-click$: $create-site.create-site-action.submit(org_slash_username = $create-site.org-slug, $site_slug = $create-site.create-site-action.site-slug, public_source = $create-site.create-site-action.public-source) -- ds.secondary-button: Cancel width: full @@ -143,8 +175,31 @@ string dashboard-url: -- end: ds.column + -- ds.column: + align-content: left + spacing: $ds.spaces.horizontal-gap.small + if: { create-site.sample-site } + + -- ds.copy-small: $use-template-text(title=$create-site.sample-site.title, link=$create-site.sample-site.ide-link) + + -- end: ds.column + + -- ds.column: + align-content: left + spacing: $ds.spaces.horizontal-gap.small + if: { !create-site.sample-site } + + -- ds.copy-small: $featured-page-msg(org = $create-site.org-slug) + if: { create-site.org-slug != "" } + + -- ds.copy-small: This site will be created using a Blog template. Browse [community templates](/featured/) for more. + if: { create-site.org-slug == "" } + + -- end: ds.column + -- ds.column: align-content: top-left + spacing: $ds.spaces.horizontal-gap.small -- ds.checkbox: Make site public so that others can view source of your site $is-checked: $create-site.create-site-action.public-source.value @@ -166,12 +221,19 @@ string dashboard-url: -- ds.column: spacing: $ds.spaces.vertical-gap.medium - - -- ds.primary-button: Create Site - width: full - radius: curved - $on-click$: $create-site.create-site-action.submit(org_slash_username = $create-site.org-slash-username, $site_slug = $create-site.create-site-action.site-slug, public_source = $create-site.create-site-action.public-source) - + + -- ds.primary-button: Create Site With Template + if: { create-site.sample-site } + width: full + radius: curved + $on-click$: $create-site.create-site-action.submit-with-templ(org_slash_username = $create-site.org-slug, $site_slug = $create-site.create-site-action.site-slug, public_source = $create-site.create-site-action.public-source, sample_site_id = $create-site.sample-site.id) + + -- ds.primary-button: Create Site + if: { !create-site.sample-site } + width: full + radius: curved + $on-click$: $create-site.create-site-action.submit(org_slash_username = $create-site.org-slug, $site_slug = $create-site.create-site-action.site-slug, public_source = $create-site.create-site-action.public-source) + -- ds.secondary-button: Cancel width: full radius: curved @@ -186,3 +248,15 @@ string dashboard-url: -- end: ds.section-column -- end: create-site + +-- string use-template-text(title, link): +string title: +string link: + + +"This site will be created using [" + title + "](" + link + ")." + +-- string featured-page-msg(org): +string org: + +"This site will be created using a Blog template. Browse [community templates](/featured/?r=" + org + ") for more." diff --git a/pages/featured/index.ftd b/pages/featured/index.ftd index 75cbd64b..67ee246c 100644 --- a/pages/featured/index.ftd +++ b/pages/featured/index.ftd @@ -1,13 +1,47 @@ -- import: ui.fifthtry.com/components/featured/page as p -- import: ui.fifthtry.com/site-data -- import: ui.fifthtry.com/records/user-data as ud --- import: ui.fifthtry.com/records/sites as templates-record +-- import: ui.fifthtry.com/records/sites as site-records -- import: ui.fifthtry.com/pages/featured/template +-- site-records.template list templates: + +-- site-records.template: +title: Blog Template +preview-url: https://blog.fifthtry.site/ +preview-img: $assets.files.assets.templates.blog-temp.png +slug: blog + +-- site-records.template: +title: Simple Website Template +preview-url: https://simple-website-template.fifthtry.site/ +preview-img: $assets.files.assets.templates.simple-ws-temp.png +slug: simple-website-template + +-- site-records.template: +title: Website Template +preview-url: https://website-template.fifthtry.site/ +preview-img: $assets.files.assets.templates.ws-temp.png +slug: website-template + +-- site-records.template: +title: Simple Blog Template +preview-url: https://simple-blog-template.fifthtry.site/ +preview-img: $assets.files.assets.templates.simple-blog-temp.png +slug: simple-blog-template + +-- site-records.template: +title: Resume Template +preview-url: https://resume-template.fifthtry.site/ +preview-img: $assets.files.assets.templates.resume.png +slug: resume-template + +-- end: templates + -- component page: module site-data: site-data ud.user-data user-data: -templates-record.template list templates: +site-records.template list templates: $templates -- p.page: site-data: $page.site-data diff --git a/pages/featured/template.ftd b/pages/featured/template.ftd index ad839f4e..23aa941e 100644 --- a/pages/featured/template.ftd +++ b/pages/featured/template.ftd @@ -1,4 +1,9 @@ -- import: ui.fifthtry.com/records/sites as template-record +-- import: fastn/processors as pr + +;; org-slug +-- optional string r: +$processor$: pr.request-data @@ -22,7 +27,7 @@ align-content: top-left title: $obj.title preview-url: $obj.preview-url preview-img: $obj.preview-img - id: $obj.id + slug: $obj.slug -- end: ds.row @@ -39,7 +44,7 @@ align-content: top-left title: $obj.title preview-url: $obj.preview-url preview-img: $obj.preview-img - id: $obj.id + slug: $obj.slug -- end: ds.column @@ -62,7 +67,7 @@ align-content: top-left string title: string preview-url: ftd.image-src preview-img: -integer id: +string slug: boolean $mouse-in: false -- ds.column: @@ -89,14 +94,13 @@ text: $grid-of-items.title -- ds.row: -- ds.primary-button: Use Template -link: $grid-of-items.preview-url +link if { r }: $create-site-with-org-link(slug = $grid-of-items.slug, org = $r) +link if { !r }: $create-site-link(slug = $grid-of-items.slug) width: full -open-in-new-tab: true -- ds.secondary-button: Preview width: full link: $grid-of-items.preview-url -open-in-new-tab: true -- end: ds.row @@ -111,3 +115,14 @@ open-in-new-tab: true -- ftd.color overlay-bg: light: #00000066 dark: #00000066 + +-- string create-site-with-org-link(slug, org): +string slug: +string org: + +"/o/" + org + "/create-site/?t=" + slug + +-- string create-site-link(slug): +string slug: + +"/create-site/?t=" + slug diff --git a/pages/org/create-site.ftd b/pages/org/create-site.ftd index e775237c..6c6226c5 100644 --- a/pages/org/create-site.ftd +++ b/pages/org/create-site.ftd @@ -3,6 +3,7 @@ -- import: ui.fifthtry.com/components/label as l -- import: ui.fifthtry.com/site-data -- import: ui.fifthtry.com/records/user-data as ud +-- import: ui.fifthtry.com/records/sites as site-records -- import: ui.fifthtry.com/actions/create-site-action -- import: ui.fifthtry.com/utils as u @@ -16,6 +17,7 @@ string dashboard-url: string create-site-url: optional string create-org-url: optional string top-message: +optional site-records.sample-site-data sample-site: -- p.page: site-data: $page.site-data @@ -27,9 +29,10 @@ hide-header: true top-message: $page.top-message -- create-site.create-site: - org-slash-username: $page.org-slug + org-slug: $page.org-slug create-site-action: $page.create-site-action dashboard-url: $page.dashboard-url + sample-site: $page.sample-site -- end: p.page diff --git a/pages/user/create-site.ftd b/pages/user/create-site.ftd index 0efd7fa1..bf71c8b0 100644 --- a/pages/user/create-site.ftd +++ b/pages/user/create-site.ftd @@ -3,6 +3,7 @@ -- import: ui.fifthtry.com/components/label as l -- import: ui.fifthtry.com/site-data -- import: ui.fifthtry.com/records/user-data as ud +-- import: ui.fifthtry.com/records/sites as site-records -- import: ui.fifthtry.com/actions/create-site-action -- import: ui.fifthtry.com/utils as u @@ -15,6 +16,7 @@ string dashboard-url: string create-site-url: optional string create-org-url: optional string top-message: +optional site-records.sample-site-data sample-site: -- p.page: site-data: $page.site-data @@ -28,9 +30,10 @@ basic-footer: true hide-footer: true -- create-site.create-site: - org-slash-username: $page.user-data.username + org-slug: $ftd.empty create-site-action: $page.create-site-action dashboard-url: $page.dashboard-url + sample-site: $page.sample-site -- end: p.page diff --git a/records/sites.ftd b/records/sites.ftd index 7c412caf..8d3a1b5c 100644 --- a/records/sites.ftd +++ b/records/sites.ftd @@ -114,10 +114,16 @@ optional string url: ;; This is present when document is not provided history-change list changes: optional string next: +;; Sample site info +;; Used in /create-site/ page to show the template that will be used +-- record sample-site-data: +ftd.integer-field id: +string title: +string ide-link: ;; template records -- record template: -integer id: +string slug: string title: string preview-url: ftd.image-src preview-img: diff --git a/scenarios/featured/index.ftd b/scenarios/featured/index.ftd index 4d6e7e08..c61c9ac9 100644 --- a/scenarios/featured/index.ftd +++ b/scenarios/featured/index.ftd @@ -1,43 +1,6 @@ -- import: ui.fifthtry.com/pages/featured --- import: ui.fifthtry.com/records/sites as template-record -- import: ui.fifthtry.com/scenarios/john-doe -- featured.page: -templates: $template-category-list user-data: $john-doe.jd - - --- template-record.template list template-category-list: - --- template-record.template: -title: Blog Template -preview-url: https://blog.fifthtry.site/ -preview-img: $assets.files.assets.templates.blog-temp.png -id: 1 - --- template-record.template: -title: Simple Website Template -preview-url: https://simple-website-template.fifthtry.site/ -preview-img: $assets.files.assets.templates.simple-ws-temp.png -id: 2 - --- template-record.template: -title: Website Template -preview-url: https://website-template.fifthtry.site/ -preview-img: $assets.files.assets.templates.ws-temp.png -id: 3 - --- template-record.template: -title: Simple Blog Template -preview-url: https://simple-blog-template.fifthtry.site/ -preview-img: $assets.files.assets.templates.simple-blog-temp.png -id: 4 - --- template-record.template: -title: Resume Template -preview-url: https://resume-template.fifthtry.site/ -preview-img: $assets.files.assets.templates.resume.png -id: 5 - --- end: template-category-list