Skip to content

Commit

Permalink
Add preliminary multi-adventure support
Browse files Browse the repository at this point in the history
There’s much still to be done in this direction but it’s
a start at least. It seems like sometimes CMSy features
are needed, like the site-specific images used for CR
which should be configured for a particular instance
rather than the adventure itself.

The env-setting in tests is thanks to @jtomaszewski:
https://elixirforum.com/t/using-application-get-env-application-put-env-in-exunit-tests/8019/3
  • Loading branch information
backspace committed Apr 8, 2023
1 parent fa0bdfe commit 0380fdd
Show file tree
Hide file tree
Showing 24 changed files with 159 additions and 121 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$global-width: 960px;
$global-font-size: 120%;

@import 'app';
@import 'clandestine-rendezvous';
File renamed without changes.
3 changes: 3 additions & 0 deletions assets/css/unmnemonic-devices.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.jortle {
color: blue;
}
10 changes: 5 additions & 5 deletions assets/js/app.js → assets/js/clandestine-rendezvous.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../css/app.scss';
import '../css/clandestine-rendezvous.scss';

// Brunch automatically concatenates all files in your
// watched paths. Those paths can be configured at
Expand All @@ -23,7 +23,7 @@ import "phoenix_html"
// import socket from "./socket"

import './add-to-team-emails';
import './camera';
import './eye-tracking';
import './moving-highlight';
import './secret-image';
import './clandestine-rendezvous/camera';
import './clandestine-rendezvous/eye-tracking';
import './clandestine-rendezvous/moving-highlight';
import './clandestine-rendezvous/secret-image';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions assets/js/unmnemonic-devices.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import '../css/unmnemonic-devices.scss';

import $ from 'jquery';

$(() => {
console.log("unmnemonic devices!");
});
5 changes: 3 additions & 2 deletions assets/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ module.exports = (env, options) => {
]
},
entry: {
'app': glob.sync('./vendor/**/*.js').concat(['./js/app.js'])
'clandestine-rendezvous': glob.sync('./vendor/clandestine-rendezvous/**/*.js').concat(['./js/clandestine-rendezvous.js']),
'unmnemonic-devices': glob.sync('./vendor/unmnemonic-devices/**/*.js').concat(['./js/unmnemonic-devices.js']),
},
externals: [ 'foundation-sites' ],
output: {
Expand Down Expand Up @@ -53,7 +54,7 @@ module.exports = (env, options) => {
]
},
plugins: [
new MiniCssExtractPlugin({ filename: '../css/app.css' }),
new MiniCssExtractPlugin({ filename: '../css/[name].css' }),
new CopyWebpackPlugin([{ from: 'static/', to: '../' }])
]
.concat(devMode ? [new HardSourceWebpackPlugin()] : [])
Expand Down
1 change: 1 addition & 0 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ config :adventure_registrations, AdventureRegistrations.Mailer,
api_key: System.get_env("MAILGUN_KEY")

config :adventure_registrations,
adventure: System.get_env("ADVENTURE"),
request_confirmation: false,
registration_closed: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule AdventureRegistrationsWeb.PageController do
use AdventureRegistrationsWeb, :controller

def index(conn, _params) do
render(conn, "index.html")
render(conn, "#{Application.get_env(:adventure_registrations, :adventure)}.html")
end

def questions(conn, %{"question" => question_params}) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<title>Clandestine Rendezvous</title>
<link href='https://fonts.googleapis.com/css?family=Oswald:300,400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href={Routes.static_path(@conn, "/css/app.css")}>
<link rel="stylesheet" href={Routes.static_path(@conn, "/css/#{Application.get_env(:adventure_registrations, :adventure)}.css")}>
</head>

<body>
Expand Down Expand Up @@ -69,6 +69,6 @@
<%= @inner_content %>
</div>

