Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Cleanup Preview

on:
pull_request:
types: [closed]

permissions:
contents: write

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages

- name: Remove preview directory
run: |
if [ -d "preview/pr-${{ github.event.number }}" ]; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git rm -rf "preview/pr-${{ github.event.number }}"
git commit -m "Remove preview for PR #${{ github.event.number }}"
git push
else
echo "No preview directory found, skipping."
fi
28 changes: 28 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Deploy

on:
push:
branches: [main]

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
bundler-cache: true

- name: Build site
run: bundle exec jekyll build

- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
63 changes: 63 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: PR Preview

on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: write
pull-requests: write

jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
bundler-cache: true

- name: Build preview
run: bundle exec jekyll build --baseurl "/preview/pr-${{ github.event.number }}"

- name: Deploy preview to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
destination_dir: preview/pr-${{ github.event.number }}

- name: Post preview comment
uses: actions/github-script@v7
with:
script: |
const url = `https://mpc-deadlines.github.io/preview/pr-${{ github.event.number }}/`;
const body = `## Preview deployed\n\n🔍 **${url}**\n\n_Updates automatically on each push to this PR._`;

const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});

const existing = comments.find(c =>
c.user.type === 'Bot' && c.body.includes('Preview deployed')
);

if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body,
});
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

.DS_Store
static/.DS_Store
static/.DS_Store
.phcode.json
_site/
.bundle/
.jekyll-cache/
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"
gem "jekyll", "~> 4.2"
gem "webrick"
85 changes: 85 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.9.0)
public_suffix (>= 2.0.2, < 8.0)
base64 (0.3.0)
bigdecimal (4.1.2)
colorator (1.1.0)
concurrent-ruby (1.3.6)
csv (3.3.5)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
eventmachine (1.2.7)
ffi (1.17.4-x86_64-linux-musl)
forwardable-extended (2.6.0)
google-protobuf (4.34.1-x86_64-linux-musl)
bigdecimal
rake (~> 13.3)
http_parser.rb (0.8.1)
i18n (1.14.8)
concurrent-ruby (~> 1.0)
jekyll (4.4.1)
addressable (~> 2.4)
base64 (~> 0.2)
colorator (~> 1.0)
csv (~> 3.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (>= 2.0, < 4.0)
jekyll-watch (~> 2.0)
json (~> 2.6)
kramdown (~> 2.3, >= 2.3.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.3, >= 0.3.6)
pathutil (~> 0.9)
rouge (>= 3.0, < 5.0)
safe_yaml (~> 1.0)
terminal-table (>= 1.8, < 4.0)
webrick (~> 1.7)
jekyll-sass-converter (3.1.0)
sass-embedded (~> 1.75)
jekyll-watch (2.2.1)
listen (~> 3.0)
json (2.19.5)
kramdown (2.5.2)
rexml (>= 3.4.4)
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.4)
listen (3.10.0)
logger
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.7.0)
mercenary (0.4.0)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (6.0.2)
rake (13.4.2)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rexml (3.4.4)
rouge (4.7.0)
safe_yaml (1.0.5)
sass-embedded (1.99.0)
google-protobuf (~> 4.31)
rake (>= 13)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.6.0)
webrick (1.9.2)

PLATFORMS
x86_64-linux
x86_64-linux-musl

DEPENDENCIES
jekyll (~> 4.2)
webrick

BUNDLED WITH
2.3.25
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ <h1>

<div class="col-xs-12">
<button id="clear-filters" class="btn btn-primary">Clear Filters</button>
&nbsp;&nbsp;
<span class="sort-label"><b>Sort by:</b></span>
<button class="btn btn-default btn-sm sort-btn active-sort" data-sort="deadline">Deadline</button>
<button class="btn btn-default btn-sm sort-btn" data-sort="event-date">Event Date</button>
</div>

