Skip to content

Commit 666fba5

Browse files
committed
docs: tasks for modules 1 and 2
1 parent 0fc7e96 commit 666fba5

File tree

2 files changed

+69
-50
lines changed

2 files changed

+69
-50
lines changed

tasks.md

Lines changed: 44 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -44,83 +44,80 @@ Every time you want to check your work locally you can type that command, and it
4444

4545
## Previewing Your Work
4646

47-
You can preview your work by running `flask run` in the root of your fork and then visit`http://localhost:5000` in your browser.
47+
You can preview your work by running `flask run` in the root of your fork and then visit `http://localhost:5000` in your browser.
4848

49-
# Module 01 - Routing and Templates
49+
# Module 01 - Routing
5050

51-
## 1.1 -
51+
## 1.1 - Import Flask
5252

53-
@pytest.mark.
54-
55-
## 1.2 -
56-
57-
@pytest.mark.
58-
59-
## 1.3 -
60-
61-
@pytest.mark.
62-
63-
## 1.4 -
64-
65-
@pytest.mark.
66-
67-
## 1.5 -
68-
69-
@pytest.mark.
53+
@pytest.mark.app-import-flask In order to create a flask application Import `Flask` and `render_template` from `flask`.
7054

71-
## 1.6 -
55+
## 1.2 - Create a Flask Application
7256

73-
@pytest.mark.
57+
@pytest.mark.app-create-flask-app Create an instance of the Flask class called `app`. Pass in the special variable `__name__`.
7458

75-
## 1.7 -
59+
## 1.3 - Templates Folder
7660

77-
@pytest.mark.
61+
@pytest.mark.templates-folder Create a folder called `templates` in the `jobs` directory.
7862

79-
## 1.8 -
63+
## 1.4 - Create Index Template
8064

81-
@pytest.mark.
65+
@pytest.mark.index-template In the root of the `templates` folder, create a file called `index.html`.
8266

83-
# Module 02 -
67+
## 1.5 - Create the Index Route
8468

85-
## 2.1 -
69+
@pytest.mark.app-create-index-route We will display all jobs on the index page. To start we will create a basic route that displays the contents of the index template. Create a function called `jobs` and attach a `route()` decorator with the URL of `/`. Add an additional path of `/jobs`. In the body of the function return a call to the `render_template()` passing the `index.html` template.
8670

87-
@pytest.mark.
71+
## 1.5 - Create Employer and Job Templates
8872

89-
## 2.2 -
73+
@pytest.mark.detail-templates In the root of the `templates` folder, create two files one called `employer.html` and the other called `job.html`.
9074

91-
@pytest.mark.
75+
## 1.6 -Create Detail Routes
9276

93-
## 2.3 -
77+
@pytest.mark.app-create-detail-routes We need routes for individual employers and jobs. Create two functions one called `employer` and the other called `job`. Add route decorators to bind these functions with the appropriate URLs:
78+
- `/employer` to the `employer` function
79+
- `/job` to the `job `function.
9480

95-
@pytest.mark.
81+
In the body of each function return a call to `render_template()` passing the appropriate template.
9682

97-
## 2.4 -
83+
# Module 02 - Templates
9884

99-
@pytest.mark.
85+
## 2.1 - Create Layout Template
10086

101-
## 2.5 -
87+
@pytest.mark.layout-template We want each template to have a consistent look and feel. We can create a base layout that each template can extend. First create a new file called `layout.html` in the root of the `templates` folder. Copy the basic structure of the file from the file called `templates.html`.
10288

103-
@pytest.mark.
89+
## 2.2 - Add Styles
10490

105-
## 2.6 -
91+
@pytest.mark.add-styles The app will be styled with bulma (bulma.io). Add three link tags to the head of `layout.html`. For the first `href` use mustache syntax `{{}}` and the `url_for()` function to link in the file `css/bulma.css` from the `static` folder. For the second add the file `css/app.css` using the same method. The last link tag should have an `href` value of `https://use.fontawesome.com/releases/v5.2.0/css/all.css`.
10692

107-
@pytest.mark.
93+
## 2.3 - Create Template Files
10894

109-
## 2.7 -
95+
@pytest.mark.create-template-files We need to create some additional template files. In the `templates` folder create the following files:
96+
- `_job.html`
97+
- `job.html`
98+
- `employer.html`
99+
- `review.html`
110100

111-
@pytest.mark.
101+
Next create a new folder called `admin` in the `templates` folder, then create the following files:
102+
- `index.html`
103+
- `create.html`
112104

113-
## 2.8 -
105+
## 2.4 - Template Files HTML
106+
@pytest.mark.template-files-html Locate the `templates.html` file in the the root of the project. To prevent having to write all HTML from scratch the HTML structure of several of the template files is given here. Each block has a comment that describes what HTML file, the HTML block, needs to be copied too. Copy each block to the correct file.
114107

115-
@pytest.mark.
108+
## 2.5 - Extend Base Layout
116109

117-
## 2.9 -
110+
@pytest.mark.extend-base-layout Each of the files list below needs to extend the base layout. This can be done by adding an `extends` directive with `{% %}` template syntax to the top of each file.
118111

119-
@pytest.mark.
112+
- `job.html`
113+
- `employer.html`
114+
- `review.html`
115+
- `admin/index.html`
116+
- `admin/create.html`
120117

121-
## 2.10 -
118+
## 2.6 - Navigation
122119

123-
@pytest.mark.
120+
@pytest.mark.navigation We want to allow the user to navigate to the admin from the front page. In the `index.html` template file create a link to the main admin page by creating an `<a>` tag nested in the `<div>` with the two classes `columns` and `is-one-fifth`. The `<a>` tag should have an `href` with the value `/admin` and the classes `button`, `is-info`, and `is-pulled-right`. In the `admin/index.html` template file create a link to add a new job by creating an `<a>` tag nested in the `<div>` with the two classes `columns` and `is-one-fifth`. The `<a>` tag should have an `href` with the value `/admin` and the classes `button`, `is-info`, and `is-pulled-right`.
124121

125122
# Module 03 -
126123

templates.html

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
<!-- templates/layout.html -->
2+
<!doctype html>
3+
<html>
4+
<head>
5+
<title>Job Board</title>
6+
7+
8+
9+
</head>
10+
<body>
11+
12+
<div class="container top">
13+
<div class="content">
14+
{% block content %}
15+
{% endblock %}
16+
</div>
17+
</div>
18+
19+
</body>
20+
</html>
21+
122
<!-- templates/index.html -->
223
{% block content %}
324
<div class="columns">
@@ -6,8 +27,9 @@ <h1>Jobs</h1>
627
</div>
728
<div class="column is-one-fifth">
829

9-
1030
</div>
31+
32+
1133
</div>
1234
{% endblock %}
1335

@@ -17,7 +39,7 @@ <h2>Jobs</h2>
1739

1840

1941
<h2>Reviews</h2>
20-
{% for review in reviews %}
42+
{% %}
2143
<div class="box">
2244
<article class="media">
2345
<div class="media-left">
@@ -32,7 +54,7 @@ <h2>Reviews</h2>
3254
</div>
3355
</article>
3456
</div>
35-
{% endfor %}
57+
{% %}
3658
<div class="columns">
3759
<div class="column">
3860
<a class="button is-info is-pulled-right">Create Review</a>

0 commit comments

Comments
 (0)