okkur / syna

Highly customizable open source theme for Hugo based static websites
https://syna.okkur.org/demo/
Apache License 2.0
250 stars 134 forks source link

WIP: Allow custom inputs (idea) #754

Closed mpourismaiel closed 4 years ago

mpourismaiel commented 4 years ago

What this PR does / why we need it: This is an idea I've been thinking about for a while and when I saw the issue, thought I create a PR for it. It's a breaking change since the config will change, but I added default inputs same as our previous sample. Please let me know what you think.

Which issue this PR fixes: fixes #753

Special notes for your reviewer: This is a work in progress and an idea. Please do not merge.

Release note:

- **UPDATE IF PR IS APPROVED**
stp-ip commented 4 years ago

This breaks existing users.

How about keeping the default fields and adding the option to add custom ones after the default ones similar to how you set the config:

[[fields.custom]]
  name = "phone"
  text = "Your Phone *"
  error = "Please enter your phone number" # defaults to theme default
  required = true

In the code we would add our default fields and afterwards iterate through the custom ones.

Thoughts?

mpourismaiel commented 4 years ago

That sounds really good.

stp-ip commented 4 years ago

Missed the WIP in the title. The code looked finished so ;)

Let me know, if you want me to revert.

mpourismaiel commented 4 years ago

I wasn't sure if the idea was polished enough. If you think it's good then fantastic!