Skip to content

Commit

Permalink
Merge pull request #60 from felipelincoln/dev
Browse files Browse the repository at this point in the history
Release v1.0.0
  • Loading branch information
felipelincoln authored Jun 5, 2021
2 parents e46d040 + e265381 commit 4c5f217
Show file tree
Hide file tree
Showing 15 changed files with 105 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/_build/
/deps/
/cover/
.env

16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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:
4 changes: 4 additions & 0 deletions apps/publishing/lib/publishing/manage.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/web/assets/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"plugins": [
["prismjs", {
"languages": [],
"theme": "okaidia",
"theme": "default",
"css": true
}]
]
Expand Down
Binary file added apps/web/assets/static/images/github-mark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/web/assets/static/images/print.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion apps/web/lib/web/live/blog_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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 %{
Expand Down
4 changes: 1 addition & 3 deletions apps/web/lib/web/live/blog_live.html.leex
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
<article>
<header>
<p class="text-gray-500 text-sm sm:text-base"><a href="<%= link %>"><%= format_date(a.inserted_at) %></a></p>
<h2 class="font-black text-lg sm:text-2xl"><a href="<%= link %>"><%= a.title %></a></h1>
<h2 class="font-black text-xl sm:text-3xl"><a href="<%= link %>"><%= a.title %></a></h1>
</header>
<div class="text-gray-700 mb-1 markdown-body"><%= raw a.preview %></div>
<a href="<%= link %>" class="text-gray-900 font-bold hover:underline">Read more</a>
</article>
<hr class="my-mb my-sc last:hidden">
<% end %>
Expand Down
13 changes: 13 additions & 0 deletions apps/web/lib/web/live/home_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
67 changes: 56 additions & 11 deletions apps/web/lib/web/live/home_live.html.leex
Original file line number Diff line number Diff line change
@@ -1,12 +1,57 @@
<nav class="navbar">
<a href="/" class="logo" aria-label="Branchpage">bp</a>
<div>
<a href="#">Start a blog</a>
</div>
</nav>
<div class="bg-gray-700 pl-8 pt-8 text-white text-xl font-bold">
<div>Branchpage</div>
</div>
<div class="bg-gray-700 pb-36 py-24">
<main class="container text-center h-full flex flex-col justify-between">
<h1 class="font-black text-white text-4xl">Start your open source blog</h1>

<form class="my-8 mb-16" phx-change="go-preview">
<input name="url" class="input p-4 rounded-xl" type="text" placeholder="Paste your github article's url">
</form>

<div class="flex justify-between mb-4 text-white text-lg">
<p class="w-72 text-right">GitHub <code class="language-none">.md</code> file</p>
<p>=</p>
<p class="w-72 text-left">blog post</p>
</div>
</main>
</div>

<main class="container">
<section class="flex flex-col items-center sm:w-1/2 h-64 sm:mx-auto px-mb sm:px-0 mb-10 sm:mb-14 border-2 border-yellow-400">
landing section
</section>
</main>
<div class="container -mt-36">
<div class="flex shadow-xl rounded-xl overflow-hidden text-sm">

<div class="w-1/2 h-72">
<div style="background-color: #242c2c" class="px-4 py-2 w-full">
<div class="h-8 w-8 rounded-full" style="background: url(images/github-mark.png) center; background-size: cover"></div>
</div>
<div class="p-4 bg-gray-50 border-b">
<div style="color: #0366d6">felipelincoln / <span class="font-bold">blog</span></div>
</div>
<div class="px-8 bg-white">
<div class="font-bold pt-4 pb-2">my_article.md</div>
<div class="border rounded px-4 py-4">
<div class="bg-gray-200 py-2 w-3/4 mb-4"></div>
<div class="bg-gray-200 py-2 w-1/2 mb-2"></div>
<div class="bg-gray-200 py-2 mb-2"></div>
<div class="bg-gray-200 py-2 mb-2"></div>
<div class="bg-gray-200 w-1/4 py-2"></div>
</div>
</div>
</div>

<div class="w-1/2 h-72 border-l bg-white p-4 flex flex-col justify-between">
<div>
<div class="float-left font-bold">Felipe Lincoln</div>
<div class="float-right">Edit<span class="ml-4">Donate</span></div>
</div>
<div class="clear-both px-8">
<div class="bg-gray-200 py-2 w-3/4 mb-4"></div>
<div class="bg-gray-200 py-2 w-1/2 mb-2"></div>
<div class="bg-gray-200 py-2 mb-2"></div>
<div class="bg-gray-200 py-2 mb-2"></div>
<div class="bg-gray-200 w-1/4 py-2"></div>
</div>
<div class="text-gray-400 text-xs">Branchpage</div>
</div>
</div>
</div>
8 changes: 6 additions & 2 deletions apps/web/lib/web/live/new_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@ 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)
|> assign(:validation, nil)
|> assign(:error, nil)
|> assign(:article, nil)
|> assign(:loading, false)
|> assign(:url, "")
|> assign(:url, url || "")

{:ok, socket}
end
Expand Down
2 changes: 1 addition & 1 deletion apps/web/lib/web/live/new_live.html.leex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<nav class="navbar">
<div class="navbar-side-item pr-mb">
<a href="/a" class="logo" aria-label="Branchpage">bp</a>
<a href="/" class="logo" aria-label="Branchpage">bp</a>
</div>

<form class="flex-1 max-w-screen-sm" phx-change="preview" onkeydown="return event.key != 'Enter';">
Expand Down
5 changes: 3 additions & 2 deletions apps/web/lib/web/templates/layout/base.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@
</head>
<body class="min-h-screen flex flex-col justify-between">
<%= @inner_content %>
<footer class="p-5 sm:p-8 mt-5 sm:mt-8">
<a class="text-gray-400" href="/">Branchpage</a>
<footer class="p-5 sm:p-8 mt-5 sm:mt-8 text-gray-400">
<a class="hover:underline" href="/">Branchpage</a>
<a class="px-8 hover:underline" href="https://github.com/felipelincoln/branchpage">GitHub</a>
</footer>
</body>
</html>
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ config :publishing,
config :publishing, Publishing.Repo, migration_timestamps: [type: :utc_datetime]

config :publishing, :markdown,
preview_length: 500,
preview_length: 120,
heading_length: 255,
heading_default: "Untitled"

Expand Down

0 comments on commit 4c5f217

Please sign in to comment.