<script src={Routes.static_path(@conn, "/js/app.js")}></script>
<script src={Routes.static_path(@conn, "/js/#{Application.get_env(:adventure_registrations, :adventure)}.js")}></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<div class='row title moving-highlight' data-highlight='h2'>
<div class='small-4 columns'>
<img src='/images/logo.png' class='logo'>
</div>
<div class='small-8 columns'>
<h2>Clandestine</h2><h2>Rendezvous</h2>
</div>
</div>

<div class='row card'>
<div class='small-12 columns'>
<p>You are a member of a secret society with a mission of the utmost importance.</p>
<p>You will have encounters with other members around an undisclosed location where you will obtain information to get closer to fulfilling your mission.</p>
</div>
</div>

<div class='row card'>
<div class='small-12 columns'>
<p>Clandestine Rendezvous is an adventure taking place at a to-be-confirmed Victoria location in the evening on <%= full_date() %>. Participants receive a set of appointment cards that direct them to specific locations at precise times at which they will meet other operatives and exchange information with them. Each rendezvous will provide a clue to solve the case.</p>
</div>
</div>

<div class='row card'>
<div class='small-12 columns'>
<img src='/images/first-image.jpg'>
</div>
</div>

<div class='row card'>
<div class='small-12 columns'>
<h4 class='moving-highlight'><i class='fa fa-white fa-clock-o'></i> When and where?</h4>
<p>The secret society is so secret that the venue for initiation cannot be shared publicly. Once it is decided, it will be shared with those who <%= link "register", to: Routes.registration_path(@conn, :new) %>. If you have questions about travel, please write to us after registering.</p>
<p>The adventure will begin at <%= start_time() %>. If you have obligations that prevent you from being present at the beginning let us know and we can discuss how to accommodate you.</p>
</div>
</div>

<div class='row card'>
<div class='small-12 columns'>
<h4 class='moving-highlight'><i class='fa fa-white fa-user-secret'></i> Who?</h4>
<p>Anyone is invited to attend. You should have a sense of adventure and stealth. You can go alone or with a partner.</p>
</div>
</div>

<div class='row card'>
<div class='small-12 columns'>
<h4 class='moving-highlight'><i class='fa fa-white fa-dollar'></i> Cost</h4>
<p>A $5 donation is requested to cover printing costs and labour. If that’s too much, any amount (including 0) is welcome.</p>
</div>
</div>
<div class='row card'>
<div class='small-12 columns'>
<h4 class='moving-highlight'><i class='fa fa-white fa-universal-access'></i> Accessibility</h4>
<p>Do you have accessibility needs we should know about? Please tell us <%= link "when you register", to: Routes.registration_path(@conn, :new) %> and we will work with you to ensure you can participate.</p>
</div>
</div>
<div class='row card'>
<div class='small-12 columns'>
<h4 class='moving-highlight'><i class='fa fa-white fa-pencil'></i> Registration</h4>
<p>You <em>must</em> <%= link "register", to: Routes.registration_path(@conn, :new) %> to attend the event, as scheduling each rendezvous depends on knowing who will attend. If you’re uncertain whether you can make it, register anyway; you can cancel up until the day before.</p>
</div>
</div>
<div class='row card'>
<div class='small-12 columns'>
<h4 class='moving-highlight' id='questions'><i class='fa fa-white fa-question-circle'></i> Questions</h4>

<p><strong>This is not the registration form, that’s <%= link "here", to: Routes.registration_path(@conn, :new) %>.</strong></p>

<%= form_for @conn, Routes.page_path(@conn, :questions), [as: :question], fn f -> %>
<div class='form-group'>
<%= label f, :name %>
<%= text_input f, :name, class: "form-control" %>
</div>

<div class='form-group'>
<%= label f, :email %>
<%= text_input f, :email, class: "form-control" %>
</div>

<div class='form-group'>
<%= label f, :subject %>
<%= text_input f, :subject, class: "form-control" %>
</div>

<div class='form-group'>
<%= label f, :question %>
<%= textarea f, :question, class: "form-control" %>
</div>

<div class="form-group">
<%= submit "Submit", class: "button" %>
</div>
<% end %>
</div>
</div>

<div class='row card eye'>
<div class='small-12 columns'>
<p>
<%= render "eye.html" %>
</p>
</div>
</div>

