2 Commits

  1. 9
      CHANGELOG.md
  2. 7
      lib/mirage/accounts/user.ex
  3. 8
      lib/mirage_web/live/about_live.html.leex
  4. 12
      lib/mirage_web/templates/user_settings/edit.html.eex
  5. 2
      mix.exs
  6. 10
      priv/repo/migrations/20210328153255_add_more_profile_props_to_user.exs

9
CHANGELOG.md

@ -5,6 +5,15 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
<!-- changelog -->
## [v0.94.0](https://git.inhji.de/inhji/mirage/compare/v0.93.0...v0.94.0) (2021-03-28)
### Features:
* add notes and real_name to profile, improve about page
## [v0.93.0](https://git.inhji.de/inhji/mirage/compare/v0.92.0...v0.93.0) (2021-03-28)

7
lib/mirage/accounts/user.ex

@ -6,6 +6,9 @@ defmodule Mirage.Accounts.User do
schema "users" do
field :email, :string
field :name, :string
field :real_name, :string
field :notes, :string
field :password, :string, virtual: true
field :hashed_password, :string
field :confirmed_at, :naive_datetime
@ -71,8 +74,8 @@ defmodule Mirage.Accounts.User do
def profile_changeset(changeset, attrs) do
changeset
|> cast(attrs, [:name])
|> validate_required([:name])
|> cast(attrs, [:name, :real_name, :notes])
|> validate_required([:name, :real_name, :notes])
end
@doc """

8
lib/mirage_web/live/about_live.html.leex

@ -1,8 +1,12 @@
<header class="hero">
<h1>About</h1>
<h2><%= @user.name %></h2>
<h1>About </h1>
</header>
<section class="about-me h-card">
<h2>My name is <span class="p-name"><%= @user.real_name %></span> or @<span class="p-nickname"><%= @user.name %></span></h2>
<h4 class="p-note"><%= @user.notes %></h4>
</section>
<%= if @about_note do %>
<section class="width-full bg-content">
<div class="content html">

12
lib/mirage_web/templates/user_settings/edit.html.eex

@ -19,6 +19,18 @@
<%= error_tag f, :name %>
</fieldset>
<fieldset>
<%= label f, :real_name %>
<%= text_input f, :real_name, required: true %>
<%= error_tag f, :real_name %>
</fieldset>
<fieldset>
<%= label f, :notes %>
<%= textarea f, :notes, required: true %>
<%= error_tag f, :notes %>
</fieldset>
<div>
<%= submit "Change Profile" %>
</div>

2
mix.exs

@ -1,7 +1,7 @@
defmodule Mirage.MixProject do
use Mix.Project
@version "0.93.0"
@version "0.94.0"
def project do
[

10
priv/repo/migrations/20210328153255_add_more_profile_props_to_user.exs

@ -0,0 +1,10 @@
defmodule Mirage.Repo.Migrations.AddMoreProfilePropsToUser do
use Ecto.Migration
def change do
alter table(:users) do
add :real_name, :string, default: ""
add :notes, :text, default: ""
end
end
end
Loading…
Cancel
Save