mod10.html 39 KB

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