diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..0eb011b --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,16 @@ +# Contributing + +TODO write docs for staff here + +## Continuous Integration (GitHub Actions) + +TODO Info here about workflows and links + +## Testing + +To run tests, run `bundle exec rspec` + +## Resources + +- [Jekyll](https://jekyllrb.com/) +- [GitHub](https://docs.github.com/) diff --git a/.github/workflows/axe-linter.yml b/.github/workflows/axe-linter.yml new file mode 100644 index 0000000..3a19bbd --- /dev/null +++ b/.github/workflows/axe-linter.yml @@ -0,0 +1,14 @@ +name: Run axe linter + +on: [pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: dequelabs/axe-linter-action@v1 + with: + api_key: ${{ secrets.AXE_LINTER_API_KEY }} + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/jekyll.yml b/.github/workflows/jekyll.yml index 68520b5..13feea7 100644 --- a/.github/workflows/jekyll.yml +++ b/.github/workflows/jekyll.yml @@ -36,7 +36,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0 with: - ruby-version: '3.1' # Not needed with a .ruby-version file + # The Ruby version is determined by either a `.ruby-version` or a `.tool-versions` file in root of the repo. bundler-cache: true # runs 'bundle install' and caches installed gems automatically cache-version: 0 # Increment this number if you need to re-download cached gems - name: Setup Pages diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml new file mode 100644 index 0000000..93951da --- /dev/null +++ b/.github/workflows/reviewdog.yml @@ -0,0 +1,44 @@ +name: reviewdog +on: [pull_request] +jobs: + pylint: + name: runner / pylint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dciborow/action-pylint@0.1.1 + with: + github_token: ${{ secrets.github_token }} + # Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review]. + reporter: github-pr-check + # Change reporter level if you need. + # GitHub Status Check won't become failure with warning. + level: warning + glob_pattern: "**/*.py" + + black: + name: runner / black + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check files using the black formatter + uses: rickstaa/action-black@v1.3.3 + id: action_black + with: + black_args: "." + - name: Annotate diff changes using reviewdog + if: steps.action_black.outputs.is_formatted == 'true' + uses: reviewdog/action-suggester@v1 + with: + tool_name: blackfmt + + markdownlint: + name: runner / markdownlint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: markdownlint + uses: reviewdog/action-markdownlint@v0.20.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + reporter: github-pr-check diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml new file mode 100644 index 0000000..0eef58b --- /dev/null +++ b/.github/workflows/rspec.yml @@ -0,0 +1,16 @@ +name: Run rspec tests + +on: [pull_request] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + # The Ruby version is determined by either a `.ruby-version` or a `.tool-versions` file in root of the repo. + bundler-cache: true + - name: Run rspec tests + run: | + bundle exec rspec diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..c99d2e7 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--require spec_helper diff --git a/Gemfile b/Gemfile index 37f5eaa..3040e60 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,13 @@ source 'https://rubygems.org' gem 'github-pages', group: :jekyll_plugins +gem 'jekyll-sitemap' +gem 'webrick' + +group :development, :test do + gem "rspec" + gem "selenium-webdriver" + gem "capybara" + gem "rack-jekyll" + gem "axe-core-rspec" + gem "axe-core-capybara" +end diff --git a/README.md b/README.md index 77dbff7..b3e3907 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,41 @@ ---- -layout: home -title: Just the Class -nav_exclude: true -permalink: /:path/ -seo: - type: Course - name: Just the Class ---- +# Berkeley Class Site -# Just the Class +A template for UC Berkeley class websites (with a focus on EECS/CS/DS courses). -Just the Class is a GitHub Pages template developed for the purpose of quickly deploying course websites. In addition to serving plain web pages and files, it provides a boilerplate for: +## Installation -- [announcements](announcements.md), -- a [course calendar](calendar.md), -- a [staff](staff.md) page, -- and a weekly [schedule](schedule.md). +Prerequisites: -Just the Class is a template that extends the popular [Just the Docs](https://github.com/just-the-docs/just-the-docs) theme, which provides a robust and thoroughly-tested foundation for your website. Just the Docs include features such as: +- You have everything that [Jekyll requires](https://jekyllrb.com/docs/installation/) +- You have installed [Bundler](https://bundler.io/): Run `gem install jekyll bundler` -- automatic [navigation structure](https://just-the-docs.github.io/just-the-docs/docs/navigation-structure/), -- instant, full-text [search](https://just-the-docs.github.io/just-the-docs/docs/search/) and page indexing, -- and a set of [UI components](https://just-the-docs.github.io/just-the-docs/docs/ui-components) and authoring [utilities](https://just-the-docs.github.io/just-the-docs/docs/utilities). +1. [Fork](https://github.com/berkeley-eecs/berkeley-class-site/fork) the repository. +2. Clone your fork (replace `YOUR_GITHUB_USERNAME` and `YOUR_REPO` accordingly). +``` +git clone git@github.com:YOUR_GITHUB_USERNAME/YOUR_REPO.git +``` +3. Install dependencies: +``` +cd YOUR_REPO +bundle install +``` -## Getting Started +## Usage -Getting started with Just the Class is simple. +To run the site locally, run: -1. Create a [new repository based on Just the Class](https://github.com/kevinlin1/just-the-class/generate). -1. Update `_config.yml` and `README.md` with your course information. [Be sure to update the url and baseurl](https://mademistakes.com/mastering-jekyll/site-url-baseurl/). -1. Configure a [publishing source for GitHub Pages](https://help.github.com/en/articles/configuring-a-publishing-source-for-github-pages). Your course website is now live! -1. Edit and create `.md` [Markdown files](https://guides.github.com/features/mastering-markdown/) to add more content pages. +``` +bundle exec jekyll serve +``` -Just the Class has been used by instructors at Stanford University ([CS 161](https://stanford-cs161.github.io/winter2021/)), UC Berkeley ([Data 100](https://ds100.org/fa21/)), UC Santa Barbara ([CSW8](https://ucsb-csw8.github.io/s22/)), Northeastern University ([CS4530/5500](https://neu-se.github.io/CS4530-CS5500-Spring-2021/)), and Carnegie Mellon University ([17-450/17-950](https://cmu-crafting-software.github.io/)). Share your course website and find more examples in the [show and tell discussion](https://github.com/kevinlin1/just-the-class/discussions/categories/show-and-tell)! +## Deployment -### Local development environment +The easiest way to deploy your site is with [GitHub Pages](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll). -Just the Class requires no special Jekyll plugins and can run on GitHub Pages' standard Jekyll compiler. To setup a local development environment, clone your template repository and follow the GitHub Docs on [Testing your GitHub Pages site locally with Jekyll](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/testing-your-github-pages-site-locally-with-jekyll). +## Contributing + +See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for instructions on how to develop this site as part of course staff or if you're interested in contributing to this template repository. + +## License + +[MIT](LICENSE) diff --git a/_config.yml b/_config.yml index 46d2c1f..df93379 100644 --- a/_config.yml +++ b/_config.yml @@ -17,9 +17,11 @@ title: Just the Class tagline: A Jekyll template for course websites description: A modern, highly customizable, responsive Jekyll template for course websites author: Kevin Lin -baseurl: '/just-the-class' # the subpath of your site, e.g. /blog -url: 'https://kevinl.info' # the base hostname & protocol for your site, e.g. http://example.com -exclude: ["Gemfile", "Gemfile.lock", "LICENSE"] +baseurl: '/berkeley-class-site' # the subpath of your site, e.g. /blog +url: 'https://phrdang.github.io' # the base hostname & protocol for your site, e.g. http://example.com +plugins: + - "jekyll-sitemap" +exclude: ["Gemfile", "Gemfile.lock", "vendor", "node_modules", "LICENSE"] # Theme settings remote_theme: just-the-docs/just-the-docs@v0.5.1 @@ -37,13 +39,42 @@ footer_content: # Collections for website data collections: staffers: + sort_by: name modules: schedules: announcements: + labs: + output: true + permalink: /:collection/:path + hw: + output: true + permalink: /:collection/:path + projects: + output: true + permalink: /:collection/:path + # Default layouts for each collection type defaults: - scope: path: '' + type: labs + values: + layout: lab + nav_exclude: true + - scope: + path: '' + type: hw + values: + layout: hw + nav_exclude: true + - scope: + path: '' + type: projects + values: + layout: project + nav_exclude: true + - scope: + path: '_staffers' type: staffers values: layout: staffer @@ -73,3 +104,7 @@ compress_html: startings: [] blanklines: false profile: false + +# Course variables +course_email: cs88@berkeley.edu +gradescope_course_id: 693229 diff --git a/_hw/hw01.md b/_hw/hw01.md new file mode 100644 index 0000000..025a5c7 --- /dev/null +++ b/_hw/hw01.md @@ -0,0 +1,19 @@ +--- +title: HW 1 +description: Recursion +due: "2024-06-13 11:59:59 PM PST" +gradescope_assignment_id: 3858564 +submission_files: + - hw01.py +--- + +1. TOC +{:toc} + +## Q1: Sample Question + +{% include questions/sample_question.md %} + +## Q2: Another Question + +{% include questions/another_question.md %} diff --git a/_includes/okpy.md b/_includes/okpy.md new file mode 100644 index 0000000..21e01f7 --- /dev/null +++ b/_includes/okpy.md @@ -0,0 +1,5 @@ +Use Ok to test your code: + +``` +python3 ok -q {{ include.question }} +``` diff --git a/_includes/questions/another_question.md b/_includes/questions/another_question.md new file mode 100644 index 0000000..58cc1a0 --- /dev/null +++ b/_includes/questions/another_question.md @@ -0,0 +1,7 @@ +This is another sample question description. + +{% highlight python %} +{% include questions/another_question.py %} +{% endhighlight %} + +{% include okpy.md question="another_question" %} diff --git a/_includes/questions/another_question.py b/_includes/questions/another_question.py new file mode 100644 index 0000000..10176de --- /dev/null +++ b/_includes/questions/another_question.py @@ -0,0 +1,12 @@ +def another_question(a, b, c): + """ + >>> another_question(1, 2, 3) + 6 + >>> another_question(0, 0, 0) + 0 + >>> another_question(3, 0, 0) + 3 + """ + # BEGIN SOLUTION + return a + b + c + # END SOLUTION diff --git a/_includes/questions/sample_question.md b/_includes/questions/sample_question.md new file mode 100644 index 0000000..bdfd88c --- /dev/null +++ b/_includes/questions/sample_question.md @@ -0,0 +1,7 @@ +This is a sample question description. + +{% highlight python %} +{% include questions/sample_question.py %} +{% endhighlight %} + +{% include okpy.md question="sample_question" %} diff --git a/_includes/questions/sample_question.py b/_includes/questions/sample_question.py new file mode 100644 index 0000000..114b5ac --- /dev/null +++ b/_includes/questions/sample_question.py @@ -0,0 +1,12 @@ +def sample_question(a, b, c): + """ + >>> another_question(1, 2, 3) + 6 + >>> another_question(0, 0, 0) + 0 + >>> another_question(3, 0, 0) + 3 + """ + # BEGIN SOLUTION + return a + b + c + # END SOLUTION diff --git a/_includes/submission.html b/_includes/submission.html new file mode 100644 index 0000000..8fa72c4 --- /dev/null +++ b/_includes/submission.html @@ -0,0 +1,9 @@ +When you are done, submit your file to Gradescope. You only need to upload the following files: + + + +You may submit more than once before the deadline; only the final submission will be graded. It is your responsibility to check that the autograder on Gradescope runs as expected after you upload your submission. diff --git a/_labs/lab01.md b/_labs/lab01.md new file mode 100644 index 0000000..603debe --- /dev/null +++ b/_labs/lab01.md @@ -0,0 +1,20 @@ +--- +title: Lab 1 +description: Control and Functions +due: "2024-06-13 11:59:59 PM PST" +gradescope_assignment_id: 3858564 +submission_files: + - lab01.py + - another_file.py +--- + +1. TOC +{:toc} + +## Q1: Sample Question + +{% include questions/sample_question.md %} + +## Q2: Another Question + +{% include questions/another_question.md %} diff --git a/_layouts/hw.html b/_layouts/hw.html new file mode 100644 index 0000000..0dcb2af --- /dev/null +++ b/_layouts/hw.html @@ -0,0 +1,14 @@ +--- +layout: default +--- + +
+