<div class='row card'>
<div class='small-12 columns'>
<div class='zoom-container'>
<img class='secret-image-container' src='/images/secret-cover.jpg'>
<div class='secret'><div class='text'>you found a secret</div></div>
</div>
</div>
</div>
112 changes: 2 additions & 110 deletions lib/adventure_registrations_web/templates/page/index.html.heex
Original file line number Diff line number Diff line change
@@ -1,111 +1,3 @@
<div class='row title moving-highlight' data-highlight='h2'>
<div class='small-4 columns'>
<img src='/images/logo.png' class='logo'>
</div>
<div class='small-8 columns'>
<h2>Clandestine</h2><h2>Rendezvous</h2>
</div>
</div>
<%= %>

<div class='row card'>
<div class='small-12 columns'>
<p>You are a member of a secret society with a mission of the utmost importance.</p>
<p>You will have encounters with other members around an undisclosed location where you will obtain information to get closer to fulfilling your mission.</p>
</div>
</div>

<div class='row card'>
<div class='small-12 columns'>
<p>Clandestine Rendezvous is an adventure taking place at a to-be-confirmed Victoria location in the evening on <%= full_date() %>. Participants receive a set of appointment cards that direct them to specific locations at precise times at which they will meet other operatives and exchange information with them. Each rendezvous will provide a clue to solve the case.</p>
</div>
</div>

<div class='row card'>
<div class='small-12 columns'>
<img src='/images/first-image.jpg'>
</div>
</div>

<div class='row card'>
<div class='small-12 columns'>
<h4 class='moving-highlight'><i class='fa fa-white fa-clock-o'></i> When and where?</h4>
<p>The secret society is so secret that the venue for initiation cannot be shared publicly. Once it is decided, it will be shared with those who <%= link "register", to: Routes.registration_path(@conn, :new) %>. If you have questions about travel, please write to us after registering.</p>
<p>The adventure will begin at <%= start_time() %>. If you have obligations that prevent you from being present at the beginning let us know and we can discuss how to accommodate you.</p>
</div>
</div>

<div class='row card'>
<div class='small-12 columns'>
<h4 class='moving-highlight'><i class='fa fa-white fa-user-secret'></i> Who?</h4>
<p>Anyone is invited to attend. You should have a sense of adventure and stealth. You can go alone or with a partner.</p>
</div>
</div>

<div class='row card'>
<div class='small-12 columns'>
<h4 class='moving-highlight'><i class='fa fa-white fa-dollar'></i> Cost</h4>
<p>A $5 donation is requested to cover printing costs and labour. If that’s too much, any amount (including 0) is welcome.</p>
</div>
</div>
<div class='row card'>
<div class='small-12 columns'>
<h4 class='moving-highlight'><i class='fa fa-white fa-universal-access'></i> Accessibility</h4>
<p>Do you have accessibility needs we should know about? Please tell us <%= link "when you register", to: Routes.registration_path(@conn, :new) %> and we will work with you to ensure you can participate.</p>
</div>
</div>
<div class='row card'>
<div class='small-12 columns'>
<h4 class='moving-highlight'><i class='fa fa-white fa-pencil'></i> Registration</h4>
<p>You <em>must</em> <%= link "register", to: Routes.registration_path(@conn, :new) %> to attend the event, as scheduling each rendezvous depends on knowing who will attend. If you’re uncertain whether you can make it, register anyway; you can cancel up until the day before.</p>
</div>
</div>
<div class='row card'>
<div class='small-12 columns'>
<h4 class='moving-highlight' id='questions'><i class='fa fa-white fa-question-circle'></i> Questions</h4>

<p><strong>This is not the registration form, that’s <%= link "here", to: Routes.registration_path(@conn, :new) %>.</strong></p>

<%= form_for @conn, Routes.page_path(@conn, :questions), [as: :question], fn f -> %>
<div class='form-group'>
<%= label f, :name %>
<%= text_input f, :name, class: "form-control" %>
</div>

