added on WebSTLs (webstls.com) at 2026-07-01 22:26:38
| 1 | package MODS::WebSTLs::DefaultContent; | |
| 2 | #====================================================================== | |
| 3 | # WebSTLs -- default seed text for new storefronts. | |
| 4 | # | |
| 5 | # Centralizes placeholder content so every new storefront starts with | |
| 6 | # the same useful drafts that prompt the creator to edit them. Each | |
| 7 | # generator takes the creator's display name and returns text with | |
| 8 | # that name substituted in. | |
| 9 | # | |
| 10 | # Used by storefront.cgi when seeding storefront_pages on first | |
| 11 | # creation, and by any future tool that resets a page to its default. | |
| 12 | # | |
| 13 | # To tweak the wording for ALL new users, edit the strings in this | |
| 14 | # file. Existing users' pages are not touched. | |
| 15 | #====================================================================== | |
| 16 | use strict; | |
| 17 | use warnings; | |
| 18 | ||
| 19 | sub new { | |
| 20 | my ($class) = @_; | |
| 21 | return bless({}, $class); | |
| 22 | } | |
| 23 | ||
| 24 | #---------------------------------------------------------------------- | |
| 25 | # about_body($store_name) -- body of the About page. | |
| 26 | #---------------------------------------------------------------------- | |
| 27 | sub about_body { | |
| 28 | my ($self, $name) = @_; | |
| 29 | $name = 'this studio' unless defined $name && length $name; | |
| 30 | return | |
| 31 | "Welcome to $name. This is the placeholder text on your About page -- " | |
| 32 | . "click anywhere in this paragraph to start editing it.\n\n" | |
| 33 | . "Tell visitors how you got into 3D design, what kinds of models " | |
| 34 | . "you make, and what they can expect when they buy from you. A " | |
| 35 | . "couple of paragraphs is enough -- buyers skim, so lead with the " | |
| 36 | . "single sentence that makes your work feel different from anyone " | |
| 37 | . "else's.\n\n" | |
| 38 | . "Things worth mentioning here:\n" | |
| 39 | . " - what software / printers you use\n" | |
| 40 | . " - how often you release new designs\n" | |
| 41 | . " - where else people can find you (Patreon, Instagram, Discord)\n" | |
| 42 | . " - your refund / support policy in plain language\n\n" | |
| 43 | . "When you are done, hit Save changes at the top of the page editor."; | |
| 44 | } | |
| 45 | ||
| 46 | #---------------------------------------------------------------------- | |
| 47 | # home_body($store_name) -- body slot for the Home page (most layouts | |
| 48 | # render the layout's own hero before this, so keep it short). | |
| 49 | #---------------------------------------------------------------------- | |
| 50 | sub home_body { | |
| 51 | my ($self, $name) = @_; | |
| 52 | return ""; | |
| 53 | } | |
| 54 | ||
| 55 | #---------------------------------------------------------------------- | |
| 56 | # collection_body($store_name) -- body for the auto-created Catalog | |
| 57 | # page (page_type='collection'). The product grid renders below this | |
| 58 | # text automatically, so keep the body short and pitch-driven. | |
| 59 | #---------------------------------------------------------------------- | |
| 60 | sub collection_body { | |
| 61 | my ($self, $name) = @_; | |
| 62 | $name = 'this studio' unless defined $name && length $name; | |
| 63 | return "Every design from $name, in one place. Click a model to see " | |
| 64 | . "files, print settings, and what's included."; | |
| 65 | } | |
| 66 | ||
| 67 | #---------------------------------------------------------------------- | |
| 68 | # custom_page_body($store_name) -- placeholder when the user creates | |
| 69 | # a brand-new custom page from the editor. | |
| 70 | #---------------------------------------------------------------------- | |
| 71 | sub custom_page_body { | |
| 72 | my ($self, $name) = @_; | |
| 73 | return "Start typing to replace this placeholder with your own content. " | |
| 74 | . "Drag images right onto the page, paste screenshots from your " | |
| 75 | . "clipboard, or use the toolbar on the left for formatting."; | |
| 76 | } | |
| 77 | ||
| 78 | #---------------------------------------------------------------------- | |
| 79 | # details_body($store_name) -- body for the system-seeded "Listing | |
| 80 | # Details" page (page_type='product'). This page is template-driven | |
| 81 | # by listing_details.cgi -- the same layout renders for every product | |
| 82 | # on the storefront -- so the body here is informational copy telling | |
| 83 | # the seller what the page is and how to preview it. The Pages admin's | |
| 84 | # "View" button maps page_type='product' to listing_details.cgi with | |
| 85 | # the seller's first published model_id so the preview shows a real | |
| 86 | # product. | |
| 87 | #---------------------------------------------------------------------- | |
| 88 | sub details_body { | |
| 89 | my ($self, $name) = @_; | |
| 90 | $name = 'this storefront' unless defined $name && length $name; | |
| 91 | return "This is the per-product detail page template for $name. " | |
| 92 | . "Buyers see this when they click any model card on your store -- " | |
| 93 | . "hero image, gallery, description, files included, print settings, " | |
| 94 | . "and an Add-to-Cart panel.\n\n" | |
| 95 | . "There's nothing to edit on this page directly. Every product " | |
| 96 | . "renders the same template with that model's own title, " | |
| 97 | . "description, files, and images. To change what appears for a " | |
| 98 | . "specific product, edit the model in My Models. To preview " | |
| 99 | . "this template with real data, click \"View\" on the right -- " | |
| 100 | . "we'll open it for your first published model."; | |
| 101 | } | |
| 102 | ||
| 103 | #---------------------------------------------------------------------- | |
| 104 | # Helper: escape a body string for inline-SQL insertion. Returns the | |
| 105 | # escaped scalar; the caller wraps it in quotes inside the qq~~ INSERT. | |
| 106 | #---------------------------------------------------------------------- | |
| 107 | sub sql_escape { | |
| 108 | my ($self, $s) = @_; | |
| 109 | $s = '' unless defined $s; | |
| 110 | $s =~ s/\\/\\\\/g; | |
| 111 | $s =~ s/'/\\'/g; | |
| 112 | $s =~ s/"/\\"/g; | |
| 113 | $s =~ s/\n/\\n/g; | |
| 114 | $s =~ s/\r//g; | |
| 115 | return $s; | |
| 116 | } | |
| 117 | ||
| 118 | 1; |