{{ page.title }}: {{ page.description }}

+
Due at: {{ page.due }}
+ + + {{ content }} + +

Submission

+ {% include submission.html gradescope_assignment_id=page.gradescope_assignment_id submission_files=page.submission_files %} +
diff --git a/_layouts/lab.html b/_layouts/lab.html new file mode 100644 index 0000000..96523cf --- /dev/null +++ b/_layouts/lab.html @@ -0,0 +1,14 @@ +--- +layout: default +--- + +
+

{{ page.title }}: {{ page.description }}

+
Due at: {{ page.due }}
+ + + {{ content }} + +

Submission

+ {% include submission.html gradescope_assignment_id=page.gradescope_assignment_id submission_files=page.submission_files %} +
diff --git a/_layouts/project.html b/_layouts/project.html new file mode 100644 index 0000000..93e1ffc --- /dev/null +++ b/_layouts/project.html @@ -0,0 +1,14 @@ +--- +layout: default +--- + +
+

{{ page.title }}: {{ page.description }}

+
Due at: {{ page.due }}
+ + + {{ content }} + +

Submission

+ {% include submission.html gradescope_assignment_id=page.gradescope_assignment_id submission_files=page.submission_files %} +
diff --git a/_layouts/staffer.html b/_layouts/staffer.html index 67b3aa8..fc044cc 100644 --- a/_layouts/staffer.html +++ b/_layouts/staffer.html @@ -1,6 +1,8 @@
{%- if page.photo -%} - + {{ page.name }} profile photo + {%- else -%} + {{ page.name }} profile photo {%- endif -%}

