diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index aaf953f..0cd39dc 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,9 +1,9 @@ # These are supported funding model platforms github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: branchpage +patreon: # branchpage open_collective: # Replace with a single Open Collective username -ko_fi: branchpage +ko_fi: # branchpage tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry liberapay: # Replace with a single Liberapay username diff --git a/.gitignore b/.gitignore index b168a32..c0dc744 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /_build/ /deps/ /cover/ +.env diff --git a/README.md b/README.md index a464fe8..23a6299 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,18 @@ # BranchPage -**TODO: Add description** +> A platform for deploying blogs using `.md` files on GitHub. +[![codecov](https://codecov.io/gh/felipelincoln/branchpage/branch/dev/graph/badge.svg?token=W1W8NUK26S)](https://codecov.io/gh/felipelincoln/branchpage) +[![](https://img.shields.io/github/v/release/felipelincoln/branchpage)](https://github.com/felipelincoln/branchpage/releases/latest) +![](https://img.shields.io/github/contributors/felipelincoln/branchpage) + +![](https://i.ibb.co/ZWgjbS5/Screenshot-from-2021-06-05-11-55-08.png) + +## Features +* Tottally free. :money_with_wings: +* Blog can be created in seconds :fast_forward: +* You content is always safe on github :octocat: +* Readers can contribute to your posts :hammer: +* Donation links available through your blog (Coming soon.) :moneybag: + +And much more features coming :grin: diff --git a/apps/publishing/lib/publishing/manage.ex b/apps/publishing/lib/publishing/manage.ex index 90cbb7b..ba0b406 100644 --- a/apps/publishing/lib/publishing/manage.ex +++ b/apps/publishing/lib/publishing/manage.ex @@ -10,6 +10,10 @@ defmodule Publishing.Manage do import Ecto.Query + def count_blogs do + Repo.aggregate(Blog, :count, :id) + end + def load_blog!(username) do db_blog = Blog diff --git a/apps/web/assets/.babelrc b/apps/web/assets/.babelrc index 45297a2..7e5c48f 100644 --- a/apps/web/assets/.babelrc +++ b/apps/web/assets/.babelrc @@ -2,7 +2,7 @@ "plugins": [ ["prismjs", { "languages": [], - "theme": "okaidia", + "theme": "default", "css": true }] ] diff --git a/apps/web/assets/static/images/github-mark.png b/apps/web/assets/static/images/github-mark.png new file mode 100644 index 0000000..ea6ff54 Binary files /dev/null and b/apps/web/assets/static/images/github-mark.png differ diff --git a/apps/web/assets/static/images/print.png b/apps/web/assets/static/images/print.png new file mode 100644 index 0000000..8c0d40e Binary files /dev/null and b/apps/web/assets/static/images/print.png differ diff --git a/apps/web/lib/web/live/blog_live.ex b/apps/web/lib/web/live/blog_live.ex index 7920651..89d0b07 100644 --- a/apps/web/lib/web/live/blog_live.ex +++ b/apps/web/lib/web/live/blog_live.ex @@ -5,7 +5,7 @@ defmodule Web.BlogLive do alias Publishing.Manage - import Phoenix.HTML, only: [raw: 1] + # import Phoenix.HTML, only: [raw: 1] import Publishing.Helper, only: [format_date: 1] @meta %{ diff --git a/apps/web/lib/web/live/blog_live.html.leex b/apps/web/lib/web/live/blog_live.html.leex index c7acb14..2a508ce 100644 --- a/apps/web/lib/web/live/blog_live.html.leex +++ b/apps/web/lib/web/live/blog_live.html.leex @@ -18,10 +18,8 @@

<%= format_date(a.inserted_at) %>

-

<%= a.title %>

+

<%= a.title %>

-
<%= raw a.preview %>
- Read more

<% end %> diff --git a/apps/web/lib/web/live/home_live.ex b/apps/web/lib/web/live/home_live.ex index 981cb89..67c9e71 100644 --- a/apps/web/lib/web/live/home_live.ex +++ b/apps/web/lib/web/live/home_live.ex @@ -3,6 +3,11 @@ defmodule Web.HomeLive do use Phoenix.LiveView + alias Web.NewLive + alias Web.Router.Helpers, as: Routes + + import Publishing.Manage, only: [count_blogs: 0] + @meta %{ title: "branchpage title", description: "some description", @@ -14,7 +19,15 @@ defmodule Web.HomeLive do socket = socket |> assign(:meta, @meta) + |> assign(:count_blogs, count_blogs()) {:ok, socket} end + + @impl true + def handle_event("go-preview", %{"url" => url}, socket) do + path = Routes.live_path(socket, NewLive, url: url) + + {:noreply, push_redirect(socket, to: path)} + end end diff --git a/apps/web/lib/web/live/home_live.html.leex b/apps/web/lib/web/live/home_live.html.leex index 9f401af..d6e8068 100644 --- a/apps/web/lib/web/live/home_live.html.leex +++ b/apps/web/lib/web/live/home_live.html.leex @@ -1,12 +1,57 @@ - +
+
Branchpage
+
+
+
+

Start your open source blog

+ +
+ +
+ +
+

GitHub .md file

+

=

+

blog post

+
+
+
-
-
- landing section -
-
+
+
+ +
+
+
+
+
+
felipelincoln / blog
+
+
+
my_article.md
+
+
+
+
+
+
+
+
+
+ +
+
+
Felipe Lincoln
+
EditDonate
+
+
+
+
+
+
+
+
+
Branchpage
+
+
+
diff --git a/apps/web/lib/web/live/new_live.ex b/apps/web/lib/web/live/new_live.ex index 13f7317..8912434 100644 --- a/apps/web/lib/web/live/new_live.ex +++ b/apps/web/lib/web/live/new_live.ex @@ -15,7 +15,11 @@ defmodule Web.NewLive do } @impl true - def mount(_params, _session, socket) do + def mount(params, _session, socket) do + url = Map.get(params, "url") + + if url, do: send(self(), :preview) + socket = socket |> assign(:meta, @meta) @@ -23,7 +27,7 @@ defmodule Web.NewLive do |> assign(:error, nil) |> assign(:article, nil) |> assign(:loading, false) - |> assign(:url, "") + |> assign(:url, url || "") {:ok, socket} end diff --git a/apps/web/lib/web/live/new_live.html.leex b/apps/web/lib/web/live/new_live.html.leex index 97869f1..7859322 100644 --- a/apps/web/lib/web/live/new_live.html.leex +++ b/apps/web/lib/web/live/new_live.html.leex @@ -1,6 +1,6 @@