fix: don't use live_redirect anywhere because we care about the session

improvement: setup CI
This commit is contained in:
Zach Daniel 2022-11-16 14:36:05 -05:00
parent 1012d1edbc
commit 5ed98bf5a9
41 changed files with 312 additions and 187 deletions

View file

@ -14,6 +14,7 @@
# {:my_mix_task, command: "mix release", env: %{"MIX_ENV" => "prod"}},
# {:my_arbitrary_tool, command: "npm test", cd: "assets"},
# {:my_arbitrary_script, command: ["my_script", "argument with spaces"], cd: "scripts"}
{:npm_test, false}
{:npm_test, false},
{:check_migrations, command: "mix ash_postgres.generate_migrations --check"}
]
]

76
.github/CODE_OF_CONDUCT.md vendored Normal file
View file

@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at zach@zachdaniel.dev. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

2
.github/CONTRIBUTING.md vendored Normal file
View file

@ -0,0 +1,2 @@
# Contributing Guidelines
Contributing guidelines can be found in the core project, [ash](https://github.com/ash-project/ash/blob/main/.github/CONTRIBUTING.md)

4
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,4 @@
### Contributor checklist
- [ ] Bug fixes include regression tests
- [ ] Features include unit/acceptance tests

71
.github/workflows/elixir.yml vendored Normal file
View file

@ -0,0 +1,71 @@
name: Elixir CI
on:
push:
branches: [main]
tags-ignore: ["v*"]
pull_request:
branches: [main]
create:
branches: main
tags: ["v*"]
jobs:
build:
runs-on: ubuntu-latest
name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} / Ash ${{matrix.ash}}
strategy:
fail-fast: false
matrix:
otp: ["25"]
elixir: ["1.14.0"]
ash: ["2.4.2"]
pg_version: ["13"]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ASH_VERSION: ${{matrix.ash}}
services:
pg:
image: postgres:${{ matrix.pg_version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
ports: ["5432:5432"]
steps:
- run: sudo apt-get install --yes erlang-dev
- uses: actions/checkout@v2
- uses: erlef/setup-elixir@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- uses: actions/cache@v2
id: cache-deps
with:
path: deps
key: otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-deps-2-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-deps-2
- uses: actions/cache@v2
id: cache-build
with:
path: _build
key: otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-build-2-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-build-2
- run: mix deps.get
- run: mix test.create
- run: mix test.migrate
- run: mix test.migrate_tenants
- run: mix check --except dialyzer
if: startsWith(github.ref, 'refs/tags/v')
- run: mix check
if: "!startsWith(github.ref, 'refs/tags/v')"
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
name: Release
needs: [build]
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only

View file

@ -1,4 +1,5 @@
defmodule AshHq.Blog do
@moduledoc "An api for interacting with the blog"
use Ash.Api,
extensions: [AshAdmin.Api]

View file

@ -1,4 +1,5 @@
defmodule AshHq.Blog.Registry do
@moduledoc "The resources used in the blog"
use Ash.Registry,
extensions: [Ash.Registry.ResourceValidations]

View file

@ -1,33 +0,0 @@
defmodule AshHq.Blog.Comment do
use Ash.Resource,
data_layer: AshPostgres.DataLayer,
extensions: [AshHq.Docs.Extensions.RenderMarkdown]
render_markdown do
render_attributes text: :text_html
end
postgres do
table "comments"
repo AshHq.Repo
end
attributes do
uuid_primary_key :id
attribute :text, :string do
allow_nil? false
end
attribute :text_html, :string do
allow_nil? false
end
end
relationships do
belongs_to :author, AshHq.Accounts.User do
allow_nil? false
api AshHq.Accounts
end
end
end

View file

@ -1,4 +1,5 @@
defmodule AshHq.Blog.Post do
@moduledoc "A blog post. Uses the AshBlog data layer and therefore is static"
use Ash.Resource,
otp_app: :ash_hq,
data_layer: AshBlog.DataLayer,
@ -24,10 +25,10 @@ defmodule AshHq.Blog.Post do
filter expr(
state == :published and
if not is_nil(^arg(:tag)) do
^arg(:tag) in tag_names
else
if is_nil(^arg(:tag)) do
true
else
^arg(:tag) in tag_names
end
)
end

View file

@ -1,4 +1,5 @@
defmodule AshHq.Blog.Tag do
@moduledoc "A tag that can be applied to a post. Currently uses CSV data layer and therefore is static"
use Ash.Resource,
data_layer: AshCsv.DataLayer

View file

@ -1,4 +1,5 @@
defmodule AshHq.Calculations.Decrypt do
@moduledoc "Decrypts a given value on demand"
use Ash.Calculation
def decrypt(field) do

View file

@ -52,6 +52,7 @@ defmodule AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure do
|> add_match_rank_calculation(config)}
end
# sobelow_skip ["DOS.BinToAtom"]
defp add_additional_html_calculations(dsl_state, config) do
dsl_state
|> Transformer.get_option([:render_markdown], :render_attributes)

View file

@ -18,7 +18,7 @@ defmodule AshHq.Docs.Importer do
{:ok, %{}}
end
defp import_periodically() do
defp import_periodically do
__MODULE__.import()
Process.send_after(self(), :import, :timer.minutes(30))
end

View file

@ -1,4 +1,5 @@
defmodule AshHq.Types.EncryptedString do
@moduledoc "Represents a string that is encrypted when cast as input"
use Ash.Type
@impl true

View file

@ -1,4 +1,5 @@
defmodule AshHq.Vault do
@moduledoc "The encryptor/decryptor, backed by the `cloak` dependency"
use Cloak.Vault, otp_app: :ash_hq
@impl GenServer

View file

@ -1,4 +1,5 @@
defmodule AshHqWeb.Components.AppView.TopBar do
@moduledoc "The global top navigation bar"
use Surface.Component
prop live_action, :atom, required: true
@ -7,10 +8,9 @@ defmodule AshHqWeb.Components.AppView.TopBar do
prop current_user, :any
alias AshHqWeb.Components.SearchBar
alias Surface.Components.LiveRedirect
alias Phoenix.LiveView.JS
alias AshHqWeb.Router.Helpers, as: Routes
alias Surface.Components.Form
alias Phoenix.LiveView.JS
alias Surface.Components.{Form, LivePatch}
def render(assigns) do
~F"""
@ -18,7 +18,8 @@ defmodule AshHqWeb.Components.AppView.TopBar do
id="top-bar"
class={
"flex justify-between items-center py-4 px-4 h-20 sticky top-0 z-50",
"border-b border-base-light-300 dark:border-base-dark-700 bg-white dark:bg-base-dark-850": @live_action == :docs_dsl
"border-b border-base-light-300 dark:border-base-dark-700 bg-white dark:bg-base-dark-850":
@live_action == :docs_dsl
}
>
<div class="flex flex-row align-baseline">
@ -132,13 +133,13 @@ defmodule AshHqWeb.Components.AppView.TopBar do
{#if @current_user}
<div class="py-1" role="none">
<!-- Active: "bg-base-light-100 text-base-light-900", Not Active: "text-base-light-700" -->
<LiveRedirect
<LivePatch
to={Routes.app_view_path(AshHqWeb.Endpoint, :user_settings)}
class="dark:text-white group flex items-center px-4 py-2 text-sm"
>
<Heroicons.Solid.PencilAltIcon class="mr-3 h-5 w-5 text-base-light-400 group-hover:text-base-light-500" />
Settings
</LiveRedirect>
</LivePatch>
</div>
<div class="py-1" role="none">
<Form for={:sign_out} action={Routes.user_session_path(AshHqWeb.Endpoint, :delete)} method="post">
@ -156,7 +157,7 @@ defmodule AshHqWeb.Components.AppView.TopBar do
</div>
{#else}
<div class="py-1" role="none">
<LiveRedirect
<LivePatch
to={Routes.app_view_path(AshHqWeb.Endpoint, :log_in)}
class="dark:text-white group flex items-center px-4 py-2 text-sm"
>
@ -164,7 +165,7 @@ defmodule AshHqWeb.Components.AppView.TopBar do
<Heroicons.Outline.UserAddIcon class="mr-3 h-5 w-5 text-base-light-400 group-hover:text-base-light-500" />
Sign In
</div>
</LiveRedirect>
</LivePatch>
</div>
{/if}
</div>

View file

@ -1,4 +1,5 @@
defmodule AshHqWeb.Components.Blog.Tag do
@moduledoc "Renders a pill-style tag"
use Surface.Component
alias Surface.Components.LivePatch

View file

@ -1,4 +1,5 @@
defmodule AshHqWeb.Components.Catalogue do
@moduledoc "Renders the catalogue of available packages"
use Surface.Component
alias AshHqWeb.Components.CalloutText

View file

@ -14,7 +14,7 @@ defmodule AshHqWeb.Components.CatalogueModal do
<div
id={@id}
style="display: none;"
class="absolute flex justify-center align-middle w-screen h-full backdrop-blur-sm bg-white bg-opacity-10 z-50"
class="fixed flex justify-center align-middle w-screen h-full backdrop-blur-sm bg-white bg-opacity-10 z-50"
>
<div
:on-click-away={AshHqWeb.AppViewLive.toggle_catalogue()}

View file

@ -2,9 +2,9 @@ defmodule AshHqWeb.Components.DocSidebar do
@moduledoc "The left sidebar of the docs pages"
use Surface.Component
alias AshHqWeb.DocRoutes
alias AshHqWeb.Components.TreeView
alias AshHqWeb.Components.DocSidebarDslItems
alias AshHqWeb.Components.TreeView
alias AshHqWeb.DocRoutes
alias Phoenix.LiveView.JS
prop class, :css_class, default: ""
@ -18,9 +18,7 @@ defmodule AshHqWeb.Components.DocSidebar do
prop dsl, :any, required: true
prop module, :any, required: true
prop mix_task, :any, required: true
prop add_version, :event, required: true
prop remove_version, :event, required: true
prop change_version, :event, required: true
data guides_by_category_and_library, :any
data extensions, :any

View file

@ -6,9 +6,9 @@ defmodule AshHqWeb.Components.DocSidebarDslItems do
alias Phoenix.LiveView.JS
alias __MODULE__
alias AshHqWeb.DocRoutes
alias AshHqWeb.Components.TreeView
alias AshHqWeb.Components.DocSidebar
alias AshHqWeb.Components.TreeView
alias AshHqWeb.DocRoutes
@doc "List of DSLs for an extension"
prop dsls, :list, required: true

View file

@ -1,4 +1,5 @@
defmodule AshHqWeb.Components.Docs.DocPath do
@moduledoc "Renders breadcrumbs to the path of the doc currently being viewed"
use Surface.Component
alias AshHqWeb.Components.CalloutText

View file

@ -1,4 +1,5 @@
defmodule AshHqWeb.Components.Docs.Functions do
@moduledoc "Lists all of the provided functions"
use Surface.Component
import AshHqWeb.Helpers

View file

@ -1,4 +1,5 @@
defmodule AshHqWeb.Components.Docs.SourceLink do
@moduledoc "A link to the source code of a given module or function"
use Surface.Component
import AshHqWeb.Helpers

View file

@ -7,7 +7,7 @@ defmodule AshHqWeb.Components.Search do
alias AshHqWeb.Components.{CalloutText, Catalogue}
alias AshHqWeb.DocRoutes
alias Phoenix.LiveView.JS
alias Surface.Components.Form
alias Surface.Components.{Form, LivePatch}
alias Surface.Components.Form.Checkbox
prop close, :event, required: true
@ -28,7 +28,7 @@ defmodule AshHqWeb.Components.Search do
<div
id={@id}
style="display: none;"
class="absolute flex justify-center align-middle w-screen h-full backdrop-blur-sm bg-white bg-opacity-10 z-50"
class="fixed flex justify-center align-middle w-screen h-full backdrop-blur-sm bg-white bg-opacity-10 z-50"
>
<div
:on-click-away={AshHqWeb.AppViewLive.toggle_search()}
@ -116,12 +116,10 @@ defmodule AshHqWeb.Components.Search do
defp render_items(assigns, items) do
~F"""
{#for item <- items}
<button
<LivePatch
class="block w-full text-left"
:on-click="go-to-doc"
phx-value-link={DocRoutes.doc_link(item, @selected_versions)}
phx-target={@myself}
id={item.id}
to={DocRoutes.doc_link(item, @selected_versions)}
opts={id: "result-#{item.id}"}
>
<div class={
"rounded-lg mb-4 py-2 px-2 hover:bg-base-dark-300 dark:hover:bg-base-dark-700",
@ -155,7 +153,7 @@ defmodule AshHqWeb.Components.Search do
{raw(item.search_headline)}
</div>
</div>
</button>
</LivePatch>
{/for}
"""
end
@ -298,7 +296,7 @@ defmodule AshHqWeb.Components.Search do
end
def handle_event("go-to-doc", %{"link" => doc_link}, socket) do
{:noreply, push_redirect(socket, to: doc_link)}
{:noreply, push_patch(socket, to: doc_link)}
end
def handle_event("go-to-doc", _, socket) do
@ -309,7 +307,7 @@ defmodule AshHqWeb.Components.Search do
{:noreply, socket}
item ->
{:noreply, push_redirect(socket, to: DocRoutes.doc_link(item))}
{:noreply, push_patch(socket, to: DocRoutes.doc_link(item))}
end
end
@ -362,6 +360,6 @@ defmodule AshHqWeb.Components.Search do
defp set_selected_item(socket, selected_item) do
socket
|> assign(:selected_item, selected_item)
|> push_event("js:scroll-to", %{id: selected_item.id})
|> push_event("js:scroll-to", %{id: "result-#{selected_item.id}"})
end
end

View file

@ -7,8 +7,8 @@ defmodule AshHqWeb.Components.TreeView do
"""
use Surface.Component
alias Phoenix.LiveView.JS
alias AshHqWeb.Components.TreeView.Item
alias Phoenix.LiveView.JS
@doc "DOM id for the outer div"
prop id, :string, required: true
@ -73,18 +73,18 @@ defmodule AshHqWeb.Components.TreeView do
~F"""
<style>
.collapsed+ul {
@apply hidden;
@apply hidden;
}
.collapsed .chevron {
@apply -rotate-90;
@apply -rotate-90;
}
@media (prefers-reduced-motion: no-preference) {
.chevron {
@apply transition-transform duration-200;
}
.chevron {
@apply transition-transform duration-200;
}
}
.indent-guide {
@apply border-l pl-1 border-primary-light-600 border-opacity-30;
@apply border-l pl-1 border-primary-light-600 border-opacity-30;
}
</style>
<li class={@class, "pt-2": @collapsable, "indent-guide": @indent_guide}>

View file

@ -46,7 +46,7 @@ defmodule AshHqWeb.DocRoutes do
},
selected_versions
) do
"/docs/module/#{sanitize_name(library_name)}/#{version(version_name, library_id, selected_versions)}/#{sanitize_name(module_name)}/##{type}-#{sanitized_name}-#{arity}"
"/docs/module/#{sanitize_name(library_name)}/#{version(version_name, library_id, selected_versions)}/#{sanitize_name(module_name)}##{type}-#{sanitized_name}-#{arity}"
end
def doc_link(

View file

@ -3,8 +3,6 @@ defmodule AshHqWeb.Helpers do
require Logger
alias AshHqWeb.DocRoutes
def latest_version(library) do
case library.versions do
[] ->
@ -141,7 +139,7 @@ defmodule AshHqWeb.Helpers do
case Version.parse(version.version) do
{:ok, %Version{pre: pre, build: build}}
when not pre == [] or not is_nil(build) ->
when pre != [] or not is_nil(build) ->
~s({:#{library.name}, "~> #{version.version}"})
{:ok, %Version{major: major, minor: minor}} ->

View file

@ -8,29 +8,30 @@ defmodule AshHqWeb.Pages.Docs do
alias AshHqWeb.Components.Docs.{DocPath, Functions, SourceLink}
alias AshHqWeb.DocRoutes
alias Phoenix.LiveView.JS
alias Surface.Components.LivePatch
require Logger
prop(change_versions, :event, required: true)
prop(selected_versions, :map, required: true)
prop(libraries, :list, default: [])
prop(uri, :string)
prop(remove_version, :event)
prop(add_version, :event)
prop(change_version, :event)
prop(params, :map, required: true)
prop change_versions, :event, required: true
prop selected_versions, :map, required: true
prop libraries, :list, default: []
prop uri, :string
prop remove_version, :event
prop add_version, :event
prop change_version, :event
prop params, :map, required: true
data(library, :any)
data(extension, :any)
data(docs, :any)
data(library_version, :any)
data(guide, :any)
data(doc_path, :list, default: [])
data(dsls, :list, default: [])
data(dsl, :any)
data(options, :list, default: [])
data(module, :any)
data(mix_task, :any)
data(positional_options, :list)
data library, :any
data extension, :any
data docs, :any
data library_version, :any
data guide, :any
data doc_path, :list, default: []
data dsls, :list, default: []
data dsl, :any
data options, :list, default: []
data module, :any
data mix_task, :any
data positional_options, :list
@spec render(any) :: Phoenix.LiveView.Rendered.t()
def render(assigns) do
@ -121,7 +122,7 @@ defmodule AshHqWeb.Pages.Docs do
<ul>
{#for section <- Enum.filter(@extension.dsls, &(&1.type == :section))}
<li>
<a href={DocRoutes.doc_link(section, @selected_versions)}>{section.name}</a>
<LivePatch to={DocRoutes.doc_link(section, @selected_versions)}>{section.name}</LivePatch>
</li>
{/for}
</ul>
@ -184,7 +185,7 @@ defmodule AshHqWeb.Pages.Docs do
{#for mod <- imports}
<ul>
<li>
<a href={DocRoutes.doc_link(mod, @selected_versions)}>{mod.name}</a>
<LivePatch to={DocRoutes.doc_link(mod, @selected_versions)}>{mod.name}</LivePatch>
</li>
</ul>
{/for}
@ -198,7 +199,7 @@ defmodule AshHqWeb.Pages.Docs do
<ul>
{#for child <- children}
<li>
<a href={DocRoutes.doc_link(child, @selected_versions)}>{child.name}</a>
<LivePatch to={DocRoutes.doc_link(child, @selected_versions)}>{child.name}</LivePatch>
</li>
{/for}
</ul>
@ -222,9 +223,9 @@ defmodule AshHqWeb.Pages.Docs do
<tr id={"#{option.sanitized_path}/#{option.name}"}>
<td>
<div class="flex flex-row items-baseline">
<a href={"##{DocRoutes.sanitize_name(option.name)}"}>
<LivePatch to={"##{DocRoutes.sanitize_name(option.name)}"}>
<Heroicons.Outline.LinkIcon class="h-3 m-3" />
</a>
</LivePatch>
<div class="flex flex-row space-x-2">
<CalloutText text={option.name} />
{render_tags(assigns, option)}
@ -266,9 +267,9 @@ defmodule AshHqWeb.Pages.Docs do
<tr id={"#{option.sanitized_path}/#{option.name}"}>
<td id={DocRoutes.sanitize_name(option.name)}>
<div class="flex flex-row items-baseline">
<a href={"##{DocRoutes.sanitize_name(option.name)}"}>
<LivePatch to={"##{DocRoutes.sanitize_name(option.name)}"}>
<Heroicons.Outline.LinkIcon class="h-3 m-3" />
</a>
</LivePatch>
<CalloutText text={option.name} />
{render_tags(assigns, option)}
</div>
@ -296,10 +297,10 @@ defmodule AshHqWeb.Pages.Docs do
<footer class="p-2 sm:justify-center">
<div class="md:flex md:justify-around items-center">
<a href="/">
<LivePatch to="/">
<img class="h-6 md:h-10 hidden dark:block" src="/images/ash-framework-dark.png">
<img class="h-6 md:h-10 dark:hidden" src="/images/ash-framework-light.png">
</a>
</LivePatch>
<a href="https://github.com/ash-project" class="hover:underline">Source</a>
<a href="https://github.com/ash-project/ash_hq/issues/new/choose" class="hover:underline">Report an issue</a>
</div>

View file

@ -2,7 +2,7 @@ defmodule AshHqWeb.Pages.LogIn do
@moduledoc "Log in page"
use Surface.LiveComponent
alias Surface.Components.{Form, LiveRedirect}
alias Surface.Components.{Form, LivePatch}
alias Surface.Components.Form.{
Checkbox,
@ -103,8 +103,8 @@ defmodule AshHqWeb.Pages.LogIn do
</div>
</div>
</Form>
<LiveRedirect to={Routes.app_view_path(AshHqWeb.Endpoint, :register)}>Register?</LiveRedirect> |
<LiveRedirect to={Routes.app_view_path(AshHqWeb.Endpoint, :reset_password)}>Forgot Password?</LiveRedirect>
<LivePatch to={Routes.app_view_path(AshHqWeb.Endpoint, :register)}>Register?</LivePatch> |
<LivePatch to={Routes.app_view_path(AshHqWeb.Endpoint, :reset_password)}>Forgot Password?</LivePatch>
</div>
</div>
"""

View file

@ -2,7 +2,7 @@ defmodule AshHqWeb.Pages.Register do
@moduledoc "Log in page"
use Surface.LiveComponent
alias Surface.Components.{Form, LiveRedirect}
alias Surface.Components.{Form, LivePatch}
alias Surface.Components.Form.{
Checkbox,
@ -87,7 +87,7 @@ defmodule AshHqWeb.Pages.Register do
</div>
</div>
</Form>
<LiveRedirect to={Routes.app_view_path(AshHqWeb.Endpoint, :log_in)}>Already Have an account?</LiveRedirect>
<LivePatch to={Routes.app_view_path(AshHqWeb.Endpoint, :log_in)}>Already Have an account?</LivePatch>
</div>
</div>
"""

View file

@ -2,7 +2,7 @@ defmodule AshHqWeb.Pages.ResetPassword do
@moduledoc "Log in page"
use Surface.LiveComponent
alias Surface.Components.{Form, LiveRedirect}
alias Surface.Components.{Form, LivePatch}
alias Surface.Components.Form.{
ErrorTag,
@ -107,7 +107,7 @@ defmodule AshHqWeb.Pages.ResetPassword do
</div>
</div>
</Form>
<LiveRedirect to={Routes.app_view_path(AshHqWeb.Endpoint, :log_in)}>Remember your password?</LiveRedirect>
<LivePatch to={Routes.app_view_path(AshHqWeb.Endpoint, :log_in)}>Remember your password?</LivePatch>
{/if}
</div>
</div>

View file

@ -1,4 +1,5 @@
defmodule AshHqWeb.Schema do
@moduledoc "The absinthe graphql schema"
use Absinthe.Schema
@apis [AshHq.Docs]
@ -15,7 +16,7 @@ defmodule AshHqWeb.Schema do
AshGraphql.add_context(ctx, @apis)
end
def plugins() do
def plugins do
[Absinthe.Middleware.Dataloader | Absinthe.Plugin.defaults()]
end
end

View file

@ -3,30 +3,31 @@ defmodule AshHqWeb.AppViewLive do
use Surface.LiveView,
container: {:div, class: "h-full"}
alias AshHqWeb.Components.{CatalogueModal, Search}
alias AshHqWeb.Components.AppView.TopBar
alias AshHqWeb.Components.{CatalogueModal, Search}
alias AshHqWeb.Pages.{Blog, Docs, Home, LogIn, Register, ResetPassword, UserSettings}
alias Phoenix.LiveView.JS
alias Surface.Components.Context
require Ash.Query
data(configured_theme, :string, default: :system)
data(searching, :boolean, default: false)
data(selected_versions, :map, default: %{})
data(libraries, :list, default: [])
data(selected_types, :map, default: %{})
data(current_user, :map)
import Tails
data(library, :any, default: nil)
data(extension, :any, default: nil)
data(docs, :any, default: nil)
data(library_version, :any, default: nil)
data(guide, :any, default: nil)
data(doc_path, :list, default: [])
data(dsls, :list, default: [])
data(dsl, :any, default: nil)
data(options, :list, default: [])
data(module, :any, default: nil)
data configured_theme, :string, default: :system
data selected_versions, :map, default: %{}
data libraries, :list, default: []
data selected_types, :map, default: %{}
data current_user, :map
data library, :any, default: nil
data extension, :any, default: nil
data docs, :any, default: nil
data library_version, :any, default: nil
data guide, :any, default: nil
data doc_path, :list, default: []
data dsls, :list, default: []
data dsl, :any, default: nil
data options, :list, default: []
data module, :any, default: nil
def render(%{platform: :ios} = assigns) do
~F"""
@ -41,7 +42,7 @@ defmodule AshHqWeb.AppViewLive do
~F"""
<div
id="app"
class={"h-full font-sans": true, "#{@configured_theme}": true}
class={classes([@configured_theme, "h-full font-sans": true])}
phx-hook="ColorTheme"
>
<Search
@ -226,7 +227,7 @@ defmodule AshHqWeb.AppViewLive do
|> push_event("set_theme", %{theme: theme})}
end
def mount(params, session, socket) do
def mount(_params, session, socket) do
socket =
assign_new(socket, :user_agent, fn _assigns ->
get_connect_params(socket)["user_agent"]

View file

@ -7,7 +7,6 @@
"ash_csv": {:git, "https://github.com/ash-project/ash_csv.git", "bad0f6961bf5d135450dacda687d9df0549e80ae", []},
"ash_graphql": {:git, "https://github.com/ash-project/ash_graphql.git", "fb7b60f9e1793c912e238043aa115cd6585c19b7", []},
"ash_json_api": {:git, "https://github.com/ash-project/ash_json_api.git", "2525172e72d0e8b0e369155f32e5edfbf25b9691", []},
"ash_paper_trail": {:git, "https://github.com/ash-project/ash_paper_trail.git", "e6928944b51fd768d27cbb2ef80fb7864aaab46d", []},
"ash_phoenix": {:git, "https://github.com/ash-project/ash_phoenix.git", "5ffcd1916ece639c684273e632cc0aecebe82f26", []},
"ash_postgres": {:hex, :ash_postgres, "1.1.1", "2bbc2b39d9e387f89b964b29b042f88dd352b71e486d9aea7f9390ab1db3ced4", [:mix], [{:ash, "~> 2.1", [hex: :ash, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.9", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: false]}], "hexpm", "fe47a6e629b6b23ce17c1d70b1bd4b3fd732df513b67126514fb88be86a6439e"},
"bcrypt_elixir": {:hex, :bcrypt_elixir, "3.0.1", "9be815469e6bfefec40fa74658ecbbe6897acfb57614df1416eeccd4903f602c", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "486bb95efb645d1efc6794c1ddd776a186a9a713abf06f45708a6ce324fb96cf"},
@ -15,7 +14,6 @@
"castore": {:hex, :castore, "0.1.18", "deb5b9ab02400561b6f5708f3e7660fc35ca2d51bfc6a940d2f513f89c2975fc", [:mix], [], "hexpm", "61bbaf6452b782ef80b33cdb45701afbcf0a918a45ebe7e73f1130d661e66a06"},
"certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"},
"cloak": {:hex, :cloak, "1.1.2", "7e0006c2b0b98d976d4f559080fabefd81f0e0a50a3c4b621f85ceeb563e80bb", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "940d5ac4fcd51b252930fd112e319ea5ae6ab540b722f3ca60a85666759b9585"},
"combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"},
"comeonin": {:hex, :comeonin, "5.3.3", "2c564dac95a35650e9b6acfe6d2952083d8a08e4a89b93a481acb552b325892e", [:mix], [], "hexpm", "3e38c9c2cb080828116597ca8807bb482618a315bfafd98c90bc22a821cc84df"},
"comparable": {:hex, :comparable, "1.0.0", "bb669e91cedd14ae9937053e5bcbc3c52bb2f22422611f43b6e38367d94a495f", [:mix], [{:typable, "~> 0.1", [hex: :typable, repo: "hexpm", optional: false]}], "hexpm", "277c11eeb1cd726e7cd41c6c199e7e52fa16ee6830b45ad4cdc62e51f62eb60c"},
"connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"},
@ -35,7 +33,6 @@
"ecto": {:hex, :ecto, "3.9.1", "67173b1687afeb68ce805ee7420b4261649d5e2deed8fe5550df23bab0bc4396", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c80bb3d736648df790f7f92f81b36c922d9dd3203ca65be4ff01d067f54eb304"},
"ecto_psql_extras": {:hex, :ecto_psql_extras, "0.7.4", "5d43fd088d39a158c860b17e8d210669587f63ec89ea122a4654861c8c6e2db4", [:mix], [{:ecto_sql, "~> 3.4", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:postgrex, ">= 0.15.7", [hex: :postgrex, repo: "hexpm", optional: false]}, {:table_rex, "~> 3.1.1", [hex: :table_rex, repo: "hexpm", optional: false]}], "hexpm", "311db02f1b772e3d0dc7f56a05044b5e1499d78ed6abf38885e1ca70059449e5"},
"ecto_sql": {:hex, :ecto_sql, "3.9.0", "2bb21210a2a13317e098a420a8c1cc58b0c3421ab8e3acfa96417dab7817918c", [:mix], [{:db_connection, "~> 2.5 or ~> 2.4.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a8f3f720073b8b1ac4c978be25fa7960ed7fd44997420c304a4a2e200b596453"},
"eflambe": {:git, "https://github.com/DockYard/flame_on.git", "3f4e3bfa2e5546d95fb94d7ecb4b459bc4398c41", []},
"eflame": {:hex, :eflame, "1.0.1", "0664d287e39eef3c413749254b3af5f4f8b00be71c1af67d325331c4890be0fc", [:mix], [], "hexpm", "e0b08854a66f9013129de0b008488f3411ae9b69b902187837f994d7a99cf04e"},
"elixir_make": {:hex, :elixir_make, "0.6.3", "bc07d53221216838d79e03a8019d0839786703129599e9619f4ab74c8c096eac", [:mix], [], "hexpm", "f5cbd651c5678bcaabdbb7857658ee106b12509cd976c2c2fca99688e1daf716"},
"elixir_sense": {:git, "https://github.com/elixir-lsp/elixir_sense.git", "85d4a87d216678dae30f348270eb90f9ed49ce20", [ref: "85d4a87d216678dae30f348270eb90f9ed49ce20"]},
@ -47,7 +44,6 @@
"excoveralls": {:hex, :excoveralls, "0.14.6", "610e921e25b180a8538229ef547957f7e04bd3d3e9a55c7c5b7d24354abbba70", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "0eceddaa9785cfcefbf3cd37812705f9d8ad34a758e513bb975b081dce4eb11e"},
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
"finch": {:hex, :finch, "0.10.2", "9ad27d68270d879f73f26604bb2e573d40f29bf0e907064a9a337f90a16a0312", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "dd8b11b282072cec2ef30852283949c248bd5d2820c88d8acc89402b81db7550"},
"flame_on": {:hex, :flame_on, "0.5.2", "31b3f417418f49956e7f8c9b10098ecadc2d529d7a2fcaf17bbe65d78462d763", [:mix], [{:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:gettext, "~> 0.19", [hex: :gettext, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:meck, "~> 0.9.2", [hex: :meck, repo: "hexpm", optional: false]}, {:phoenix_ecto, "~> 4.4", [hex: :phoenix_ecto, repo: "hexpm", optional: false]}, {:phoenix_live_dashboard, "~> 0.6.4", [hex: :phoenix_live_dashboard, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.17.6", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "552b0013640089d07ae03bee93c6c3f0803adf1a001138ee7ec06e72b7da3756"},
"floki": {:hex, :floki, "0.33.1", "f20f1eb471e726342b45ccb68edb9486729e7df94da403936ea94a794f072781", [:mix], [{:html_entities, "~> 0.5.0", [hex: :html_entities, repo: "hexpm", optional: false]}], "hexpm", "461035fd125f13fdf30f243c85a0b1e50afbec876cbf1ceefe6fddd2e6d712c6"},
"getopt": {:hex, :getopt, "1.0.1", "c73a9fa687b217f2ff79f68a3b637711bb1936e712b521d8ce466b29cbf7808a", [:rebar3], [], "hexpm", "53e1ab83b9ceb65c9672d3e7a35b8092e9bdc9b3ee80721471a161c10c59959c"},
"gettext": {:hex, :gettext, "0.20.0", "75ad71de05f2ef56991dbae224d35c68b098dd0e26918def5bb45591d5c8d429", [:mix], [], "hexpm", "1c03b177435e93a47441d7f681a7040bd2a816ece9e2666d1c9001035121eb3d"},
@ -59,7 +55,6 @@
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
"jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"},
"json_xema": {:hex, :json_xema, "0.4.2", "85de190f597a98ce9da436b8a59c97ef561a6ab6017255df8b494babefd6fb10", [:mix], [{:conv_case, "~> 0.2", [hex: :conv_case, repo: "hexpm", optional: false]}, {:xema, "~> 0.11", [hex: :xema, repo: "hexpm", optional: false]}], "hexpm", "5516213758667d21669e0d63ea287238d277519527bac6c02140a5e34c1fda80"},
"libgraph": {:hex, :libgraph, "0.13.3", "20732b7bafb933dcf7351c479e03076ebd14a85fd3202c67a1c197f4f7c2466b", [:mix], [], "hexpm", "78f2576eef615440b46f10060b1de1c86640441422832052686df53dc3c148c6"},
"makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"},
"makeup_eex": {:hex, :makeup_eex, "0.1.1", "89352d5da318d97ae27bbcc87201f274504d2b71ede58ca366af6a5fbed9508d", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.16", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_html, "~> 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d111a0994eaaab09ef1a4b3b313ef806513bb4652152c26c0d7ca2be8402a964"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"},
@ -68,7 +63,6 @@
"makeup_html": {:hex, :makeup_html, "0.1.0", "b0228fda985e311d8f0d25bed58f8280826633a38d7448cabdd723e116165bcf", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "0ca44e7dcb8d933e010740324470dd8ec947243b51304bd34b8165ef3281edc2"},
"makeup_js": {:hex, :makeup_js, "0.1.0", "ffa8ce9db95d14dcd09045334539d5992d540d63598c592d4805b7674bdd6675", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "3f0c1a5eb52c9737b1679c926574e83bb260ccdedf08b58ee96cca7c685dea75"},
"makeup_sql": {:hex, :makeup_sql, "0.1.0", "197a8a0a38e83885f73767530739bb8f990aecf7fd1597d3141608c14f5f233e", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "556e23ff88ad2fb8c44e393467cfba0c4f980cbe90316deaf48a1362f58cd118"},
"meck": {:hex, :meck, "0.9.2", "85ccbab053f1db86c7ca240e9fc718170ee5bda03810a6292b5306bf31bae5f5", [:rebar3], [], "hexpm", "81344f561357dc40a8344afa53767c32669153355b626ea9fcbc8da6b3045826"},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"},
"mime": {:hex, :mime, "2.0.3", "3676436d3d1f7b81b5a2d2bd8405f412c677558c81b1c92be58c00562bb59095", [:mix], [], "hexpm", "27a30bf0db44d25eecba73755acf4068cbfe26a4372f9eb3e4ea3a45956bff6b"},
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
@ -109,9 +103,7 @@
"telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"},
"telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"},
"telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"},
"timex": {:hex, :timex, "3.7.9", "790cdfc4acfce434e442f98c02ea6d84d0239073bfd668968f82ac63e9a6788d", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "64691582e5bb87130f721fc709acfb70f24405833998fabf35be968984860ce1"},
"typable": {:hex, :typable, "0.3.0", "0431e121d124cd26f312123e313d2689b9a5322b15add65d424c07779eaa3ca1", [:mix], [], "hexpm", "880a0797752da1a4c508ac48f94711e04c86156f498065a83d160eef945858f8"},
"tzdata": {:hex, :tzdata, "1.1.1", "20c8043476dfda8504952d00adac41c6eda23912278add38edc140ae0c5bcc46", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a69cec8352eafcd2e198dea28a34113b60fdc6cb57eb5ad65c10292a6ba89787"},
"ua_inspector": {:hex, :ua_inspector, "3.0.1", "649e68e31296a7bc39204e84b13a14c245b61df43fde0dd91ef784a98ecb04d4", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:yamerl, "~> 0.7", [hex: :yamerl, repo: "hexpm", optional: false]}], "hexpm", "b510ce5a5fd70a37bf5eab8008a25fc57388ea240b95bb4d98fc892648f9b916"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
"xema": {:hex, :xema, "0.17.0", "982e397ce0af55cdf1c6bf9c5ee6e20c5ea4a24e58e5266339cfff0dadbfa01e", [:mix], [{:conv_case, "~> 0.2.2", [hex: :conv_case, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "9020afc75c5b9fba1c5875fd735a19c3c544db058cd97ef4c4675e479fc8bcbe"},

View file

@ -9,95 +9,95 @@ defmodule AshHq.Repo.Migrations.MigrateResources30 do
def up do
alter table(:options) do
add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")
add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()")
add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()"))
add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()"))
end
alter table(:modules) do
add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")
add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()")
add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()"))
add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()"))
end
alter table(:mix_tasks) do
add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")
add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()")
add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()"))
add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()"))
end
alter table(:library_versions) do
add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")
add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()")
add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()"))
add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()"))
end
alter table(:libraries) do
add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")
add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()")
add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()"))
add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()"))
end
alter table(:guides) do
add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")
add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()")
add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()"))
add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()"))
end
alter table(:functions) do
add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")
add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()")
add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()"))
add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()"))
end
alter table(:extensions) do
add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")
add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()")
add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()"))
add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()"))
end
alter table(:dsls) do
add :inserted_at, :utc_datetime_usec, null: false, default: fragment("now()")
add :updated_at, :utc_datetime_usec, null: false, default: fragment("now()")
add(:inserted_at, :utc_datetime_usec, null: false, default: fragment("now()"))
add(:updated_at, :utc_datetime_usec, null: false, default: fragment("now()"))
end
end
def down do
alter table(:dsls) do
remove :updated_at
remove :inserted_at
remove(:updated_at)
remove(:inserted_at)
end
alter table(:extensions) do
remove :updated_at
remove :inserted_at
remove(:updated_at)
remove(:inserted_at)
end
alter table(:functions) do
remove :updated_at
remove :inserted_at
remove(:updated_at)
remove(:inserted_at)
end
alter table(:guides) do
remove :updated_at
remove :inserted_at
remove(:updated_at)
remove(:inserted_at)
end
alter table(:libraries) do
remove :updated_at
remove :inserted_at
remove(:updated_at)
remove(:inserted_at)
end
alter table(:library_versions) do
remove :updated_at
remove :inserted_at
remove(:updated_at)
remove(:inserted_at)
end
alter table(:mix_tasks) do
remove :updated_at
remove :inserted_at
remove(:updated_at)
remove(:inserted_at)
end
alter table(:modules) do
remove :updated_at
remove :inserted_at
remove(:updated_at)
remove(:inserted_at)
end
alter table(:options) do
remove :updated_at
remove :inserted_at
remove(:updated_at)
remove(:inserted_at)
end
end
end
end

View file

@ -9,13 +9,13 @@ defmodule AshHq.Repo.Migrations.MigrateResources32 do
def up do
alter table(:guides) do
add :default, :boolean, null: false, default: false
add(:default, :boolean, null: false, default: false)
end
end
def down do
alter table(:guides) do
remove :default
remove(:default)
end
end
end
end

View file

@ -42,16 +42,16 @@ defmodule AshHqWeb.UserSessionControllerTest do
end
end
describe "DELETE /users/log_out" do
describe "POST /users/log_out" do
test "logs the user out", %{conn: conn, user: user} do
conn = conn |> log_in_user(user) |> delete(Routes.user_session_path(conn, :delete))
conn = conn |> log_in_user(user) |> post(Routes.user_session_path(conn, :delete))
assert redirected_to(conn) == "/"
refute get_session(conn, :user_token)
assert get_flash(conn, :info) =~ "Logged out successfully"
end
test "succeeds even if the user is not logged in", %{conn: conn} do
conn = delete(conn, Routes.user_session_path(conn, :delete))
conn = post(conn, Routes.user_session_path(conn, :delete))
assert redirected_to(conn) == "/"
refute get_session(conn, :user_token)
assert get_flash(conn, :info) =~ "Logged out successfully"

View file

@ -16,7 +16,8 @@ defmodule AshHqWeb.UserSettingsControllerTest do
:deliver_update_email_instructions,
%{
email: email,
current_password: valid_user_password()
current_password: valid_user_password(),
update_url_fun: &Routes.user_settings_url(AshHqWeb.Endpoint, :confirm_email, &1)
},
authorize?: false
)

View file

@ -1,10 +1,8 @@
defmodule AshHq.SettingsTest do
use AshHqWeb.ConnCase
import Plug.Conn
import Phoenix.ConnTest
import Phoenix.LiveViewTest
import Swoosh.TestAssertions
@endpoint AshHqWeb.Endpoint
@ -58,7 +56,7 @@ defmodule AshHq.SettingsTest do
assert_received {:email, email}
assert %{"url" => url} = Regex.named_captures(~r/(?<url>http[^\s]*)/, email.text_body)
assert %{"url" => url} = Regex.named_captures(~r/(?<url>http[^\s\"]*)/, email.html_body)
path = URI.parse(url).path

View file

@ -11,7 +11,9 @@ defmodule AshHq.AccountsFixtures do
params =
Enum.into(attrs, %{
email: unique_user_email(),
password: valid_user_password()
password: valid_user_password(),
confirmation_url_fun:
&AshHqWeb.Router.Helpers.user_confirmation_url(AshHqWeb.Endpoint, :confirm, &1)
})
user =