mod19.html 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346
  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 19 PWA 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 = `Module 19 PWA Challenge Rubric (Coding)`;
  458. this.categories = [
  459. {
  460. title: "Technical Acceptance Criteria",
  461. subtitle: null,
  462. solution: null,
  463. previewText: null,
  464. score: 0,
  465. questions: [
  466. {
  467. title: "Application uses IndexedDB to create an object store and includes both GET and PUT methods",
  468. score: 5,
  469. type: "likert",
  470. options: [
  471. {
  472. message: "The application does not use IndexedDB",
  473. score: 0
  474. },
  475. {
  476. message: "Application uses IndexedDB to create an object store, but doesn't include GET or PUT methods",
  477. score: 1
  478. },
  479. {
  480. message: "Application uses IndexedDB to create an object store, but only includes one of the 2 following: a GET or PUT method",
  481. score: 3
  482. },
  483. {
  484. message: "Application uses IndexedDB to create an object store and includes both GET and PUT methods",
  485. score: 5
  486. }
  487. ],
  488. message: "",
  489. status: false
  490. },
  491. {
  492. title: "The application works without an internet connection",
  493. score: 5,
  494. type: "true false",
  495. message: "The application does not work without an internet connection",
  496. status: false
  497. },
  498. {
  499. title: "Application automatically saves the content in the text editor when the DOM window is unfocused",
  500. score: 5,
  501. type: "true false",
  502. message: "Content in the text editor content is not saved when the DOM window is unfocused",
  503. status: false
  504. },
  505. {
  506. title: "The application is bundled with webpack",
  507. score: 5,
  508. type: "true false",
  509. message: "The application is not bundled using webpack",
  510. status: false
  511. },
  512. {
  513. title: "The application creates a service worker with workbox that caches static assets",
  514. score: 5,
  515. type: "likert",
  516. options: [
  517. {
  518. message: "The application does not register a service worker with workbox that caches static assets",
  519. score: 0
  520. },
  521. {
  522. message: "The application creates a service worker with workbox, but it does not cache static assets",
  523. score: 2
  524. },
  525. {
  526. message: "The application creates a service worker with workbox that caches static assets",
  527. score: 5
  528. }
  529. ],
  530. message: "",
  531. status: false
  532. },
  533. {
  534. title: "The application uses Babel to use async/await",
  535. score: 5,
  536. type: "true false",
  537. message: "The application does not use Babel to use async/await",
  538. status: false
  539. },
  540. {
  541. title: "Application has a manifest.json generated using the WebpackPwaManifest plug-in",
  542. score: 5,
  543. type: "true false",
  544. message: "The application does not have a manifest.json",
  545. status: false
  546. },
  547. {
  548. title: "Application can be installed as a Progressive Web Application",
  549. score: 5,
  550. type: "true false",
  551. message: "Application cannot be installed as a Progressive Web Application",
  552. status: false
  553. }
  554. ]
  555. },
  556. {
  557. title: "Deployment",
  558. subtitle: null,
  559. solution: null,
  560. previewText: null,
  561. score: 0,
  562. questions: [
  563. {
  564. title: "Application deployed to Heroku at live URL with build scripts",
  565. score: 8,
  566. type: "true false",
  567. message: "Application isn't deployed and doesn't have build scripts",
  568. status: false
  569. },
  570. {
  571. title: "Application loads with no errors",
  572. score: 8,
  573. type: "true false",
  574. message: "Application isn't deployed",
  575. status: false
  576. },
  577. {
  578. title: "Application GitHub URL submitted",
  579. score: 8,
  580. type: "true false",
  581. message: "Missing GitHub submission URL",
  582. status: false
  583. },
  584. {
  585. title: "GitHub repo contains application code",
  586. score: 8,
  587. type: "true false",
  588. message: "GitHub repo is empty",
  589. status: false
  590. }
  591. ]
  592. },
  593. {
  594. title: "Application Quality",
  595. subtitle: null,
  596. score: 0,
  597. questions: [
  598. {
  599. title: "Application user experience is intuitive and easy to navigate",
  600. score: 5,
  601. type: "likert",
  602. options: [
  603. {
  604. message: "Application user experience is not intuitive and easy to navigate",
  605. score: 0
  606. },
  607. {
  608. message: "Application user experience could be much more intuitive and easy to navigate",
  609. score: 2
  610. },
  611. {
  612. message: "Application user experience could be a lot more intuitive and easy to navigate",
  613. score: 4
  614. },
  615. {
  616. message: "Application user experience is intuitive and easy to navigate",
  617. score: 5
  618. }
  619. ],
  620. message: "",
  621. status: false
  622. },
  623. {
  624. title: "Application user interface style is clean and polished",
  625. score: 5,
  626. type: "likert",
  627. options: [
  628. {
  629. message: "Application user interface is not clean and polished",
  630. score: 0
  631. },
  632. {
  633. message: "Application user interface could be much better",
  634. score: 2
  635. },
  636. {
  637. message: "Application user interface could be a bit better",
  638. score: 4
  639. },
  640. {
  641. message: "Application user interface style is clean and polished",
  642. score: 5
  643. }
  644. ],
  645. message: "",
  646. status: false
  647. },
  648. {
  649. title: "Application resembles the mock-up functionality provided in Challenge instructions",
  650. score: 5,
  651. type: "likert",
  652. options: [
  653. {
  654. message: "Application doesn't resemble the mock-up functionality provided in Challenge instructions",
  655. score: 0
  656. },
  657. {
  658. message: "Application could resemble mock-up functionality provided with Challenge instructions much more closely",
  659. score: 2
  660. },
  661. {
  662. message: "Application could resemble mock-up functionality provided with Challenge instructions a bit more closely",
  663. score: 4
  664. },
  665. {
  666. message: "Application resembles the mock-up functionality provided in Challenge instructions",
  667. score: 5
  668. }
  669. ],
  670. message: "",
  671. status: false
  672. }
  673. ]
  674. },
  675. {
  676. title: "Repository Quality",
  677. subtitle: null,
  678. score: 0,
  679. questions: [
  680. {
  681. title: "Repository has a unique name",
  682. score: 2,
  683. type: "true false",
  684. message: "Repo doesn't have a unique name",
  685. status: false
  686. },
  687. {
  688. title:
  689. "Repository follows best practices for file structure and naming conventions",
  690. score: 2,
  691. type: "true false",
  692. message:
  693. "Code doesn't follow recommended file/folder structure",
  694. status: false
  695. },
  696. {
  697. title:
  698. "Repository follows best practices for class/id naming conventions, indentation, quality comments, etc.",
  699. score: 2,
  700. type: "true false",
  701. message:
  702. "Code doesn't follow good practices for class/id names, indentation, lacks quality comments",
  703. status: false
  704. },
  705. {
  706. title:
  707. "Repository contains multiple descriptive commit messages",
  708. score: 2,
  709. type: "true false",
  710. message:
  711. "Repo doesn't contain multiple descriptive commit messages",
  712. status: false
  713. },
  714. {
  715. title: "Repository contains quality README with description, screenshot, link to deployed application",
  716. score: 5,
  717. type: "likert",
  718. options: [
  719. {
  720. message: "Repo doesn't include a high quality README with screenshots, a description, link to deployed application",
  721. score: 0
  722. },
  723. {
  724. message: "Repository README is missing 2 of the following: description, screenshot, or link to deployed application",
  725. score: 2
  726. },
  727. {
  728. message: "Repository README is missing 1 of the following: description, screenshot, or link to deployed application",
  729. score: 4
  730. },
  731. {
  732. message: "Repository contains quality README with description, screenshot, link to deployed application",
  733. score: 5
  734. }
  735. ],
  736. message: "",
  737. status: false
  738. }
  739. ]
  740. },
  741. {
  742. title: "Academic Integrity",
  743. 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.",
  744. solution: null,
  745. previewText: null,
  746. score: null,
  747. questions: [
  748. {
  749. title: "Application contains a low number of commits",
  750. score: 0,
  751. type: "true false",
  752. message: null,
  753. status: false
  754. },
  755. {
  756. title: "Application codebase appears advanced for the student, at this point in the course, or in general",
  757. score: 0,
  758. type: "true false",
  759. message: null,
  760. status: false
  761. },
  762. {
  763. title: "Application package.json file references a different author and/or repository",
  764. score: 0,
  765. type: "true false",
  766. message: null,
  767. status: false
  768. },
  769. {
  770. title: "Application package.json file references much older versions of npm packages",
  771. score: 0,
  772. type: "true false",
  773. message: null,
  774. status: false
  775. }
  776. ]
  777. }
  778. ];
  779. this.initStorage();
  780. }
  781. Model.prototype.initStorage = function() {
  782. this.score = 0;
  783. this.questions = [];
  784. this.messages = new Set();
  785. this.flagged = new Set();
  786. this.isDarkMode =
  787. JSON.parse(localStorage.getItem("isDarkMode")) || false;
  788. this.categories
  789. .forEach(category => {
  790. category.score = 0;
  791. category.questions.forEach(question => {
  792. question.category = category.title;
  793. question.status = false;
  794. question.id = this.questions.length;
  795. question.flagged = category.title === "Academic Integrity";
  796. question.bonus = category.title === "Bonus";
  797. if (question.type === "likert") {
  798. question.message = question.options[0].message.split(" - ").pop();
  799. };
  800. let messageObj = {
  801. message : question.message,
  802. category : question.category
  803. };
  804. question.message && !question.bonus && this.messages.add(messageObj);
  805. this.questions.push(question);
  806. category.score += question.score;
  807. });
  808. });
  809. };
  810. Model.prototype.toggleDarkMode = function() {
  811. this.isDarkMode = !this.isDarkMode;
  812. localStorage.setItem("isDarkMode", this.isDarkMode);
  813. };
  814. Model.prototype.toggleRadio = function(radio) {
  815. const id = Number(radio.getAttribute("name"));
  816. const question = this.questions[id];
  817. const questionScore = document.querySelector("span[data-id='" + id + "']");
  818. const category = question.category;
  819. const categoryScore = document.querySelector("span[data-cat='" + category.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, '-').toLowerCase() + "']");
  820. const resultsCategoryScore = document.querySelector("span[data-res-cat='" + category.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, '-').toLowerCase() + "']");
  821. question.status = !question.status;
  822. if (question.status === true) {
  823. if (!question.bonus) {
  824. this.messages.forEach(message => {
  825. if (message.message === question.message) {
  826. this.messages.delete(message);
  827. }
  828. })
  829. } else {
  830. let messageObj = {
  831. message : question.message,
  832. category : category
  833. }
  834. this.messages.add(messageObj);
  835. }
  836. this.score += question.score;
  837. if (question.flagged) {
  838. this.flagged.add(question.id);
  839. }
  840. } else {
  841. if (question.flagged) {
  842. this.flagged.delete(question.id);
  843. }
  844. if (!question.bonus) {
  845. if (question.message) {
  846. let messageObj = {
  847. message: question.message,
  848. category: category
  849. }
  850. this.messages.add(messageObj);
  851. }
  852. } else {
  853. this.messages.forEach(message => {
  854. if (message.message === question.message) {
  855. this.messages.delete(message);
  856. }
  857. })
  858. }
  859. this.score -= question.score;
  860. }
  861. if (category !== "Academic Integrity") {
  862. if (question.status) {
  863. questionScore.textContent = question.score;
  864. } else {
  865. questionScore.textContent = 0;
  866. }
  867. const catQuestions = this.categories.filter(cat => cat.title === category)[0].questions;
  868. let categoryTotal = 0;
  869. catQuestions.forEach(question => {
  870. if (question.type === "true false") {
  871. if (question.status) {
  872. categoryTotal += question.score;
  873. }
  874. } else {
  875. let score = document.querySelector("select[name='" + question.id + "']").value;
  876. categoryTotal += parseInt(score);
  877. }
  878. })
  879. categoryScore.textContent = categoryTotal;
  880. resultsCategoryScore.textContent = categoryTotal;
  881. }
  882. };
  883. Model.prototype.handleSelect = function (select) {
  884. const id = Number(select.getAttribute("name"));
  885. const question = this.questions[id];
  886. const questionScore = document.querySelector("span[data-id='" + id + "']");
  887. const oldScore = questionScore.textContent;
  888. const category = question.category;
  889. const categoryScore = document.querySelector("span[data-cat='" + category.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, '-').toLowerCase() + "']");
  890. const resultsCategoryScore = document.querySelector("span[data-res-cat='" + category.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, '-').toLowerCase() + "']");
  891. let newMessage = select.selectedOptions[0].text.split(" - ").pop();
  892. if (newMessage === "Open this menu") {
  893. newMessage = select[1].text.split(" - ").pop();
  894. };
  895. if (question.type === "likert") {
  896. this.messages.forEach(item => {
  897. if (item.message === question.message) {
  898. this.messages.delete(item)
  899. }
  900. })
  901. question.message = newMessage;
  902. let messageObj = {
  903. message: newMessage,
  904. category: category
  905. }
  906. this.messages.add(messageObj);
  907. };
  908. this.score -= parseInt(oldScore);
  909. this.score += parseInt(select.value);
  910. questionScore.textContent = select.value;
  911. const catQuestions = this.categories.filter(cat => cat.title === category)[0].questions;
  912. let categoryTotal = 0;
  913. catQuestions.forEach(question => {
  914. if (question.type === "true false") {
  915. if (question.status) {
  916. categoryTotal += question.score;
  917. }
  918. } else {
  919. let score = document.querySelector("select[name='" + question.id + "']").value;
  920. categoryTotal += parseInt(score);
  921. }
  922. })
  923. categoryScore.textContent = categoryTotal;
  924. resultsCategoryScore.textContent = categoryTotal;
  925. };
  926. Model.prototype.calcGrade = function() {
  927. const roundedScore = Math.min(100, Math.ceil(this.score));
  928. let letterGrade = "";
  929. if (roundedScore >= 99.5) {
  930. letterGrade = "A+";
  931. } else if (roundedScore >= 94.5 && roundedScore <= 99.4) {
  932. letterGrade = "A";
  933. } else if (roundedScore >= 91.5 && roundedScore <= 94.4) {
  934. letterGrade = "A-";
  935. } else if (roundedScore >= 87.5 && roundedScore <= 91.4) {
  936. letterGrade = "B+";
  937. } else if (roundedScore >= 84.5 && roundedScore <= 87.4) {
  938. letterGrade = "B";
  939. } else if (roundedScore >= 81.5 && roundedScore <= 84.4) {
  940. letterGrade = "B-";
  941. } else if (roundedScore >= 77.5 && roundedScore <= 81.4) {
  942. letterGrade = "C+";
  943. } else if (roundedScore >= 74.5 && roundedScore <= 77.4) {
  944. letterGrade = "C";
  945. } else if (roundedScore >= 71.5 && roundedScore <= 74.4) {
  946. letterGrade = "C-";
  947. } else if (roundedScore >= 69.5 && roundedScore <= 71.4) {
  948. letterGrade = "D+";
  949. } else if (roundedScore >= 64.5 && roundedScore <= 69.4) {
  950. letterGrade = "D";
  951. } else if (roundedScore >= 61.5 && roundedScore <= 64.4) {
  952. letterGrade = "D-";
  953. } else {
  954. letterGrade = "F";
  955. }
  956. return letterGrade;
  957. };
  958. Model.prototype.hasFlags = function() {
  959. return this.flagged.size > 0;
  960. };
  961. function View(model) {
  962. this.model = model;
  963. this.generateHTML();
  964. this.cacheDom();
  965. }
  966. View.prototype.cacheDom = function() {
  967. this.darkModeToggle = document.querySelector("#dark-mode");
  968. this.radios = Array.from(
  969. document.querySelectorAll("input[type='radio']")
  970. );
  971. this.selects = Array.from(
  972. document.querySelectorAll("select")
  973. );
  974. this.totals = document.querySelector(".totals");
  975. this.grade = document.querySelector(".grade");
  976. this.alert = document.querySelector("div[role='alert']");
  977. this.summaryHeading = document.querySelector(".summary-heading");
  978. this.summary = document.querySelector(".summary");
  979. this.model.categories
  980. .filter(category => category.title !== "Academic Integrity")
  981. .map(category => {
  982. let summary = category.title.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, '-').toLowerCase();
  983. let summaryName = summary + "-summary";
  984. return this[summaryName] = document.querySelector("." + summary);
  985. })
  986. this.resetButton = document.querySelector(".reset");
  987. this.model.categories
  988. .filter(category => category.title !== "Academic Integrity")
  989. .map(category => {
  990. let button = category.title.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, '-').toLowerCase();
  991. let buttonName = "copyButton-" + button;
  992. return this[buttonName] = document.querySelector(".copy-" + button);
  993. })
  994. };
  995. View.prototype.createFieldset = function({ title, id, score, status, category, type, options }) {
  996. return `<fieldset class="input-group">
  997. <legend>
  998. <span class="title">${title}</span> ${category === "Academic Integrity" ? "" : "<span class='score'><span data-id='" + id + "' class='current-score'>0</span> / " + score + "</span>"}
  999. </legend>
  1000. ${type === "true false" ?
  1001. `<div class="radio-group">
  1002. <input type="radio" name="${id}" id="${id}-true" value="true">
  1003. <label for="${id}-true">True</label>
  1004. </div>
  1005. <div class="radio-group">
  1006. <input type="radio" name="${id}" id="${id}-false" value="false" checked>
  1007. <label for="${id}-false">False</label>
  1008. </div>` :
  1009. `<div class="select-group">
  1010. <select name="${id}" class="select-lg select2 narrow wrap">
  1011. <option value="0" selected>Open this menu</option>
  1012. ${options.map(option => `<option value="${option.score}">${option.score} - ${option.message}</option>`)}
  1013. </select>
  1014. </div>`
  1015. }
  1016. </fieldset>`;
  1017. };
  1018. View.prototype.createCard = function({ title, subtitle, solution, previewText, questions, score }) {
  1019. return `<div class="card">
  1020. <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>
  1021. ${subtitle ? `<h3>${subtitle}</h3>` : ""}
  1022. ${solution ? `<h3 class="solution">Solution: <a href=${solution} target="_blank" rel="noopener noreferrer">${previewText !== null ? previewText : solution}</a></h3>` : ""}
  1023. ${questions.map(child => this.createFieldset(child)).join("")}
  1024. </div>`;
  1025. };
  1026. View.prototype.createResults = function() {
  1027. return `<div class="card">
  1028. <h2>Recommended Grade: <span class="grade">F</span></h2>
  1029. <h2 class="totals">Total: (0/100)</h2>
  1030. <div class="d-none" role="alert">
  1031. You've selected <strong>True</strong> for one of more Academic
  1032. Integrity prompts and are advised to investigate plagiarism before
  1033. issuing a grade.
  1034. </div>
  1035. <div class="summary" aria-label="summary">
  1036. ${this.model.categories
  1037. .filter(category => category.title !== "Academic Integrity")
  1038. .map(category => {
  1039. let score = category.score;
  1040. let title = category.title;
  1041. let catClass = title.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, '-').toLowerCase();
  1042. 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]
  1043. .filter(messageObj => messageObj.category === category.title)
  1044. .map(messageObj => `* ${messageObj.message}\n`)
  1045. .join("") + "</pre><button class='copy copy-" + catClass + "'>Copy To Clipboard</button>"
  1046. })
  1047. .join("")}
  1048. </div>
  1049. <div class="btn-container">
  1050. <button class="reset">Reset Form</button>
  1051. </div>
  1052. </div>`;
  1053. };
  1054. View.prototype.createHeader = function(title, isDarkMode = false) {
  1055. return `<header>
  1056. <h1>${title}</h1>
  1057. <div class="switch-group">
  1058. <input type="checkbox" name="dark-mode" id="dark-mode" ${
  1059. isDarkMode ? "checked" : ""
  1060. }>
  1061. <label aria-label="dark mode" for="dark-mode" class="toggle">
  1062. </label>
  1063. </div>
  1064. </header>`;
  1065. };
  1066. View.prototype.generateHTML = function() {
  1067. this.wrapper = document.querySelector("#app");
  1068. if (this.model.isDarkMode) {
  1069. this.wrapper.classList.add("dark");
  1070. }
  1071. const survey = this.model.categories.reduce((final, current) => {
  1072. final += this.createCard(current);
  1073. return final;
  1074. }, "");
  1075. const results = this.createResults();
  1076. const header = this.createHeader(
  1077. this.model.title,
  1078. this.model.isDarkMode
  1079. );
  1080. this.wrapper.innerHTML = header + survey + results;
  1081. };
  1082. View.prototype.update = function() {
  1083. const roundedScore = Math.min(100, Math.ceil(this.model.score));
  1084. this.totals.textContent = `Total: (${roundedScore}/ 100)`;
  1085. const letterGrade = this.model.calcGrade();
  1086. this.grade.textContent = letterGrade;
  1087. if (this.model.hasFlags()) {
  1088. this.alert.classList.remove("d-none");
  1089. } else {
  1090. this.alert.classList.add("d-none");
  1091. }
  1092. if (this.model.isDarkMode) {
  1093. this.wrapper.classList.add("dark");
  1094. } else {
  1095. this.wrapper.classList.remove("dark");
  1096. }
  1097. this.model.categories
  1098. .filter(category => category.title !== "Academic Integrity")
  1099. .forEach(category => {
  1100. let catClass = category.title.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, '-').toLowerCase();
  1101. this[catClass + "-summary"].innerHTML = [...this.model.messages]
  1102. .filter(messageObj => messageObj.category === category.title)
  1103. .map(messageObj => `* ${messageObj.message}\n`)
  1104. .join("")
  1105. })
  1106. };
  1107. function Controller(model, view) {
  1108. this.model = model;
  1109. this.view = view;
  1110. this.addEventListeners();
  1111. }
  1112. Controller.prototype.addEventListeners = function() {
  1113. this.view.wrapper.addEventListener("change", event => {
  1114. const { target } = event;
  1115. if (target.name !== "dark-mode") {
  1116. if (!target.matches("input[type='radio']")) {
  1117. this.model.handleSelect(target);
  1118. } else {
  1119. this.model.toggleRadio(target);
  1120. }
  1121. }
  1122. this.view.update();
  1123. });
  1124. this.view.resetButton.addEventListener("click", () => {
  1125. this.model.initStorage();
  1126. this.view.radios.forEach(
  1127. radio => (radio.checked = radio.hasAttribute("checked"))
  1128. );
  1129. this.view.selects.forEach(
  1130. select => select.selectedIndex = null
  1131. )
  1132. this.model.questions
  1133. .filter(question => question.category !== "Academic Integrity")
  1134. .forEach(question => {
  1135. const id = question.id;
  1136. const questionScore = document.querySelector("span[data-id='" + id + "']");
  1137. questionScore.textContent = 0;
  1138. });
  1139. this.model.categories
  1140. .filter(category => category.title !== "Academic Integrity")
  1141. .forEach(category => {
  1142. const title = category.title
  1143. const categoryScore = document.querySelector("span[data-cat='" + title.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, '-').toLowerCase() + "']");
  1144. const resultsCategoryScore = document.querySelector("span[data-res-cat='" + title.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, '-').toLowerCase() + "']");
  1145. categoryScore.textContent = 0;
  1146. resultsCategoryScore.textContent = 0;
  1147. });
  1148. this.view.update();
  1149. window.scrollTo(0, 0);
  1150. });
  1151. this.model.categories
  1152. .filter(category => category.title !== "Academic Integrity")
  1153. .forEach(category => {
  1154. let title = category.title.replace(/[^a-zA-Z0-9 ]/g, '').replace(/\s+/g, '-').toLowerCase();
  1155. let buttonName = "copyButton-" + title;
  1156. let summaryName = title + "-summary";
  1157. this.view[buttonName].addEventListener("click", () => {
  1158. const selection = window.getSelection();
  1159. const range = document.createRange();
  1160. range.selectNodeContents(this.view[summaryName]);
  1161. selection.removeAllRanges();
  1162. selection.addRange(range);
  1163. document.execCommand("copy");
  1164. });
  1165. });
  1166. this.view.darkModeToggle.addEventListener("change", () => {
  1167. this.model.toggleDarkMode();
  1168. this.view.update();
  1169. });
  1170. };
  1171. function App(Model, View, Controller) {
  1172. this.model = new Model();
  1173. this.view = new View(this.model);
  1174. this.controller = new Controller(this.model, this.view);
  1175. }
  1176. return new App(Model, View, Controller);
  1177. })(window);
  1178. </script>
  1179. </body>
  1180. </html>