</div>
Expand All @@ -110,7 +114,7 @@ <h1>
<!--{% assign conf_id = conf.name | append: conf.year | append: '-' | append: i | slugify %}-->
{% assign conf_type = conf.tags | join: "-" | slugify %}
{% assign conf_id = conf.name | append: conf.year | append: '-' | append: conf_type | append: '-' | append: i | slugify %}
<div id="{{ conf_id }}" class="conf {% for tag in conf.tags %} {{tag}} {% endfor %}">
<div id="{{ conf_id }}" class="conf {% for tag in conf.tags %} {{tag}} {% endfor %}" data-conf-date="{{ conf.date }}" data-conf-year="{{ conf.year }}">
<div class="row">
<div class="col-xs-12 col-sm-6">
<a class="conf-title" href="{{conf.link}}" target="_blank">{{conf.name}} {{conf.year}}</a>
Expand Down
12 changes: 12 additions & 0 deletions static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,16 @@ h2 .evtname {

.past {
opacity: 0.5;
}

.sort-label {
margin-left: 10px;
margin-right: 5px;
vertical-align: middle;
}

.sort-btn.active-sort {
background-color: #337ab7;
color: #fff;
border-color: #2e6da4;
}
80 changes: 50 additions & 30 deletions static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,39 +82,59 @@ $(function() {

// Reorder list
var today = moment();
var confs = $('.conf').detach();

confs.sort(function(a, b) {
var aDeadline = deadlineByConf[a.id];
var bDeadline = deadlineByConf[b.id];
var aDiff = today.diff(aDeadline);
var bDiff = today.diff(bDeadline);
if (aDiff < 0 && bDiff > 0) {
return -1;
}
if (aDiff > 0 && bDiff < 0) {
return 1;
}
return bDiff - aDiff;
});

var pastConfs = [];
var upcomingConfs = [];

confs.each(function() {
var conf = $(this);

if (conf.hasClass("past")) {
pastConfs.push(conf);
function getEventStartDate(confEl) {
var dateStr = $(confEl).data('conf-date');
var year = $(confEl).data('conf-year');
if (!dateStr || String(dateStr).toLowerCase().indexOf('tba') === 0) return null;
// Handle "June 29 - July 03" → "June 29"; handle "November 15-19" → "November 15"
var firstPart = String(dateStr).split(' - ')[0].replace(/-\d+$/, '').trim();
var parsed = moment(firstPart + ' ' + year, 'MMMM D YYYY');
return parsed.isValid() ? parsed : null;
}

function renderConfs(sortMode) {
var confs = $('.conf-container .conf, #past-events-list .conf').detach();

if (sortMode === 'event-date') {
confs.sort(function(a, b) {
var aDate = getEventStartDate(a);
var bDate = getEventStartDate(b);
if (!aDate && !bDate) return 0;
if (!aDate) return 1;
if (!bDate) return -1;
return aDate.diff(bDate);
});
} else {
upcomingConfs.push(conf);
confs.sort(function(a, b) {
var aDeadline = deadlineByConf[a.id];
var bDeadline = deadlineByConf[b.id];
var aDiff = today.diff(aDeadline);
var bDiff = today.diff(bDeadline);
if (aDiff < 0 && bDiff > 0) return -1;
if (aDiff > 0 && bDiff < 0) return 1;
return bDiff - aDiff;
});
}
});

//$('.conf-container').append(confs);
$('.conf-container').append(upcomingConfs);
$('#past-events-list').append(pastConfs);


var pastConfs = [];
var upcomingConfs = [];
confs.each(function() {
($(this).hasClass('past') ? pastConfs : upcomingConfs).push(this);
});

$('.conf-container').append(upcomingConfs);
$('#past-events-list').append(pastConfs);
}

renderConfs('deadline');

$('.sort-btn').click(function() {
$('.sort-btn').removeClass('active-sort');
$(this).addClass('active-sort');
renderConfs($(this).data('sort'));
});

// Toggle past events visibility
$(".past-deadlines").click(function() {
$("#past-events-list").slideToggle();
Expand Down
Loading