5 Commits

  1. 13
      CHANGELOG.md
  2. 6
      assets/css/app.scss
  3. 5
      lib/mirage/notes.ex
  4. 2
      lib/mirage/settings.ex
  5. 4
      lib/mirage/topics.ex
  6. 12
      lib/mirage_web/templates/topic/index.html.eex
  7. 2
      mix.exs
  8. 24
      priv/repo/migrations/20210225070255_add_setting_data3.exs

13
CHANGELOG.md

@ -5,6 +5,19 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
<!-- changelog -->
## [v0.59.0](https://git.inhji.de/inhji/mirage/compare/v0.58.0...v0.59.0) (2021-02-25)
### Features:
* sort topics by name
* show topics as cards
* add daily_template setting
## [v0.58.0](https://git.inhji.de/inhji/mirage/compare/v0.57.0...v0.58.0) (2021-02-24)

6
assets/css/app.scss

@ -210,12 +210,6 @@ kbd {
a { text-decoration: none; }
}
@for $i from 1 through 30 {
.tag.count-#{$i} {
font-size: 100% + percentage(($i*5) / 100);
}
}
}
.cards {

5
lib/mirage/notes.ex

@ -118,10 +118,13 @@ defmodule Mirage.Notes do
[note]
nil ->
template = Mirage.Settings.get_setting_by_name!("daily_template")
IO.inspect(template)
{:ok, note} =
create_note(%{
title: date_title,
content: "Note for #{date_title}"
content: template.value
})
[note]

2
lib/mirage/settings.ex

@ -52,7 +52,7 @@ defmodule Mirage.Settings do
## Examples
iex> get_setting!("somename)
iex> get_setting!("somename")
%Setting{}
iex> get_setting!("someothername")

4
lib/mirage/topics.ex

@ -15,7 +15,9 @@ defmodule Mirage.Topics do
"""
def list_topics do
Repo.all(Topic)
Topic
|> order_by(:text)
|> Repo.all()
|> Repo.preload(@topic_preloads)
end

12
lib/mirage_web/templates/topic/index.html.eex

@ -3,13 +3,11 @@
<p><%= Enum.count(@topics) %> Topics</p>
</header>
<div class="tags width-full bg-content">
<section class="bg-content width-full grid cards wrap">
<%= for topic <- @topics do %>
<span class="tag count-<%= Enum.count(topic.notes) %>">
<%= link to: Routes.topic_path(@conn, :show, topic) do %>
<%= topic.text %> (<%= Enum.count(topic.notes) + Enum.count(topic.links) %>)
<%= link to: Routes.topic_path(@conn, :show, topic), class: "col card", id: "topic-#{topic.id}" do %>
<strong><%= topic.text %></strong>
<p><%= Enum.count(topic.notes) %> Notes, <%= Enum.count(topic.links) %> links</p>
<% end %>
</span>
<% end %>
</div>
</section>

2
mix.exs

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

24
priv/repo/migrations/20210225070255_add_setting_data3.exs

@ -0,0 +1,24 @@
defmodule Mirage.Repo.Migrations.AddSettingsData3 do
use Ecto.Migration
alias Mirage.Settings.Setting
alias Ecto.Multi
import Ecto.Query, warn: false
@settings ["daily_template"]
def up do
Multi.new()
|> Multi.insert(:daily_template, %Setting{
name: "daily_template",
value: "Something",
value_html: "Something"
})
|> repo().transaction()
end
def down do
from(s in Setting, where: s.name in @settings)
|> repo().delete_all()
end
end
Loading…
Cancel
Save