fe8.html 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  7. <link href="https://rsms.me/inter/inter.css" rel="stylesheet" />
  8. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"></script>
  9. <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.full.js"></script>
  10. <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.css" rel="stylesheet" />
  11. <title>Module 8 Server-Side APIs Challenge Rubric</title>
  12. <style>
  13. *,
  14. *::before,
  15. *::after {
  16. box-sizing: border-box;
  17. }
  18. html,
  19. body {
  20. margin: 0;
  21. padding: 0;
  22. line-height: 1.15;
  23. font-size: 100%;
  24. color: #fefefe;
  25. transition: all 0.4s;
  26. }
  27. body {
  28. background-color: #fbfcfd;
  29. font-family: "Inter", sans-serif;
  30. color: #4a4a4a;
  31. }
  32. #app.dark {
  33. background-color: #121212;
  34. color: #e2e2e2;
  35. }
  36. h1 {
  37. font-size: 1.9rem;
  38. }
  39. h2 {
  40. font-size: 1.6rem;
  41. }
  42. h3 {
  43. font-size: 1.2rem;
  44. }
  45. h4 {
  46. font-size: 0.9rem;
  47. }
  48. p,
  49. legend {
  50. font-size: 1.2rem;
  51. }
  52. label {
  53. font-size: 0.9rem;
  54. line-height: 2;
  55. }
  56. fieldset {
  57. border: none;
  58. padding: 0;
  59. margin-top: 0.9rem;
  60. }
  61. input[type="radio"],
  62. input[type="checkbox"] {
  63. position: absolute !important;
  64. height: 1px;
  65. width: 1px;
  66. overflow: hidden;
  67. clip: rect(1px 1px 1px 1px);
  68. clip: rect(1px, 1px, 1px, 1px);
  69. white-space: nowrap;
  70. }
  71. .select-lg,
  72. .select-lg option {
  73. font-family: "Inter", sans-serif;
  74. padding: 10px;
  75. }
  76. .narrow {
  77. width: 800px;
  78. }
  79. #app {
  80. padding: 3%;
  81. transition: all 0.4s;
  82. }
  83. #app h1 {
  84. font-size: 1.9rem;
  85. font-weight: 700;
  86. line-height: 1.3;
  87. }
  88. header {
  89. display: flex;
  90. justify-content: space-between;
  91. align-items: center;
  92. }
  93. .switch-group {
  94. display: flex;
  95. align-items: center;
  96. height: 2.25rem;
  97. width: 4.5rem;
  98. }
  99. input[type="checkbox"]+.toggle {
  100. height: 100%;
  101. width: 100%;
  102. background-color: #77a1db;
  103. border-radius: 1.9rem;
  104. cursor: pointer;
  105. display: flex;
  106. align-items: center;
  107. padding: 0.35rem;
  108. cursor: pointer;
  109. overflow: hidden;
  110. background-position: 25% 125%;
  111. transition: all 0.5s;
  112. }
  113. input[type="checkbox"]:focus+.toggle {
  114. outline: rgb(59, 153, 252) auto 5px;
  115. }
  116. input[type="checkbox"]:checked+.toggle {
  117. background-color: rgb(85, 89, 204);
  118. background-size: 1rem;
  119. background-repeat: no-repeat;
  120. background-position: 25%;
  121. background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHZpZXdCb3g9IjAgMCAxNCAxNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMSIgY3k9IjgiIHI9IjEiIGZpbGw9IndoaXRlIi8+CjxjaXJjbGUgY3g9IjgiIGN5PSI3IiByPSIxIiBmaWxsPSJ3aGl0ZSIvPgo8Y2lyY2xlIGN4PSI1IiBjeT0iMTMiIHI9IjEiIGZpbGw9IndoaXRlIi8+CjxjaXJjbGUgY3g9IjUiIGN5PSIyIiByPSIyIiBmaWxsPSJ3aGl0ZSIvPgo8Y2lyY2xlIGN4PSIxMyIgY3k9IjMiIHI9IjEiIGZpbGw9IndoaXRlIi8+CjxjaXJjbGUgY3g9IjEyLjUiIGN5PSI5LjUiIHI9IjEuNSIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==");
  122. transition: all 0.5s;
  123. }
  124. input[type="checkbox"]+.toggle::after {
  125. content: "";
  126. display: block;
  127. height: 1.7rem;
  128. width: 1.7rem;
  129. border-radius: 50%;
  130. cursor: pointer;
  131. border: 4px solid #e1be64;
  132. background-color: #fddf74;
  133. transform: translateX(0rem);
  134. transition: all 0.5s;
  135. background-position: center bottom;
  136. }
  137. input[type="checkbox"]:hover+.toggle::after {
  138. transform: translateX(0rem) scale(1.1);
  139. }
  140. input[type="checkbox"]:checked+.toggle::after {
  141. border: 4px solid #ffffff;
  142. background-color: rgba(255, 255, 255, 0.4);
  143. transform: translateX(2.1rem);
  144. transition: all 0.5s;
  145. background-position: center;
  146. background-size: 60%;
  147. background-repeat: no-repeat;
  148. background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkiIGhlaWdodD0iMTkiIHZpZXdCb3g9IjAgMCAxOSAxOSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE4LjUgMTAuMjlDMTguMzQyNyAxMS45OTIyIDE3LjcwMzkgMTMuNjE0NCAxNi42NTgyIDE0Ljk2NjhDMTUuNjEyNiAxNi4zMTkyIDE0LjIwMzUgMTcuMzQ1OCAxMi41OTU3IDE3LjkyNjVDMTAuOTg3OSAxOC41MDczIDkuMjQ3OTggMTguNjE4MSA3LjU3OTUgMTguMjQ2MUM1LjkxMTAyIDE3Ljg3NDEgNC4zODI5OSAxNy4wMzQ1IDMuMTc0MjMgMTUuODI1OEMxLjk2NTQ2IDE0LjYxNyAxLjEyNTk0IDEzLjA4OSAwLjc1MzkwNyAxMS40MjA1QzAuMzgxODc1IDkuNzUyMDIgMC40OTI3MTYgOC4wMTIwOCAxLjA3MzQ2IDYuNDA0M0MxLjY1NDIgNC43OTY1MSAyLjY4MDgzIDMuMzg3MzcgNC4wMzMyMSAyLjM0MTc1QzUuMzg1NTkgMS4yOTYxNCA3LjAwNzggMC42NTczMDUgOC43MSAwLjVDNy43MTM0MSAxLjg0ODI3IDcuMjMzODUgMy41MDk0NSA3LjM1ODUzIDUuMTgxNDFDNy40ODMyMSA2Ljg1MzM4IDguMjAzODYgOC40MjUwNiA5LjM4OTQgOS42MTA2QzEwLjU3NDkgMTAuNzk2MSAxMi4xNDY2IDExLjUxNjggMTMuODE4NiAxMS42NDE1QzE1LjQ5MDYgMTEuNzY2MiAxNy4xNTE3IDExLjI4NjYgMTguNSAxMC4yOVYxMC4yOVoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=");
  149. }
  150. input[type="checkbox"]:checked:hover+.toggle::after {
  151. transform: translateX(2.1rem) scale(1.075);
  152. }
  153. .card {
  154. background-color: #fff;
  155. border-radius: 6px;
  156. border-width: 0;
  157. box-shadow: rgba(155, 155, 155, 0.45) 0 0 30px -5px;
  158. font-size: 1.1rem;
  159. height: 100%;
  160. line-height: 1.8rem;
  161. padding: 1.5rem 2rem;
  162. width: 100%;
  163. margin-bottom: 1.9rem;
  164. }
  165. .dark .card {
  166. background-color: #333333;
  167. box-shadow: none;
  168. }
  169. .card h1,
  170. .card h2,
  171. .card h3,
  172. .card h4,
  173. .card h5,
  174. .card h6 {
  175. color: #4a4a4a;
  176. }
  177. .dark .card h1,
  178. .dark .card h2,
  179. .dark .card h3,
  180. .dark .card h4,
  181. .dark .card h5,
  182. .dark .card h6 {
  183. color: #e2e2e2;
  184. }
  185. .card-header h2 {
  186. display: inline-block;
  187. }
  188. .card .cat-score {
  189. margin-left: 20px;
  190. font-size: smaller;
  191. }
  192. .card h3 {
  193. font-size: 1.2rem;
  194. font-weight: 700;
  195. line-height: 1.8em;
  196. margin: 0;
  197. padding: 0;
  198. }
  199. .card p,
  200. .card label,
  201. .card legend {
  202. color: #7a869c;
  203. border-width: 0;
  204. display: block;
  205. font-size: 1.1rem;
  206. font-weight: 300;
  207. line-height: 1.8em;
  208. margin: 0;
  209. padding: 0;
  210. }
  211. .card legend {
  212. display: flex;
  213. justify-content: flex-start;
  214. align-items: center;
  215. }
  216. .card legend .score {
  217. font-size: smaller;
  218. margin-left: 20px;
  219. font-weight: 100;
  220. min-width: 5%;
  221. }
  222. .dark .card p,
  223. .dark .card label,
  224. .dark .card legend {
  225. color: #e2e2e2;
  226. }
  227. .card label {
  228. display: inline-block;
  229. }
  230. .card input[type="radio"]+label::before {
  231. content: "";
  232. height: 0.9rem;
  233. width: 0.9rem;
  234. margin-right: 0.7rem;
  235. border-radius: 50%;
  236. border: 1px solid rgb(74, 74, 74);
  237. background-color: #ffffff;
  238. display: inline-block;
  239. cursor: pointer;
  240. position: relative;
  241. top: 0.09rem;
  242. }
  243. .dark .card input[type="radio"]+label::before {
  244. border: 1px solid #e2e2e2;
  245. background-color: inherit;
  246. }
  247. .card input[type="radio"]:checked+label::before {
  248. background-color: rgb(47, 106, 189);
  249. border-color: rgb(47, 106, 189);
  250. }
  251. .dark .card input[type="radio"]:checked+label::before {
  252. background-color: #d9d9d9;
  253. border-color: #d9d9d9;
  254. }
  255. .card input[type="radio"]:checked+label {
  256. font-weight: bold;
  257. color: #4a4a4a;
  258. }
  259. .dark input[type="radio"]:checked+label {
  260. color: #e2e2e2;
  261. }
  262. .card input[type="radio"]:focus+label::before {
  263. outline: rgb(59, 153, 252) auto 5px;
  264. }
  265. .card legend {
  266. margin-bottom: 0.4rem;
  267. }
  268. .totals {
  269. font-size: 1.6rem;
  270. }
  271. .totals+h2 {
  272. font-size: 1.9rem;
  273. margin-top: 0;
  274. }
  275. .grade {
  276. font-size: 1.9rem;
  277. }
  278. button {
  279. background-color: #fff;
  280. border: 1px solid #4a4a4a;
  281. border-radius: 6px;
  282. box-shadow: rgba(155, 155, 155, 0.5) 1px 2px 3px 0;
  283. color: #4a4a4a;
  284. cursor: pointer;
  285. display: inline-block;
  286. font-size: 1rem;
  287. font-weight: 500;
  288. letter-spacing: 0.04em;
  289. line-height: 1.8em;
  290. margin: 0.75rem 1.1rem 1.1rem 0;
  291. outline: none;
  292. padding: 0.5rem 1.4rem;
  293. text-transform: uppercase;
  294. transition-delay: 0s;
  295. transition-duration: 0.25s;
  296. transition-property: all;
  297. transition-timing-function: ease-out;
  298. width: fit-content;
  299. }
  300. .dark button {
  301. background: #d9d9d9;
  302. color: #121212;
  303. box-shadow: none;
  304. }
  305. button:hover {
  306. border-color: #dbdbdb;
  307. color: #dbdbdb;
  308. }
  309. .dark button:hover {
  310. color: #121212;
  311. }
  312. button.copy {
  313. margin-left: 0.4rem;
  314. font-size: .8rem;
  315. }
  316. button:focus {
  317. border-color: rgb(56, 56, 56);
  318. box-shadow: rgb(219, 219, 219) 0px 0px 0px 3px;
  319. color: rgb(56, 56, 56);
  320. }
  321. div[role="alert"] {
  322. color: #4a4a4a;
  323. font-size: 1.2rem;
  324. margin-bottom: 1.2rem;
  325. }
  326. .dark div[role="alert"] {
  327. color: #e2e2e2;
  328. }
  329. .summary {
  330. font-size: 1.2rem;
  331. border: none;
  332. font-family: monospace;
  333. background-color: #d5d9de;
  334. padding: 0.9rem;
  335. border-radius: 6px;
  336. line-height: 1.5;
  337. width: 100%;
  338. }
  339. .summary h2,
  340. .dark .summary h2 {
  341. font-size: 1.2rem;
  342. font-family: "Inter", sans-serif;
  343. margin-top: 35px;
  344. margin-bottom: 5px;
  345. }
  346. .summary h2:first-of-type,
  347. .dark .summary h2:first-of-type {
  348. margin-top: 15px;
  349. }
  350. .dark .summary {
  351. background: #6b6a6a;
  352. color: #e2e2e2;
  353. }
  354. .summary pre,
  355. .dark .summary pre {
  356. white-space: pre-wrap;
  357. border-radius: 5px;
  358. padding: 15px;
  359. border: solid 2px rgba(0, 0, 0, .4);
  360. }
  361. .summary pre:empty {
  362. display: none;
  363. }
  364. .summary pre:empty+button {
  365. display: none;
  366. }
  367. .d-none {
  368. display: none;
  369. }
  370. @media (max-width: 450px) {
  371. .btn-container {
  372. text-align: center;
  373. }
  374. button {
  375. width: 100%;
  376. margin: 0.5rem;
  377. }
  378. input[type="checkbox"]:checked+.toggle::after {
  379. transform: translateX(1.3rem);
  380. background-size: 50%;
  381. }
  382. input[type="checkbox"]:checked:hover+.toggle::after {
  383. transform: translateX(1.3rem) scale(1.1);
  384. background-size: 50%;
  385. }
  386. }
  387. @media (max-width: 515px) {
  388. input[type="checkbox"]:checked+.toggle::after {
  389. transform: translateX(1.7rem);
  390. }
  391. input[type="checkbox"]:checked:hover+.toggle::after {
  392. transform: translateX(1.7rem) scale(1.1);
  393. }
  394. }
  395. @media (max-width: 460px) {
  396. input[type="checkbox"]:checked+.toggle::after {
  397. transform: translateX(1.4rem);
  398. }
  399. input[type="checkbox"]:checked:hover+.toggle::after {
  400. transform: translateX(1.4rem) scale(1.1);
  401. }
  402. }
  403. @media (max-width: 400px) {
  404. #app h1 {
  405. font-size: 1.6rem;
  406. }
  407. input[type="checkbox"]:checked+.toggle::after {
  408. transform: translateX(1.3rem);
  409. }
  410. input[type="checkbox"]:checked:hover+.toggle::after {
  411. transform: translateX(1.3rem) scale(1.1);
  412. }
  413. }
  414. @media (max-width: 340px) {
  415. input[type="checkbox"]:checked+.toggle::after {
  416. transform: translateX(0.9rem);
  417. }
  418. input[type="checkbox"]:checked:hover+.toggle::after {
  419. transform: translateX(0.9rem) scale(1.075);
  420. }
  421. }
  422. </style>
  423. <script>
  424. $(function () {
  425. let $select2 = $('.select2').select2({
  426. containerCssClass: "wrap"
  427. })
  428. function triggerEvent(name, val) {
  429. let selected = $("select[name='" + name + "']")
  430. let change = new Event('change', { bubbles: true })
  431. selected[0].dispatchEvent(change)
  432. }
  433. $('.select2').on('select2:select', function (e) {
  434. triggerEvent(e.target.name, e.target.value)
  435. });
  436. })
  437. </script>
  438. </head>
  439. <body>
  440. <div id="app"></div>
  441. <script>
  442. (function (window) {
  443. "use strict";
  444. function Model() {
  445. this.title = `Module 8 Server-Side APIs Challenge Rubric (Coding)`;
  446. this.categories = [
  447. {
  448. title: "Deployment",
  449. subtitle: null,
  450. score: 0,
  451. questions: [
  452. {
  453. title: "Student submitted deployed live application URL",
  454. score: 8,
  455. type: "true false",
  456. message: "Application isn't deployed",
  457. status: false
  458. },
  459. {
  460. title:
  461. "Application loads at deployed URL (no 404, or Heroku/GH Pages error)",
  462. score: 8,
  463. type: "true false",
  464. message: "Application isn't deployed",
  465. status: false
  466. },
  467. {
  468. title: "Student submitted application GitHub URL",
  469. score: 8,
  470. type: "true false",
  471. message: "Missing GitHub submission URL",
  472. status: false
  473. },
  474. {
  475. title: "GitHub Repo contains application code",
  476. score: 8,
  477. type: "true false",
  478. message: "GitHub repo is empty",
  479. status: false
  480. }
  481. ]
  482. },
  483. {
  484. title: "Technical Acceptance Criteria",
  485. subtitle:
  486. "Keep your browser console open and watch out for errors from this point forward.",
  487. score: 0,
  488. questions: [
  489. {
  490. title:
  491. "When a user searches for a city they are presented with current and future conditions for that city and that city is added to the search history",
  492. score: 8,
  493. type: "true false",
  494. message:
  495. "When a user searches for a city they are not presented with the current and future conditions for that city",
  496. status: false
  497. },
  498. {
  499. title:
  500. "When a user views the current weather conditions for a city they are presented with the city's name, the date, an icon representation of the weather conditions, the temperature, the humidity, and the wind speed",
  501. score: 8,
  502. type: "likert",
  503. options: [
  504. {
  505. message: "The current weather conditions section does not contain any of the required data",
  506. score: 0
  507. },
  508. {
  509. message: "The current weather conditions section contains some of the required data",
  510. score: 3
  511. },
  512. {
  513. message: "The current weather conditions section contains most of the required data",
  514. score: 6
  515. },
  516. {
  517. message: "The current weather conditions section contains all of the required data",
  518. score: 8
  519. }
  520. ]
  521. },
  522. {
  523. title:
  524. "When a user view future weather conditions for that city they are presented with a 5-day forecast that displays: the date, an icon representation of weather conditions, the temperature, and the humidity",
  525. score: 8,
  526. type: "likert",
  527. options: [
  528. {
  529. message: "The future weather conditions section does not contain any of the required data",
  530. score: 0
  531. },
  532. {
  533. message: "The future weather conditions section contains some of the required data",
  534. score: 4
  535. },
  536. {
  537. message: "The future weather conditions section contains all of the required data",
  538. score: 8
  539. }
  540. ]
  541. },
  542. {
  543. title:
  544. "When a user click on a city in the search history they are again presented with current and future conditions for that city",
  545. score: 8,
  546. type: "true false",
  547. message:
  548. "When a user clicks on a past search they are not presented with the current and future conditions for that city",
  549. status: false
  550. },
  551. {
  552. title:
  553. "Application uses the OpenWeather API to retrieve weather data.",
  554. score: 4,
  555. type: "true false",
  556. message:
  557. "Application does not use the OpenWeather API to retrieve weather data.",
  558. status: false
  559. },
  560. {
  561. title:
  562. "Application uses localStorage to store persistent data.",
  563. score: 4,
  564. type: "true false",
  565. message:
  566. "Application does not use localStorage to store persistent data.",
  567. status: false
  568. },
  569. ]
  570. },
  571. {
  572. title: "Repository Quality",
  573. subtitle: null,
  574. score: 0,
  575. questions: [
  576. {
  577. title: "Repository has a unique name",
  578. score: 2,
  579. type: "true false",
  580. message: "Repo doesn't have a unique name",
  581. status: false
  582. },
  583. {
  584. title:
  585. "Repository follows best practices for file structure and naming conventions",
  586. score: 2,
  587. type: "true false",
  588. message:
  589. "Code doesn't follow recommended file/folder structure",
  590. status: false
  591. },
  592. {
  593. title:
  594. "Repository follows best practices for class/id naming conventions, indentation, quality comments, etc.",
  595. score: 2,
  596. type: "true false",
  597. message:
  598. "Code doesn't follow good practices for class/id names, indentation, lacks quality comments",
  599. status: false
  600. },
  601. {
  602. title:
  603. "Repository contains multiple descriptive commit messages",
  604. score: 2,
  605. type: "true false",
  606. message:
  607. "Repo doesn't contain multiple descriptive commit messages",
  608. status: false
  609. },
  610. {
  611. title: "Repository contains quality README with description, screenshot, link to deployed application",
  612. score: 5,
  613. type: "likert",
  614. options: [
  615. {
  616. message: "Repo doesn't include a high quality README with screenshots, a description, link to deployed application",
  617. score: 0
  618. },
  619. {
  620. message: "Repository README is missing 2 of the following: description, screenshot, or link to deployed application",
  621. score: 2
  622. },
  623. {
  624. message: "Repository README is missing 1 of the following: description, screenshot, or link to deployed application",
  625. score: 4
  626. },
  627. {
  628. message: "Repository contains quality README with description, screenshot, link to deployed application",
  629. score: 5
  630. }
  631. ],
  632. message: "",
  633. status: false
  634. }
  635. ]
  636. },
  637. {
  638. title: "Application Quality",
  639. subtitle: null,
  640. score: 0,
  641. questions: [
  642. {
  643. title: "Application user experience is intuitive and easy to navigate",
  644. score: 5,
  645. type: "likert",
  646. options: [
  647. {
  648. message: "Application user experience is not intuitive and easy to navigate",
  649. score: 0
  650. },
  651. {
  652. message: "Application user experience could be much more intuitive and easy to navigate",
  653. score: 2
  654. },
  655. {
  656. message: "Application user experience could be a lot more intuitive and easy to navigate",
  657. score: 4
  658. },
  659. {
  660. message: "Application user experience is intuitive and easy to navigate",
  661. score: 5
  662. }
  663. ],
  664. message: "",
  665. status: false
  666. },
  667. {
  668. title: "Application user interface style is clean and polished",
  669. score: 5,
  670. type: "likert",
  671. options: [
  672. {
  673. message: "Application user interface is not clean and polished",
  674. score: 0
  675. },
  676. {
  677. message: "Application user interface could be much better",
  678. score: 2
  679. },
  680. {
  681. message: "Application user interface could be a bit better",
  682. score: 4
  683. },
  684. {
  685. message: "Application user interface style is clean and polished",
  686. score: 5
  687. }
  688. ],
  689. message: "",
  690. status: false
  691. },
  692. {
  693. title: "Application resembles the mock-up functionality provided in homework instructions",
  694. score: 5,
  695. type: "likert",
  696. options: [
  697. {
  698. message: "Application doesn't resemble the mock-up functionality provided in homework instructions",
  699. score: 0
  700. },
  701. {
  702. message: "Application could resemble mock-up functionality provided with homework instructions much more closely",
  703. score: 2
  704. },
  705. {
  706. message: "Application could resemble mock-up functionality provided with homework instructions a bit more closely",
  707. score: 4
  708. },
  709. {
  710. message: "Application resembles the mock-up functionality provided in homework instructions",
  711. score: 5
  712. }
  713. ],
  714. message: "",
  715. status: false
  716. }
  717. ]
  718. },
  719. {
  720. title: "Academic Integrity",
  721. subtitle:
  722. "If any of of the following are true, partner with your instructor to investigate plagiarism. Contact your SSM if you believe plagiarism has occurred.",
  723. score: 0,
  724. questions: [
  725. {
  726. title: "Application contains a low number of commits",
  727. score: 0,
  728. type: "true false",
  729. message: null,
  730. status: false
  731. },
  732. {
  733. title:
  734. "Application codebase appears advanced for the student, at this point in the course, or in general",
  735. score: 0,
  736. type: "true false",
  737. message: null,
  738. status: false
  739. },
  740. {
  741. title:
  742. "Application package.json file references a different author and/or repository",
  743. score: 0,
  744. type: "true false",
  745. message: null,
  746. status: false
  747. },
  748. {
  749. title:
  750. "Application package.json file references much older versions of npm packages",
  751. score: 0,
  752. type: "true false",
  753. message: null,
  754. status: false
  755. }
  756. ]
  757. }
  758. ];
  759. this.initStorage();
  760. }
  761. Model.prototype.initStorage = function () {
  762. this.score = 0;
  763. this.questions = [];
  764. this.messages = new Set();
  765. this.flagged = new Set();
  766. this.isDarkMode =
  767. JSON.parse(localStorage.getItem("isDarkMode")) || false;
  768. this.categories
  769. .forEach(category => {
  770. category.score = 0;
  771. category.questions.forEach(question => {
  772. question.category = category.title;
  773. question.status = false;
  774. question.id = this.questions.length;
  775. question.flagged = category.title === "Academic Integrity";
  776. question.bonus = category.title === "Bonus";
  777. if (question.type === "likert") {
  778. question.message = question.options[0].message.split(" - ").pop();
  779. };
  780. let messageObj = {
  781. message: question.message,
  782. category: question.category
  783. };
  784. question.message && !question.bonus && this.messages.add(messageObj);
  785. this.questions.push(question);
  786. category.score += question.score;
  787. });
  788. });
  789. };
  790. Model.prototype.toggleDarkMode = function () {
  791. this.isDarkMode = !this.isDarkMode;
  792. localStorage.setItem("isDarkMode", this.isDarkMode);
  793. };
  794. Model.prototype.toggleRadio = function (radio) {
  795. const id = Number(radio.getAttribute("name"));
  796. const question = this.questions[id];
  797. const questionScore = document.querySelector("span[data-id='" + id + "']");
  798. const category = question.category;
  799. const categoryScore = document.querySelector("span[data-cat='" + category + "']");
  800. const resultsCategoryScore = document.querySelector("span[data-res-cat='" + category + "']");
  801. question.status = !question.status;
  802. if (question.status === true) {
  803. if (!question.bonus) {
  804. this.messages.forEach(message => {
  805. if (message.message === question.message) {
  806. this.messages.delete(message);
  807. }
  808. })
  809. } else {
  810. let messageObj = {
  811. message: question.message,
  812. category: category
  813. }
  814. this.messages.add(messageObj);
  815. }
  816. this.score += question.score;
  817. if (question.flagged) {
  818. this.flagged.add(question.id);
  819. }
  820. } else {
  821. if (question.flagged) {
  822. this.flagged.delete(question.id);
  823. }
  824. if (!question.bonus) {
  825. if (question.message) {
  826. let messageObj = {
  827. message: question.message,
  828. category: category
  829. }
  830. this.messages.add(messageObj);
  831. }
  832. } else {
  833. this.messages.forEach(message => {
  834. if (message.message === question.message) {
  835. this.messages.delete(message);
  836. }
  837. })
  838. }
  839. this.score -= question.score;
  840. }
  841. if (category !== "Academic Integrity") {
  842. if (question.status) {
  843. questionScore.textContent = question.score;
  844. } else {
  845. questionScore.textContent = 0;
  846. }
  847. const catQuestions = this.categories.filter(cat => cat.title === category)[0].questions;
  848. let categoryTotal = 0;
  849. catQuestions.forEach(question => {
  850. if (question.type === "true false") {
  851. if (question.status) {
  852. categoryTotal += question.score;
  853. }
  854. } else {
  855. let score = document.querySelector("select[name='" + question.id + "']").value;
  856. categoryTotal += parseInt(score);
  857. }
  858. })
  859. categoryScore.textContent = categoryTotal;
  860. resultsCategoryScore.textContent = categoryTotal;
  861. }
  862. };
  863. Model.prototype.handleSelect = function (select) {
  864. const id = Number(select.getAttribute("name"));
  865. const question = this.questions[id];
  866. const questionScore = document.querySelector("span[data-id='" + id + "']");
  867. const oldScore = questionScore.textContent;
  868. const category = question.category;
  869. const categoryScore = document.querySelector("span[data-cat='" + category + "']");
  870. const resultsCategoryScore = document.querySelector("span[data-res-cat='" + category + "']");
  871. let newMessage = select.selectedOptions[0].text.split(" - ").pop();
  872. if (newMessage === "Open this menu") {
  873. newMessage = select[1].text.split(" - ").pop();
  874. };
  875. if (question.type === "likert") {
  876. this.messages.forEach(item => {
  877. if (item.message === question.message) {
  878. this.messages.delete(item)
  879. }
  880. })
  881. question.message = newMessage;
  882. let messageObj = {
  883. message: newMessage,
  884. category: category
  885. }
  886. this.messages.add(messageObj);
  887. };
  888. this.score -= parseInt(oldScore);
  889. this.score += parseInt(select.value);
  890. questionScore.textContent = select.value;
  891. const catQuestions = this.categories.filter(cat => cat.title === category)[0].questions;
  892. let categoryTotal = 0;
  893. catQuestions.forEach(question => {
  894. if (question.type === "true false") {
  895. if (question.status) {
  896. categoryTotal += question.score;
  897. }
  898. } else {
  899. let score = document.querySelector("select[name='" + question.id + "']").value;
  900. categoryTotal += parseInt(score);
  901. }
  902. })
  903. categoryScore.textContent = categoryTotal;
  904. resultsCategoryScore.textContent = categoryTotal;
  905. };
  906. Model.prototype.calcGrade = function () {
  907. const roundedScore = Math.min(100, Math.ceil(this.score));
  908. let letterGrade = "";
  909. if (roundedScore >= 97) {
  910. letterGrade = "A+";
  911. } else if (roundedScore >= 93 && roundedScore <= 96) {
  912. letterGrade = "A";
  913. } else if (roundedScore >= 90 && roundedScore <= 92) {
  914. letterGrade = "A-";
  915. } else if (roundedScore >= 87 && roundedScore <= 89) {
  916. letterGrade = "B+";
  917. } else if (roundedScore >= 83 && roundedScore <= 86) {
  918. letterGrade = "B";
  919. } else if (roundedScore >= 80 && roundedScore <= 82) {
  920. letterGrade = "B-";
  921. } else if (roundedScore >= 77 && roundedScore <= 79) {
  922. letterGrade = "C+";
  923. } else if (roundedScore >= 73 && roundedScore <= 76) {
  924. letterGrade = "C";
  925. } else if (roundedScore >= 70 && roundedScore <= 72) {
  926. letterGrade = "C-";
  927. } else if (roundedScore >= 67 && roundedScore <= 69) {
  928. letterGrade = "D+";
  929. } else if (roundedScore >= 63 && roundedScore <= 66) {
  930. letterGrade = "D";
  931. } else if (roundedScore >= 60 && roundedScore <= 62) {
  932. letterGrade = "D-";
  933. } else {
  934. letterGrade = "F";
  935. }
  936. return letterGrade;
  937. };
  938. Model.prototype.hasFlags = function () {
  939. return this.flagged.size > 0;
  940. };
  941. function View(model) {
  942. this.model = model;
  943. this.generateHTML();
  944. this.cacheDom();
  945. }
  946. View.prototype.cacheDom = function () {
  947. this.darkModeToggle = document.querySelector("#dark-mode");
  948. this.radios = Array.from(
  949. document.querySelectorAll("input[type='radio']")
  950. );
  951. this.selects = Array.from(
  952. document.querySelectorAll("select")
  953. );
  954. this.totals = document.querySelector(".totals");
  955. this.grade = document.querySelector(".grade");
  956. this.alert = document.querySelector("div[role='alert']");
  957. this.summaryHeading = document.querySelector(".summary-heading");
  958. this.summary = document.querySelector(".summary");
  959. this.model.categories
  960. .filter(category => category.title !== "Academic Integrity")
  961. .map(category => {
  962. let summary = category.title.replace(/\s+/g, '-').toLowerCase();
  963. let summaryName = summary + "-summary";
  964. return this[summaryName] = document.querySelector("." + summary);
  965. })
  966. this.resetButton = document.querySelector(".reset");
  967. this.model.categories
  968. .filter(category => category.title !== "Academic Integrity")
  969. .map(category => {
  970. let button = category.title.replace(/\s+/g, '-').toLowerCase();
  971. let buttonName = "copyButton-" + button;
  972. return this[buttonName] = document.querySelector(".copy-" + button);
  973. })
  974. };
  975. View.prototype.createFieldset = function ({ title, id, score, status, category, type, options }) {
  976. return `<fieldset class="input-group">
  977. <legend>
  978. <span class="title">${title}</span> ${category === "Academic Integrity" ? "" : "<span class='score'><span data-id='" + id + "' class='current-score'>0</span> / " + score + "</span>"}
  979. </legend>
  980. ${type === "true false" ?
  981. `<div class="radio-group">
  982. <input type="radio" name="${id}" id="${id}-true" value="true">
  983. <label for="${id}-true">True</label>
  984. </div>
  985. <div class="radio-group">
  986. <input type="radio" name="${id}" id="${id}-false" value="false" checked>
  987. <label for="${id}-false">False</label>
  988. </div>` :
  989. `<div class="select-group">
  990. <select name="${id}" class="select-lg select2 narrow wrap">
  991. <option value="0" selected>Open this menu</option>
  992. ${options.map(option => `<option value="${option.score}">${option.score} - ${option.message}</option>`)}
  993. </select>
  994. </div>`
  995. }
  996. </fieldset>`;
  997. };
  998. View.prototype.createCard = function ({ title, subtitle, questions, score }) {
  999. return `<div class="card">
  1000. <div class="card-header"><h2>${title}</h2> ${title !== "Academic Integrity" ? "<span class='cat-score'><span data-cat='" + title + "'>0</span> / " + score + "</span>" : ""}</div>
  1001. ${subtitle ? `<h3>${subtitle}</h3>` : ""}
  1002. ${questions.map(child => this.createFieldset(child)).join("")}
  1003. </div>`;
  1004. };
  1005. View.prototype.createResults = function () {
  1006. return `<div class="card">
  1007. <h2>Recommended Grade: <span class="grade">F</span></h2>
  1008. <h2 class="totals">Total: (0/100)</h2>
  1009. <div class="d-none" role="alert">
  1010. You've selected <strong>True</strong> for one of more Academic
  1011. Integrity prompts and are advised to investigate plagiarism before
  1012. issuing a grade.
  1013. </div>
  1014. <div class="summary" aria-label="summary">
  1015. ${this.model.categories
  1016. .filter(category => category.title !== "Academic Integrity")
  1017. .map(category => {
  1018. let score = category.score;
  1019. let title = category.title;
  1020. let catClass = title.replace(/\s+/g, '-').toLowerCase();
  1021. return "<h2>" + title + "<span class='cat-score'><span data-res-cat='" + title + "'>0</span> / " + score + "</span></h2><pre class='" + catClass + "'>" + [...this.model.messages]
  1022. .filter(messageObj => messageObj.category === category.title)
  1023. .map(messageObj => `* ${messageObj.message}\n`)
  1024. .join("") + "</pre><button class='copy copy-" + catClass + "'>Copy To Clipboard</button>"
  1025. })
  1026. .join("")}
  1027. </div>
  1028. <div class="btn-container">
  1029. <button class="reset">Reset Form</button>
  1030. </div>
  1031. </div>`;
  1032. };
  1033. View.prototype.createHeader = function (title, isDarkMode = false) {
  1034. return `<header>
  1035. <h1>${title}</h1>
  1036. <div class="switch-group">
  1037. <input type="checkbox" name="dark-mode" id="dark-mode" ${
  1038. isDarkMode ? "checked" : ""
  1039. }>
  1040. <label aria-label="dark mode" for="dark-mode" class="toggle">
  1041. </label>
  1042. </div>
  1043. </header>`;
  1044. };
  1045. View.prototype.generateHTML = function () {
  1046. this.wrapper = document.querySelector("#app");
  1047. if (this.model.isDarkMode) {
  1048. this.wrapper.classList.add("dark");
  1049. }
  1050. const survey = this.model.categories.reduce((final, current) => {
  1051. final += this.createCard(current);
  1052. return final;
  1053. }, "");
  1054. const results = this.createResults();
  1055. const header = this.createHeader(
  1056. this.model.title,
  1057. this.model.isDarkMode
  1058. );
  1059. this.wrapper.innerHTML = header + survey + results;
  1060. };
  1061. View.prototype.update = function () {
  1062. const roundedScore = Math.min(100, Math.ceil(this.model.score));
  1063. this.totals.textContent = `Total: (${roundedScore}/ 100)`;
  1064. const letterGrade = this.model.calcGrade();
  1065. this.grade.textContent = letterGrade;
  1066. if (this.model.hasFlags()) {
  1067. this.alert.classList.remove("d-none");
  1068. } else {
  1069. this.alert.classList.add("d-none");
  1070. }
  1071. if (this.model.isDarkMode) {
  1072. this.wrapper.classList.add("dark");
  1073. } else {
  1074. this.wrapper.classList.remove("dark");
  1075. }
  1076. this.model.categories
  1077. .filter(category => category.title !== "Academic Integrity")
  1078. .forEach(category => {
  1079. let catClass = category.title.replace(/\s+/g, '-').toLowerCase();
  1080. this[catClass + "-summary"].innerHTML = [...this.model.messages]
  1081. .filter(messageObj => messageObj.category === category.title)
  1082. .map(messageObj => `* ${messageObj.message}\n`)
  1083. .join("")
  1084. })
  1085. };
  1086. function Controller(model, view) {
  1087. this.model = model;
  1088. this.view = view;
  1089. this.addEventListeners();
  1090. }
  1091. Controller.prototype.addEventListeners = function () {
  1092. this.view.wrapper.addEventListener("change", event => {
  1093. const { target } = event;
  1094. if (target.name !== "dark-mode") {
  1095. if (!target.matches("input[type='radio']")) {
  1096. this.model.handleSelect(target);
  1097. } else {
  1098. this.model.toggleRadio(target);
  1099. }
  1100. }
  1101. this.view.update();
  1102. });
  1103. this.view.resetButton.addEventListener("click", () => {
  1104. this.model.initStorage();
  1105. this.view.radios.forEach(
  1106. radio => (radio.checked = radio.hasAttribute("checked"))
  1107. );
  1108. this.view.selects.forEach(
  1109. select => select.selectedIndex = null
  1110. )
  1111. this.model.questions
  1112. .filter(question => question.category !== "Academic Integrity")
  1113. .forEach(question => {
  1114. const id = question.id;
  1115. const questionScore = document.querySelector("span[data-id='" + id + "']");
  1116. questionScore.textContent = 0;
  1117. });
  1118. this.model.categories
  1119. .filter(category => category.title !== "Academic Integrity")
  1120. .forEach(category => {
  1121. const title = category.title
  1122. const categoryScore = document.querySelector("span[data-cat='" + title + "']");
  1123. const resultsCategoryScore = document.querySelector("span[data-res-cat='" + title + "']");
  1124. categoryScore.textContent = 0;
  1125. resultsCategoryScore.textContent = 0;
  1126. });
  1127. this.view.update();
  1128. window.scrollTo(0, 0);
  1129. });
  1130. this.model.categories
  1131. .filter(category => category.title !== "Academic Integrity")
  1132. .forEach(category => {
  1133. let title = category.title.replace(/\s+/g, '-').toLowerCase();
  1134. let buttonName = "copyButton-" + title;
  1135. let summaryName = title + "-summary";
  1136. this.view[buttonName].addEventListener("click", () => {
  1137. const selection = window.getSelection();
  1138. const range = document.createRange();
  1139. range.selectNodeContents(this.view[summaryName]);
  1140. selection.removeAllRanges();
  1141. selection.addRange(range);
  1142. document.execCommand("copy");
  1143. });
  1144. });
  1145. this.view.darkModeToggle.addEventListener("change", () => {
  1146. this.model.toggleDarkMode();
  1147. this.view.update();
  1148. });
  1149. };
  1150. function App(Model, View, Controller) {
  1151. this.model = new Model();
  1152. this.view = new View(this.model);
  1153. this.controller = new Controller(this.model, this.view);
  1154. }
  1155. return new App(Model, View, Controller);
  1156. })(window);
  1157. </script>
  1158. </body>
  1159. </html>