From 99d49adac1843366b72168dfc232ef348fe57769 Mon Sep 17 00:00:00 2001 From: Jim Cramer Date: Sun, 27 May 2018 10:57:24 +0200 Subject: [PATCH 1/6] preparation for homework as PR --- .gitignore | 61 +++++++++ .vscode/settings.json | 8 +- LICENSE | 3 + README.md | 4 +- Week1/MAKEME.md | 210 ++++++++++++++++++++++-------- Week1/assets/hyf-github-error.png | Bin 0 -> 10721 bytes Week2/MAKEME.md | 36 ++++- Week3/MAKEME.md | 200 ++++++++++++---------------- Week3/README.md | 5 + homework/.eslintrc | 47 +++++++ homework/src/App.js | 72 ++++++++++ homework/src/Contributor.js | 18 +++ homework/src/Repository.js | 34 +++++ homework/src/Util.js | 35 +++++ homework/src/hyf.png | Bin 0 -> 6971 bytes homework/src/index.html | 23 ++++ homework/src/index.js | 47 +++++++ homework/src/style.css | 3 + termp.html | 5 + 19 files changed, 632 insertions(+), 179 deletions(-) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 Week1/assets/hyf-github-error.png create mode 100644 homework/.eslintrc create mode 100644 homework/src/App.js create mode 100644 homework/src/Contributor.js create mode 100644 homework/src/Repository.js create mode 100644 homework/src/Util.js create mode 100644 homework/src/hyf.png create mode 100644 homework/src/index.html create mode 100644 homework/src/index.js create mode 100644 homework/src/style.css create mode 100644 termp.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..6c589c2f8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,61 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +.netlify +dist/ diff --git a/.vscode/settings.json b/.vscode/settings.json index 6e2e53564..f7a55df12 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,10 @@ { + "editor.formatOnSave": true, + "editor.formatOnType": true, + "editor.formatOnPaste": true, + "editor.detectIndentation": false, + "editor.tabSize": 2, "cSpell.words": [ - "orgs", - "repos" + "tabindex" ] } \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..79285a5eb --- /dev/null +++ b/LICENSE @@ -0,0 +1,3 @@ +This work is licensed under the Creative Commons Attribution 4.0 International License. +To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ +or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. \ No newline at end of file diff --git a/README.md b/README.md index 0f0f7e9b1..c6d11c65a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Here you can find course content and homework for the JavaScript3 modules |----|-----|----|--------| |1.|• Structure for a basic SPA (Single Page Application)
• [XMLHttpRequests](../../../fundamentals/blob/master/fundamentals/XMLHttpRequest.md)
• API calls|[Reading Week 1](/Week1/README.md)|[Homework Week 1](/Week1/MAKEME.md)| |2.|• [Event Loop (order of execution)](../../../fundamentals/blob/master/fundamentals/event_loop.md)
• [Promises](../../../fundamentals/blob/master/fundamentals/promises.md)|[Reading Week 2](/Week2/README.md)|[Homework Week 2](/Week2/MAKEME.md)| -|3.|• [try...catch](../../../fundamentals/blob/master/fundamentals/try_catch.md)
• [async/await](../../../fundamentals/blob/master/fundamentals/async_await.md)
• [Object Oriented Programming and ES6 Classes](../../../fundamentals/blob/master/fundamentals/oop_classes.md)
• [The `this` keyword](../../../fundamentals/blob/master/fundamentals/this.md)
• call, apply, bind |[Reading Week 3](/Week3/README.md)|[Homework Week 3](/Week3/MAKEME.md)| +|3.|• [try...catch](../../../fundamentals/blob/master/fundamentals/try_catch.md)
• [async/await](../../../fundamentals/blob/master/fundamentals/async_await.md)
• [The `this` keyword](../../../fundamentals/blob/master/fundamentals/this.md)
• call, apply, bind
• [Object Oriented Programming and ES6 Classes](../../../fundamentals/blob/master/fundamentals/oop_classes.md)|[Reading Week 3](/Week3/README.md)|[Homework Week 3](/Week3/MAKEME.md)| __Kind note:__ @@ -18,3 +18,5 @@ We expect you to __always__ come prepared to the class on Sunday. A good understanding of all the above mentioned topics. Want to check your Knowledge? Go through the [JavaScript Fundamentals README](../../../fundamentals/blob/master/README.md) and research/ ask for help (Slack!) with the concepts that are not entirely clear. *The HackYourFuture curriculum is subject to CC BY copyright. This means you can freely use our materials, but just make sure to give us credit for it :)* + +Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/Week1/MAKEME.md b/Week1/MAKEME.md index a1c527078..4e90abaa9 100644 --- a/Week1/MAKEME.md +++ b/Week1/MAKEME.md @@ -7,108 +7,212 @@ Topics discussed this week: • API calls ``` - >[Here](/Week3/README.md) you find the readings you have to complete before the ninth lecture. ## Step 1: Feedback -_Deadline Monday_ - -Please provide feedback in an issue. - -_Deadline Monday_ +**_Deadline Monday_** -## Step 2: FINISH ALL YOUR JAVASCRIPT HOMEWORK +Please provide feedback on last week's homework from a fellow student as a GitHub issue. -_Deadline Saturday_ +## Step 2: Single Page Application :sweat_drops: -:point_up: +**_Deadline Thursday_** -## Step 3: SPA :sweat_drops: +_This homework is more extensive and challenging than previous homework! Please read the instructions below carefully and follow them precisely. Start this homework as soon as you can and allow time for discussion and questions (slack!)._ -_Deadline Saturday_ +### 2.1 Introduction -You are going to write a SPA (Single Page Application) that uses the [GitHub API](https://developer.github.com/guides/getting-started/). +You are going to write a _Single Page Application_ (SPA) that uses the [GitHub API](https://developer.github.com/guides/getting-started/). -This application should display information about the available [HYF repositories](https://github.com/hackyourfuture): +This application should display information about the available [HYF GitHub repositories](https://github.com/hackyourfuture): - You should be able to select a repository from a list of available repositories. - The application should display high-level information about the selected repository and show a list of its contributors. +- When clicking on the name of the selected repository the GitHub page for the corresponding repository should be opened in a new browser tab. +- When clicking on a contributor, the GitHub page for the contributor should be opened in a new browser tab. Figure 1 below shows an example of what your application could look like. Note that this is just an example. If you find it boring or unimaginative, please improve on it! On the other hand, a simpler version is OK too, so long as you implement the expected functionality. ![UI Example](./assets/hyf-github.png) -Figure 1. Example User Interface using [Material Design](https://material.io/guidelines/) principles. +Figure 1. Example User Interface using [Material Design](https://material.io/guidelines/) principles. -### Instructions +A live version of this application can be found here: http://hyf-github.netlify.com/ -1. Create this application in the `week1` folder of your `hyf-javascript1` repo. Your application should at minimum consist of the files `index.html`, `style.css` and `app.js`. -2. Your `index.html` file should load the `style.css` and `app.js` files, using the appropriate HTML tags. -3. The `body` of your `index.html` should contain a single `div` element like this: `
`. -4. All other HTML elements should be generated programmatically by your `app.js` file and ultimately be hanging off the root `div` element. -5. Implement the repository selection list by means of an HTML [\](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select) element. +### 2.2 The GitHub API -You will need to use XMLHttpRequests against the GitHub API to get the relevant information. The GitHub API documentation is very extensive. An overview is given [here](https://developer.github.com/v3/) but we will point you to the relevant sections in the documentation needed for this assignment. +#### 2.2.1 Get a list of HYF repositories -#### List of repositories - -You can obtain a list of HYF repositories through this API endpoint ([What is an API Endpoint?](https://teamtreehouse.com/community/what-is-an-api-endpoint)): +You can fetch a list of HYF repositories through this API endpoint ([What is an API Endpoint?](https://teamtreehouse.com/community/what-is-an-api-endpoint)): ``` https://api.github.com/orgs/HackYourFuture/repos?per_page=100 ``` -GitHub API documentation: [List organization repositories](https://developer.github.com/v3/repos/#list-organization-repositories) +If you open this URL in the browser (_try it!_) you will receive JSON data about the available HYF repositories. This is the data that you will need to work with in this assignment. + +Note the query string `?per_page=100` in the above URL. If you don't specify this query string you will only get the first 30 repositories (the default `per_page` is 30). HackYourFuture has more than 30 repositories but less than 100. + +The returned JSON data contains some basic information about each repository, such as `name`, `full_name`, `description` etc. There are also many properties that contain URLs to obtain detail information about certain aspects of the repository. + +#### 2.2.2 Get contributor information for a repository + +The JSON data that is returned from the initial request to get repository information includes a property named `contributors_url`. Use the value of this property to fetch a list of contributors. + +#### 2.2.3 GitHub API documentation + +You can find detailed information about the GitHub API by means of the link listed below. However, the documentation is very extensive and not easy to digest. For this homework it is not necessary to study the GitHub API documentation. We provide the link here for completeness. + +> GitHub API documentation: https://developer.github.com/v3/ + +### 2.3 Preparation + +You will be working on this same application during the next three weeks. For each week you will need to create a new Git branch, as listed in the Table 1 below. + +| Week | Branch | Assignment | +|:----:|--------|------------| +| 1 | `week1` | Create a basic application using callbacks to handle network requests. | +| 2 | `week2` | 1. Refactor the callbacks to promises.
2. Make the UI responsive.| +| 3 | `week3` | 1. Refactor the application to use ES6 Classes and async/await.
2. Make the app ARIA-compliant. | + +Table 1. Homework schedule + +**Instructions** + +1. Fork the JavaScript3 repository (_this repository_) to your own GitHub account. +2. Clone the fork to your laptop. +3. Open the `homework` folder inside the cloned repository in VSCode. +4. Create a new branch for the week 1 homework with the following command: + + ``` + git checkout -b week1 + ``` + +### 2.4 Code Overview + +The files that make up the application are located in the `src` folder. It contains the following files: + +| Filename | Description | +|------------------|-------------| +| ~~`App.js`~~ | Not used in week 1 and 2. | +| ~~`Contributor.js`~~ | Not used in week 1 and 2. | +| `hyf.png` | Contains the HackYourFuture logo. | +| `index.html` | The application's HTML file. | +| `index.js` | A starter JavaScript file. | +| ~~`Repository.js`~~ | Not used in week 1 and 2. | +| `style.css` | A starter CSS file. | +| ~~`Util.js`~~ | Not used in week 1 and 2. | + +In week 1, you should only modify `index.js` and `style.css`. + +_**Do not modify any other files at this time!**_ -Note the query string `?per_page=100`. If you don't specify this query string you will only get the first 30 repositories (the default `per_page` is 30 and HYF has more than 30 - but less than 100). +#### 2.4.1 A first examination -#### Get contributor information +1. Open `index.html` and examine its contents (but don't modify anything). Notice that the HTML `body` looks like this: -The response object that is returned by GitHub from the request to get repository information includes a property with the `contributors_url`. Use the value of this property to make a new request to GitHub to obtain a list of contributors. + ```html + +
+ + + ``` -In the lecture we developed some utility functions to simplify making XMLHttpRequests (function `fetchJSON()`) and creating and manipulating HTML elements (function `createAndAppend()`). You are free to copy and use these utility functions, but if you do we expect that you can explain how they work. + The `body` tag contains a single `div` to which you will need to dynamically append HTML elements through your JavaScript code in `index.js`. -### Refinements +2. Open `index.js`. This file contains a starter set of code for you to expand. It contains the following three functions: -- Make all the repositories link to their own page in GitHub. Use the value of the key: `name` to make this work (hint: GitHub urls always look like this https://api.github.com/repos/HackYourFuture/[repositoryName] where [repositoryName] would be replaced by the actual `name` of the repository, for example `CommandLine`). -- Make sure the link opens in a new tab. + | Function | Description | + |----------|-------------| + | `fetchJSON` | Uses `XMLHttpRequest` to fetch JSON data from an API end point. This function uses an asynchronous callback. | + | `createAndAppend` | A utility function for easily creating and appending HTML elements. | + | `main` | Contains the start-up code for the application. | + + `index.js` also contains a constant with the URL for the HYF repositories as listed in section 2.2.1: -### Important + ```js + const HYF_REPOS_URL = 'https://api.github.com/orgs/HackYourFuture/repos?per_page=100'; + ``` -- Do not duplicate code! This is especially important for making requests since we are making multiple ones with different urls and we want to do different actions based on the call we are making. Here are some handles to get you started: - - Write a function called `fetchJSON` (or copy from the lecture code) which accepts (at least) the following parameters: `url` and `callback`. - - Make sure your `callback` is called when the request errors or when it sends a response (look at the documentation) - - Your `callback` functions should accept two parameters so it can handle both errors: `err` and `response`. - So when a user selects a repository from the list you want to call `fetchJSON` with a different `url` and supply it with a function that handles both errors (display an error message to the user for example) and responses (render it correctly as HTML elements in your page). -- When the user changes the selected repository, any existing repository information in your page should be cleared before displaying the new information. -- Make your functions small and reusable (modular)! That means create separate functions to handle certain steps. +3. Open the `index.html` file in your browser. Notice that it produces the same JSON output that you saw previously when you opened the URL directly in the browser. -Note: +4. Review the `main()` function in `index.js` and examine how this code renders the JSON output in the browser by means of a `pre` HTML element (for demonstration purposes). -1. Please remove all redundant, commented-out code and console.log's from your files before pushing your homework as finished. There is no need for your mentors to review this stuff. -2. Please make sure your code is well-formatted and follows the recommended naming conventions. +### 2.5 Week 1 Assignment -_GO WILD_ +The assignment is to produce an application similar to the one illustrated in Figure 1 above. -Again, check out the GitHub API documentation to see what kind of magic stuff you can do with it. +It should include the following components: -The assignment is to implement something extra that is not in the assignment :scream: (nice and vague, right?) +1. An HTML `select` element from which the user can select a HYF repository. This `select` element must be populated with `option` elements, one for each HYF repository. +2. A left-hand column that displays basic information about the selected repository. +3. A right-hand column that displays a list of contributors to the repository. -Endless fun and possibilities. Need inspiration? Check out the GitHub API documentation. Oh, and please make it look nice (hint: use the stuff you learned in HTML/CSS)! +**Functional Requirements:** +1. The list of repositories in the `select` element should be sorted (case-insensitive) on repository name. +2. At start-up your application should display information about the first repository as displayed in the `select` element. +3. When the user changes the selection, the information in the web page should be refreshed for the newly selected repository. +4. You should be able to click on the repository name of the selected repository to open a new browser tab with the GitHub page for that repository. +5. You should be able to click on a contributor to open a new browser tab with the GitHub page for that contributor. +6. You should render network errors to the DOM (see Figure 2 below for an example). Do not use `console.log` as regular users will not see the console output. +7. Your UI should be responsive. Try it with Chrome Developer Tools in the browser, using a mobile phone format and a tablet format, portrait and landscape. If necessary, you can also do this work in week 2. + +![Error rendering](./assets/hyf-github-error.png) + +Figure 2. Rendering of network errors. + +**Code modifications:** + +**`index.js`** + +- Add new functions and modify function `main()` as you see fit. It is not likely that you will need to modify `fetchJSON()` and `createAndAppend()`. + +**`style.css`** + +- Add your own styling. + +**Hints:** + +- Add one `option` element per repository to the `select` element, where each `option` element has the array index of the repository as its `value` attribute and the name of the repository as its text content: + + ```html + + ``` + + +- To sort the list repositories use [`.sort()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) and [`.localeCompare()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare). + +- Use CSS media queries and [Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) to make the UI responsive. + +- To force a 404 network error so that you can test the rendering of errors, change the URL to make an invalid GitHub request, e.g. append an `x` to `orgs`: `orgsx`. + + +### 2.5 Handing in your homework + + +1. Push your `week1` branch to GitHub: + + ``` + git push -u origin week1 + ``` + +2. Create a pull request for your `week1` branch. + +--- _BONUS_ : Code Kata Race - [Codewars](https://www.codewars.com/collections/hyf-homework-number-2) -## Step 5: Read before next lecture +## Step 3: Read before next lecture _Deadline Sunday morning_ -Go trough the reading material in the [README.md](/Week2/README.md) to prepare for your next class. - ->Commit and push your homework in your "hyf-javascript3" GitHub repository. -Make sure that your commit message are meaningful. -Place the link to your repository folder in Trello. \ No newline at end of file +Go through the reading material in the [README.md](/Week2/README.md) to prepare for your next class. diff --git a/Week1/assets/hyf-github-error.png b/Week1/assets/hyf-github-error.png new file mode 100644 index 0000000000000000000000000000000000000000..545c658f4b105f1dd36fdde8d9bdd4d276d3dcdf GIT binary patch literal 10721 zcmeHtRa{iv8!i%pAR(zVill@}NDrW-bi)9W0>jWbbfbs}5(?5?Lk-=af^-kvNX-n2 zbj=y``~3Ldox5{$=3@W$tiATTo;TK7@AK~UN?lc+n2?qb3k!=_QQ@g378cIseFVXE z%(dnM+JJ?1&DT~|R$Wn6mRa4!(c0GD3JZ%P*5btrF2x5N-DYMlUUc_!a}v6EYDPxB z(R|U`+1B6I$^7}n7v{7NK;YtSvc=9o3g5=BZ3J0-+rfQGzs|fz^QwI>sD;Wty6D~) zt=kW}=BZ@o{0Il<9{#)3Pnw@T5m~NdO^JTPdv+giaFf}nwkZeev*b0)D9URL1eOce zDn?llq|6@VANoII>r#-f-n3N4n!;8jtGOPTN@8XdIQi|)D^5TSem8F*_sKN0H(l__dilNh>-ahNKRmw8um5P{(UZg+-S|LC(RCVa zYOB1L@f=UEWrcLwMWkvoV64>&^6iiL4AkV?yW57aa!4p&l4VQb2dTWI6pJD2HSKPD zQP|hkHXA~woc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6=(Y~O}pQS zYu8jgP*n4o^Q&B~qSoCK7ZM z4!K2}*2tv}wm1X()*)Rbqm;XNFduvC+Px)jd=;HwOVc$_Ul~~X&h}}Cyw+Fvn@y>A z{XC_xz=LyfWD2XFbZgpp*LZ}n`A6!#)WhZ6wG%x}i+q~d^`<#qZP9gO8}fhVVNed) z2FP=f?!k>)90J{ZOjl|hfJJixfg6;|qI(mp`JIm+&w( z$QDA*|EgzL*fb`AfTfOfcYr8`PwffLQRsg-F`Bb1V&lT!F9wH_An#Sq`eu+- zi2cu5qYNH`&y0{UY9+NhR}2AQF2a` by name (case-insensitive). -- Refactor your app to replace `.then()` and `.catch()` with `async`/`await` and `try...catch`. +#### 2.2.1 async/await -Read: +**_Deadline Thursday_** + +_Read:_ - [try...catch](../../../../fundamentals/blob/master/fundamentals/try_catch.md) - [async/await](../../../../fundamentals/blob/master/fundamentals/async_await.md) -## Step 5: OOP and ES6 classes +_Instructions:_ + +- Refactor all `.then()` and `.catch()` methods with `async`/`await` and `try...catch`. + +TODO: ARIA-compliance + +#### 2.2.2 Bonus assignment: ES6 Classes + +**_Deadline Saturday_** + +This final **bonus** assignment requires you to got the extra mile and master Object Oriented Programming and ES6 classes. ES6 classes are not used in the Node and Database modules. You will not come across them again until the React module. + +TODO: Is this optional/bonus? Separate branch `final`? + +**_Deadline Thursday_** + +In this assignment you need to redistribute and adapt the code from `index.js` to the files `App.js`, `Repository.js` and `Contributor.js`. You do not need to modify `Util.js`. + +| File | Description | +|------------------|-------------| +| `App.js` | The `App` class contains the start-up code and manages the overall orchestration of the app. | +| `Repository.js` | The `Repository` class holds code and data for a single repository. | +| `Contributor.js` | The `Contributor` class holds code and data for a single contributor. | +| `Util.js` | The `Util` class contains static helper methods for use in the other classes. | + +The `App.js`, `Repository.js` and `Contributor.js` files each contain skeleton code that you can use to migrate portions of your code from `index.js` to. + +_Read:_ + +- HYF fundamental: [ES6 Classes](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/oop_classes.md#es6-classes) +- More on ES6 classes: [ES6 Classes in Depth](https://ponyfoo.com/articles/es6-classes-in-depth) + +_Instructions:_ + +1. Commit any outstanding changes. +2. Change the content of the `body` tag of `index.html` as follows: + + ```html + +
+ + + + + + ``` + + +## Step 3: OOP and ES6 classes - If you need to refresh your memory on es6 classes: [es6-classes-in-depth](https://ponyfoo.com/articles/es6-classes-in-depth) @@ -52,113 +105,24 @@ Read: Instructions: -1. You should refactor your code to use three classes, named `Repository`, `Contributor` and `View`. +1. You should refactor your code into four classes, named `App`, `Repository`, `Contributor` and `Util`. 2. Move your existing code that deals with rendering the repository information to the `render()` method of the `Repository` class. 3. Move your existing code that deals with rendering the information for a single contributor to the `render()` method of the `Contributor` class. 4. Move your existing code responsible for initializing your application to the `constructor` of the `View` class. 5. The bulk of your remaining code should probably go to the `fetchAndRender()` method of the `View` class. -### Suggested skeleton - -You could use this skeleton as overall design for your code in `app.js`: - -```js -'use strict'; -{ - const hyfUrl = 'https://api.github.com'; - const hyfReposUrl = hyfUrl + '/orgs/HackYourFuture/repos?per_page=100'; - - class Repository { - constructor(data) { - this._data = data; - } - - /** - * Render the repository info to the DOM. - * @param {HTML element} parent The parent element in which to render the repository. - * info. - */ - render(parent) { - // Add your code here. - // This method should render the repository data stored in the '_data' property - // as HTML elements and append them to the `parent` element. - } - - /** - * Returns an array of contributors as a promise - */ - fetchContributors() { - // Add your code here - } - } - - class Contributor { - constructor(data) { - this._data = data; - } - - /** - * Render the contributor info to the DOM. - * @param {HTML element} parent The parent element in which to render the contributor. - * info. - */ - render(parent) { - // Add your code here. - // This method should render the contributor data stored in the 'data' property - // as HTML elements and append them to the `parent` element. - } - } - - class View { - constructor() { - this.initialize(); - } - - /** - * View initialization - */ - async initialize() { - // Add code here to initialize your app - // 1. Create the fixed HTML elements of your page - // 2. Make an initial XMLHttpRequest to populate your element + + const root = document.getElementById('root'); + // ... + + try { + // ... + const repos = await Util.fetchJSON(url); + this.repos = repos.map(repo => new Repository(repo)); + // ... + } catch (error) { + this.renderError(error); + } + } + + /** + * Fetch contributor information for the selected repository and render the + * repo and its contributors as HTML elements in the DOM. + * @param {number} index The array index of the repository. + */ + async fetchContributorsAndRender(index) { + try { + const repo = this.repos[index]; + const contributors = await repo.fetchContributors(); + + const container = document.getElementById('container'); + // Erase previously generated inner HTML from the container div + container.innerHTML = ''; + + const leftDiv = Util.createAndAppend('div', container); + const rightDiv = Util.createAndAppend('div', container); + + const contributorList = Util.createAndAppend('ul', rightDiv); + + repo.render(leftDiv); + + contributors + .map(contributor => new Contributor(contributor)) + .forEach(contributor => contributor.render(contributorList)); + } catch (error) { + this.renderError(error); + } + } + + /** + * Render an error to the DOM. + * @param {Error} error An Error object describing the error. + */ + renderError(error) { + // Replace this comment with your code + } +} + +const HYF_REPOS_URL = 'https://api.github.com/orgs/HackYourFuture/repos?per_page=100'; + +window.onload = () => new App(HYF_REPOS_URL); diff --git a/homework/src/Contributor.js b/homework/src/Contributor.js new file mode 100644 index 000000000..34bcc810b --- /dev/null +++ b/homework/src/Contributor.js @@ -0,0 +1,18 @@ +'use strict'; + +/* global Util */ + +// eslint-disable-next-line no-unused-vars +class Contributor { + constructor(data) { + this.data = data; + } + + /** + * Render the contributor info to the DOM. + * @param {HTMLElement} contributorList The parent element in which to render the contributor. + */ + render(contributorList) { + // Replace this comment with your code + } +} diff --git a/homework/src/Repository.js b/homework/src/Repository.js new file mode 100644 index 000000000..c4d3ec797 --- /dev/null +++ b/homework/src/Repository.js @@ -0,0 +1,34 @@ +'use strict'; + +/* global Util */ + +// eslint-disable-next-line no-unused-vars +class Repository { + constructor(data) { + this.data = data; + } + + /** + * Render the repository info to the DOM. + * @param {HTMLElement} parent The parent element in which to render the repository. + */ + render(parent) { + // + // Replace this comment with your code + // + } + + /** + * Returns an array of contributors as a promise + */ + fetchContributors() { + return Util.fetchJSON(this.data.contributors_url); + } + + /** + * Returns the name of the repository + */ + name() { + return this.data.name; + } +} diff --git a/homework/src/Util.js b/homework/src/Util.js new file mode 100644 index 000000000..4de3f0185 --- /dev/null +++ b/homework/src/Util.js @@ -0,0 +1,35 @@ +'use strict'; + +// eslint-disable-next-line no-unused-vars +class Util { + static createAndAppend(name, parent, options = {}) { + const elem = document.createElement(name); + parent.appendChild(elem); + Object.keys(options).forEach((key) => { + const value = options[key]; + if (key === 'html') { + elem.innerHTML = value; + } else { + elem.setAttribute(key, value); + } + }); + return elem; + } + + static fetchJSON(url) { + return new Promise((resolve, reject) => { + const xhr = new XMLHttpRequest(); + xhr.open('GET', url); + xhr.responseType = 'json'; + xhr.onload = () => { + if (xhr.status < 400) { + resolve(xhr.response); + } else { + reject(new Error(`Network error: ${xhr.status} - ${xhr.statusText}`)); + } + }; + xhr.onerror = () => reject(new Error('Network request failed')); + xhr.send(); + }); + } +} diff --git a/homework/src/hyf.png b/homework/src/hyf.png new file mode 100644 index 0000000000000000000000000000000000000000..a4626c91cc28dd92f3a8843aa3919c472d609984 GIT binary patch literal 6971 zcmd6sRZtw^x9vj$!4e!oa0?bBID>0&hv1OGT@qj*Fi3D12u^T!cZZ;ZyK8WF7{UO< zng4w|Z};9h59gt~tG?>$UA4P=t>0c>xVoy`TP!lH7cXACRgjm_L|zB~b6~tgp6P@D zLoZ&Czf_Qs)b>n2$-ov#SbBy+M@d6srIefszLi9AFcY_)IyolamYo(QM4Yi2m&mjb z^?%mXOwb8pmN68sVJ(+xZP8hdS&{!X)T#`5E~C2U9U1l9`}RBK*{ciIQ1yL0ecyW= zqBa4T@EX7O4PRSZ6U302{EOc93hxpX3;QK1GaCk8b~TNJf6vbsDE}K5Xv|8qW3s5p ziPxG|*GA&6gTpT`y;^>G6C>JfVuwcGue!ydwJZS!W(u!tgLrt!*qJ^ak8Swr>gu?= zPsv4-0SuJvk09?E2rx%>4?w!=+KUa&)S;;pnIchLzLaBj(PS;aYb!~gz;4v|>h*>B z!otEE_H$jmepy*C=c9?=%dDQ#l1iB1w|@pk>5y_ZagW7IK_(`|=heJW{nOLa4l%m; zA^7Xpb$g@tUYk-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azA z$4SkC7#JSJ5ORgz?e8Za7blKG zizmAOF6s_0y+`YkEtdk66Bg{o)5UJp?R6bosX}uWa5r9Z;`c2J>xic=TTI`dXBr*WBCNn29fqV6ysrW=%FRy~JIbo7vs+uqhLB(6-tKNnYKpCmouZ+D4Ut!foH9vbFwA+LF zI7vtr2nkSgSy6J!bGN8T54?{ONFInoHx(5ujzh>RfnKf&aCZm;~Lq@38Pp8iO=Vl3`;QmS7? z>df*6iV+(X9gIBIsiWyB&yQYTtgLi&bp8{}c6k5psn*E*JjN>kJ>x?S?L9m?e5`+Yb*8W^Xi^TEM;a8OWq*Wp?nQa`5QB q{eMOe|IHi!$Di^1?!}AeXDJlZH8z|Z3FM~O3k6wKnM$dzKmQAHWO%^< literal 0 HcmV?d00001 diff --git a/homework/src/index.html b/homework/src/index.html new file mode 100644 index 000000000..9c8f80c1a --- /dev/null +++ b/homework/src/index.html @@ -0,0 +1,23 @@ + + + + + + + + + + + + + HYF-GITHUB + + + + + +

+ + + + \ No newline at end of file diff --git a/homework/src/index.js b/homework/src/index.js new file mode 100644 index 000000000..1cb1638a0 --- /dev/null +++ b/homework/src/index.js @@ -0,0 +1,47 @@ +'use strict'; + +{ + function fetchJSON(url, cb) { + const xhr = new XMLHttpRequest(); + xhr.open('GET', url); + xhr.responseType = 'json'; + xhr.onload = () => { + if (xhr.status < 400) { + cb(null, xhr.response); + } else { + cb(new Error(`Network error: ${xhr.status} - ${xhr.statusText}`)); + } + }; + xhr.onerror = () => cb(new Error('Network request failed')); + xhr.send(); + } + + function createAndAppend(name, parent, options = {}) { + const elem = document.createElement(name); + parent.appendChild(elem); + Object.keys(options).forEach((key) => { + const value = options[key]; + if (key === 'html') { + elem.innerHTML = value; + } else { + elem.setAttribute(key, value); + } + }); + return elem; + } + + function main(url) { + fetchJSON(url, (err, data) => { + const root = document.getElementById('root'); + if (err) { + createAndAppend('div', root, { html: err.message, class: 'alert-error' }); + } else { + createAndAppend('pre', root, { html: JSON.stringify(data, null, 2) }); + } + }); + } + + const HYF_REPOS_URL = 'https://api.github.com/orgs/HackYourFuture/repos?per_page=100'; + + window.onload = () => main(HYF_REPOS_URL); +} diff --git a/homework/src/style.css b/homework/src/style.css new file mode 100644 index 000000000..a8985a8a5 --- /dev/null +++ b/homework/src/style.css @@ -0,0 +1,3 @@ +.alert-error { + color: red; +} \ No newline at end of file diff --git a/termp.html b/termp.html new file mode 100644 index 000000000..ba3809c4d --- /dev/null +++ b/termp.html @@ -0,0 +1,5 @@ + \ No newline at end of file From 14cb668dd0852ac7c18fbf9fb7065f57ef1a9e9a Mon Sep 17 00:00:00 2001 From: Jim Cramer Date: Wed, 30 May 2018 17:28:16 +0200 Subject: [PATCH 2/6] updated MAKEME's --- Week1/MAKEME.md | 17 +++++++--- Week2/MAKEME.md | 22 ++++++------- Week3/MAKEME.md | 82 ++++++++++++++++++++----------------------------- termp.html | 5 --- 4 files changed, 56 insertions(+), 70 deletions(-) delete mode 100644 termp.html diff --git a/Week1/MAKEME.md b/Week1/MAKEME.md index 4e90abaa9..6281b264a 100644 --- a/Week1/MAKEME.md +++ b/Week1/MAKEME.md @@ -19,7 +19,7 @@ Please provide feedback on last week's homework from a fellow student as a GitHu **_Deadline Thursday_** -_This homework is more extensive and challenging than previous homework! Please read the instructions below carefully and follow them precisely. Start this homework as soon as you can and allow time for discussion and questions (slack!)._ +_This homework is more extensive and challenging than previous homework! Please read the instructions below carefully and follow them meticulously. Start this homework as soon as you can and allow time for discussion and questions (slack!)._ ### 2.1 Introduction @@ -54,7 +54,7 @@ If you open this URL in the browser (_try it!_) you will receive JSON data about Note the query string `?per_page=100` in the above URL. If you don't specify this query string you will only get the first 30 repositories (the default `per_page` is 30). HackYourFuture has more than 30 repositories but less than 100. -The returned JSON data contains some basic information about each repository, such as `name`, `full_name`, `description` etc. There are also many properties that contain URLs to obtain detail information about certain aspects of the repository. +The returned JSON data contains some basic information about each repository, such as `name`, `full_name`, `description` etc. There are also many properties that contain URLs that can be used to obtain detail information about certain aspects of the repository. #### 2.2.2 Get contributor information for a repository @@ -73,8 +73,8 @@ You will be working on this same application during the next three weeks. For ea | Week | Branch | Assignment | |:----:|--------|------------| | 1 | `week1` | Create a basic application using callbacks to handle network requests. | -| 2 | `week2` | 1. Refactor the callbacks to promises.
2. Make the UI responsive.| -| 3 | `week3` | 1. Refactor the application to use ES6 Classes and async/await.
2. Make the app ARIA-compliant. | +| 2 | `week2` | - Refactor the callbacks to promises.
- Make the UI responsive.| +| 3 | `week3` | - Refactor the application to use ES6 Classes and async/await.
- Make the app ARIA-compliant. | Table 1. Homework schedule @@ -190,11 +190,18 @@ It should include the following components: - Use CSS media queries and [Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) to make the UI responsive. -- To force a 404 network error so that you can test the rendering of errors, change the URL to make an invalid GitHub request, e.g. append an `x` to `orgs`: `orgsx`. +- To force a `404` network error so that you can test the rendering of errors, change the URL to make an invalid GitHub request, e.g. append an `x` to `orgs`: `orgsx`. ### 2.5 Handing in your homework +- Have you removed all commented out code (should never be present in a PR)? +- Have you used `const` and `let` and avoided `var`? +- Do the variable, function and argument names you created follow the [Naming Conventions](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md)? +- Is your code well-formatted (see [Code Formatting](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md))? +- Have you resolved all issues flagged by ESLint and the spell checker (no wavy red and green underlines in VSCode)? + +If the answer is 'yes' to all preceding questions you are ready to follow these instructions: 1. Push your `week1` branch to GitHub: diff --git a/Week2/MAKEME.md b/Week2/MAKEME.md index 9aec2885e..04c09b4da 100644 --- a/Week2/MAKEME.md +++ b/Week2/MAKEME.md @@ -20,12 +20,11 @@ Topics discussed this week: - YouTube: [promises](https://www.youtube.com/watch?v=WBupia9oidU) -## Step 2: Feedback +## Step 2: Implement requested PR changes -- Create at least 2 issues (bug / feature / code improvement) on another student's GitHub repository. -- Solve the issue(s) proposed by another students in your GitHub repository. More info [here](https://hackyourfuture.slack.com/files/michahell/F31BX1XT6/Merging_a_local_branch_into_master). +- Fix Requested Changes (if any) on the Pull Request. -## Step 3: Promises +## Step 3: Convert callbacks to promises **_Deadline Thursday_** @@ -47,16 +46,17 @@ You will continue to work on the files `index.js` and (possibly) `style.css`. - Complete your GitHub app code from the previous week, if needed, to meet the requirements from that week's assignment. - Replace all asynchronous callbacks (e.g. as used with XMLHttpRequest) by ES6 promises. - Beautify your app's styling. -- Make your app responsive (use CSS media queries and [Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)). -- Make your app ARIA-compliant. +- If not yet completed in week 1, make your app responsive (use CSS media queries and [Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)). -**ARIA-compliance** - -Please review the material from the HTML/CSS module: [Get familiar with Accessible Rich Internet Applications (ARIA)](https://github.com/HackYourFuture/HTML-CSS/tree/master/Week1#get-familiar-with-accessible-rich-internet-applications-aria). +### 3.3 Handing in your homework -For the GitHub application ARIA-compliance means that the Contributors list should either be a native HTML list (i.e. using `ul` and `li` elements) or otherwise marked with an appropriate ARIA **role**. Furthermore, a user should be able to navigate to all interactive elements using the keyboard (e.g., using the **Tab** key). Pressing **Enter** on such an element should be equivalent to a clicking the mouse. +- Have you removed all commented out code (should never be present in a PR)? +- Have you used `const` and `let` and avoided `var`? +- Do the variable, function and argument names you created follow the [Naming Conventions](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md)? +- Is your code well-formatted (see [Code Formatting](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md))? +- Have you resolved all issues flagged by ESLint and the spell checker (no wavy red and green underlines in VSCode)? -### 3.3 Handing in your homework +If the answer is 'yes' to all preceding questions you are ready to follow these instructions: 1. Push your `week2` branch to GitHub: diff --git a/Week3/MAKEME.md b/Week3/MAKEME.md index e89d9d544..61f38d8c5 100644 --- a/Week3/MAKEME.md +++ b/Week3/MAKEME.md @@ -7,16 +7,25 @@ Topics discussed this week: • call, apply, bind ``` + ## Step 1: Fix requested changes -_Deadline Wednesday_ +_Deadline Monday_ -- Fix the requested changes from the PR from the last weeks and make sure you explain how you fixed the issue in a comment. +- Fix Requested Changes (if any) on the Pull Request. ## Step 2 +**_Deadline Thursday_** + ### 2.1 Preparation +**Read the fundamental pages on:** + +- [try...catch](../../../../fundamentals/blob/master/fundamentals/try_catch.md) +- [async/await](../../../../fundamentals/blob/master/fundamentals/async_await.md) + + The homework for week 3 will build on the work you did in week 2. You will create a new branch based on the `week2` branch. 1. Make sure that you committed all changes in the week 2 version of your homework. @@ -31,33 +40,29 @@ The homework for week 3 will build on the work you did in week 2. You will creat This week you will work with all JavaScript files in the `src` folder. The assignment consists of two parts: 1. Refactor all `.then()` and `.catch()` methods with `async`/`await` and `try...catch`. -2. Refactor your application to use ES6 classes. +2. Make your app ARIA-compliant (see below). +3. Refactor your application to use ES6 classes. + #### 2.2.1 async/await -**_Deadline Thursday_** +**Instructions:** -_Read:_ +1. Refactor all `.then()` and `.catch()` methods with `async`/`await` and `try...catch`. -- [try...catch](../../../../fundamentals/blob/master/fundamentals/try_catch.md) -- [async/await](../../../../fundamentals/blob/master/fundamentals/async_await.md) +2. Make sure that your error handling code still works. See the week2 MAKEME on how to force an error response from GitHub. -_Instructions:_ -- Refactor all `.then()` and `.catch()` methods with `async`/`await` and `try...catch`. +#### 2.2.2 ARIA-compliance -TODO: ARIA-compliance +Please review the material from the HTML/CSS module: [Get familiar with Accessible Rich Internet Applications (ARIA)](https://github.com/HackYourFuture/HTML-CSS/tree/master/Week1#get-familiar-with-accessible-rich-internet-applications-aria). -#### 2.2.2 Bonus assignment: ES6 Classes +For the GitHub application ARIA-compliance means that the Contributors list should either be a native HTML list (i.e. using `ul` and `li` elements) or otherwise marked with an appropriate ARIA **role**. Furthermore, a user should be able to navigate through all interactive elements using the keyboard (e.g., using the **Tab** key). Pressing **Enter** on such an element should be equivalent to clicking the mouse. -**_Deadline Saturday_** +#### 2.2.3 ES6 Classes (Bonus) This final **bonus** assignment requires you to got the extra mile and master Object Oriented Programming and ES6 classes. ES6 classes are not used in the Node and Database modules. You will not come across them again until the React module. -TODO: Is this optional/bonus? Separate branch `final`? - -**_Deadline Thursday_** - In this assignment you need to redistribute and adapt the code from `index.js` to the files `App.js`, `Repository.js` and `Contributor.js`. You do not need to modify `Util.js`. | File | Description | @@ -76,8 +81,7 @@ _Read:_ _Instructions:_ -1. Commit any outstanding changes. -2. Change the content of the `body` tag of `index.html` as follows: +1. Copy `index.html` to file named `classes.html` and change the content of the `body` tag of `classes.html` as follows: ```html @@ -90,45 +94,25 @@ _Instructions:_ ``` -## Step 3: OOP and ES6 classes - -- If you need to refresh your memory on es6 classes: [es6-classes-in-depth](https://ponyfoo.com/articles/es6-classes-in-depth) - -_Deadline Saturday_ - -Refactor your GitHub app to use OOP with ES6 classes (see skeleton code below). We will be introducing a `Repository` and a `Contributor` class that will each be responsible for rendering their own data. A third `View` class will contain all remaining code. +#### 2.2.4 Handing in your homework -Read: +- Have you removed all commented out code (should never be present in a PR)? +- Have you used `const` and `let` and avoided `var`? +- Do the variable, function and argument names you created follow the [Naming Conventions](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md)? +- Is your code well-formatted (see [Code Formatting](../../../../fundamentals/blob/master/fundamentals/naming_conventions.md))? +- Have you resolved all issues flagged by ESLint and the spell checker (no wavy red and green underlines in VSCode)? -- [Object Oriented Programming and ES6 Classes](../../../../fundamentals/blob/master/fundamentals/oop_classes.md) -- [The `this` keyword](../../../../fundamentals/blob/master/fundamentals/this.md) +If the answer is 'yes' to all preceding questions you are ready to follow these instructions: -Instructions: - -1. You should refactor your code into four classes, named `App`, `Repository`, `Contributor` and `Util`. -2. Move your existing code that deals with rendering the repository information to the `render()` method of the `Repository` class. -3. Move your existing code that deals with rendering the information for a single contributor to the `render()` method of the `Contributor` class. -4. Move your existing code responsible for initializing your application to the `constructor` of the `View` class. -5. The bulk of your remaining code should probably go to the `fetchAndRender()` method of the `View` class. - -TODO: describe the division of work between the classes - - -### 3.3 Handing in your homework - -1. Push your `week2` branch to GitHub: +1. Push your `week3` branch to GitHub: ``` - git push -u origin week2 + git push -u origin week3 ``` -2. Create a pull request for your `week2` branch. - -Note: +2. Create a pull request for your `week3` branch. -1. Please remove all redundant, commented-out code and console.log's from your files before pushing your homework as finished. There is no need for your mentors to review this stuff. -2. Please make sure your code is well-formatted and follows the recommended naming conventions. -## Step 6: Read before next lecture +## Step 3: Read before next lecture _Deadline Sunday morning_ diff --git a/termp.html b/termp.html deleted file mode 100644 index ba3809c4d..000000000 --- a/termp.html +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file From a02af3396b173e018c1f0bb137e8ea1ff62c701d Mon Sep 17 00:00:00 2001 From: Jim Cramer Date: Thu, 31 May 2018 15:04:38 +0200 Subject: [PATCH 3/6] Removed bonus designation from ES6 classes assignment --- Week3/MAKEME.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Week3/MAKEME.md b/Week3/MAKEME.md index 61f38d8c5..81ea6db22 100644 --- a/Week3/MAKEME.md +++ b/Week3/MAKEME.md @@ -59,9 +59,11 @@ Please review the material from the HTML/CSS module: [Get familiar with Accessib For the GitHub application ARIA-compliance means that the Contributors list should either be a native HTML list (i.e. using `ul` and `li` elements) or otherwise marked with an appropriate ARIA **role**. Furthermore, a user should be able to navigate through all interactive elements using the keyboard (e.g., using the **Tab** key). Pressing **Enter** on such an element should be equivalent to clicking the mouse. -#### 2.2.3 ES6 Classes (Bonus) +#### 2.2.3 ES6 Classes -This final **bonus** assignment requires you to got the extra mile and master Object Oriented Programming and ES6 classes. ES6 classes are not used in the Node and Database modules. You will not come across them again until the React module. +**_Deadline Saturday_** + +This final assignment requires you to go the extra mile and master Object Oriented Programming and ES6 classes. In this assignment you need to redistribute and adapt the code from `index.js` to the files `App.js`, `Repository.js` and `Contributor.js`. You do not need to modify `Util.js`. From c1d13033d73162ad89b91781b16ed98646d39e7c Mon Sep 17 00:00:00 2001 From: Jim Cramer Date: Fri, 8 Jun 2018 12:37:23 +0200 Subject: [PATCH 4/6] incorporated Maartjes feedback --- README.md | 2 +- Week1/MAKEME.md | 2 +- Week3/MAKEME.md | 13 ++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 65b9a4985..fa97dad57 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Here you can find course content and homework for the JavaScript3 modules |----|-----|----|--------| |1.|• Structure for a basic SPA (Single Page Application)
• [XMLHttpRequests](../../../fundamentals/blob/master/fundamentals/XMLHttpRequest.md)
• API calls|[Reading Week 1](/Week1/README.md)|[Homework Week 1](/Week1/MAKEME.md)| |2.|• [Event Loop (order of execution)](../../../fundamentals/blob/master/fundamentals/event_loop.md)
• [Promises](../../../fundamentals/blob/master/fundamentals/promises.md)|[Reading Week 2](/Week2/README.md)|[Homework Week 2](/Week2/MAKEME.md)| -|3.|• [try...catch](../../../fundamentals/blob/master/fundamentals/try_catch.md)
• [async/await](../../../fundamentals/blob/master/fundamentals/async_await.md)
• [The `this` keyword](../../../fundamentals/blob/master/fundamentals/this.md)
• call, apply, bind
• [Object Oriented Programming and ES6 Classes](../../../fundamentals/blob/master/fundamentals/oop_classes.md)|[Reading Week 3](/Week3/README.md)|[Homework Week 3](/Week3/MAKEME.md)| +|3.|• [try...catch](../../../fundamentals/blob/master/fundamentals/try_catch.md)
• [async/await](../../../fundamentals/blob/master/fundamentals/async_await.md)
• [The `this` keyword](../../../fundamentals/blob/master/fundamentals/this.md)
• call, apply, bind
• [Object Oriented Programming and ES6 Classes](../../../fundamentals/blob/master/fundamentals/oop_classes.md)|[Reading Week 3](/Week3/README.md)|[Homework Week 3](/Week3/MAKEME.md)| __Kind note:__ diff --git a/Week1/MAKEME.md b/Week1/MAKEME.md index 6281b264a..2b8ff2803 100644 --- a/Week1/MAKEME.md +++ b/Week1/MAKEME.md @@ -19,7 +19,7 @@ Please provide feedback on last week's homework from a fellow student as a GitHu **_Deadline Thursday_** -_This homework is more extensive and challenging than previous homework! Please read the instructions below carefully and follow them meticulously. Start this homework as soon as you can and allow time for discussion and questions (slack!)._ +_This homework is more extensive and challenging than previous homework! Please read the instructions below carefully and follow them with great attention to detail. Start this homework as soon as you can and allow time for discussion and questions (slack!)._ ### 2.1 Introduction diff --git a/Week3/MAKEME.md b/Week3/MAKEME.md index 81ea6db22..56eff3595 100644 --- a/Week3/MAKEME.md +++ b/Week3/MAKEME.md @@ -53,13 +53,7 @@ This week you will work with all JavaScript files in the `src` folder. The assig 2. Make sure that your error handling code still works. See the week2 MAKEME on how to force an error response from GitHub. -#### 2.2.2 ARIA-compliance - -Please review the material from the HTML/CSS module: [Get familiar with Accessible Rich Internet Applications (ARIA)](https://github.com/HackYourFuture/HTML-CSS/tree/master/Week1#get-familiar-with-accessible-rich-internet-applications-aria). - -For the GitHub application ARIA-compliance means that the Contributors list should either be a native HTML list (i.e. using `ul` and `li` elements) or otherwise marked with an appropriate ARIA **role**. Furthermore, a user should be able to navigate through all interactive elements using the keyboard (e.g., using the **Tab** key). Pressing **Enter** on such an element should be equivalent to clicking the mouse. - -#### 2.2.3 ES6 Classes +#### 2.2.2 ES6 Classes (BONUS) **_Deadline Saturday_** @@ -95,6 +89,11 @@ _Instructions:_ ``` +#### 2.2.3 ARIA-compliance + +Please review the material from the HTML/CSS module: [Get familiar with Accessible Rich Internet Applications (ARIA)](https://github.com/HackYourFuture/HTML-CSS/tree/master/Week1#get-familiar-with-accessible-rich-internet-applications-aria). + +For the GitHub application ARIA-compliance means that the Contributors list should either be a native HTML list (i.e. using `ul` and `li` elements) or otherwise marked with an appropriate ARIA **role**. Furthermore, a user should be able to navigate through all interactive elements using the keyboard (e.g., using the **Tab** key). Pressing **Enter** on such an element should be equivalent to clicking the mouse. #### 2.2.4 Handing in your homework From 5c9c677648eb244facb5615f2116411921828767 Mon Sep 17 00:00:00 2001 From: Jim Cramer Date: Fri, 8 Jun 2018 12:44:05 +0200 Subject: [PATCH 5/6] Made ARIA-compliance BONUS instead of ES6 Classes --- Week3/MAKEME.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Week3/MAKEME.md b/Week3/MAKEME.md index 56eff3595..ad6e7286e 100644 --- a/Week3/MAKEME.md +++ b/Week3/MAKEME.md @@ -53,7 +53,7 @@ This week you will work with all JavaScript files in the `src` folder. The assig 2. Make sure that your error handling code still works. See the week2 MAKEME on how to force an error response from GitHub. -#### 2.2.2 ES6 Classes (BONUS) +#### 2.2.2 ES6 Classes **_Deadline Saturday_** @@ -89,7 +89,7 @@ _Instructions:_ ``` -#### 2.2.3 ARIA-compliance +#### 2.2.3 ARIA-compliance (BONUS) Please review the material from the HTML/CSS module: [Get familiar with Accessible Rich Internet Applications (ARIA)](https://github.com/HackYourFuture/HTML-CSS/tree/master/Week1#get-familiar-with-accessible-rich-internet-applications-aria). From 936bff191bf93ec5d555a73fb93789a48f529df7 Mon Sep 17 00:00:00 2001 From: Jim Cramer Date: Fri, 8 Jun 2018 12:50:10 +0200 Subject: [PATCH 6/6] Clarification on the functionalities the application is to deliver --- Week1/MAKEME.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Week1/MAKEME.md b/Week1/MAKEME.md index 2b8ff2803..f6bd345b6 100644 --- a/Week1/MAKEME.md +++ b/Week1/MAKEME.md @@ -25,9 +25,9 @@ _This homework is more extensive and challenging than previous homework! Please You are going to write a _Single Page Application_ (SPA) that uses the [GitHub API](https://developer.github.com/guides/getting-started/). -This application should display information about the available [HYF GitHub repositories](https://github.com/hackyourfuture): +This application should display information about the available [HYF GitHub repositories](https://github.com/hackyourfuture). The functionalities we would like to see in your application are as follows: -- You should be able to select a repository from a list of available repositories. +- The user should be able to select a repository from a list of available repositories. - The application should display high-level information about the selected repository and show a list of its contributors. - When clicking on the name of the selected repository the GitHub page for the corresponding repository should be opened in a new browser tab. - When clicking on a contributor, the GitHub page for the contributor should be opened in a new browser tab.