Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple directive values, use Liquid to avoid repetition in HTML #29

Merged
merged 7 commits into from
Mar 8, 2019

Conversation

joker314
Copy link
Contributor

@joker314 joker314 commented Mar 3, 2019

Resolves #27
Resolves #30

This pull request makes the following changes:

  • Use the Liquid templating language to avoid repetition of HTML code
  • Add some help text so that users don't have to look at the spec to figure out what to put.
  • Move the links to the spec sections into that help text
  • Add "tags" next to the headings so that it is clear whether the directive is optional, required, and whether it can have more than one alternative
  • Add a button called "Add another alternative", which, when clicked, constructs an input with a "Remove" button and gives that new input focus. This pull requests adds the JavaScript to handle multiple inputs and to construct a security.txt file from them.
  • Disable (i.e. grey out) those buttons when only one alternative is allowed. (I decided that this applies to "Preferred-Languages", though ideally we'd abstract away that fact and still let the user add alternatives, and keep one language code per alternative (we'd then need to string these together ourselves). The help text for that directive makes it clear that multiple languages are allowed though.)
  • Add a note in the "Step 2" section about digitally signing files
  • Make the "Generate" button green to distinguish it from all the other buttons.
  • Use <legend> instead of <label> now that we can have multiple inputs per label.

Pictures!!!

The redesigned view of the Contact and Encryption directives

The "Preferred Languages" and "Canonical" fields are both marked as "Only 1 allowed", and the former has a bold note explaining that multiple language codes are indeed allowed nonetheless

The "Generate security.txt file is now light green, the same colour as the "Optional" tags

"Step Two" now describes digitally signing files

Note that I have fixed the help text for Encryption since taking that screenshot. It now says "a link to" a key.

@joker314 joker314 changed the title Allow the user to add multiple alternatives for directives in forms Allow multiple directive values, use Liquid to avoid repetition in HTML Mar 3, 2019
@joker314
Copy link
Contributor Author

joker314 commented Mar 3, 2019

I just pushed a commit which resolves #30 (Use templating to avoid repetition). Now, all the directives and their properties are defined at the top of the document, in YAML, and then a for loop will iterate over each of the directives and in turn apply the same HTML to it. It relies on the assumption that hashes are ordered.

EDIT: Hashes being ordered is hacky as it relies on the Ruby version. I've now added a commit which uses a list of objects. This is guaranteed to be ordered.

@EdOverflow EdOverflow merged commit b71c342 into securitytxt:master Mar 8, 2019
@joker314 joker314 mentioned this pull request Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use templating language to avoid repetition Allow 'chaining' of directives in the form that generates them
2 participants