From 9aa30f6091b86c991c7461365258b35abeb7eced Mon Sep 17 00:00:00 2001
From: Olivia Theze
Date: Sat, 7 Mar 2015 12:03:24 -0500
Subject: [PATCH] lots of changes. described in description
changed config to point to reference by default
added reference character, showing all options.
added date to required references.
modified code to handle some overrides, and adding current year.
added sticky footer to css.
rewrote templates to match schema in reference. improved features.
---
config.yml | 2 +-
lib/charbase.rb | 2 +-
lib/charbase/app.rb | 9 +-
lib/public/assets/css/template.css | 21 +++++
lib/views/character.liquid | 110 +++++++++++--------------
lib/views/charcss.liquid | 52 ++++++------
lib/views/index.liquid | 17 +++-
lib/views/usercss.liquid | 66 +++++++++------
reference.yml | 127 +++++++++++++++++++++++++++++
9 files changed, 283 insertions(+), 123 deletions(-)
create mode 100644 reference.yml
diff --git a/config.yml b/config.yml
index 59bdf7e..8f700be 100644
--- a/config.yml
+++ b/config.yml
@@ -2,7 +2,7 @@
siteroot: /home/olivia/code/charbase/lib
public: public
views: views
-dsn: yaml://%siteroot%/../characters.yml
+dsn: yaml://%siteroot%/../reference.yml
site:
name: Charbase
diff --git a/lib/charbase.rb b/lib/charbase.rb
index 43da928..f7247ad 100755
--- a/lib/charbase.rb
+++ b/lib/charbase.rb
@@ -6,5 +6,5 @@ require 'liquid'
require 'yaml'
require 'charbase/app'
require 'json'
-
+require 'date'
Charbase::App.run!
diff --git a/lib/charbase/app.rb b/lib/charbase/app.rb
index 5472cfb..7ce01df 100644
--- a/lib/charbase/app.rb
+++ b/lib/charbase/app.rb
@@ -29,7 +29,7 @@ module Charbase
char = {}
char["characters"] = @characters["characters"].select { |c| c["hidden"] != true }
- liquid :index, :locals => {:s => @site, :c => char}
+ liquid :index, :locals => {:s => @site, :c => char, :year => DateTime.now.strftime("%Y")}
end
get "/assets/css/characters.css" do
char = {}
@@ -72,19 +72,20 @@ module Charbase
# this is a nasty hack, eventually i should find a way to add a filter
# to liquid to do this.
- for x in [ "description","bodydesc","attire","skills","magic" ]
+ for x in [ "description","appearance","personality","attire","skills","magic" ].push(*char["overrides"]["paragraph"])
if char[x] != nil and char[x].include?("\n\n")
char[x].gsub!(/\n\n/,"
")
end
end
# end hack
- liquid :character, :locals => {:site => @site, :character => char}
+ liquid :character, :locals => {:site => @site, :character => char, :year => DateTime.now.strftime("%Y")}
end
+
get "/assets/css/:nick.css" do |nick|
char = @characters["characters"].select { |n| n["nick"] == nick }.first
content_type "text/css"
- liquid :usercss, :locals => {:site => @site, :character => char}
+ liquid :usercss, :locals => {:site => @site, :css => char["overrides"]["css"], :nick => char["nick"]}
end
end
diff --git a/lib/public/assets/css/template.css b/lib/public/assets/css/template.css
index a4c2f73..1ad187f 100755
--- a/lib/public/assets/css/template.css
+++ b/lib/public/assets/css/template.css
@@ -51,3 +51,24 @@ body {
margin-left: auto;
margin-right: auto
}
+
+html {
+ position: relative;
+ min-height: 100%;
+}
+body {
+ /* Margin bottom by footer height */
+ margin-bottom: 60px;
+}
+.footer {
+position: absolute;
+bottom: 0;
+width: 100%;
+/* Set the fixed height of the footer here */
+height: 60px;
+background-color: inherit;
+}
+.footer .container .text-muted {
+ margin: 20px 0;
+}
+
diff --git a/lib/views/character.liquid b/lib/views/character.liquid
index 92ed993..5391917 100644
--- a/lib/views/character.liquid
+++ b/lib/views/character.liquid
@@ -30,8 +30,8 @@