diff options
author | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-14 00:18:01 -0600 |
---|---|---|
committer | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-14 00:18:01 -0600 |
commit | ddfab312f73a3f3e15ceb6fec7d350500adb53d6 (patch) | |
tree | 9cb6db148a93f21d320538ecc0a523aff8907244 | |
parent | 43f225e181ec370dfa7de1b2dc9f18d9eec31be8 (diff) | |
download | aggiedit-ddfab312f73a3f3e15ceb6fec7d350500adb53d6.tar.gz aggiedit-ddfab312f73a3f3e15ceb6fec7d350500adb53d6.zip |
Update UI
-rw-r--r-- | assets/css/app.css | 13 | ||||
-rw-r--r-- | assets/css/phoenix.css | 101 | ||||
-rw-r--r-- | assets/js/app.js | 5 | ||||
-rw-r--r-- | lib/aggiedit_web/live/live_helpers.ex | 2 | ||||
-rw-r--r-- | lib/aggiedit_web/live/post_live/form_component.html.heex | 46 | ||||
-rw-r--r-- | lib/aggiedit_web/live/post_live/index.ex | 2 | ||||
-rw-r--r-- | lib/aggiedit_web/live/post_live/index.html.heex | 59 | ||||
-rw-r--r-- | lib/aggiedit_web/templates/layout/_user_menu.html.heex | 21 | ||||
-rw-r--r-- | lib/aggiedit_web/templates/layout/root.html.heex | 47 | ||||
-rw-r--r-- | lib/aggiedit_web/templates/page/index.html.heex | 67 | ||||
-rw-r--r-- | lib/aggiedit_web/templates/user_confirmation/edit.html.heex | 6 | ||||
-rw-r--r-- | lib/aggiedit_web/templates/user_confirmation/new.html.heex | 12 | ||||
-rw-r--r-- | lib/aggiedit_web/templates/user_registration/new.html.heex | 30 | ||||
-rw-r--r-- | lib/aggiedit_web/templates/user_reset_password/edit.html.heex | 22 | ||||
-rw-r--r-- | lib/aggiedit_web/templates/user_session/new.html.heex | 27 | ||||
-rw-r--r-- | lib/aggiedit_web/templates/user_settings/edit.html.heex | 50 |
16 files changed, 231 insertions, 279 deletions
diff --git a/assets/css/app.css b/assets/css/app.css index 19c2e51..882a0bb 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -1,12 +1,10 @@ -/* This file is for your main application CSS */ -@import "./phoenix.css"; - /* Alerts and form errors used by phx.new */ .alert { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; + cursor: pointer; } .alert-info { color: #31708f; @@ -63,11 +61,10 @@ } .phx-modal-content { - background-color: #fefefe; margin: 15vh auto; padding: 20px; - border: 1px solid #888; width: 80%; + max-width: 600px; } .phx-modal-close { @@ -118,3 +115,9 @@ 0% { opacity: 1; } 100% { opacity: 0; } } + + +.thumbnail { + max-width: 100px; + max-height: 100px; +}
\ No newline at end of file diff --git a/assets/css/phoenix.css b/assets/css/phoenix.css deleted file mode 100644 index 0d59050..0000000 --- a/assets/css/phoenix.css +++ /dev/null @@ -1,101 +0,0 @@ -/* Includes some default style for the starter application. - * This can be safely deleted to start fresh. - */ - -/* Milligram v1.4.1 https://milligram.github.io - * Copyright (c) 2020 CJ Patoilo Licensed under the MIT license - */ - -*,*:after,*:before{box-sizing:inherit}html{box-sizing:border-box;font-size:62.5%}body{color:#000000;font-family:'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;font-size:1.6em;font-weight:300;letter-spacing:.01em;line-height:1.6}blockquote{border-left:0.3rem solid #d1d1d1;margin-left:0;margin-right:0;padding:1rem 1.5rem}blockquote *:last-child{margin-bottom:0}.button,button,input[type='button'],input[type='reset'],input[type='submit']{background-color:#0069d9;border:0.1rem solid #0069d9;border-radius:.4rem;color:#fff;cursor:pointer;display:inline-block;font-size:1.1rem;font-weight:700;height:3.8rem;letter-spacing:.1rem;line-height:3.8rem;padding:0 3.0rem;text-align:center;text-decoration:none;text-transform:uppercase;white-space:nowrap}.button:focus,.button:hover,button:focus,button:hover,input[type='button']:focus,input[type='button']:hover,input[type='reset']:focus,input[type='reset']:hover,input[type='submit']:focus,input[type='submit']:hover{background-color:#606c76;border-color:#606c76;color:#fff;outline:0}.button[disabled],button[disabled],input[type='button'][disabled],input[type='reset'][disabled],input[type='submit'][disabled]{cursor:default;opacity:.5}.button[disabled]:focus,.button[disabled]:hover,button[disabled]:focus,button[disabled]:hover,input[type='button'][disabled]:focus,input[type='button'][disabled]:hover,input[type='reset'][disabled]:focus,input[type='reset'][disabled]:hover,input[type='submit'][disabled]:focus,input[type='submit'][disabled]:hover{background-color:#0069d9;border-color:#0069d9}.button.button-outline,button.button-outline,input[type='button'].button-outline,input[type='reset'].button-outline,input[type='submit'].button-outline{background-color:transparent;color:#0069d9}.button.button-outline:focus,.button.button-outline:hover,button.button-outline:focus,button.button-outline:hover,input[type='button'].button-outline:focus,input[type='button'].button-outline:hover,input[type='reset'].button-outline:focus,input[type='reset'].button-outline:hover,input[type='submit'].button-outline:focus,input[type='submit'].button-outline:hover{background-color:transparent;border-color:#606c76;color:#606c76}.button.button-outline[disabled]:focus,.button.button-outline[disabled]:hover,button.button-outline[disabled]:focus,button.button-outline[disabled]:hover,input[type='button'].button-outline[disabled]:focus,input[type='button'].button-outline[disabled]:hover,input[type='reset'].button-outline[disabled]:focus,input[type='reset'].button-outline[disabled]:hover,input[type='submit'].button-outline[disabled]:focus,input[type='submit'].button-outline[disabled]:hover{border-color:inherit;color:#0069d9}.button.button-clear,button.button-clear,input[type='button'].button-clear,input[type='reset'].button-clear,input[type='submit'].button-clear{background-color:transparent;border-color:transparent;color:#0069d9}.button.button-clear:focus,.button.button-clear:hover,button.button-clear:focus,button.button-clear:hover,input[type='button'].button-clear:focus,input[type='button'].button-clear:hover,input[type='reset'].button-clear:focus,input[type='reset'].button-clear:hover,input[type='submit'].button-clear:focus,input[type='submit'].button-clear:hover{background-color:transparent;border-color:transparent;color:#606c76}.button.button-clear[disabled]:focus,.button.button-clear[disabled]:hover,button.button-clear[disabled]:focus,button.button-clear[disabled]:hover,input[type='button'].button-clear[disabled]:focus,input[type='button'].button-clear[disabled]:hover,input[type='reset'].button-clear[disabled]:focus,input[type='reset'].button-clear[disabled]:hover,input[type='submit'].button-clear[disabled]:focus,input[type='submit'].button-clear[disabled]:hover{color:#0069d9}code{background:#f4f5f6;border-radius:.4rem;font-size:86%;margin:0 .2rem;padding:.2rem .5rem;white-space:nowrap}pre{background:#f4f5f6;border-left:0.3rem solid #0069d9;overflow-y:hidden}pre>code{border-radius:0;display:block;padding:1rem 1.5rem;white-space:pre}hr{border:0;border-top:0.1rem solid #f4f5f6;margin:3.0rem 0}input[type='color'],input[type='date'],input[type='datetime'],input[type='datetime-local'],input[type='email'],input[type='month'],input[type='number'],input[type='password'],input[type='search'],input[type='tel'],input[type='text'],input[type='url'],input[type='week'],input:not([type]),textarea,select{-webkit-appearance:none;background-color:transparent;border:0.1rem solid #d1d1d1;border-radius:.4rem;box-shadow:none;box-sizing:inherit;height:3.8rem;padding:.6rem 1.0rem .7rem;width:100%}input[type='color']:focus,input[type='date']:focus,input[type='datetime']:focus,input[type='datetime-local']:focus,input[type='email']:focus,input[type='month']:focus,input[type='number']:focus,input[type='password']:focus,input[type='search']:focus,input[type='tel']:focus,input[type='text']:focus,input[type='url']:focus,input[type='week']:focus,input:not([type]):focus,textarea:focus,select:focus{border-color:#0069d9;outline:0}select{background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 8" width="30"><path fill="%23d1d1d1" d="M0,0l6,8l6-8"/></svg>') center right no-repeat;padding-right:3.0rem}select:focus{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 8" width="30"><path fill="%230069d9" d="M0,0l6,8l6-8"/></svg>')}select[multiple]{background:none;height:auto}textarea{min-height:6.5rem}label,legend{display:block;font-size:1.6rem;font-weight:700;margin-bottom:.5rem}fieldset{border-width:0;padding:0}input[type='checkbox'],input[type='radio']{display:inline}.label-inline{display:inline-block;font-weight:normal;margin-left:.5rem}.container{margin:0 auto;max-width:112.0rem;padding:0 2.0rem;position:relative;width:100%}.row{display:flex;flex-direction:column;padding:0;width:100%}.row.row-no-padding{padding:0}.row.row-no-padding>.column{padding:0}.row.row-wrap{flex-wrap:wrap}.row.row-top{align-items:flex-start}.row.row-bottom{align-items:flex-end}.row.row-center{align-items:center}.row.row-stretch{align-items:stretch}.row.row-baseline{align-items:baseline}.row .column{display:block;flex:1 1 auto;margin-left:0;max-width:100%;width:100%}.row .column.column-offset-10{margin-left:10%}.row .column.column-offset-20{margin-left:20%}.row .column.column-offset-25{margin-left:25%}.row .column.column-offset-33,.row .column.column-offset-34{margin-left:33.3333%}.row .column.column-offset-40{margin-left:40%}.row .column.column-offset-50{margin-left:50%}.row .column.column-offset-60{margin-left:60%}.row .column.column-offset-66,.row .column.column-offset-67{margin-left:66.6666%}.row .column.column-offset-75{margin-left:75%}.row .column.column-offset-80{margin-left:80%}.row .column.column-offset-90{margin-left:90%}.row .column.column-10{flex:0 0 10%;max-width:10%}.row .column.column-20{flex:0 0 20%;max-width:20%}.row .column.column-25{flex:0 0 25%;max-width:25%}.row .column.column-33,.row .column.column-34{flex:0 0 33.3333%;max-width:33.3333%}.row .column.column-40{flex:0 0 40%;max-width:40%}.row .column.column-50{flex:0 0 50%;max-width:50%}.row .column.column-60{flex:0 0 60%;max-width:60%}.row .column.column-66,.row .column.column-67{flex:0 0 66.6666%;max-width:66.6666%}.row .column.column-75{flex:0 0 75%;max-width:75%}.row .column.column-80{flex:0 0 80%;max-width:80%}.row .column.column-90{flex:0 0 90%;max-width:90%}.row .column .column-top{align-self:flex-start}.row .column .column-bottom{align-self:flex-end}.row .column .column-center{align-self:center}@media (min-width: 40rem){.row{flex-direction:row;margin-left:-1.0rem;width:calc(100% + 2.0rem)}.row .column{margin-bottom:inherit;padding:0 1.0rem}}a{color:#0069d9;text-decoration:none}a:focus,a:hover{color:#606c76}dl,ol,ul{list-style:none;margin-top:0;padding-left:0}dl dl,dl ol,dl ul,ol dl,ol ol,ol ul,ul dl,ul ol,ul ul{font-size:90%;margin:1.5rem 0 1.5rem 3.0rem}ol{list-style:decimal inside}ul{list-style:circle inside}.button,button,dd,dt,li{margin-bottom:1.0rem}fieldset,input,select,textarea{margin-bottom:1.5rem}blockquote,dl,figure,form,ol,p,pre,table,ul{margin-bottom:2.5rem}table{border-spacing:0;display:block;overflow-x:auto;text-align:left;width:100%}td,th{border-bottom:0.1rem solid #e1e1e1;padding:1.2rem 1.5rem}td:first-child,th:first-child{padding-left:0}td:last-child,th:last-child{padding-right:0}@media (min-width: 40rem){table{display:table;overflow-x:initial}}b,strong{font-weight:bold}p{margin-top:0}h1,h2,h3,h4,h5,h6{font-weight:300;letter-spacing:-.1rem;margin-bottom:2.0rem;margin-top:0}h1{font-size:4.6rem;line-height:1.2}h2{font-size:3.6rem;line-height:1.25}h3{font-size:2.8rem;line-height:1.3}h4{font-size:2.2rem;letter-spacing:-.08rem;line-height:1.35}h5{font-size:1.8rem;letter-spacing:-.05rem;line-height:1.5}h6{font-size:1.6rem;letter-spacing:0;line-height:1.4}img{max-width:100%}.clearfix:after{clear:both;content:' ';display:table}.float-left{float:left}.float-right{float:right} - -/* General style */ -h1{font-size: 3.6rem; line-height: 1.25} -h2{font-size: 2.8rem; line-height: 1.3} -h3{font-size: 2.2rem; letter-spacing: -.08rem; line-height: 1.35} -h4{font-size: 1.8rem; letter-spacing: -.05rem; line-height: 1.5} -h5{font-size: 1.6rem; letter-spacing: 0; line-height: 1.4} -h6{font-size: 1.4rem; letter-spacing: 0; line-height: 1.2} -pre{padding: 1em;} - -.container{ - margin: 0 auto; - max-width: 80.0rem; - padding: 0 2.0rem; - position: relative; - width: 100% -} -select { - width: auto; -} - -/* Phoenix promo and logo */ -.phx-hero { - text-align: center; - border-bottom: 1px solid #e3e3e3; - background: #eee; - border-radius: 6px; - padding: 3em 3em 1em; - margin-bottom: 3rem; - font-weight: 200; - font-size: 120%; -} -.phx-hero input { - background: #ffffff; -} -.phx-logo { - min-width: 300px; - margin: 1rem; - display: block; -} -.phx-logo img { - width: auto; - display: block; -} - -/* Headers */ -header { - width: 100%; - background: #fdfdfd; - border-bottom: 1px solid #eaeaea; - margin-bottom: 2rem; -} -header section { - align-items: center; - display: flex; - flex-direction: column; - justify-content: space-between; -} -header section :first-child { - order: 2; -} -header section :last-child { - order: 1; -} -header nav ul, -header nav li { - margin: 0; - padding: 0; - display: block; - text-align: right; - white-space: nowrap; -} -header nav ul { - margin: 1rem; - margin-top: 0; -} -header nav a { - display: block; -} - -@media (min-width: 40.0rem) { /* Small devices (landscape phones, 576px and up) */ - header section { - flex-direction: row; - } - header nav ul { - margin: 1rem; - } - .phx-logo { - flex-basis: 527px; - margin: 2rem 1rem; - } -} diff --git a/assets/js/app.js b/assets/js/app.js index 3d4ea2a..a884e88 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -41,4 +41,7 @@ liveSocket.connect() // >> liveSocket.enableDebug() // >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session // >> liveSocket.disableLatencySim() -window.liveSocket = liveSocket
\ No newline at end of file +window.liveSocket = liveSocket + +// Hack to remove alerts on click +Array.from(window.document.getElementsByClassName('alert')).forEach((x) => x.addEventListener('click', () => x.style.display = "none"))
\ No newline at end of file diff --git a/lib/aggiedit_web/live/live_helpers.ex b/lib/aggiedit_web/live/live_helpers.ex index a8d067e..b5c81b9 100644 --- a/lib/aggiedit_web/live/live_helpers.ex +++ b/lib/aggiedit_web/live/live_helpers.ex @@ -38,7 +38,7 @@ defmodule AggieditWeb.LiveHelpers do <div id="modal" class="phx-modal fade-in" phx-remove={hide_modal()}> <div id="modal-content" - class="phx-modal-content fade-in-scale" + class="phx-modal-content shadow-lg fade-in-scale rounded bg-white" phx-click-away={JS.dispatch("click", to: "#close")} phx-window-keydown={JS.dispatch("click", to: "#close")} phx-key="escape" diff --git a/lib/aggiedit_web/live/post_live/form_component.html.heex b/lib/aggiedit_web/live/post_live/form_component.html.heex index b0a798e..aa24a3c 100644 --- a/lib/aggiedit_web/live/post_live/form_component.html.heex +++ b/lib/aggiedit_web/live/post_live/form_component.html.heex @@ -9,35 +9,33 @@ phx-change="validate" phx-submit="save"> - <%= label f, :title %> - <%= textarea f, :title %> - <%= error_tag f, :title %> + <div class="form-group"> + <%= label f, :title %> + <%= text_input f, :title, class: "form-control" %> + <%= error_tag f, :title %> + </div> - <%= label f, :body %> - <%= textarea f, :body %> - <%= error_tag f, :body %> + <div class="form-group mt-2"> + <%= label f, :body %> + <%= textarea f, :body, class: "form-control" %> + <%= error_tag f, :body %> + </div> - <%= if !Ecto.assoc_loaded?(@post.upload) do %> - <%= live_file_input @uploads.upload %> - <%= for upload <- @uploads.upload.entries do %> - <div class="row"> - <div class="column"> - <%= live_img_preview upload, height: 80 %> + <div class="form-group mt-2"> + <%= if !Ecto.assoc_loaded?(@post.upload) do %> + <%= live_file_input @uploads.upload %> + <%= for upload <- @uploads.upload.entries do %> + <div class="row"> + <div class="column"> + <%= live_img_preview upload, height: 80 %> + </div> </div> - </div> + <% end %> <% end %> - <% else %> - <%= if !is_nil(@post.upload) do %> - <div class="row"> - <div class="column"> - <img style="height:80px" src={Routes.static_path(@socket, "/uploads/#{@post.upload.file}")} /> - </div> - </div> - <% end %> - <% end %> + </div> - <div> - <%= submit "Save", phx_disable_with: "Saving..." %> + <div class="mt-2"> + <%= submit "Save", phx_disable_with: "Saving...", class: "btn btn-primary" %> </div> </.form> </div> diff --git a/lib/aggiedit_web/live/post_live/index.ex b/lib/aggiedit_web/live/post_live/index.ex index 6972a44..57ae727 100644 --- a/lib/aggiedit_web/live/post_live/index.ex +++ b/lib/aggiedit_web/live/post_live/index.ex @@ -10,7 +10,7 @@ defmodule AggieditWeb.PostLive.Index do def mount(%{"room_id" => _room_id} = params, session, socket) do {:ok, socket} = assign_socket_room_and_user_or_error(params, session, socket) case socket.assigns do - %{:room => room} -> {:ok, assign(socket, %{:posts => room |> Repo.preload(:posts) |> Map.get(:posts)})} + %{:room => room} -> {:ok, assign(socket, %{:posts => room |> Repo.preload(posts: [:user, :upload]) |> Map.get(:posts)})} _ -> {:ok, socket} end end diff --git a/lib/aggiedit_web/live/post_live/index.html.heex b/lib/aggiedit_web/live/post_live/index.html.heex index 329f84c..7532685 100644 --- a/lib/aggiedit_web/live/post_live/index.html.heex +++ b/lib/aggiedit_web/live/post_live/index.html.heex @@ -1,4 +1,4 @@ -<h1>Listing Posts</h1> +<h1>@<%= @room.domain %></h1> <%= if @live_action in [:new, :edit] do %> <.modal return_to={Routes.post_index_path(@socket, :index, @room)}> @@ -14,29 +14,40 @@ </.modal> <% end %> -<table> - <thead> - <tr> - <th>Title</th> - <th>Body</th> +<span><%= live_patch "New Post", to: Routes.post_index_path(@socket, :new, @room) %></span> +<%= for post <- @posts do %> + <div class="card d-flex flex-row align-items-center p-2 m-2 shadow"> + <%= if !is_nil(post.upload) do %> + <%= live_redirect to: Routes.post_show_path(@socket, :show, @room, post) do %> + <div class="card-image d-flex justify-content-center" style="width: 100px"> + <img class="fluid-img thumbnail" src={Routes.static_path(@socket, "/uploads/#{post.upload.file}")} /> + </div> + <% end %> + <% end %> + <div class="card-body"> + <%= live_redirect to: Routes.post_show_path(@socket, :show, @room, post) do %> + <h4 class="card-title"><%= post.title %></h4> + <% end %> + <h6 class="card-subtitle mb-2"><span class="text-muted">aggie/</span><%= post.user.username %></h6> + <p class="card-text"><%= post.body %></p> - <th></th> - </tr> - </thead> - <tbody id="posts"> - <%= for post <- @posts do %> - <tr id={"post-#{post.id}"}> - <td><%= post.title %></td> - <td><%= post.body %></td> + <%= if Aggiedit.Roles.guard?(@current_user, :edit, post) && Aggiedit.Roles.guard?(@current_user, :edit, post) do %> + <span><%= live_patch "Edit", to: Routes.post_index_path(@socket, :edit, @room, post) %></span> + <span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: post.id %></span> + <% end %> + </div> + </div> +<!-- + <div class=> + </div> + <tr id={"post-#{post.id}"}> + <td><%= post.title %></td> + <td><%= post.body %></td> - <td> - <span><%= live_redirect "Show", to: Routes.post_show_path(@socket, :show, @room, post) %></span> - <span><%= live_patch "Edit", to: Routes.post_index_path(@socket, :edit, @room, post) %></span> - <span><%= link "Delete", to: "#", phx_click: "delete", phx_value_id: post.id, data: [confirm: "Are you sure?"] %></span> - </td> - </tr> - <% end %> - </tbody> -</table> + <td> + <span></span> + </td> + </tr> + --> +<% end %> -<span><%= live_patch "New Post", to: Routes.post_index_path(@socket, :new, @room) %></span> diff --git a/lib/aggiedit_web/templates/layout/_user_menu.html.heex b/lib/aggiedit_web/templates/layout/_user_menu.html.heex index f281cfc..4ab3b78 100644 --- a/lib/aggiedit_web/templates/layout/_user_menu.html.heex +++ b/lib/aggiedit_web/templates/layout/_user_menu.html.heex @@ -1,10 +1,15 @@ -<ul> <%= if @current_user do %> - <li><%= @current_user.email %></li> - <li><%= link "Settings", to: Routes.user_settings_path(@conn, :edit) %></li> - <li><%= link "Log out", to: Routes.user_session_path(@conn, :delete), method: :delete %></li> + <li class="nav-item active"> + <%= link "Settings", to: Routes.user_settings_path(@conn, :edit), class: "nav-link" %> + </li> + <li class="nav-item active"> + <%= link "Log out", to: Routes.user_session_path(@conn, :delete), method: :delete, class: "nav-link" %> + </li> <% else %> - <li><%= link "Register", to: Routes.user_registration_path(@conn, :new) %></li> - <li><%= link "Log in", to: Routes.user_session_path(@conn, :new) %></li> -<% end %> -</ul> + <li class="nav-item active"> + <%= link "Register", to: Routes.user_registration_path(@conn, :new), class: "nav-link" %> + </li> + <li class="nav-item active"> + <%= link "Log in", to: Routes.user_session_path(@conn, :new), class: "nav-link" %> + </li> +<% end %>
\ No newline at end of file diff --git a/lib/aggiedit_web/templates/layout/root.html.heex b/lib/aggiedit_web/templates/layout/root.html.heex index 014c44a..3fb7d93 100644 --- a/lib/aggiedit_web/templates/layout/root.html.heex +++ b/lib/aggiedit_web/templates/layout/root.html.heex @@ -5,24 +5,43 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <%= csrf_meta_tag() %> - <%= live_title_tag assigns[:page_title] || "Aggiedit", suffix: " ยท Phoenix Framework" %> + <%= live_title_tag assigns[:page_title] || "Aggiedit" %> <link phx-track-static rel="stylesheet" href={Routes.static_path(@conn, "/assets/app.css")}/> <script defer phx-track-static type="text/javascript" src={Routes.static_path(@conn, "/assets/app.js")}></script> + + <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script> </head> - <body> + <body class="bg-secondary min-vh-100"> <header> - <section class="container"> - <nav> - <ul> - <li><a href="https://hexdocs.pm/phoenix/overview.html">Get Started</a></li> - <%= if function_exported?(Routes, :live_dashboard_path, 2) do %> - <li><%= link "LiveDashboard", to: Routes.live_dashboard_path(@conn, :home) %></li> - <% end %> - </ul> - <%= render "_user_menu.html", assigns %> - </nav> - </section> + <nav class="navbar navbar-expand-md navbar-dark bg-dark"> + <div class="container"> + <a href="/" class="navbar-brand"> + AggiEdit + </a> + <button class="navbar-toggler ms-auto" type="button" data-bs-toggle="collapse" data-bs-target="#toggle"> + <span class="navbar-toggler-icon"></span> + </button> + <div class="navbar-collapse collapse" id="toggle"> + <ul class="navbar-nav"> + <li class="nav-item active"> + <a class="nav-link" href="/">Home</a> + </li> + <%= if @current_user do %> + <li class="nav-item active"> + <%= link "My SubAggie", to: "/room/#{@current_user.room_id}", class: "nav-link" %> + </li> + <% end %> + </ul> + <ul class="navbar-nav ms-auto"> + <%= render "_user_menu.html", assigns %> + </ul> + </div> + </div> + </nav> </header> - <%= @inner_content %> + <div class="container mt-2 bg-light p-2 shadow rounded"> + <%= @inner_content %> + </div> </body> </html> diff --git a/lib/aggiedit_web/templates/page/index.html.heex b/lib/aggiedit_web/templates/page/index.html.heex index f844bd8..f2d2128 100644 --- a/lib/aggiedit_web/templates/page/index.html.heex +++ b/lib/aggiedit_web/templates/page/index.html.heex @@ -1,41 +1,26 @@ -<section class="phx-hero"> - <h1><%= gettext "Welcome to %{name}!", name: "Phoenix" %></h1> - <p>Peace of mind from prototype to production</p> -</section> - -<section class="row"> - <article class="column"> - <h2>Resources</h2> - <ul> - <li> - <a href="https://hexdocs.pm/phoenix/overview.html">Guides & Docs</a> - </li> - <li> - <a href="https://github.com/phoenixframework/phoenix">Source</a> - </li> - <li> - <a href="https://github.com/phoenixframework/phoenix/blob/v1.6/CHANGELOG.md">v1.6 Changelog</a> - </li> - </ul> - </article> - <article class="column"> - <h2>Help</h2> - <ul> - <li> - <a href="https://elixirforum.com/c/phoenix-forum">Forum</a> - </li> - <li> - <a href="https://web.libera.chat/#elixir">#elixir on Libera Chat (IRC)</a> - </li> - <li> - <a href="https://twitter.com/elixirphoenix">Twitter @elixirphoenix</a> - </li> - <li> - <a href="https://elixir-slackin.herokuapp.com/">Elixir on Slack</a> - </li> - <li> - <a href="https://discord.gg/elixir">Elixir on Discord</a> - </li> - </ul> - </article> -</section> +<div> + <h1> + Welcome to AggiEdit! + </h1> +</div> +<div> + <h3> + How does it work? + </h3> + <p> + AggiEdit is a Reddit clone, but "sub-aggies" are only available to other users that share the same domain name in the email as yourself. + For example, if you sign up with your email address "joe@mailinator.com" you are assigned to the sub-aggie "mailinator.com". + <br> + In a sub-aggie, you can create posts with a title, a body, and an attachment. Posts are visible to everyone in your sub-aggie, and a realtime + chat-room is created for each post in the sub-aggie to discuss that post. + </p> + <%= if !@current_user do %> + <p> + Get started by <%= link "registering", to: Routes.user_registration_path(@conn, :new) %> to be able to view posts in your sub-aggie! + </p> + <% else %> + <p> + You are signed in! <%= link "Visit your sub-aggie!", to: "/room/#{@current_user.room_id}" %> + </p> + <% end %> +</div>
\ No newline at end of file diff --git a/lib/aggiedit_web/templates/user_confirmation/edit.html.heex b/lib/aggiedit_web/templates/user_confirmation/edit.html.heex index e9bf443..efc4739 100644 --- a/lib/aggiedit_web/templates/user_confirmation/edit.html.heex +++ b/lib/aggiedit_web/templates/user_confirmation/edit.html.heex @@ -1,11 +1,11 @@ <h1>Confirm account</h1> <.form let={_f} for={:user} action={Routes.user_confirmation_path(@conn, :update, @token)}> - <div> - <%= submit "Confirm my account" %> + <div class="form-group"> + <%= submit "Confirm my account", class: "btn btn-primary" %> </div> </.form> - +<hr> <p> <%= link "Register", to: Routes.user_registration_path(@conn, :new) %> | <%= link "Log in", to: Routes.user_session_path(@conn, :new) %> diff --git a/lib/aggiedit_web/templates/user_confirmation/new.html.heex b/lib/aggiedit_web/templates/user_confirmation/new.html.heex index 4d9bee3..7cabce3 100644 --- a/lib/aggiedit_web/templates/user_confirmation/new.html.heex +++ b/lib/aggiedit_web/templates/user_confirmation/new.html.heex @@ -1,14 +1,16 @@ <h1>Resend confirmation instructions</h1> <.form let={f} for={:user} action={Routes.user_confirmation_path(@conn, :create)}> - <%= label f, :email %> - <%= email_input f, :email, required: true %> + <div class="form-group"> + <%= label f, :email %> + <%= email_input f, :email, required: true, class: "form-control" %> + </div> - <div> - <%= submit "Resend confirmation instructions" %> + <div class="mt-2"> + <%= submit "Resend confirmation instructions", class: "btn btn-primary" %> </div> </.form> - +<hr> <p> <%= link "Register", to: Routes.user_registration_path(@conn, :new) %> | <%= link "Log in", to: Routes.user_session_path(@conn, :new) %> diff --git a/lib/aggiedit_web/templates/user_registration/new.html.heex b/lib/aggiedit_web/templates/user_registration/new.html.heex index 6ff00fc..6aa8df1 100644 --- a/lib/aggiedit_web/templates/user_registration/new.html.heex +++ b/lib/aggiedit_web/templates/user_registration/new.html.heex @@ -7,23 +7,29 @@ </div> <% end %> - <%= label f, :email %> - <%= email_input f, :email, required: true %> - <%= error_tag f, :email %> + <div class="form-group mt-2"> + <%= label f, :email %> + <%= email_input f, :email, required: true, class: "form-control" %> + <%= error_tag f, :email %> + </div> - <%= label f, :username %> - <%= text_input f, :username, required: true %> - <%= error_tag f, :username %> + <div class="form-group mt-2"> + <%= label f, :username %> + <%= text_input f, :username, required: true, class: "form-control" %> + <%= error_tag f, :username %> + </div> - <%= label f, :password %> - <%= password_input f, :password, required: true %> - <%= error_tag f, :password %> + <div class="form-group mt-2"> + <%= label f, :password %> + <%= password_input f, :password, required: true, class: "form-control" %> + <%= error_tag f, :password %> + </div> - <div> - <%= submit "Register" %> + <div class="mt-2"> + <%= submit "Register", class: "btn btn-primary" %> </div> </.form> - +<hr> <p> <%= link "Log in", to: Routes.user_session_path(@conn, :new) %> | <%= link "Forgot your password?", to: Routes.user_reset_password_path(@conn, :new) %> diff --git a/lib/aggiedit_web/templates/user_reset_password/edit.html.heex b/lib/aggiedit_web/templates/user_reset_password/edit.html.heex index d8efb4b..cac89e5 100644 --- a/lib/aggiedit_web/templates/user_reset_password/edit.html.heex +++ b/lib/aggiedit_web/templates/user_reset_password/edit.html.heex @@ -7,19 +7,23 @@ </div> <% end %> - <%= label f, :password, "New password" %> - <%= password_input f, :password, required: true %> - <%= error_tag f, :password %> + <div class="form-group mt-2"> + <%= label f, :password, "New Password" %> + <%= password_input f, :password, required: true, class: "form-control" %> + <%= error_tag f, :password %> + </div> - <%= label f, :password_confirmation, "Confirm new password" %> - <%= password_input f, :password_confirmation, required: true %> - <%= error_tag f, :password_confirmation %> + <div class="form-group mt-2"> + <%= label f, :password_confirmation, "Confirm new password" %> + <%= password_input f, :password_confirmation, required: true, class: "form-control" %> + <%= error_tag f, :password_confirmation %> + </div> - <div> - <%= submit "Reset password" %> + <div class="form-group mt-2"> + <%= submit "Reset password", class: "btn btn-primary" %> </div> </.form> - +<hr> <p> <%= link "Register", to: Routes.user_registration_path(@conn, :new) %> | <%= link "Log in", to: Routes.user_session_path(@conn, :new) %> diff --git a/lib/aggiedit_web/templates/user_session/new.html.heex b/lib/aggiedit_web/templates/user_session/new.html.heex index 49a7d79..46287e3 100644 --- a/lib/aggiedit_web/templates/user_session/new.html.heex +++ b/lib/aggiedit_web/templates/user_session/new.html.heex @@ -7,20 +7,25 @@ </div> <% end %> - <%= label f, :email %> - <%= email_input f, :email, required: true %> - - <%= label f, :password %> - <%= password_input f, :password, required: true %> - - <%= label f, :remember_me, "Keep me logged in for 60 days" %> - <%= checkbox f, :remember_me %> - - <div> - <%= submit "Log in" %> + <div class="form-group"> + <%= label f, :email %> + <%= email_input f, :email, required: true, class: "form-control" %> + </div> + <div class="form-group mt-2"> + <%= label f, :password %> + <%= password_input f, :password, required: true, class: "form-control" %> + </div> + <div class="form-check mt-2"> + <%= label f, :remember_me, "Keep me logged in for 60 days" %> + <%= checkbox f, :remember_me, class: "form-check-input" %> + </div> + <div class="mt-2"> + <%= submit "Log in", class: "btn btn-primary" %> </div> </.form> +<hr> + <p> <%= link "Register", to: Routes.user_registration_path(@conn, :new) %> | <%= link "Forgot your password?", to: Routes.user_reset_password_path(@conn, :new) %> diff --git a/lib/aggiedit_web/templates/user_settings/edit.html.heex b/lib/aggiedit_web/templates/user_settings/edit.html.heex index 9863bc5..f414e0b 100644 --- a/lib/aggiedit_web/templates/user_settings/edit.html.heex +++ b/lib/aggiedit_web/templates/user_settings/edit.html.heex @@ -11,19 +11,25 @@ <%= hidden_input f, :action, name: "action", value: "update_email" %> - <%= label f, :email %> - <%= email_input f, :email, required: true %> - <%= error_tag f, :email %> + <div class="form-group"> + <%= label f, :email %> + <%= email_input f, :email, required: true, class: "form-control" %> + <%= error_tag f, :email %> + </div> - <%= label f, :current_password, for: "current_password_for_email" %> - <%= password_input f, :current_password, required: true, name: "current_password", id: "current_password_for_email" %> - <%= error_tag f, :current_password %> + <div class="form-group mt-2"> + <%= label f, :current_password, for: "current_password_for_email" %> + <%= password_input f, :current_password, required: true, name: "current_password", id: "current_password_for_email", class: "form-control" %> + <%= error_tag f, :current_password %> + </div> - <div> - <%= submit "Change email" %> + <div class="mt-2"> + <%= submit "Change email", class: "btn btn-primary" %> </div> </.form> +<hr> + <h3>Change password</h3> <.form let={f} for={@password_changeset} action={Routes.user_settings_path(@conn, :update)} id="update_password"> @@ -35,19 +41,25 @@ <%= hidden_input f, :action, name: "action", value: "update_password" %> - <%= label f, :password, "New password" %> - <%= password_input f, :password, required: true %> - <%= error_tag f, :password %> + <div class="form-group"> + <%= label f, :password, "New password" %> + <%= password_input f, :password, required: true, class: "form-control" %> + <%= error_tag f, :password %> + </div> - <%= label f, :password_confirmation, "Confirm new password" %> - <%= password_input f, :password_confirmation, required: true %> - <%= error_tag f, :password_confirmation %> + <div class="form-group mt-2"> + <%= label f, :password_confirmation, "Confirm new password" %> + <%= password_input f, :password_confirmation, required: true, class: "form-control" %> + <%= error_tag f, :password_confirmation %> + </div> - <%= label f, :current_password, for: "current_password_for_password" %> - <%= password_input f, :current_password, required: true, name: "current_password", id: "current_password_for_password" %> - <%= error_tag f, :current_password %> + <div class="form-group mt-2"> + <%= label f, :current_password, for: "current_password_for_password" %> + <%= password_input f, :current_password, required: true, name: "current_password", id: "current_password_for_password", class: "form-control" %> + <%= error_tag f, :current_password %> + </div> - <div> - <%= submit "Change password" %> + <div class="mt-2"> + <%= submit "Change password", class: "btn btn-primary" %> </div> </.form> |