Skip to content

Commit

Permalink
Merge pull request #26 from ZabGo/upgrade-to-phoenix-1.7
Browse files Browse the repository at this point in the history
Resources page and link to rules of Cornucopia game
  • Loading branch information
tobyirvine authored May 30, 2024
2 parents 296bfa4 + 7493730 commit 98dc110
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/copi_web/components/core_components/headers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule CopiWeb.CoreComponents.Headers do

def header(assigns) do
~H"""
<header class={[@actions != [] && "flex items-center justify-between gap-6", @class]}>
<header class={[@actions != [] && "flex items-center justify-between gap-6", @class]}>
<div>
<h1 class="text-lg font-semibold leading-8 text-zinc-800">
<%= render_slot(@inner_block) %>
Expand All @@ -34,14 +34,14 @@ defmodule CopiWeb.CoreComponents.Headers do
Renders a header with title.
"""
attr :class, :string, default: nil

attr :id, :string, default: ""
slot :inner_block, required: true
slot :subtitle
slot :actions

def header1(assigns) do
~H"""
<h1 class="my-4 text-4xl font-bold leading-8 text-zinc-800">
<h1 id={@id} class={["my-4 text-4xl font-bold leading-8 text-zinc-800", @class]}>
<%= render_slot(@inner_block) %>
</h1>
"""
Expand All @@ -56,7 +56,7 @@ defmodule CopiWeb.CoreComponents.Headers do

def header2(assigns) do
~H"""
<h2 class="my-4 text-2xl font-semibold leading-8 text-zinc-800">
<h2 class={["my-4 text-2xl font-semibold leading-8 text-zinc-800", @class]}>
<%= render_slot(@inner_block) %>
</h2>
"""
Expand Down
1 change: 1 addition & 0 deletions lib/copi_web/components/layouts/app.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<a href="/games/new" class="text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium">Start A Game</a>
<%!-- <a href="#" class="text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium">Join A Game</a> --%>
<a href="/cards" class="text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium">Game Cards</a>
<a href="/resources" class="text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium">Resources</a>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/copi_web/controllers/page_html/home.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
Uncover the security flaws in your software's design before the bad guys do it for you! Get your team together on a call or in a room and use OWASP Cornucopia Web & Mobile and Elevation of Privilege card decks to guide your threat modelling.</p>
<div class="mt-10 flex items-center gap-x-6">
<a href="/games/new" class="rounded-md bg-indigo-500 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-400">Start a game</a>
<a href="#" class="text-sm font-semibold leading-6 text-white">How do we play? <span aria-hidden="true">→</span></a>
<a href="/games/new#howtoplay" class="text-sm font-semibold leading-6 text-white">How do we play? <span aria-hidden="true">→</span></a>
</div>
</div>
<div class="mx-auto mt-16 flex max-w-2xl sm:mt-24 lg:ml-10 lg:mr-0 lg:mt-0 lg:max-w-none lg:flex-none xl:ml-32">
Expand Down
2 changes: 1 addition & 1 deletion lib/copi_web/live/game_live/index.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<hr class="h-2 mx-40 rounded bg-gray-800 my-8">

<.header1 >How to play</.header1>
<.header1 id="howtoplay">How to play</.header1>

<.header2>Preparations</.header2>

Expand Down
15 changes: 15 additions & 0 deletions lib/copi_web/live/resources_live/index.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
defmodule CopiWeb.ResourcesLive.Index do
use CopiWeb, :live_view

use Phoenix.Component

import CopiWeb.LiveHelpers

alias Copi.Cornucopia
alias Copi.Cornucopia.Game

@impl true
def mount(_params, _session, socket) do
{:ok, socket}
end
end
19 changes: 19 additions & 0 deletions lib/copi_web/live/resources_live/index.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<.header1>Resources</.header1>

<.header2 class="my-8">Articles, blogs, books</.header2>

<div>
<p class="mb-4 text-[#F7813E]"><a href="https://martinfowler.com/articles/agile-threat-modelling.html" target="_blank" rel="noreferrer noopener" >A Guide to Threat Modelling for Developers by Jim Gumbley</a></p>

<p class="mb-4 text-[#F7813E]"> <a href="https://cheatsheetseries.owasp.org/cheatsheets/Threat_Modeling_Cheat_Sheet.html" target="_blank" rel="noreferrer noopener" >OWASP Threat Modeling Cheat Sheet</a></p>
</div>

<.header2 class="my-8">Videos</.header2>

<div>
<p class="mb-4 text-[#F7813E]"><a href="https://www.youtube.com/watch?v=BZVoQurTEMc" target="_blank" rel="noreferrer noopener" >Cornucopia game explained</a></p>

<p class="mb-4 text-[#F7813E]"> <a href="https://www.youtube.com/watch?v=mL5G8HeI8zI" target="_blank" rel="noreferrer noopener" >Threat modelling with OWASP Threat Dragon</a></p>
</div>


2 changes: 2 additions & 0 deletions lib/copi_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ defmodule CopiWeb.Router do

live "/games/:game_id/players/:id", PlayerLive.Show, :show

live "/resources", ResourcesLive.Index, :index

resources "/cards", CardController, only: [:index, :show]
end

Expand Down

0 comments on commit 98dc110

Please sign in to comment.