mod17.html 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284
  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 17 CS 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 17 CS Challenge Rubric (Coding)`;
  446. this.categories = [
  447. {
  448. title: "Deliverables",
  449. subtitle: null,
  450. score: 0,
  451. questions: [
  452. {
  453. title: "Student submitted GitHub gist URL",
  454. score: 15,
  455. type: "true false",
  456. message: "Missing GitHub gist submission URL",
  457. status: false
  458. },
  459. {
  460. title: "GitHub gist contains tutorial Markdown",
  461. score: 8,
  462. type: "true false",
  463. message: "GitHub gist is empty",
  464. status: false
  465. },
  466. {
  467. title: "GitHub gist renders as Markdown in the browser",
  468. score: 7,
  469. type: "true false",
  470. message: "GitHub gist doesn't render as Markdown in the broswer",
  471. status: false
  472. }
  473. ]
  474. },
  475. {
  476. title: "Technical Acceptance Criteria",
  477. subtitle: null,
  478. score: 0,
  479. questions: [
  480. {
  481. title:
  482. "Student chooses a valid regex other than the one covered in the Regex Tutorial blog post (Matching a Username)",
  483. score: 5,
  484. type: "true false",
  485. message:
  486. "Student did not choose a valid regex or chose the regex covered in the Regex Tutorial blog post (Matching a Username)",
  487. status: false
  488. },
  489. {
  490. title:
  491. "Tutorial includes a unique name specific to the tutorial",
  492. score: 5,
  493. type: "true false",
  494. message:
  495. "Tutorial doesn't include a unique name specific to the tutorial",
  496. status: false
  497. },
  498. {
  499. title:
  500. "Tutorial includes an introductory paragraph explaining the purpose of the tutorial",
  501. score: 5,
  502. type: "true false",
  503. message:
  504. "Tutorial doesn't include an introductory paragraph explaining the purpose of the tutorial",
  505. status: false
  506. },
  507. {
  508. title:
  509. "Tutorial includes a summary describing the regex featured in the tutorial",
  510. score: 5,
  511. type: "true false",
  512. message:
  513. "Tutorial doesn't include a summary describing the regex featured in the tutorial",
  514. status: false
  515. },
  516. {
  517. title:
  518. "Tutorial includes a functioning table of contents linking to different sections that break down each component of the regex and explain what it does",
  519. score: 5,
  520. type: "true false",
  521. message:
  522. "Tutorial doesn't include a functioning table of contents linking to different sections that break down each component of the regex and explain what it does",
  523. status: false
  524. },
  525. {
  526. title:
  527. "Tutorial includes a section at the end of the tutorial about the author with a link to the author’s GitHub profile",
  528. score: 5,
  529. type: "true false",
  530. message:
  531. "Tutorial doesn't include a section at the end of the tutorial about the author with a link to the author’s GitHub profile",
  532. status: false
  533. },
  534. {
  535. title: "Tutorial includes sections that correspond to each of the components that make up the regex that they chose",
  536. score: 5,
  537. type: "likert",
  538. options: [
  539. {
  540. message: "Tutorial omits three or more of the components that make up the regex that they chose",
  541. score: 0
  542. },
  543. {
  544. message: "Tutorial omits two of the components that make up the regex that they chose",
  545. score: 1
  546. },
  547. {
  548. message: "Tutorial omits one of the components that make up the regex that they chose",
  549. score: 3
  550. },
  551. {
  552. message: "Tutorial includes sections that correspond to each of the components that make up the regex that they chose",
  553. score: 5
  554. }
  555. ],
  556. message: "",
  557. status: false
  558. },
  559. {
  560. title: "Each section of the tutorial that describes a different component of the regex includes more than just one sentence explaining what it does",
  561. score: 5,
  562. type: "likert",
  563. options: [
  564. {
  565. message: "Three or more sections of the tutorial that describe a different component of the regex only include one sentence explaining what it does",
  566. score: 0
  567. },
  568. {
  569. message: "Two sections of the tutorial that describe a different component of the regex only include one sentence explaining what it does",
  570. score: 1
  571. },
  572. {
  573. message: "One section of the tutorial that describes a different component of the regex only includes one sentence explaining what it does",
  574. score: 3
  575. },
  576. {
  577. message: "Each section of the tutorial that describes a different component of the regex includes more than just one sentence explaining what it does",
  578. score: 5
  579. }
  580. ],
  581. message: "",
  582. status: false
  583. },
  584. {
  585. title: "Each section of the tutorial that describes a different component of the regex includes a code snippet of that particular component of the regex",
  586. score: 5,
  587. type: "likert",
  588. options: [
  589. {
  590. message: "Three or more sections of the tutorial that describe a different component of the regex don't include a code snippet of that particular component of the regex",
  591. score: 0
  592. },
  593. {
  594. message: "Two sections of the tutorial that describe a different component of the regex don't include a code snippet of that particular component of the regex",
  595. score: 1
  596. },
  597. {
  598. message: "One section of the tutorial that describes a different component of the regex doesn't include a code snippet of that particular component of the regex",
  599. score: 3
  600. },
  601. {
  602. message: "Each section of the tutorial that describes a different component of the regex includes a code snippet of that particular component of the regex",
  603. score: 5
  604. }
  605. ],
  606. message: "",
  607. status: false
  608. },
  609. {
  610. title: "Each section of the tutorial that describes a different component of the regex includes at least one example that would meet the requirements of that component",
  611. score: 5,
  612. type: "likert",
  613. options: [
  614. {
  615. message: "Three or more sections of the tutorial that describe a different component of the regex don't include at least one example that would meet the requirements of that component",
  616. score: 0
  617. },
  618. {
  619. message: "Two sections of the tutorial that describe a different component of the regex don't include at least one example that would meet the requirements of that component",
  620. score: 1
  621. },
  622. {
  623. message: "One section of the tutorial that describes a different component of the regex doesn't include at least one example that would meet the requirements of that component",
  624. score: 3
  625. },
  626. {
  627. message: "Each section of the tutorial that describes a different component of the regex includes at least one example that would meet the requirements of that component",
  628. score: 5
  629. }
  630. ],
  631. message: "",
  632. status: false
  633. }
  634. ]
  635. },
  636. {
  637. title: "Tutorial Clarity and Quality",
  638. subtitle: null,
  639. score: 0,
  640. questions: [
  641. {
  642. title: "Student provides a clear explanation of how this regex works",
  643. score: 10,
  644. type: "likert",
  645. options: [
  646. {
  647. message: "Tutorial clarity is poor",
  648. score: 0
  649. },
  650. {
  651. message: "Tutorial clarity is fair",
  652. score: 3
  653. },
  654. {
  655. message: "Tutorial clarity is good",
  656. score: 7
  657. },
  658. {
  659. message: "Tutorial clarity is excellent",
  660. score: 10
  661. }
  662. ],
  663. message: "",
  664. status: false
  665. },
  666. {
  667. title: "Student describes each component of the regex in a separate section",
  668. score: 10,
  669. type: "likert",
  670. options: [
  671. {
  672. message: "Student combines the description of three or more of the components in one section",
  673. score: 0
  674. },
  675. {
  676. message: "Student combines the description of two of the components in one section",
  677. score: 5
  678. },
  679. {
  680. message: "Student describes each component of the regex in a separate section",
  681. score: 10
  682. }
  683. ],
  684. message: "",
  685. status: false
  686. }
  687. ]
  688. },
  689. {
  690. title: "Academic Integrity",
  691. subtitle:
  692. "If any of of the following are true, partner with your instructor to investigate plagiarism. Contact your SSM if you believe plagiarism has occurred.",
  693. score: 0,
  694. questions: [
  695. {
  696. title:
  697. "Tutorial uses regex covered in the Regex Tutorial blog post (Matching a Username)",
  698. score: 0,
  699. type: "true false",
  700. message: null,
  701. status: false
  702. },
  703. {
  704. title: "Gist revision history contains a low number of edits or very large additions (copy/paste)",
  705. score: 0,
  706. type: "true false",
  707. message: null,
  708. status: false
  709. },
  710. {
  711. title:
  712. "Tutorial appears advanced for the student at this point in the course, or in general",
  713. score: 0,
  714. type: "true false",
  715. message: null,
  716. status: false
  717. }
  718. ]
  719. }
  720. ];
  721. this.initStorage();
  722. }
  723. Model.prototype.initStorage = function () {
  724. this.score = 0;
  725. this.questions = [];
  726. this.messages = new Set();
  727. this.flagged = new Set();
  728. this.isDarkMode =
  729. JSON.parse(localStorage.getItem("isDarkMode")) || false;
  730. this.categories
  731. .forEach(category => {
  732. category.score = 0;
  733. category.questions.forEach(question => {
  734. question.category = category.title;
  735. question.status = false;
  736. question.id = this.questions.length;
  737. question.flagged = category.title === "Academic Integrity";
  738. question.bonus = category.title === "Bonus";
  739. if (question.type === "likert") {
  740. question.message = question.options[0].message.split(" - ").pop();
  741. };
  742. let messageObj = {
  743. message: question.message,
  744. category: question.category
  745. };
  746. question.message && !question.bonus && this.messages.add(messageObj);
  747. this.questions.push(question);
  748. category.score += question.score;
  749. });
  750. });
  751. };
  752. Model.prototype.toggleDarkMode = function () {
  753. this.isDarkMode = !this.isDarkMode;
  754. localStorage.setItem("isDarkMode", this.isDarkMode);
  755. };
  756. Model.prototype.toggleRadio = function (radio) {
  757. const id = Number(radio.getAttribute("name"));
  758. const question = this.questions[id];
  759. const questionScore = document.querySelector("span[data-id='" + id + "']");
  760. const category = question.category;
  761. const categoryScore = document.querySelector("span[data-cat='" + category + "']");
  762. const resultsCategoryScore = document.querySelector("span[data-res-cat='" + category + "']");
  763. question.status = !question.status;
  764. if (question.status === true) {
  765. if (!question.bonus) {
  766. this.messages.forEach(message => {
  767. if (message.message === question.message) {
  768. this.messages.delete(message);
  769. }
  770. })
  771. } else {
  772. let messageObj = {
  773. message: question.message,
  774. category: category
  775. }
  776. this.messages.add(messageObj);
  777. }
  778. this.score += question.score;
  779. if (question.flagged) {
  780. this.flagged.add(question.id);
  781. }
  782. } else {
  783. if (question.flagged) {
  784. this.flagged.delete(question.id);
  785. }
  786. if (!question.bonus) {
  787. if (question.message) {
  788. let messageObj = {
  789. message: question.message,
  790. category: category
  791. }
  792. this.messages.add(messageObj);
  793. }
  794. } else {
  795. this.messages.forEach(message => {
  796. if (message.message === question.message) {
  797. this.messages.delete(message);
  798. }
  799. })
  800. }
  801. this.score -= question.score;
  802. }
  803. if (category !== "Academic Integrity") {
  804. if (question.status) {
  805. questionScore.textContent = question.score;
  806. } else {
  807. questionScore.textContent = 0;
  808. }
  809. const catQuestions = this.categories.filter(cat => cat.title === category)[0].questions;
  810. let categoryTotal = 0;
  811. catQuestions.forEach(question => {
  812. if (question.type === "true false") {
  813. if (question.status) {
  814. categoryTotal += question.score;
  815. }
  816. } else {
  817. let score = document.querySelector("select[name='" + question.id + "']").value;
  818. categoryTotal += parseInt(score);
  819. }
  820. })
  821. categoryScore.textContent = categoryTotal;
  822. resultsCategoryScore.textContent = categoryTotal;
  823. }
  824. };
  825. Model.prototype.handleSelect = function (select) {
  826. const id = Number(select.getAttribute("name"));
  827. const question = this.questions[id];
  828. const questionScore = document.querySelector("span[data-id='" + id + "']");
  829. const oldScore = questionScore.textContent;
  830. const category = question.category;
  831. const categoryScore = document.querySelector("span[data-cat='" + category + "']");
  832. const resultsCategoryScore = document.querySelector("span[data-res-cat='" + category + "']");
  833. let newMessage = select.selectedOptions[0].text.split(" - ").pop();
  834. if (newMessage === "Open this menu") {
  835. newMessage = select[1].text.split(" - ").pop();
  836. };
  837. if (question.type === "likert") {
  838. this.messages.forEach(item => {
  839. if (item.message === question.message) {
  840. this.messages.delete(item)
  841. }
  842. })
  843. question.message = newMessage;
  844. let messageObj = {
  845. message: newMessage,
  846. category: category
  847. }
  848. this.messages.add(messageObj);
  849. };
  850. this.score -= parseInt(oldScore);
  851. this.score += parseInt(select.value);
  852. questionScore.textContent = select.value;
  853. const catQuestions = this.categories.filter(cat => cat.title === category)[0].questions;
  854. let categoryTotal = 0;
  855. catQuestions.forEach(question => {
  856. if (question.type === "true false") {
  857. if (question.status) {
  858. categoryTotal += question.score;
  859. }
  860. } else {
  861. let score = document.querySelector("select[name='" + question.id + "']").value;
  862. categoryTotal += parseInt(score);
  863. }
  864. })
  865. categoryScore.textContent = categoryTotal;
  866. resultsCategoryScore.textContent = categoryTotal;
  867. };
  868. Model.prototype.calcGrade = function () {
  869. const roundedScore = Math.min(100, Math.ceil(this.score));
  870. let letterGrade = "";
  871. if (roundedScore >= 99.5) {
  872. letterGrade = "A+";
  873. } else if (roundedScore >= 94.5 && roundedScore <= 99.4) {
  874. letterGrade = "A";
  875. } else if (roundedScore >= 91.5 && roundedScore <= 94.4) {
  876. letterGrade = "A-";
  877. } else if (roundedScore >= 87.5 && roundedScore <= 91.4) {
  878. letterGrade = "B+";
  879. } else if (roundedScore >= 84.5 && roundedScore <= 87.4) {
  880. letterGrade = "B";
  881. } else if (roundedScore >= 81.5 && roundedScore <= 84.4) {
  882. letterGrade = "B-";
  883. } else if (roundedScore >= 77.5 && roundedScore <= 81.4) {
  884. letterGrade = "C+";
  885. } else if (roundedScore >= 74.5 && roundedScore <= 77.4) {
  886. letterGrade = "C";
  887. } else if (roundedScore >= 71.5 && roundedScore <= 74.4) {
  888. letterGrade = "C-";
  889. } else if (roundedScore >= 69.5 && roundedScore <= 71.4) {
  890. letterGrade = "D+";
  891. } else if (roundedScore >= 64.5 && roundedScore <= 69.4) {
  892. letterGrade = "D";
  893. } else if (roundedScore >= 61.5 && roundedScore <= 64.4) {
  894. letterGrade = "D-";
  895. } else {
  896. letterGrade = "F";
  897. }
  898. return letterGrade;
  899. };
  900. Model.prototype.hasFlags = function () {
  901. return this.flagged.size > 0;
  902. };
  903. function View(model) {
  904. this.model = model;
  905. this.generateHTML();
  906. this.cacheDom();
  907. }
  908. View.prototype.cacheDom = function () {
  909. this.darkModeToggle = document.querySelector("#dark-mode");
  910. this.radios = Array.from(
  911. document.querySelectorAll("input[type='radio']")
  912. );
  913. this.selects = Array.from(
  914. document.querySelectorAll("select")
  915. );
  916. this.totals = document.querySelector(".totals");
  917. this.grade = document.querySelector(".grade");
  918. this.alert = document.querySelector("div[role='alert']");
  919. this.summaryHeading = document.querySelector(".summary-heading");
  920. this.summary = document.querySelector(".summary");
  921. this.model.categories
  922. .filter(category => category.title !== "Academic Integrity")
  923. .map(category => {
  924. let summary = category.title.replace(/\s+/g, '-').toLowerCase();
  925. let summaryName = summary + "-summary";
  926. return this[summaryName] = document.querySelector("." + summary);
  927. })
  928. this.resetButton = document.querySelector(".reset");
  929. this.model.categories
  930. .filter(category => category.title !== "Academic Integrity")
  931. .map(category => {
  932. let button = category.title.replace(/\s+/g, '-').toLowerCase();
  933. let buttonName = "copyButton-" + button;
  934. return this[buttonName] = document.querySelector(".copy-" + button);
  935. })
  936. };
  937. View.prototype.createFieldset = function ({ title, id, score, status, category, type, options }) {
  938. return `<fieldset class="input-group">
  939. <legend>
  940. <span class="title">${title}</span> ${category === "Academic Integrity" ? "" : "<span class='score'><span data-id='" + id + "' class='current-score'>0</span> / " + score + "</span>"}
  941. </legend>
  942. ${type === "true false" ?
  943. `<div class="radio-group">
  944. <input type="radio" name="${id}" id="${id}-true" value="true">
  945. <label for="${id}-true">True</label>
  946. </div>
  947. <div class="radio-group">
  948. <input type="radio" name="${id}" id="${id}-false" value="false" checked>
  949. <label for="${id}-false">False</label>
  950. </div>` :
  951. `<div class="select-group">
  952. <select name="${id}" class="select-lg select2 narrow wrap">
  953. <option value="0" selected>Open this menu</option>
  954. ${options.map(option => `<option value="${option.score}">${option.score} - ${option.message}</option>`)}
  955. </select>
  956. </div>`
  957. }
  958. </fieldset>`;
  959. };
  960. View.prototype.createCard = function ({ title, subtitle, questions, score }) {
  961. return `<div class="card">
  962. <div class="card-header"><h2>${title}</h2> ${title !== "Academic Integrity" ? "<span class='cat-score'><span data-cat='" + title + "'>0</span> / " + score + "</span>" : ""}</div>
  963. ${subtitle ? `<h3>${subtitle}</h3>` : ""}
  964. ${questions.map(child => this.createFieldset(child)).join("")}
  965. </div>`;
  966. };
  967. View.prototype.createResults = function () {
  968. return `<div class="card">
  969. <h2>Recommended Grade: <span class="grade">F</span></h2>
  970. <h2 class="totals">Total: (0/100)</h2>
  971. <div class="d-none" role="alert">
  972. You've selected <strong>True</strong> for one of more Academic
  973. Integrity prompts and are advised to investigate plagiarism before
  974. issuing a grade.
  975. </div>
  976. <div class="summary" aria-label="summary">
  977. ${this.model.categories
  978. .filter(category => category.title !== "Academic Integrity")
  979. .map(category => {
  980. let score = category.score;
  981. let title = category.title;
  982. let catClass = title.replace(/\s+/g, '-').toLowerCase();
  983. return "<h2>" + title + "<span class='cat-score'><span data-res-cat='" + title + "'>0</span> / " + score + "</span></h2><pre class='" + catClass + "'>" + [...this.model.messages]
  984. .filter(messageObj => messageObj.category === category.title)
  985. .map(messageObj => `* ${messageObj.message}\n`)
  986. .join("") + "</pre><button class='copy copy-" + catClass + "'>Copy To Clipboard</button>"
  987. })
  988. .join("")}
  989. </div>
  990. <div class="btn-container">
  991. <button class="reset">Reset Form</button>
  992. </div>
  993. </div>`;
  994. };
  995. View.prototype.createHeader = function (title, isDarkMode = false) {
  996. return `<header>
  997. <h1>${title}</h1>
  998. <div class="switch-group">
  999. <input type="checkbox" name="dark-mode" id="dark-mode" ${isDarkMode ? "checked" : ""
  1000. }>
  1001. <label aria-label="dark mode" for="dark-mode" class="toggle">
  1002. </label>
  1003. </div>
  1004. </header>`;
  1005. };
  1006. View.prototype.generateHTML = function () {
  1007. this.wrapper = document.querySelector("#app");
  1008. if (this.model.isDarkMode) {
  1009. this.wrapper.classList.add("dark");
  1010. }
  1011. const survey = this.model.categories.reduce((final, current) => {
  1012. final += this.createCard(current);
  1013. return final;
  1014. }, "");
  1015. const results = this.createResults();
  1016. const header = this.createHeader(
  1017. this.model.title,
  1018. this.model.isDarkMode
  1019. );
  1020. this.wrapper.innerHTML = header + survey + results;
  1021. };
  1022. View.prototype.update = function () {
  1023. const roundedScore = Math.min(100, Math.ceil(this.model.score));
  1024. this.totals.textContent = `Total: (${roundedScore}/ 100)`;
  1025. const letterGrade = this.model.calcGrade();
  1026. this.grade.textContent = letterGrade;
  1027. if (this.model.hasFlags()) {
  1028. this.alert.classList.remove("d-none");
  1029. } else {
  1030. this.alert.classList.add("d-none");
  1031. }
  1032. if (this.model.isDarkMode) {
  1033. this.wrapper.classList.add("dark");
  1034. } else {
  1035. this.wrapper.classList.remove("dark");
  1036. }
  1037. this.model.categories
  1038. .filter(category => category.title !== "Academic Integrity")
  1039. .forEach(category => {
  1040. let catClass = category.title.replace(/\s+/g, '-').toLowerCase();
  1041. this[catClass + "-summary"].innerHTML = [...this.model.messages]
  1042. .filter(messageObj => messageObj.category === category.title)
  1043. .map(messageObj => `* ${messageObj.message}\n`)
  1044. .join("")
  1045. })
  1046. };
  1047. function Controller(model, view) {
  1048. this.model = model;
  1049. this.view = view;
  1050. this.addEventListeners();
  1051. }
  1052. Controller.prototype.addEventListeners = function () {
  1053. this.view.wrapper.addEventListener("change", event => {
  1054. const { target } = event;
  1055. if (target.name !== "dark-mode") {
  1056. if (!target.matches("input[type='radio']")) {
  1057. this.model.handleSelect(target);
  1058. } else {
  1059. this.model.toggleRadio(target);
  1060. }
  1061. }
  1062. this.view.update();
  1063. });
  1064. this.view.resetButton.addEventListener("click", () => {
  1065. this.model.initStorage();
  1066. this.view.radios.forEach(
  1067. radio => (radio.checked = radio.hasAttribute("checked"))
  1068. );
  1069. this.view.selects.forEach(
  1070. select => select.selectedIndex = null
  1071. )
  1072. this.model.questions
  1073. .filter(question => question.category !== "Academic Integrity")
  1074. .forEach(question => {
  1075. const id = question.id;
  1076. const questionScore = document.querySelector("span[data-id='" + id + "']");
  1077. questionScore.textContent = 0;
  1078. });
  1079. this.model.categories
  1080. .filter(category => category.title !== "Academic Integrity")
  1081. .forEach(category => {
  1082. const title = category.title
  1083. const categoryScore = document.querySelector("span[data-cat='" + title + "']");
  1084. const resultsCategoryScore = document.querySelector("span[data-res-cat='" + title + "']");
  1085. categoryScore.textContent = 0;
  1086. resultsCategoryScore.textContent = 0;
  1087. });
  1088. this.view.update();
  1089. window.scrollTo(0, 0);
  1090. });
  1091. this.model.categories
  1092. .filter(category => category.title !== "Academic Integrity")
  1093. .forEach(category => {
  1094. let title = category.title.replace(/\s+/g, '-').toLowerCase();
  1095. let buttonName = "copyButton-" + title;
  1096. let summaryName = title + "-summary";
  1097. this.view[buttonName].addEventListener("click", () => {
  1098. const selection = window.getSelection();
  1099. const range = document.createRange();
  1100. range.selectNodeContents(this.view[summaryName]);
  1101. selection.removeAllRanges();
  1102. selection.addRange(range);
  1103. document.execCommand("copy");
  1104. });
  1105. });
  1106. this.view.darkModeToggle.addEventListener("change", () => {
  1107. this.model.toggleDarkMode();
  1108. this.view.update();
  1109. });
  1110. };
  1111. function App(Model, View, Controller) {
  1112. this.model = new Model();
  1113. this.view = new View(this.model);
  1114. this.controller = new Controller(this.model, this.view);
  1115. }
  1116. return new App(Model, View, Controller);
  1117. })(window);
  1118. </script>
  1119. </body>
  1120. </html>