<div class='form-group'>
<%= label f, :email %>
<%= text_input f, :email, class: "form-control" %>
</div>

<div class='form-group'>
<%= label f, :subject %>
<%= text_input f, :subject, class: "form-control" %>
</div>

<div class='form-group'>
<%= label f, :question %>
<%= textarea f, :question, class: "form-control" %>
</div>

<div class="form-group">
<%= submit "Submit", class: "button" %>
</div>
<% end %>
</div>
</div>

<div class='row card eye'>
<div class='small-12 columns'>
<p>
<%= render "eye.html" %>
</p>
</div>
</div>

<div class='row card'>
<div class='small-12 columns'>
<div class='zoom-container'>
<img class='secret-image-container' src='/images/secret-cover.jpg'>
<div class='secret'><div class='text'>you found a secret</div></div>
</div>
</div>
</div>
<%= render "#{Application.get_env(:adventure_registrations, :adventure)}.html" %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h1>unmnemonic devices</h1>

<p>Placeholder!</p>
1 change: 1 addition & 0 deletions test/controllers/page_controller_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defmodule AdventureRegistrations.PageControllerTest do
use AdventureRegistrationsWeb.ConnCase
use AdventureRegistrations.ClandestineRendezvous

test "GET /" do
conn = get(build_conn(), "/")
Expand Down
1 change: 1 addition & 0 deletions test/integration/admin_test.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defmodule AdventureRegistrations.Integration.Admin do
use AdventureRegistrationsWeb.ConnCase
use AdventureRegistrations.SwooshHelper
use AdventureRegistrations.ClandestineRendezvous

alias AdventureRegistrations.Pages.Login
alias AdventureRegistrations.Pages.Nav
Expand Down
1 change: 1 addition & 0 deletions test/integration/messages_test.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defmodule AdventureRegistrations.Integration.Messages do
use AdventureRegistrationsWeb.ConnCase
use AdventureRegistrations.SwooshHelper
use AdventureRegistrations.ClandestineRendezvous

alias AdventureRegistrations.Pages.Login
alias AdventureRegistrations.Pages.Register
Expand Down
1 change: 1 addition & 0 deletions test/integration/questions_test.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defmodule AdventureRegistrations.Integration.Questions do
use AdventureRegistrationsWeb.ConnCase
use AdventureRegistrations.SwooshHelper
use AdventureRegistrations.ClandestineRendezvous

alias AdventureRegistrations.Pages.Home
alias AdventureRegistrations.Pages.Nav
Expand Down
1 change: 1 addition & 0 deletions test/integration/registrations_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ defmodule AdventureRegistrations.Integration.Registrations do
use AdventureRegistrationsWeb.ConnCase
use AdventureRegistrations.SwooshHelper
use AdventureRegistrations.ResetRegistrationClosed
use AdventureRegistrations.ClandestineRendezvous

alias AdventureRegistrations.Pages.Register
alias AdventureRegistrations.Pages.Login
Expand Down
1 change: 1 addition & 0 deletions test/integration/teams_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ defmodule AdventureRegistrations.Integration.Teams do
use AdventureRegistrationsWeb.ConnCase
use AdventureRegistrations.SwooshHelper
use AdventureRegistrations.ResetRequestConfirmation
use AdventureRegistrations.ClandestineRendezvous

alias AdventureRegistrations.Pages.Login
alias AdventureRegistrations.Pages.Nav
Expand Down
14 changes: 14 additions & 0 deletions test/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,17 @@ defmodule AdventureRegistrations.SwooshHelper do
length(sent_email()) > 0
end
end

defmodule AdventureRegistrations.ClandestineRendezvous do
use ExUnit.CaseTemplate

setup do
put_application_env_for_test(:adventure_registrations, :adventure, "clandestine-rendezvous")
end

defp put_application_env_for_test(app, key, value) do
previous_value = Application.get_env(app, key)
Application.put_env(app, key, value)
on_exit(fn -> Application.put_env(app, key, previous_value) end)
end
end

0 comments on commit 0380fdd

Please sign in to comment.