Add feature to use custom CSS if set in settings

This commit is contained in:
Mikko Ahlroth 2015-12-29 21:41:59 +02:00
parent ff9fb796ff
commit 90459b2588
4 changed files with 16 additions and 3 deletions

View file

@ -24,6 +24,7 @@ The engine consists of two parts:
* Disqus commenting
* RSS feeds for all posts and for tags
* Override templates by putting replacements into a directory
* Use custom style CSS by defining path in settings
* Expect script for refreshing blog from the command line
* Splitting of posts so that only the beginning will be shown in a list view or feed
@ -32,7 +33,6 @@ The engine consists of two parts:
* Tests
* User's guide
* Sitemap
* Override styles more easily
## Licence

View file

@ -65,7 +65,11 @@ config :mebe_web,
"FeedView" => false,
"PageView" => false,
"LayoutView" => false # Base layouts
}
},
use_default_style: true, # Use the default builtin style.css
custom_style_path: '/custom.css' # Path to custom style CSS, appended to absolute_url. Set to nil to disable
# Configures Elixir's Logger
config :logger, :console,

View file

@ -32,6 +32,8 @@ defmodule MebeWeb.ControllerUtils do
|> assign(:disqus_shortname, Utils.get_conf(:disqus_shortname))
|> assign(:feeds_enabled, Utils.get_conf(:feeds_enabled))
|> assign(:force_read_more, Utils.get_conf(:force_read_more))
|> assign(:use_default_style, Utils.get_conf(:use_default_style))
|> assign(:custom_style_path, Utils.get_conf(:custom_style_path))
end
@doc """

View file

@ -7,7 +7,14 @@
<meta name="author" content="<%= @blog_author %>">
<title><%= title @conn %></title>
<link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">
<%= if @use_default_style do %>
<link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">
<% end %>
<%= if @custom_style_path != nil do %>
<link rel="stylesheet" href="<%= @custom_style_path %>">
<% end %>
<%= if @feeds_enabled do %>
<%= if assigns[:page_type] == :tag do %>