From 613429707bf677759c26638cfb4efc3fdf82d27d Mon Sep 17 00:00:00 2001 From: emilyliublair <67622097+emilyliublair@users.noreply.github.com> Date: Wed, 8 Sep 2021 23:50:20 -0400 Subject: [PATCH] push --- Cargo.lock | 192 +++++++++++++++++----------------- app/Announcements.js | 3 +- app/Calendar.js | 56 ++++++---- app/ChallengeWeek.js | 2 +- app/Clubs.js | 2 +- app/Home.js | 11 +- app/LunchEvents.js | 2 +- app/SSLOps.js | 5 +- app/Staff.js | 2 +- app/StudentWeek.js | 4 +- cms/migrations/setup/up.sql | 4 +- cms/src/data/mod.rs | 2 + cms/templates/events.html.hbs | 87 ++++++++++----- 13 files changed, 214 insertions(+), 158 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 608b363..41c683e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -183,15 +183,15 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "cc" -version = "1.0.69" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2" +checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0" [[package]] name = "cfg-if" @@ -271,7 +271,7 @@ name = "cms_macro" version = "0.1.0" dependencies = [ "diesel", - "proc-macro2 1.0.28", + "proc-macro2 1.0.29", "quote 1.0.9", ] @@ -309,9 +309,9 @@ checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" [[package]] name = "cpufeatures" -version = "0.1.5" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66c99696f6c9dd7f35d486b9d04d7e6e202aa3e8c40d553f2fdf5e7e0c6a71ef" +checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" dependencies = [ "libc", ] @@ -402,9 +402,9 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3" dependencies = [ - "proc-macro2 1.0.28", + "proc-macro2 1.0.29", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -536,55 +536,55 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" [[package]] name = "futures-channel" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74ed2411805f6e4e3d9bc904c95d5d423b89b3b25dc0250aa74729de20629ff9" +checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af51b1b4a7fdff033703db39de8802c673eb91855f2e0d47dcf3bf2c0ef01f99" +checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d" [[package]] name = "futures-io" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b0e06c393068f3a6ef246c75cdca793d6a46347e75286933e5e75fd2fd11582" +checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377" [[package]] name = "futures-macro" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54913bae956fb8df7f4dc6fc90362aa72e69148e3f39041fbe8742d21e0ac57" +checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" dependencies = [ "autocfg", "proc-macro-hack", - "proc-macro2 1.0.28", + "proc-macro2 1.0.29", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] name = "futures-sink" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0f30aaa67363d119812743aa5f33c201a7a66329f97d1a887022971feea4b53" +checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11" [[package]] name = "futures-task" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe54a98670017f3be909561f6ad13e810d9a51f3f061b902062ca3da80799f2" +checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99" [[package]] name = "futures-util" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67eb846bfd58e44a8481a00049e82c43e0ccb5d61f8dc071057cb19249dd4d78" +checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" dependencies = [ "autocfg", "futures-core", @@ -742,9 +742,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" +checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" [[package]] name = "httpdate" @@ -773,9 +773,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.11" +version = "0.14.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b61cf2d1aebcf6e6352c97b81dc2244ca29194be1b276f5d8ad5c6330fffb11" +checksum = "13f67199e765030fa08fe0bd581af683f0d5bc04ea09c2b1102012c5fb90e7fd" dependencies = [ "bytes", "futures-channel", @@ -802,7 +802,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" dependencies = [ "futures-util", - "hyper 0.14.11", + "hyper 0.14.12", "log 0.4.14", "rustls", "tokio", @@ -817,7 +817,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper 0.14.11", + "hyper 0.14.12", "native-tls", "tokio", "tokio-native-tls", @@ -910,15 +910,15 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "js-sys" -version = "0.3.52" +version = "0.3.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce791b7ca6638aae45be056e068fc756d871eb3b3b10b8efa62d1c9cec616752" +checksum = "e4bf49d50e2961077d9c99f4b7997d770a1114f087c3c2e0069b36c13fc2979d" dependencies = [ "wasm-bindgen", ] @@ -953,15 +953,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.99" +version = "0.2.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765" +checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21" [[package]] name = "lock_api" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb" +checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" dependencies = [ "scopeguard", ] @@ -1018,9 +1018,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9753f12909fd8d923f75ae5c3258cae1ed3c8ec052e1b38c93c21a6d157f789c" dependencies = [ "migrations_internals", - "proc-macro2 1.0.28", + "proc-macro2 1.0.29", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -1272,9 +1272,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", @@ -1283,9 +1283,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ "cfg-if 1.0.0", "instant", @@ -1356,9 +1356,9 @@ checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" dependencies = [ "pest", "pest_meta", - "proc-macro2 1.0.28", + "proc-macro2 1.0.29", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -1439,9 +1439,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.28" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612" +checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d" dependencies = [ "unicode-xid 0.2.2", ] @@ -1467,7 +1467,7 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2 1.0.28", + "proc-macro2 1.0.29", ] [[package]] @@ -1569,7 +1569,7 @@ dependencies = [ "futures-util", "http", "http-body", - "hyper 0.14.11", + "hyper 0.14.12", "hyper-rustls", "hyper-tls", "ipnet", @@ -1764,9 +1764,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.3.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467" +checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87" dependencies = [ "bitflags", "core-foundation", @@ -1777,9 +1777,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.3.0" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4effb91b4b8b6fb7732e670b6cee160278ff8e6bf485c7805d9e319d76e284" +checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e" dependencies = [ "core-foundation-sys", "libc", @@ -1787,29 +1787,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.127" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f03b9878abf6d14e6779d3f24f07b2cfa90352cfec4acc5aab8f1ac7f146fae8" +checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.127" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a024926d3432516606328597e0f224a51355a493b49fdd67e9209187cbe55ecc" +checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" dependencies = [ - "proc-macro2 1.0.28", + "proc-macro2 1.0.29", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] name = "serde_json" -version = "1.0.66" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "336b10da19a12ad094b59d870ebde26a45402e5b470add4b5fd03c5048a32127" +checksum = "a7f9e390c27c3c0ce8bc5d725f6e4d30a29d26659494aa4b17535f7522c5c950" dependencies = [ "itoa", "ryu", @@ -1851,9 +1851,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362ae5752fd2137731f9fa25fd4d9058af34666ca1966fb969119cc35719f12" +checksum = "9204c41a1597a8c5af23c82d1c921cb01ec0a4c59e07a9c7306062829a3903f3" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", @@ -1921,11 +1921,11 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.74" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c" +checksum = "b7f58f7e8eaa0009c5fec437aabf511bd9933e4b2d7407bd05273c01a8906ea7" dependencies = [ - "proc-macro2 1.0.28", + "proc-macro2 1.0.29", "quote 1.0.9", "unicode-xid 0.2.2", ] @@ -1955,22 +1955,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93119e4feac1cbe6c798c34d3a53ea0026b0b1de6a120deef895137c0529bfe2" +checksum = "283d5230e63df9608ac7d9691adc1dfb6e701225436eb64d0b9a7f0a5a04f6ec" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" +checksum = "fa3884228611f5cd3608e2d409bf7dce832e4eb3135e3f11addbd7e41bd68e71" dependencies = [ - "proc-macro2 1.0.28", + "proc-macro2 1.0.29", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -2001,9 +2001,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cf844b23c6131f624accf65ce0e4e9956a8bb329400ea5bcc26ae3a5c20b0b" +checksum = "b4efe6fc2395938c8155973d7be49fe8d03a843726e285e100a8a383cc0154ce" dependencies = [ "autocfg", "bytes", @@ -2105,9 +2105,9 @@ checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" [[package]] name = "typenum" -version = "1.13.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" [[package]] name = "ucd-trie" @@ -2259,9 +2259,9 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.75" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b608ecc8f4198fe8680e2ed18eccab5f0cd4caaf3d83516fa5fb2e927fda2586" +checksum = "8ce9b1b516211d33767048e5d47fa2a381ed8b76fc48d2ce4aa39877f9f183e0" dependencies = [ "cfg-if 1.0.0", "serde", @@ -2271,24 +2271,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.75" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "580aa3a91a63d23aac5b6b267e2d13cb4f363e31dce6c352fca4752ae12e479f" +checksum = "cfe8dc78e2326ba5f845f4b5bf548401604fa20b1dd1d365fb73b6c1d6364041" dependencies = [ "bumpalo", "lazy_static", "log 0.4.14", - "proc-macro2 1.0.28", + "proc-macro2 1.0.29", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.25" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16646b21c3add8e13fdb8f20172f8a28c3dbf62f45406bcff0233188226cfe0c" +checksum = "95fded345a6559c2cfee778d562300c581f7d4ff3edb9b0d230d69800d213972" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -2298,9 +2298,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.75" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "171ebf0ed9e1458810dfcb31f2e766ad6b3a89dbda42d8901f2b268277e5f09c" +checksum = "44468aa53335841d9d6b6c023eaab07c0cd4bddbcfdee3e2bb1e8d2cb8069fef" dependencies = [ "quote 1.0.9", "wasm-bindgen-macro-support", @@ -2308,28 +2308,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.75" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c2657dd393f03aa2a659c25c6ae18a13a4048cebd220e147933ea837efc589f" +checksum = "0195807922713af1e67dc66132c7328206ed9766af3858164fb583eedc25fbad" dependencies = [ - "proc-macro2 1.0.28", + "proc-macro2 1.0.29", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.75" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e0c4a743a309662d45f4ede961d7afa4ba4131a59a639f29b0069c3798bbcc2" +checksum = "acdb075a845574a1fa5f09fd77e43f7747599301ea3417a9fbffdeedfc1f4a29" [[package]] name = "web-sys" -version = "0.3.52" +version = "0.3.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01c70a82d842c9979078c772d4a1344685045f1a5628f677c2b2eab4dd7d2696" +checksum = "224b2f6b67919060055ef1a67807367c2066ed520c3862cc013d26cf893a783c" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/app/Announcements.js b/app/Announcements.js index 6d8b3ea..a3f8bdd 100644 --- a/app/Announcements.js +++ b/app/Announcements.js @@ -163,7 +163,7 @@ class Announcements extends React.Component { } getData() { - fetch(`${url}/api/en/announcements`,{ + fetch(`${url}/api/`+String(I18n.locale).split('-')[0]+`/announcements`,{ headers: { 'Cache-Control': 'no-cache' } @@ -174,6 +174,7 @@ class Announcements extends React.Component { }) .then((txt) => { const data = JSON.parse(txt).data; + console.log(data) const teacherNames = [...new Set(data.filter(x=>x.teacher!=null&&x.teacher.trim()!=='').map(x=>x.teacher))]; teacherNames.sort() this.setState({data: data, teacherNames: teacherNames.map(x=>({name:x})),isLoading:false}); diff --git a/app/Calendar.js b/app/Calendar.js index 9c9b16d..7be56a4 100644 --- a/app/Calendar.js +++ b/app/Calendar.js @@ -28,19 +28,21 @@ const Stack = createStackNavigator(); const getCurrentDate=()=>{ var date = new Date().getDate(); - var month = new Date().getMonth() + 1; + var month = new Date().getMonth(); var year = new Date().getFullYear(); return new Date(year, month, date); } export const EventInfo = ({route}) => { const item = route.params; - const itemDate = new Date(item.date) + const itemDate = new Date(item.event_date) const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] const months = ['January','February','March','April','May','June','July','August','September','October','November','December',] const dayOfWeek = days[itemDate.getDay()] const month = months[itemDate.getMonth()] const date = itemDate.getDate() + + console.log(itemDate.getDate()) return ( @@ -77,11 +79,11 @@ export const EventInfo = ({route}) => { } const Event = (props) => { const item = props.item - const date = item.item.date.split('-') + const date = item.item.event_date.split('-') return ( - props.navigation.navigate('EventInfo', {data:props.data, title: item.item.title,text:item.item.text,location:item.item.location,date:item.item.date, name:item.item.name, emails: item.item.emails})} activeOpacity={0.8}> + props.navigation.navigate('EventInfo', {data:props.data, title: item.item.title,text:item.item.text,location:item.item.location,date:item.item.event_date, name:item.item.name, emails: item.item.emails})} activeOpacity={0.8}> @@ -172,17 +174,18 @@ class Calendar extends React.Component { } getData() { - fetch(`${url}/api/en/events`,{ + fetch(`http://127.0.0.1:8080/api/en/events`,{ headers: { 'Cache-Control': 'no-cache' } }) .then((response) => { return response.text(); + }) .then((json) => { - const data = JSON.parse(json).data - data.sort((a,b)=>new Date(b.date).getTime()-new Date(a.date).getTime()) - console.log(data); + const data = JSON.parse(json) + data.sort((a,b)=>a.id-b.id) + data.sort((a,b)=>new Date(b.event_date).getTime()-new Date(a.event_date).getTime()) this.setState({data: data}); }) .catch((error) => console.error(error)) @@ -202,20 +205,31 @@ class Calendar extends React.Component { var todayBoolean = true var pastBoolean = true var futureBoolean = true - - for (var i =0; i < this.state.data.length; i++) { - const itemDate = new Date(this.state.data[i].date) - if (itemDate == todayDate) { - today.push(this.state.data[i]) - } - else if (itemDate > todayDate && itemDate <= weekFutureDate) { - future.push(this.state.data[i]) - } - //else if (itemDate >= weekPastDate && itemDate < todayDate) { - else if (itemDate < todayDate) { - past.push(this.state.data[i]) + + if (this.state.data.length >0) { + try { + for (var i =0; i < this.state.data.length; i++) { + console.log(String(this.state.data[i].event_date)) + const itemDate = new Date(parseInt(String(this.state.data[i].event_date).split('-')[0]), parseInt(String(this.state.data[i].event_date).split('-')[1])-1, parseInt(String(this.state.data[i].event_date).split('-')[2])) + console.log(itemDate) + console.log('he') + if (itemDate.getTime() == todayDate.getTime()) { + today.push(this.state.data[i]) + } + else if (itemDate > todayDate && itemDate <= weekFutureDate) { + future.push(this.state.data[i]) + } + //else if (itemDate >= weekPastDate && itemDate < todayDate) { + else if (itemDate < todayDate) { + past.push(this.state.data[i]) + } + } } + catch {null} + + } + if (today.length === 0) todayBoolean = false if (past.length === 0) pastBoolean = false if (future.length === 0) futureBoolean = false @@ -223,8 +237,8 @@ class Calendar extends React.Component { return ( {todayBoolean?: <>} - {pastBoolean?: <>} {futureBoolean?: <>} + {pastBoolean?: <>} {!noAnn?{I18n.t('calendar.noEvents')}:<>} ) diff --git a/app/ChallengeWeek.js b/app/ChallengeWeek.js index f744dff..01a1099 100644 --- a/app/ChallengeWeek.js +++ b/app/ChallengeWeek.js @@ -33,7 +33,7 @@ class ChallengeWeek extends React.Component { } componentDidMount() { - fetch(`${url}/api/en/challenge`,{ + fetch(`${url}/api/`+String(I18n.locale).split('-')[0]+`/challenge`,{ headers: { 'Cache-Control': 'no-cache' }} diff --git a/app/Clubs.js b/app/Clubs.js index b580693..ad4fb8d 100644 --- a/app/Clubs.js +++ b/app/Clubs.js @@ -140,7 +140,7 @@ class Clubs extends React.Component { } getData() { - fetch(`${url}/api/en/clubs`,{ + fetch(`${url}/api/`+String(I18n.locale).split('-')[0]+`/clubs`,{ headers: { 'Cache-Control': 'no-cache' } }) diff --git a/app/Home.js b/app/Home.js index d4d86ab..de94f60 100644 --- a/app/Home.js +++ b/app/Home.js @@ -41,6 +41,8 @@ const Stack = createStackNavigator() const windowWidth = Dimensions.get('window').width; const windowHeight = Dimensions.get('window').height; +console.log(String(I18n.locale).split('-')[0]) + const getCurrentDate=()=>{ var date = new Date().getDate(); var month = new Date().getMonth(); @@ -196,7 +198,6 @@ export const NewItem = ({route}) => { {item.date} {item.name} - ) @@ -489,7 +490,7 @@ class Home extends React.Component { AsyncStorage.setItem(STORAGE_KEY,JSON.stringify(favoriteNames)).catch(console.log).done() } componentDidMount() { - fetch(`${url}/api/en/student`,{ + fetch(`${url}/api/`+String(I18n.locale).split('-')[0]+`/student`,{ headers: { 'Cache-Control': 'no-cache' }} @@ -499,7 +500,7 @@ class Home extends React.Component { this.setState({studentData: JSON.parse(json),isLoading:false}); }).catch((error) => console.error(error)) - fetch(`${url}/api/en/lunchEvents`,{ + fetch(`${url}/api/`+String(I18n.locale).split('-')[0]+`/lunchEvents`,{ headers: { 'Cache-Control': 'no-cache' }} @@ -526,7 +527,7 @@ class Home extends React.Component { } getData() { - fetch(`${url}/api/en/new`,{ + fetch(`${url}/api/`+String(I18n.locale).split('-')[0]+`/new`,{ headers: { 'Cache-Control': 'no-cache' } }) @@ -543,7 +544,7 @@ class Home extends React.Component { } getData1() { - fetch(`${url}/api/en/announcements`,{ + fetch(`${url}/api/`+String(I18n.locale).split('-')[0]+`/announcements`,{ headers: { 'Cache-Control': 'no-cache' }}) diff --git a/app/LunchEvents.js b/app/LunchEvents.js index 9925892..2180bd3 100644 --- a/app/LunchEvents.js +++ b/app/LunchEvents.js @@ -81,7 +81,7 @@ class LunchEvents extends React.Component { } componentDidMount() { - fetch(`${url}/api/en/lunchEvents`,{ + fetch(`${url}/api/`+String(I18n.locale).split('-')[0]+`/lunchEvents`,{ headers: { 'Cache-Control': 'no-cache' } diff --git a/app/SSLOps.js b/app/SSLOps.js index 80d6231..b53cedd 100644 --- a/app/SSLOps.js +++ b/app/SSLOps.js @@ -91,7 +91,8 @@ class SSLOps extends React.Component { } componentDidMount() { - fetch(`${url}/api/en/sslOps`,{ + fetch(`http://localhost:8000/data/en/sslOps.json`,{ + //fetch(`${url}/api/en/sslOps`,{ headers: { 'Cache-Control': 'no-cache' } @@ -101,7 +102,7 @@ class SSLOps extends React.Component { return response.text(); }) .then((json) => { - this.setState({data: JSON.parse(json).ops}); + this.setState({data: JSON.parse(json)}); }) .catch((error) => console.error(error)) } diff --git a/app/Staff.js b/app/Staff.js index 426d3ab..509c3d0 100644 --- a/app/Staff.js +++ b/app/Staff.js @@ -171,7 +171,7 @@ class Staffs extends React.Component { } getData() { - fetch(`${url}/api/en/teachers`,{ + fetch(`${url}/api/`+String(I18n.locale).split('-')[0]+`/teachers`,{ headers: { 'Cache-Control': 'no-cache' } }) diff --git a/app/StudentWeek.js b/app/StudentWeek.js index 6ad15a9..fa477f8 100644 --- a/app/StudentWeek.js +++ b/app/StudentWeek.js @@ -50,14 +50,16 @@ class StudentWeek extends React.Component { componentDidMount() { - fetch(`${url}/api/en/student`,{ + fetch(`${url}/api/`+String(I18n.locale).split('-')[0]+`/student`,{ headers: { 'Cache-Control': 'no-cache' }} ).then((response) => { return response.text(); }).then((json) => { + this.setState({data: JSON.parse(json),isLoading:false}); + console.log(this.state.data) }).catch((error) => console.error(error)) } diff --git a/cms/migrations/setup/up.sql b/cms/migrations/setup/up.sql index 0100d78..22b74c3 100644 --- a/cms/migrations/setup/up.sql +++ b/cms/migrations/setup/up.sql @@ -11,7 +11,9 @@ CREATE TABLE events ( title VARCHAR NOT NULL, text VARCHAR, location VARCHAR NOT NULL, - event_date DATE + event_date DATE, + name VARCHAR NOT NULL, + emails VARCHAR NOT NULL ); diff --git a/cms/src/data/mod.rs b/cms/src/data/mod.rs index ffd9df1..e29861d 100644 --- a/cms/src/data/mod.rs +++ b/cms/src/data/mod.rs @@ -149,6 +149,8 @@ api_route! { location: (Text, String, String), text: (Text, String, String), event_date: (Date, NaiveDate, DateForm), + name: (Text, String, String), + emails: (Text, String, String) } } diff --git a/cms/templates/events.html.hbs b/cms/templates/events.html.hbs index 22040b8..7d8fb92 100644 --- a/cms/templates/events.html.hbs +++ b/cms/templates/events.html.hbs @@ -5,37 +5,70 @@ +

Calendar Events

{{#each ctx}} -

{{id}} {{lang}} {{title}} {{location}} {{text}} {{event_date}}

+
+

ID: {{id}} LANG: {{lang}} EVENT TITLE: {{title}} EVENT LOCATION: {{location}} EVNET INFO: {{text}} EVENT DATE: {{event_date}}

+
{{/each}}
-

add

-
- - - - - - -
+
+
+

Add Calendar Event

+
+

Lang (enter 'en' (for english) or 'es' (for spanish))

+ +

Title

+ +

Location

+ +

Information

+ +

Date

+ +

Teacher/Organizer

+ +

Teacher/Organizer Email

+ +

+ +
+
+ +
+

Delete Calendar Event

+
+

Enter the ID of event to delete:

+ + +
+
-

del

-
- - -
- - -

upd

-
- - - - - - - -
+
+

Update Calendar Event

+
+

ID of Event to be Updated

+ +

Lang (enter 'en' (for english) or 'es' (for spanish)

+ +

Title

+ +

Location

+ +

Information

+ +

Date

+ +

Teacher/Organizer

+ +

Teacher/Organizer Email

+ +

+ +
+
+
+