improve form and add taggle

session-crate
Ondřej Hruška 5 years ago
parent 01d740e55c
commit 23931b1620
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 130
      Cargo.lock
  2. 22
      Cargo.toml
  3. 8
      data/repository.yaml
  4. 48
      src/store/form.rs
  5. 2
      src/store/mod.rs
  6. 7
      src/store/model.rs
  7. 76
      templates/form_macros.html.tera
  8. 40
      templates/index.html.tera
  9. 2
      templates/layout.html.tera
  10. 60
      templates/static/style.css
  11. 113
      templates/static/taggle.css
  12. 1
      templates/static/taggle.min.js

130
Cargo.lock generated

@ -1,5 +1,13 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]]
name = "aho-corasick"
version = "0.6.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.7.6" version = "0.7.6"
@ -126,8 +134,6 @@ name = "cookie"
version = "0.11.1" version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -179,16 +185,6 @@ name = "dtoa"
version = "0.4.4" version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "educe"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "error-chain" name = "error-chain"
version = "0.12.1" version = "0.12.1"
@ -337,6 +333,7 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -394,6 +391,11 @@ name = "language-tags"
version = "0.2.2" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "lazy_static"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
@ -466,20 +468,6 @@ dependencies = [
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "mime"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "mime_guess"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"mime 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.6.21" version = "0.6.21"
@ -712,6 +700,18 @@ name = "redox_syscall"
version = "0.1.56" version = "0.1.56"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "regex"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.3.1" version = "1.3.1"
@ -725,19 +725,16 @@ dependencies = [
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.6.12" version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"ucd-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "ring" name = "regex-syntax"
version = "0.13.5" version = "0.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
"untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "rocket" name = "rocket"
@ -759,32 +756,22 @@ dependencies = [
"yansi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "yansi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "rocket-download-response"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"educe 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"mime 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "rocket-inv" name = "rocket-inv"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"ifmt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "ifmt 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"json_dotpath 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "json_dotpath 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rocket 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket-download-response 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"rocket_contrib 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rocket_contrib 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)", "serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
"titlecase 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -881,6 +868,7 @@ name = "serde_json"
version = "1.0.44" version = "1.0.44"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
@ -997,6 +985,15 @@ dependencies = [
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "titlecase"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.4.10" version = "0.4.10"
@ -1025,6 +1022,11 @@ name = "ucd-trie"
version = "0.1.2" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "ucd-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "unic-char-property" name = "unic-char-property"
version = "0.7.0" version = "0.7.0"
@ -1077,14 +1079,6 @@ dependencies = [
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "unicase"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "unicode-bidi" name = "unicode-bidi"
version = "0.3.4" version = "0.3.4"
@ -1111,11 +1105,6 @@ name = "unicode-xid"
version = "0.2.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "untrusted"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "url" name = "url"
version = "1.7.2" version = "1.7.2"
@ -1126,6 +1115,11 @@ dependencies = [
"percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "utf8-ranges"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.1.5" version = "0.1.5"
@ -1211,6 +1205,7 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata] [metadata]
"checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5"
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90"
"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
@ -1234,7 +1229,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum devise_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf41c59b22b5e3ec0ea55c7847e5f358d340f3a8d6d53a5cf4f1564967f96487" "checksum devise_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf41c59b22b5e3ec0ea55c7847e5f358d340f3a8d6d53a5cf4f1564967f96487"
"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" "checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
"checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" "checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e"
"checksum educe 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d27c760a73a13abb1ddf417c06bc2b8d14b0607dd19097316e0ca9412a971088"
"checksum error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ab49e9dcb602294bc42f9a7dfc9bc6e936fca4418ea300dbfb84fe16de0b7d9" "checksum error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ab49e9dcb602294bc42f9a7dfc9bc6e936fca4418ea300dbfb84fe16de0b7d9"
"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
"checksum filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1ff6d4dab0aa0c8e6346d46052e93b13a16cf847b54ed357087c35011048cc7d" "checksum filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1ff6d4dab0aa0c8e6346d46052e93b13a16cf847b54ed357087c35011048cc7d"
@ -1260,6 +1254,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum json_dotpath 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ef7d9a147f00a2132581af7d0bc059d544a5efd2d24f579c4af5d0ad60fba47d" "checksum json_dotpath 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ef7d9a147f00a2132581af7d0bc059d544a5efd2d24f579c4af5d0ad60fba47d"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
@ -1272,8 +1267,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" "checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
"checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" "checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0"
"checksum mime 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "dd1d63acd1b78403cc0c325605908475dd9b9a3acbf65ed8bcab97e27014afcf"
"checksum mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a0ed03949aef72dbdf3116a383d7b38b4768e6f960528cd6a6044aa9ed68599"
"checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" "checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f"
"checksum mio-extras 2.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" "checksum mio-extras 2.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19"
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
@ -1298,11 +1291,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
"checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384"
"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd" "checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd"
"checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7"
"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716" "checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716"
"checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a"
"checksum rocket 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "42c1e9deb3ef4fa430d307bfccd4231434b707ca1328fae339c43ad1201cc6f7" "checksum rocket 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "42c1e9deb3ef4fa430d307bfccd4231434b707ca1328fae339c43ad1201cc6f7"
"checksum rocket-download-response 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "21d40232a9e54d5f5710be2d326bbf7686a5d81ecc78d328fdb158f71744dad7"
"checksum rocket_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "79aa1366f9b2eccddc05971e17c5de7bb75a5431eb12c2b5c66545fd348647f4" "checksum rocket_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "79aa1366f9b2eccddc05971e17c5de7bb75a5431eb12c2b5c66545fd348647f4"
"checksum rocket_contrib 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e0fa5c1392135adc0f96a02ba150ac4c765e27c58dbfd32aa40678e948f6e56f" "checksum rocket_contrib 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e0fa5c1392135adc0f96a02ba150ac4c765e27c58dbfd32aa40678e948f6e56f"
"checksum rocket_http 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b1391457ee4e80b40d4b57fa5765c0f2836b20d73bcbee4e3f35d93cf3b80817" "checksum rocket_http 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b1391457ee4e80b40d4b57fa5765c0f2836b20d73bcbee4e3f35d93cf3b80817"
@ -1326,11 +1319,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)" = "4b505279e19d8f7d24b1a9dc58327c9c36174b1a2c7ebdeac70792d017cb64f3" "checksum tera 0.11.20 (registry+https://github.com/rust-lang/crates.io-index)" = "4b505279e19d8f7d24b1a9dc58327c9c36174b1a2c7ebdeac70792d017cb64f3"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
"checksum titlecase 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0650399a761c61e9691ccc878bce2608291f7c18d8f84d188e6e11748a5316c8"
"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"
"checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" "checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079"
"checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" "checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887"
"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" "checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9"
"checksum ucd-trie 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8f00ed7be0c1ff1e24f46c3d2af4859f7e863672ba3a6e92e7cff702bf9f06c2" "checksum ucd-trie 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8f00ed7be0c1ff1e24f46c3d2af4859f7e863672ba3a6e92e7cff702bf9f06c2"
"checksum ucd-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b3b49edd3468c0e6565d85783f51af95212b6fa3986a5500954f00b460874"
"checksum unic-char-property 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce36d3f7ce754afdbccccf8ff0dd0134e50fb44aaae579f96218856e9e5dbd1e" "checksum unic-char-property 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce36d3f7ce754afdbccccf8ff0dd0134e50fb44aaae579f96218856e9e5dbd1e"
"checksum unic-char-range 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9ab85fab42ad1b26cafc03bf891f69cb4d6e15f491030e89a0122197baa8ae8" "checksum unic-char-range 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9ab85fab42ad1b26cafc03bf891f69cb4d6e15f491030e89a0122197baa8ae8"
"checksum unic-common 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8d4a7ade929ef7d971e16ced21a8cd56a63869aa6032dfb8cb083cf7d077bf" "checksum unic-common 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8d4a7ade929ef7d971e16ced21a8cd56a63869aa6032dfb8cb083cf7d077bf"
@ -1338,13 +1333,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum unic-ucd-segment 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "48f1a08ce0409a9e391b88d1930118eec48af12742fc538bcec55f775865776e" "checksum unic-ucd-segment 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "48f1a08ce0409a9e391b88d1930118eec48af12742fc538bcec55f775865776e"
"checksum unic-ucd-version 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1f5e6c6c53c2d0ece4a5964bc55fcff8602153063cb4fab20958ff32998ff6" "checksum unic-ucd-version 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1f5e6c6c53c2d0ece4a5964bc55fcff8602153063cb4fab20958ff32998ff6"
"checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" "checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33"
"checksum unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
"checksum unicode-normalization 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b561e267b2326bb4cebfc0ef9e68355c7abe6c6f522aeac2f5bf95d56c59bdcf" "checksum unicode-normalization 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b561e267b2326bb4cebfc0ef9e68355c7abe6c6f522aeac2f5bf95d56c59bdcf"
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
"checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f"
"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
"checksum utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba"
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
"checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" "checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce"
"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" "checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e"

@ -7,23 +7,21 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
rocket-download-response = "0.4.9" #rocket-download-response = "0.4.9"
#rocket-include-tera = "0.4.5"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = { version="1.0", features= ["preserve_order"] }
serde_yaml = "0.8.11" serde_yaml = "0.8.11"
json_dotpath = "0.1.2" json_dotpath = "0.1.2"
titlecase = "0.10.0"
# special data structure that preserves order
indexmap = { version="1.3.0", features=["serde-1"] }
rocket = { version="0.4.2", default-features = false}
rocket_contrib = { version="0.4.2", features = ["json", "serve", "tera_templates"]}
ifmt = "0.2.0" ifmt = "0.2.0"
parking_lot = "0.10.0" parking_lot = "0.10.0"
lazy_static = "1.4.0" lazy_static = "1.4.0"
linked-hash-map = "0.5.2"
[dependencies.rocket]
version = "0.4.2"
default-features = false
[dependencies.rocket_contrib]
version = "0.4.2"
default-features = false
features = ["json", "serve", "tera_templates"]

@ -30,3 +30,11 @@ model:
type: "text" type: "text"
checkbox: checkbox:
type: "bool" type: "bool"
fixed_tags:
type: "tags"
options:
- aaa
- bbb
- ccc
- ddd
- eee

@ -18,6 +18,8 @@ pub struct RenderedField<'a> {
pub step: &'static str, pub step: &'static str,
pub min: String, pub min: String,
pub max: String, pub max: String,
pub all_tags_json: String,
pub tags_json: String,
pub options: Option<&'a Vec<String>>, pub options: Option<&'a Vec<String>>,
pub value: Cow<'a, str>, pub value: Cow<'a, str>,
pub checked: bool, pub checked: bool,
@ -33,7 +35,7 @@ impl<'a> RenderedField<'a> {
let mut rendered = RenderedField::default(); let mut rendered = RenderedField::default();
rendered.key = key.as_str().into(); rendered.key = key.as_str().into();
rendered.label = if field.label.is_empty() { rendered.label = if field.label.is_empty() {
rendered.key.clone() titlecase::titlecase(&key.replace('_', " ")).into()
} else { } else {
field.label.as_str().into() field.label.as_str().into()
}; };
@ -105,20 +107,56 @@ impl<'a> RenderedField<'a> {
FieldKind::Enum { options, default } => { FieldKind::Enum { options, default } => {
rendered.kind = "select"; rendered.kind = "select";
rendered.options = Some(options); rendered.options = Some(options);
if let Some(Value::String(s)) = value {
rendered.value = Cow::Borrowed(&s.as_str());
}
} }
FieldKind::FreeEnum { enum_group } => { FieldKind::FreeEnum { enum_group } => {
rendered.kind = "free_select"; rendered.kind = "free_select";
let group = enum_group.as_ref().unwrap_or(key); let group = enum_group.as_ref().unwrap_or(key);
rendered.options = Some(index.free_enums.get(group).unwrap_or(&EMPTY_VEC)) let options = index.free_enums.get(group).unwrap_or(&EMPTY_VEC);
rendered.options = Some(options);
if let Some(Value::String(s)) = value {
rendered.value = Cow::Borrowed(&s.as_str());
}
} }
FieldKind::Tags { options } => { FieldKind::Tags { options } => {
rendered.kind = "select"; rendered.kind = "tags";
rendered.options = Some(options); rendered.options = Some(options);
if value.is_some() {
rendered.value = serde_json::from_value::<Vec<String>>(value.unwrap().clone())
.unwrap().join(" ").into();
}
if let Some(Value::Array(items)) = value {
rendered.tags_json = serde_json::to_string(items).unwrap();
} else {
rendered.tags_json = "[]".into();
};
rendered.all_tags_json = serde_json::to_string(options).unwrap();
} }
FieldKind::FreeTags { tag_group } => { FieldKind::FreeTags { tag_group } => {
rendered.kind = "free_select"; rendered.kind = "free_tags";
let group = tag_group.as_ref().unwrap_or(key); let group = tag_group.as_ref().unwrap_or(key);
rendered.options = Some(index.free_tags.get(group).unwrap_or(&EMPTY_VEC)) let options = index.free_tags.get(group).unwrap_or(&EMPTY_VEC);
if value.is_some() {
rendered.value = serde_json::from_value::<Vec<String>>(value.unwrap().clone())
.unwrap().join(" ").into();
}
if let Some(Value::Array(items)) = value {
rendered.tags_json = serde_json::to_string(items).unwrap();
} else {
rendered.tags_json = "[]".into();
};
rendered.options = Some(options);
rendered.tags_json = serde_json::to_string(options).unwrap();
} }
} }

@ -25,7 +25,7 @@ pub struct Indexes {
} }
/// Struct loaded from the repositroy config file /// Struct loaded from the repositroy config file
#[derive(Serialize,Deserialize,Debug)] #[derive(Deserialize,Debug)]
struct RepositoryConfig { struct RepositoryConfig {
pub model : Model, pub model : Model,
} }

@ -1,15 +1,16 @@
use std::collections::HashMap; use std::collections::HashMap;
use indexmap::map::IndexMap;
/// A data card's model. /// A data card's model.
/// Cards of one model can be sorted, searched and filtered by their fields. /// Cards of one model can be sorted, searched and filtered by their fields.
#[derive(Serialize, Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct Model { pub struct Model {
/// Fields defined by this model /// Fields defined by this model
pub fields: HashMap<String, Field>, pub fields: IndexMap<String, Field>,
} }
/// One field of a model /// One field of a model
#[derive(Serialize, Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct Field { pub struct Field {
/// Field label shown in the user interface /// Field label shown in the user interface
#[serde(default)] #[serde(default)]

@ -1,3 +1,5 @@
{# TEXT #}
{% macro text(field) %} {% macro text(field) %}
<label for="field-{{field.key}}"> <label for="field-{{field.key}}">
{{field.label}} {{field.label}}
@ -8,6 +10,9 @@
value="{{field.value}}"> value="{{field.value}}">
{% endmacro %} {% endmacro %}
{# TEXT AREA #}
{% macro longtext(field) %} {% macro longtext(field) %}
<label for="field-{{field.key}}"> <label for="field-{{field.key}}">
{{field.label}} {{field.label}}
@ -15,6 +20,9 @@
<textarea id="field-{{field.key}}" name="{{field.key}}">{{field.value}}</textarea> <textarea id="field-{{field.key}}" name="{{field.key}}">{{field.value}}</textarea>
{% endmacro %} {% endmacro %}
{# FREE SELECT #}
{% macro free_select(field) %} {% macro free_select(field) %}
<label for="field-{{field.key}}"> <label for="field-{{field.key}}">
{{field.label}} {{field.label}}
@ -24,14 +32,16 @@
type="text" type="text"
list="suggestions-{{field.key}}" list="suggestions-{{field.key}}"
value="{{field.value}}"> value="{{field.value}}">
<datalist id="suggestions-{{field.key}}"> <datalist id="suggestions-{{field.key}}">
{% for option in field.options %} {%- for option in field.options %}
<option value="{{option}}"> <option value="{{option}}">
{% endfor %} {%- endfor %}
</datalist> </datalist>
{% endmacro %} {% endmacro %}
{# NUMBER #}
{% macro number(field) %} {% macro number(field) %}
<label for="field-{{field.key}}"> <label for="field-{{field.key}}">
{{field.label}} {{field.label}}
@ -45,23 +55,77 @@
max="{{field.max}}"> max="{{field.max}}">
{% endmacro %} {% endmacro %}
{# CHECKBOX #}
{% macro checkbox(field) %} {% macro checkbox(field) %}
<label for="field-{{field.key}}"> <label for="field-{{field.key}}">
{{field.label}} {{field.label}}
</label> </label>
<label class="checkbox-wrap" for="field-{{field.key}}">
<input id="field-{{field.key}}" <input id="field-{{field.key}}"
name="{{field.key}}" name="{{field.key}}"
type="checkbox" type="checkbox"
{% if field.checked %}checked{% endif %}> {% if field.checked %}checked{% endif %}>
</label>
{% endmacro %} {% endmacro %}
{# SELECT #}
{% macro select(field) %} {% macro select(field) %}
<label for="field-{{field.key}}"> <label for="field-{{field.key}}">
{{field.label}} {{field.label}}
</label> </label>
<select id="field-{{field.key}}" name="{{field.key}}"> <select id="field-{{field.key}}" name="{{field.key}}">
{% for option in field.options %} {%- for option in field.options %}
<option value="{{option}}">{{option}}</option> <option value="{{option}}" {% if field.value == option %}selected{% endif %}>{{option}}</option>
{% endfor %} {%- endfor %}
</select> </select>
{% endmacro %} {% endmacro %}
{# TAGS #}
{% macro tags(field,free=false) %}
<label for="field-{{field.key}}">
{{field.label}}
</label>
<input type="hidden" id="field-{{field.key}}" name="{{field.key}}" value="{{field.value}}">
<div class="tag-input" id="tag-input-{{field.key}}"></div>
<datalist id="suggestions-{{field.key}}">
{%- for option in field.options %}
<option value="{{option}}">
{%- endfor %}
</datalist>
<script>
!(function() {
let taggle;
let hiden_field = document.querySelector('#field-{{field.key}}');
let onchange = () => {
let values = taggle.tag.values.join(" ");
hiden_field.setAttribute("value", values);
};
taggle = new Taggle('tag-input-{{field.key}}', {
placeholder: 'Enter tags...',
allowDuplicates: false,
tags: {{field.tags_json | safe }},
allowedTags: {% if not free %}{{field.all_tags_json | safe}}{% else %}[]{% endif %},
onTagAdd: onchange,
onTagRemove: onchange,
});
document.querySelector('#tag-input-{{field.key}} .taggle_input')
.setAttribute('list', 'suggestions-{{field.key}}');
})();
</script>
{% endmacro %}
{# FREE TAGS #}
{% macro free_tags(field) %}
{{ self::tags(field=field, free=true) }}
{% endmacro %}

@ -5,43 +5,41 @@
Form Form
{%- endblock title %} {%- endblock title %}
{% block content %} {% block content -%}
<form action="/add" method="POST" class="Form">
<form action="/add" method="POST"> {%- for field in fields %}
{% for field in fields %} <!-- {{ field.key }} -->
<div class="Row"> <div class="Row">
{% if field.kind == "string" %} {%- if field.kind == "string" -%}
{{ form::text(field=field) }} {{ form::text(field=field) }}
{% elif field.kind == "text" %} {%- elif field.kind == "text" -%}
{{ form::longtext(field=field) }} {{ form::longtext(field=field) }}
{% elif field.kind == "number" %} {%- elif field.kind == "number" -%}
{{ form::number(field=field) }} {{ form::number(field=field) }}
{% elif field.kind == "bool" %} {%- elif field.kind == "bool" -%}
{{ form::checkbox(field=field) }} {{ form::checkbox(field=field) }}
{% elif field.kind == "select" %} {%- elif field.kind == "select" -%}
{{ form::select(field=field) }} {{ form::select(field=field) }}
{% elif field.kind == "free_select" %} {%- elif field.kind == "free_select" -%}
{{ form::free_select(field=field) }} {{ form::free_select(field=field) }}
{% else %} {%- elif field.kind == "tags" -%}
{{ form::tags(field=field) }}
{%- elif field.kind == "free_tags" -%}
{{ form::free_tags(field=field) }}
{%- else -%}
{{ field.key }} {{ field.key }}
{% endif %} {%- endif -%}
</div> </div>
{% endfor %} {%- endfor %}
<button type="submit">Add</button> <button type="submit">Add</button>
</form> </form>
{% endblock content %} {%- endblock content %}

@ -4,6 +4,8 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>{% block title %}{% endblock title %}</title> <title>{% block title %}{% endblock title %}</title>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="taggle.css">
<script src="taggle.min.js"></script>
</head> </head>
<body> <body>
{% block content %}{% endblock content %} {% block content %}{% endblock content %}

@ -2,26 +2,76 @@
box-sizing: border-box; box-sizing: border-box;
} }
form .Row { html, textarea, select {
font-family: "IBM Plex", "DejaVu Sans", "Helvetica", sans-serif;
}
.Form .Row {
display: flex; display: flex;
padding: .25rem; padding: .25rem;
} }
form .Row label { input[type="text"],
input[type="number"],
textarea,
.tag-input {
border: 1px solid silver;
padding: 0.5rem;
border-radius: 5px;
font-size: 1rem;
}
input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
.tag-input.active {
box-shadow: inset 0 0 0 1px #3c97ff;
border-color: #3c97ff;
outline: 0 none !important;
}
.Form label {
flex-shrink: 0; flex-shrink: 0;
width: 10rem; width: 10rem;
height: 2.1rem;
line-height: 2.1rem;
vertical-align: middle;
text-align: right; text-align: right;
display: inline-block; display: inline-block;
padding-right: .5rem; padding-right: .5rem;
align-self: flex-start;
} }
form .Row input, .Form input[type="text"],
form .Row select { .Form input[type="number"],
.Form select {
height: 2.1rem; height: 2.1rem;
width: 15rem;
} }
form .Row textarea { .Form textarea {
flex-shrink: 1; flex-shrink: 1;
width: 30rem; width: 30rem;
height: 6rem; height: 6rem;
} }
.Form label.checkbox-wrap {
width: 15rem;
padding-right: 1rem;
text-align: left !important;
}
.tag-input {
position: relative;
width: 30rem;
padding-bottom: 0rem !important;
}
.tag-input input,
.tag-input input:focus {
border: 0 transparent;
padding: 0;
margin: 0;
box-shadow: none;
outline: 0 none !important;
}

@ -0,0 +1,113 @@
/*
Basic styles to get you started in styling taggle
https://jsfiddle.net/okcoker/aqnspdtr/8/
*/
/*.textarea {
width: 100%;
height: 300px;
border: 1px solid red;
}*/
.taggle_list {
float: left;
padding: 0;
margin: 0;
width: 100%;
}
.taggle_input {
border: none;
outline: none;
font-size: 16px;
/*font-weight: 300;*/
}
.taggle_list li {
float: left;
display: inline-block;
white-space: nowrap;
font-weight: 500;
margin-bottom: .5rem;
}
.taggle_list .taggle {
margin-right: 8px;
background: #E2E1DF;
padding: .45rem;
border-radius: 3px;
position: relative;
cursor: pointer;
transition: all .3s;
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.taggle_list .taggle_hot {
background: #cac8c4;
}
.taggle_list .taggle .close {
font-size: 1.5rem;
position: absolute;
top: 10px;
right: 3px;
text-decoration: none;
padding: 0;
line-height: 0.5;
color: #ccc;
color: rgba(0, 0, 0, 0.2);
padding-bottom: 4px;
display: none;
border: 0;
background: none;
cursor: pointer;
}
.taggle_list .taggle:hover {
/*padding: 5px;*/
padding-right: 20px;
background: #ccc;
/*transition: all .3s;*/
}
.taggle_list .taggle:hover > .close {
display: block;
}
.taggle_list .taggle .close:hover {
color: #b5003b;
}
.taggle_placeholder {
position: absolute;
color: #CCC;
top: 12px;
left: 8px;
/*transition: opacity, .25s;*/
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.taggle_input {
padding: 8px;
padding-left: 0;
float: left;
margin-top: -5px;
background: none;
width: 100% !important;
max-width: 100%;
}
.taggle_sizer {
padding: 0;
margin: 0;
position: absolute;
top: -500px;
z-index: -1;
visibility: hidden;
}

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save