Add capability to use custom footer HTML

This commit is contained in:
Mikko Ahlroth 2015-11-30 22:57:49 +02:00
parent 6f9915d34f
commit 9f17f21d6d
3 changed files with 33 additions and 19 deletions

View file

@ -50,6 +50,10 @@ config :mebe_web,
</script>
""",
# Custom HTML for the footer of the site
# Set to nil to use default footer
custom_footer_html: nil,
# Custom templates
# Set to true for any view you want to use custom templates for.
# If using custom templates for a view, create a folder web/templates/custom/<viewname>

View file

@ -36,26 +36,31 @@
<div class="container">
<%= @inner %>
<div class="footer row">
<div class="col-xs-12 col-sm-4">
<p>
© <%= @blog_author %>
</p>
<% footer = custom_footer_html %>
<%= if footer != nil do %>
<%= raw footer %>
<%= else %>
<div class="footer row">
<div class="col-xs-12 col-sm-4">
<p>
© <%= @blog_author %>
</p>
</div>
<div class="col-xs-12 col-sm-4">
<p>
<a href="https://blog.nytsoi.net/mebe">
Powered by Elixir + Phoenix + Mebe
</a>
</p>
</div>
<div class="col-xs-12 col-sm-4">
<p>
<% {time, unit} = request_time @conn %>
Rendered in <%= time |> safe_round |> trunc %>&nbsp;<%= unit %>.
</p>
</div>
</div>
<div class="col-xs-12 col-sm-4">
<p>
<a href="<%= page_path @conn, :page, "mebe" %>">
Powered by Elixir + Phoenix + Mebe
</a>
</p>
</div>
<div class="col-xs-12 col-sm-4">
<p>
<% {time, unit} = request_time @conn %>
Rendered in <%= time |> safe_round |> trunc %>&nbsp;<%= unit %>.
</p>
</div>
</div>
<% end %>
</div> <!-- /container -->
<script src="<%= static_path(@conn, "/js/app.js") %>"></script>

View file

@ -24,6 +24,11 @@ defmodule MebeWeb.LayoutView do
"""
def extra_html(), do: Utils.get_conf :extra_html
@doc """
Return the custom footer HTML defined in the config.
"""
def custom_footer_html(), do: Utils.get_conf :custom_footer_html
@doc """
Calculate time taken for request so far.
"""