Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
806134e95e |
No files matched your search
Generated
+682
-149
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -12,11 +12,11 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"autoprefixer": "^10.3.1",
|
"autoprefixer": "^10.3.1",
|
||||||
"esbuild": "^0.12.22",
|
"esbuild": "^0.21.0",
|
||||||
"esbuild-plugin-postcss2": "0.0.9",
|
"esbuild-plugin-postcss2": "0.0.9",
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.0.0",
|
||||||
"postcss": "^8.3.6",
|
"postcss": "^8.3.6",
|
||||||
"postcss-import": "^15.0.0",
|
"postcss-import": "^15.0.0",
|
||||||
"tailwindcss": "^3.4.3"
|
"tailwindcss": "^3.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
content: [
|
purge: [
|
||||||
"../lib/**/*.ex",
|
"../lib/**/*.ex",
|
||||||
"../lib/**/*.leex",
|
"../lib/**/*.leex",
|
||||||
"../lib/**/*.eex",
|
"../lib/**/*.eex",
|
||||||
"../lib/**/*.heex",
|
"../lib/**/*.heex",
|
||||||
"./js/**/*.js",
|
"./js/**/*.js",
|
||||||
],
|
],
|
||||||
darkMode: 'media', // or 'media' or 'class'
|
darkMode: false, // or 'media' or 'class'
|
||||||
theme: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
colors: {
|
colors: {
|
||||||
amber: "#ff9800",
|
amber: '#ff9800',
|
||||||
"light-grey": "#212121",
|
'light-grey': '#212121',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
variants: {
|
variants: {
|
||||||
extend: {},
|
extend: {},
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import Config
|
use Mix.Config
|
||||||
|
|
||||||
# Only in tests, remove the complexity from the password hashing algorithm
|
# Only in tests, remove the complexity from the password hashing algorithm
|
||||||
config :bcrypt_elixir, :log_rounds, 1
|
config :bcrypt_elixir, :log_rounds, 1
|
||||||
|
|||||||
@@ -21,10 +21,6 @@ defmodule Ketbin.Pastes do
|
|||||||
Repo.all(Paste)
|
Repo.all(Paste)
|
||||||
end
|
end
|
||||||
|
|
||||||
def list_pastes_by_user(user_id) do
|
|
||||||
Repo.all(from(p in Paste, where: p.belongs_to == ^user_id))
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Gets a single paste.
|
Gets a single paste.
|
||||||
|
|
||||||
|
|||||||
@@ -134,9 +134,4 @@ defmodule KetbinWeb.PageController do
|
|||||||
render(conn, "edit.html", paste: paste, changeset: changeset)
|
render(conn, "edit.html", paste: paste, changeset: changeset)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pastes(%{assigns: %{current_user: current_user}} = conn, _params) do
|
|
||||||
pastes = Pastes.list_pastes_by_user(current_user.id)
|
|
||||||
render(conn, "pastes.html", pastes: pastes)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
@@ -18,13 +18,6 @@ defmodule KetbinWeb.Router do
|
|||||||
plug :fetch_current_user
|
plug :fetch_current_user
|
||||||
end
|
end
|
||||||
|
|
||||||
# scope to ensure user is authenticated
|
|
||||||
scope "/", KetbinWeb do
|
|
||||||
pipe_through [:browser, :require_authenticated_user]
|
|
||||||
|
|
||||||
get "/pastes", PageController, :pastes
|
|
||||||
end
|
|
||||||
|
|
||||||
scope "/", KetbinWeb do
|
scope "/", KetbinWeb do
|
||||||
pipe_through :browser
|
pipe_through :browser
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,8 @@
|
|||||||
<script>
|
|
||||||
function toggleDropdown() {
|
|
||||||
const dropdown = document.querySelector('#dropdown');
|
|
||||||
const dropdownLabel = document.querySelector('#dropdown-label');
|
|
||||||
if (dropdown.classList.contains('hidden')) {
|
|
||||||
dropdown.classList.remove('hidden');
|
|
||||||
dropdown.classList.add('absolute');
|
|
||||||
dropdownLabel.innerHTML = dropdownLabel.innerHTML.replace('▼', '▲');
|
|
||||||
} else {
|
|
||||||
dropdown.classList.add('hidden');
|
|
||||||
dropdown.classList.remove('absolute');
|
|
||||||
dropdownLabel.innerHTML = dropdownLabel.innerHTML.replace('▲', '▼');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<ul>
|
<ul>
|
||||||
<%= if @current_user do %>
|
<%= if @current_user do %>
|
||||||
<div class="relative">
|
<li><%= @current_user.email %></li>
|
||||||
<li id="dropdown-label" onclick="toggleDropdown()" class="text-[#ff9800] cursor-pointer select-none"><%= @current_user.email %> ▼</li>
|
<li><%= link "Settings", to: Routes.user_settings_path(@conn, :edit) %></li>
|
||||||
<div id="dropdown" class="hidden right-0 z-50 bg-[#313131] px-4 py-2">
|
<li><%= link "Log out", to: Routes.user_session_path(@conn, :delete), method: :delete %></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><%= link "My Pastes", to: Routes.page_path(@conn, :pastes) %></li>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<li><%= link "Register", to: Routes.user_registration_path(@conn, :new) %></li>
|
<li><%= link "Register", to: Routes.user_registration_path(@conn, :new) %></li>
|
||||||
<li><%= link "Log in", to: Routes.user_session_path(@conn, :new) %></li>
|
<li><%= link "Log in", to: Routes.user_session_path(@conn, :new) %></li>
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
<div class="flex relative flex-col w-full h-full">
|
|
||||||
<ul class="break-word py-4 h-full w-full overflow-y-auto">
|
|
||||||
<%= for paste <- @pastes do %>
|
|
||||||
<li class="flex flex-row items-center justify-between">
|
|
||||||
<a href={ Routes.page_path(@conn, :show, paste) } class="">
|
|
||||||
https://katb.in/v/<%= paste.id %>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
@@ -7,7 +7,7 @@ defmodule Ketbin.MixProject do
|
|||||||
version: "0.1.0",
|
version: "0.1.0",
|
||||||
elixir: "~> 1.12",
|
elixir: "~> 1.12",
|
||||||
elixirc_paths: elixirc_paths(Mix.env()),
|
elixirc_paths: elixirc_paths(Mix.env()),
|
||||||
compilers: [:phoenix] ++ Mix.compilers(),
|
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
|
||||||
start_permanent: Mix.env() == :prod,
|
start_permanent: Mix.env() == :prod,
|
||||||
aliases: aliases(),
|
aliases: aliases(),
|
||||||
deps: deps()
|
deps: deps()
|
||||||
|
|||||||
Reference in new issue
Block a user