mod22.html 44 KB

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