-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.corgi.go
51 lines (46 loc) · 9.46 KB
/
create.corgi.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package edit
// Code generated by github.com/mavolin/corgi v0.5.6. DO NOT EDIT.
import (
_bytes "bytes"
_io "io"
_writeutil "github.com/mavolin/corgi/pkg/writeutil"
)
func RenderCreate(_w _io.Writer) (err error) {
var (
_buf _bytes.Buffer
_closed bool
// in case we never use them
_ = _buf
_ = _closed
)
_closed = false
err = _writeutil.Write(_w, "<!doctype html><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><meta content=\"ie=edge\" http-equiv=\"x-ua-compatible\"><link rel=\"stylesheet\" href=\"/static/css/main.css\"><title")
if err != nil {
return err
}
if !_closed {
_closed = true
err = _writeutil.Write(_w, ">")
if err != nil {
return err
}
}
_closed = false
err = _writeutil.Write(_w, "Create a new word</title></head><body")
if err != nil {
return err
}
if !_closed {
_closed = true
err = _writeutil.Write(_w, ">")
if err != nil {
return err
}
}
_closed = true
err = _writeutil.Write(_w, "<div class=\"l-container\"><form method=\"post\" action=\"/create\"><div class=\"c-entry-section\"><h2 class=\"c-entry-section__title\">Base Information</h2><div class=\"c-entry-section__body\"><table class=\"c-entry-fields-table\"><tr class=\"c-entry-field\"><td class=\"c-entry-field__label\"><label for=\"word\">Word:</label></td><td><input type=\"text\" name=\"word\" id=\"word\"></td></tr><tr class=\"c-entry-field\"><td class=\"c-entry-field__label\"><label for=\"root\">Root:</label></td><td><input type=\"text\" name=\"root\" id=\"root\"></td></tr><tr class=\"c-entry-field\"><td class=\"c-entry-field__label\"><label for=\"definition\">Gender-Neutral Translation:</label></td><td><input type=\"text\" name=\"gender_neutral_translation\" id=\"gender_neutral_translation\"><script>let copyGenderNeutralTranslation = true\n\nconst genderNeutralFormEl = document.querySelector('#gender_neutral_translation')\ngenderNeutralFormEl.addEventListener('input', (ev) => {\n if (copyGenderNeutralTranslation) {\n document.querySelector('#female_translation').value = 'female '+genderNeutralFormEl.value\n document.querySelector('#male_translation').value = 'male ' + genderNeutralFormEl.value\n }\n})</script></td></tr><tr class=\"c-entry-field\"><td class=\"c-entry-field__label\"><label for=\"definition\">Female Translation:</label></td><td><input type=\"text\" name=\"female_translation\" id=\"female_translation\" oninput=\"copyGenderNeutralTranslation = false\"></td></tr><tr class=\"c-entry-field\"><td class=\"c-entry-field__label\"><label for=\"definition\">Male Translation:</label></td><td><input type=\"text\" name=\"male_translation\" id=\"male_translation\" oninput=\"copyGenderNeutralTranslation = false\"></td></tr></table></div></div><div class=\"c-entry-section\"><h2 class=\"c-entry-section__title\">Compound Word Information</h2><div class=\"c-entry-section__body\"><div class=\"js-compound-words\"></div><button type=\"button\" style=\"margin-top: 10px\" class=\"js-add-compound-word-btn\">Add Compound Word</button><button type=\"button\" class=\"js-delete-last-compound-word-btn\">Delete Last Compound Word</button><script>document.querySelector('.js-add-compound-word-btn').addEventListener('click', (ev) => {\n ev.preventDefault()\n const sectionEl = document.querySelector('.js-compound-words')\n\n const tableEl = document.createElement('table')\n tableEl.classList.add('c-entry-fields-table')\n\n tableEl.innerHTML = `\n <tr class=\"c-entry-field\">\n <td class=\"c-entry-field__label\">\n <label for=\"compound_word\">Word:</label>\n </td>\n <td>\n <input type=\"text\" name=\"compound_words\" id=\"compound_word\" required>\n </td>\n </tr>\n `\n\n sectionEl.appendChild(tableEl)\n})\n\ndocument.querySelector('.js-delete-last-compound-word-btn').addEventListener('click', (ev) => {\n ev.preventDefault()\n const sectionEl = document.querySelector('.js-compound-words')\n if (sectionEl.lastChild) {\n sectionEl.removeChild(sectionEl.lastChild)\n }\n})</script></div></div><div class=\"c-entry-section\"><h2 class=\"c-entry-section__title\">Definitions</h2><div class=\"c-entry-section__body\"><div class=\"js-definitions\"><table class=\"c-entry-fields-table\"><tr class=\"c-entry-field\"><td class=\"c-entry-field__label\"><label for=\"type\">Type:</label></td><td><select name=\"definitions.type\" id=\"type\" required><option value=\"1\">Noun</option><option value=\"2\">Verb</option><option value=\"4\">Adjective</option><option value=\"5\">Adverb</option><option value=\"6\">Preposition</option><option value=\"7\">Conjunction</option><option value=\"8\">Interjection</option><option value=\"9\">Pronoun</option><option value=\"10\">Article</option><option value=\"11\">Cardinal</option><option value=\"13\">Abbreviation</option><option value=\"14\">Idiom</option><option value=\"14\">Other</option></select></td></tr><tr class=\"c-entry-field\"><td class=\"c-entry-field__label\"><label for=\"translation\">Translation:</label></td><td><input type=\"text\" name=\"definitions.translation\" id=\"translation\"></td></tr><tr class=\"c-entry-field\"><td class=\"c-entry-field__label\"><label for=\"definition\">Definition:</label></td><td><input type=\"text\" name=\"definitions.definition\" id=\"definition\"></td></tr><tr class=\"c-entry-field\"><td class=\"c-entry-field__label\"><label for=\"example\">Example:</label></td><td><input type=\"text\" name=\"definitions.example\" id=\"example\"></td></tr><tr class=\"c-entry-field\"><td class=\"c-entry-field__label\"><label for=\"example_translation\">Example Translation:</label></td><td><input type=\"text\" name=\"definitions.example_translation\" id=\"example_translation\"></td></tr></table></div><button type=\"button\" style=\"margin-top: 10px\" class=\"js-add-definition-btn\">Add Definition</button><button type=\"button\" class=\"js-delete-last-definition-btn\">Delete Last Definition</button><script> document.querySelector('.js-add-definition-btn').addEventListener('click', (ev) => {\n ev.preventDefault()\n const sectionEl = document.querySelector('.js-definitions')\n\n const tableEl = document.createElement('table')\n tableEl.classList.add('c-entry-fields-table')\n tableEl.style.marginTop = '5px'\n\n tableEl.innerHTML = `\n <tr class=\"c-entry-field\">\n <td class=\"c-entry-field__label\">\n <label for=\"type\">Type:</label>\n </td>\n <td>\n <select name=\"definitions.type\" id=\"type\" required>\n <option value=\"1\">Noun</option>\n <option value=\"2\">Verb</option>\n <option value=\"4\">Adjective</option>\n <option value=\"5\">Adverb</option>\n <option value=\"6\">Preposition</option>\n <option value=\"7\">Conjunction</option>\n <option value=\"8\">Interjection</option>\n <option value=\"9\">Pronoun</option>\n <option value=\"10\">Article</option>\n <option value=\"11\">Cardinal</option>\n <option value=\"13\">Abbreviation</option>\n <option value=\"14\">Idiom</option>\n <option value=\"15\">Other</option>\n </select>\n </td>\n </tr>\n <tr class=\"c-entry-field\">\n <td class=\"c-entry-field__label\">\n <label for=\"translation\">Translation:</label>\n </td>\n <td>\n <input type=\"text\" name=\"definitions.translation\" id=\"translation\">\n </td>\n </tr>\n <tr class=\"c-entry-field\">\n <td class=\"c-entry-field__label\">\n <label for=\"definition\">Definition:</label>\n </td>\n <td>\n <input type=\"text\" name=\"definitions.definition\" id=\"definition\">\n </td>\n </tr>\n <tr class=\"c-entry-field\">\n <td class=\"c-entry-field__label\">\n <label for=\"example\">Example:</label>\n </td>\n <td>\n <input type=\"text\" name=\"definitions.example\" id=\"example\">\n </td>\n </tr>\n <tr class=\"c-entry-field\">\n <td class=\"c-entry-field__label\">\n <label for=\"example_translation\">Example Translation:</label>\n </td>\n <td>\n <input type=\"text\" name=\"definitions.example_translation\" id=\"example_translation\">\n </td>\n </tr>\n `\n\n sectionEl.appendChild(tableEl)\n })\n\n document.querySelector('.js-delete-last-definition-btn').addEventListener('click', (ev) => {\n ev.preventDefault()\n const sectionEl = document.querySelector('.js-definitions')\n if (sectionEl.lastChild) {\n sectionEl.removeChild(sectionEl.lastChild)\n }\n })</script></div></div><div class=\"c-entry-section\"><div class=\"c-entry-section__body\"><button type=\"submit\">Create</button></div></div></form></div></body>")
if err != nil {
return err
}
return nil
}