Style changes

This commit is contained in:
Shadowfacts 2020-08-02 17:46:18 -04:00
parent 28cd37966a
commit e7f89b85b9
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
7 changed files with 35 additions and 151 deletions

View File

@ -1,36 +1,29 @@
/* This file is for your main application css. */
@import "./phoenix.css";
body {
font-family: -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
}
/* Alerts and form errors */
.alert {
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
.container {
max-width: 1280px;
margin: 0 auto;
}
.alert-info {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}
.alert-warning {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
.alert-danger {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
.alert p {
margin-bottom: 0;
}
.alert:empty {
display: none;
}
.invalid-feedback {
color: #a94442;
display: block;
margin: -1rem 0 2rem;
header nav {
display: flex;
flex-direction: row;
justify-content: space-between;
ul {
padding-left: 0;
li {
list-style: none;
display: inline;
margin-right: 15px;
&:last-child {
margin-right: 0;
}
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -18,8 +18,8 @@ defmodule Wiki.Content do
[%Page{}, ...]
"""
def list_pages do
Repo.all(Page)
def list_pages(user) do
Repo.all(from p in Page, where: p.user_id == ^user.id)
end
@doc """

View File

@ -56,7 +56,7 @@ defmodule WikiWeb.PageController do
end
def index(conn, _params) do
pages = Content.list_pages()
pages = Content.list_pages(conn.assigns.current_user)
render(conn, "index.html", pages: pages)
end

View File

@ -16,12 +16,6 @@ defmodule WikiWeb.Router do
plug :accepts, ["json"]
end
scope "/", WikiWeb do
pipe_through :browser
get "/", PageController, :index
end
# Other scopes may use custom stacks.
# scope "/api", WikiWeb do
# pipe_through :api
@ -66,7 +60,8 @@ defmodule WikiWeb.Router do
put "/users/settings/update_email", UserSettingsController, :update_email
get "/users/settings/confirm_email/:token", UserSettingsController, :confirm_email
resources "/pages", PageController
resources "/pages", PageController, except: [:index]
get "/", PageController, :index
post "/pages/:id/uploads", PageController, :create_upload
get "/pages/:id/uploads/:upload_id", PageController, :get_upload
delete "/pages/:id/uploads/:upload_id", PageController, :delete_upload

View File

@ -4,7 +4,7 @@
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Wiki · Phoenix Framework</title>
<title>Wiki</title>
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
<script defer type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
</head>
@ -13,16 +13,13 @@
<section class="container">
<nav role="navigation">
<ul>
<li><a href="https://hexdocs.pm/phoenix/overview.html">Get Started</a></li>
<li><a href="/">Home</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>
<a href="https://phoenixframework.org/" class="phx-logo">
<img src="<%= Routes.static_path(@conn, "/images/phoenix.png") %>" alt="Phoenix Framework Logo"/>
</a>
</section>
</header>
<main role="main" class="container">

View File

@ -3,8 +3,8 @@ defmodule Wiki.Repo.Migrations.CreatePageLinks do
def change do
create table(:page_links) do
add :from_id, references(:pages, on_delete: :nothing), primary_key: true
add :to_id, references(:pages, on_delete: :nothing), primary_key: true
add :from_id, references(:pages, on_delete: :delete_all), primary_key: true
add :to_id, references(:pages, on_delete: :delete_all), primary_key: true
end
create index(:page_links, [:from_id])