@@ -10,17 +12,23 @@

{{ page.name }} {%- endif -%} {%- if page.pronouns -%} - {{ page.pronouns }} + {{ page.pronouns }} + {%- endif -%} + {%- if page.access_email -%} + {{ site.course_email }} + {%- endif -%} + {%- if page.access_dsp -%} + DSP {%- endif -%}

{%- if page.email -%}

{{ page.email }}

{%- endif -%} {%- if page.section -%} -

Quiz Section: {{ page.section | markdownify | strip_html }}

+

Section: {{ page.section | markdownify | strip_html }}

{%- endif -%} - {%- if page.office-hours -%} -

Office Hours: {{ page.office-hours | markdownify | strip_html }}

+ {%- if page.office_hours -%} +

Office Hours: {{ page.office_hours | markdownify | strip_html }}

{%- endif -%} {{ content }}
diff --git a/_modules/week-01.md b/_modules/week-01.md index 9af2bd4..92167ed 100644 --- a/_modules/week-01.md +++ b/_modules/week-01.md @@ -15,9 +15,9 @@ Sep 30 : [1.2](#), [2.1](#) Oct 1 -: **Lab**{: .label .label-purple } [Intro to Java](#) +: **Lab**{: .label .label-purple } [Lab 1: Control and Functions]({{ site.baseurl }}/labs/lab01) Oct 2 : [Tracing, IntLists, & Recursion](#) : [2.1](#) -: **HW 1 due**{: .label .label-red } +: **HW 1 due**{: .label .label-red } [HW 1: Recursion]({{ site.baseurl }}/hw/hw01) diff --git a/_modules/week-02.md b/_modules/week-02.md index 86b8eb3..217e239 100644 --- a/_modules/week-02.md +++ b/_modules/week-02.md @@ -15,7 +15,7 @@ Oct 7 : [2.4](#), [2.5](#) Oct 8 -: **Lab**{: .label .label-purple } [Resizing Arrays](#) +: **Project**{: .label .label-green } [Project 1: Ants vs. Some Bees]({{ site.baseurl }}/projects/proj01) Oct 9 : [Runtime Analysis](#) diff --git a/_projects/proj01.md b/_projects/proj01.md new file mode 100644 index 0000000..eff9089 --- /dev/null +++ b/_projects/proj01.md @@ -0,0 +1,19 @@ +--- +title: Project 1 +description: Ants vs. Some Bees +due: "2024-06-13 11:59:59 PM PST" +gradescope_assignment_id: 3858564 +submission_files: + - ants.py +--- + +1. TOC +{:toc} + +## Q1: Sample Question + +{% include questions/sample_question.md %} + +## Q2: Another Question + +{% include questions/another_question.md %} diff --git a/_sass/custom/lab.scss b/_sass/custom/lab.scss new file mode 100644 index 0000000..c1860a6 --- /dev/null +++ b/_sass/custom/lab.scss @@ -0,0 +1 @@ +// TODO style labs diff --git a/_sass/custom/staffer.scss b/_sass/custom/staffer.scss index be87853..988a721 100644 --- a/_sass/custom/staffer.scss +++ b/_sass/custom/staffer.scss @@ -14,7 +14,7 @@ margin: $sp-1 !important; } - .staffer-pronouns { + .staffer-badge { @extend .label, .text-grey-dk-100, .bg-grey-lt-200; user-select: none; diff --git a/_staffers/jane-doe.md b/_staffers/jane-doe.md new file mode 100644 index 0000000..292bff4 --- /dev/null +++ b/_staffers/jane-doe.md @@ -0,0 +1,7 @@ +--- +name: Jane Doe +role: Head Teaching Assistant +email: janedoe@berkeley.edu +--- + +I like teaching Computer Science! diff --git a/_staffers/kevin.md b/_staffers/kevin-lin.md similarity index 75% rename from _staffers/kevin.md rename to _staffers/kevin-lin.md index 7759a4f..d09081d 100644 --- a/_staffers/kevin.md +++ b/_staffers/kevin-lin.md @@ -4,6 +4,9 @@ role: Instructor email: me@example.com website: https://kevinl.info photo: kevin.jpg +pronouns: he/him +access_email: true +access_dsp: true --- [Schedule an appointment](#){: .btn .btn-outline } diff --git a/_staffers/really-evil-kevin.md b/_staffers/really-evil-kevin.md index 377d089..afeb5e2 100644 --- a/_staffers/really-evil-kevin.md +++ b/_staffers/really-evil-kevin.md @@ -1,6 +1,6 @@ --- name: Really Evil Kevin -role: Teaching Assistant +role: Academic Intern email: me@example.com website: https://kevinl.info photo: kevin.jpg diff --git a/_staffers/evil-kevin.md b/_staffers/really-really-evil-kevin.md similarity index 72% rename from _staffers/evil-kevin.md rename to _staffers/really-really-evil-kevin.md index ff5264f..360aabc 100644 --- a/_staffers/evil-kevin.md +++ b/_staffers/really-really-evil-kevin.md @@ -1,6 +1,6 @@ --- -name: Evil Kevin -role: Teaching Assistant +name: Really Really Evil Kevin +role: Tutor email: me@example.com website: https://kevinl.info photo: kevin.jpg diff --git a/_staffers/sam.md b/_staffers/sam.md new file mode 100644 index 0000000..11c2343 --- /dev/null +++ b/_staffers/sam.md @@ -0,0 +1,12 @@ +--- +name: Sam +role: Head Teaching Assistant +email: me@example.com +website: https://kevinl.info +photo: kevin.jpg +section: Soda 380 Tue 3-4 PM +office_hours: Warren Hall Tue 2-3 PM +access_dsp: true +--- + +I like teaching Computer Science! diff --git a/assets/images/default_photo.jpg b/assets/images/default_photo.jpg new file mode 100644 index 0000000..8cecc30 Binary files /dev/null and b/assets/images/default_photo.jpg differ diff --git a/calendar.md b/calendar.md index 930a417..3a47537 100644 --- a/calendar.md +++ b/calendar.md @@ -2,6 +2,7 @@ layout: page title: Calendar description: Listing of course modules and topics. +nav_order: 1 --- # Calendar diff --git a/home.md b/home.md new file mode 100644 index 0000000..77dbff7 --- /dev/null +++ b/home.md @@ -0,0 +1,39 @@ +--- +layout: home +title: Just the Class +nav_exclude: true +permalink: /:path/ +seo: + type: Course + name: Just the Class +--- + +# Just the Class + +Just the Class is a GitHub Pages template developed for the purpose of quickly deploying course websites. In addition to serving plain web pages and files, it provides a boilerplate for: + +- [announcements](announcements.md), +- a [course calendar](calendar.md), +- a [staff](staff.md) page, +- and a weekly [schedule](schedule.md). + +Just the Class is a template that extends the popular [Just the Docs](https://github.com/just-the-docs/just-the-docs) theme, which provides a robust and thoroughly-tested foundation for your website. Just the Docs include features such as: + +- automatic [navigation structure](https://just-the-docs.github.io/just-the-docs/docs/navigation-structure/), +- instant, full-text [search](https://just-the-docs.github.io/just-the-docs/docs/search/) and page indexing, +- and a set of [UI components](https://just-the-docs.github.io/just-the-docs/docs/ui-components) and authoring [utilities](https://just-the-docs.github.io/just-the-docs/docs/utilities). + +## Getting Started + +Getting started with Just the Class is simple. + +1. Create a [new repository based on Just the Class](https://github.com/kevinlin1/just-the-class/generate). +1. Update `_config.yml` and `README.md` with your course information. [Be sure to update the url and baseurl](https://mademistakes.com/mastering-jekyll/site-url-baseurl/). +1. Configure a [publishing source for GitHub Pages](https://help.github.com/en/articles/configuring-a-publishing-source-for-github-pages). Your course website is now live! +1. Edit and create `.md` [Markdown files](https://guides.github.com/features/mastering-markdown/) to add more content pages. + +Just the Class has been used by instructors at Stanford University ([CS 161](https://stanford-cs161.github.io/winter2021/)), UC Berkeley ([Data 100](https://ds100.org/fa21/)), UC Santa Barbara ([CSW8](https://ucsb-csw8.github.io/s22/)), Northeastern University ([CS4530/5500](https://neu-se.github.io/CS4530-CS5500-Spring-2021/)), and Carnegie Mellon University ([17-450/17-950](https://cmu-crafting-software.github.io/)). Share your course website and find more examples in the [show and tell discussion](https://github.com/kevinlin1/just-the-class/discussions/categories/show-and-tell)! + +### Local development environment + +Just the Class requires no special Jekyll plugins and can run on GitHub Pages' standard Jekyll compiler. To setup a local development environment, clone your template repository and follow the GitHub Docs on [Testing your GitHub Pages site locally with Jekyll](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/testing-your-github-pages-site-locally-with-jekyll). diff --git a/schedule.md b/schedule.md index a634af6..39f2220 100644 --- a/schedule.md +++ b/schedule.md @@ -2,6 +2,7 @@ layout: page title: Schedule description: The weekly event schedule. +nav_order: 2 --- # Weekly Schedule diff --git a/spec/accessibility_spec.rb b/spec/accessibility_spec.rb new file mode 100644 index 0000000..96c6f16 --- /dev/null +++ b/spec/accessibility_spec.rb @@ -0,0 +1,21 @@ +describe "course website", type: :feature, js: true do + before :all do + visit('/sitemap.xml') + sitemap_links = page.html.scan(/.+<\/loc>/) + @links = [] + sitemap_links.each do |link| + # TODO don't hardcode base url + first_removed = link.sub('https://phrdang.github.io/berkeley-class-site', '') + last_removed = first_removed.sub('', '') + @links.push(last_removed) + end + end + + # TODO run each page's axe check separately so it doesn't exit on first failure + it "is accessible" do + @links.each do |link| + visit(link) + expect(page).to be_axe_clean.according_to :wcag2a, "path: #{link} not accessible" + end + end +end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..9a7d4f1 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,80 @@ +# This file was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration + +require 'rspec' +require 'capybara/rspec' +require 'rack/jekyll' +require 'rack/test' +require 'axe-rspec' +require 'axe-capybara' + +RSpec.configure do |config| + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + mocks.verify_partial_doubles = true + end + + # This option will default to `:apply_to_host_groups` in RSpec 4 (and will + # have no way to turn it off -- the option exists only for backwards + # compatibility in RSpec 3). It causes shared context metadata to be + # inherited by the metadata hash of host groups and examples, rather than + # triggering implicit auto-inclusion in groups with matching metadata. + config.shared_context_metadata_behavior = :apply_to_host_groups + + Capybara.register_driver :chrome_headless do |app| + options = Selenium::WebDriver::Chrome::Options.new + options.add_argument('--headless') + options.add_argument('--no-sandbox') + options.add_argument('--disable-dev-shm-usage') + options.add_argument('--window-size=1400,1400') + + Capybara::Selenium::Driver.new(app, browser: :chrome, options: options) + end + + # Change default_driver to :selenium_chrome if you want to actually see the tests running in a browser locally. + # Should be :chrome_headless in CI though. + Capybara.default_driver = :chrome_headless + Capybara.javascript_driver = :chrome_headless + + # Configure Capybara to load the website through rack-jekyll. + # (force_build: true) builds the site before the tests are run, + # so our tests are always running against the latest version + # of our jekyll site. + jekyll_app = Rack::Jekyll.new(force_build: true) + + # https://stackoverflow.com/questions/52506822/testing-a-jekyll-site-with-rspec-and-capybara-getting-a-bizarre-race-case-on-rs + sleep 0.1 while jekyll_app.compiling? + + Capybara.app = jekyll_app + + # Configure Capybara server (otherwise it will error and say to use webrick or puma) + Capybara.server = :webrick +end diff --git a/staff.md b/staff.md index 54c585e..a65b56c 100644 --- a/staff.md +++ b/staff.md @@ -2,6 +2,7 @@ layout: page title: Staff description: A listing of all the course staff members. +nav_order: 4 --- # Staff @@ -15,6 +16,16 @@ Staff information is stored in the `_staffers` directory and rendered according {{ staffer }} {% endfor %} +{% assign head_teaching_assistants = site.staffers | where: 'role', 'Head Teaching Assistant' %} +{% assign num_head_teaching_assistants = head_teaching_assistants | size %} +{% if num_head_teaching_assistants != 0 %} +## Head Teaching Assistants + +{% for staffer in head_teaching_assistants %} +{{ staffer }} +{% endfor %} +{% endif %} + {% assign teaching_assistants = site.staffers | where: 'role', 'Teaching Assistant' %} {% assign num_teaching_assistants = teaching_assistants | size %} {% if num_teaching_assistants != 0 %} @@ -24,3 +35,23 @@ Staff information is stored in the `_staffers` directory and rendered according {{ staffer }} {% endfor %} {% endif %} + +{% assign tutors = site.staffers | where: 'role', 'Tutor' %} +{% assign num_tutors = tutors | size %} +{% if num_tutors != 0 %} +## Tutors + +{% for staffer in tutors %} +{{ staffer }} +{% endfor %} +{% endif %} + +{% assign academic_interns = site.staffers | where: 'role', 'Academic Intern' %} +{% assign num_academic_interns = academic_interns | size %} +{% if num_academic_interns != 0 %} +## Academic Interns + +{% for staffer in academic_interns %} +{{ staffer }} +{% endfor %} +{% endif %} diff --git a/about.md b/syllabus.md similarity index 98% rename from about.md rename to syllabus.md index a522c3d..74cad05 100644 --- a/about.md +++ b/syllabus.md @@ -1,11 +1,12 @@ --- layout: page -title: About +title: Syllabus description: >- Course policies and information. +nav_order: 3 --- -# About +# Syllabus {:.no_toc} ## Table of contents