@@ -8,3 +8,5 @@ Installing | |||||
---------- | ---------- | ||||
calefaction can be deployed as a standard Rails app. | calefaction can be deployed as a standard Rails app. | ||||
- describe db setup here... |
@@ -3,7 +3,7 @@ require 'calefaction/version' | |||||
module ApplicationHelper | module ApplicationHelper | ||||
def get_title(title = '') | def get_title(title = '') | ||||
base = '[Site Name]' | |||||
base = AdminSetting.get('site_name') | |||||
title.empty? ? base : "#{title} : #{base}" | title.empty? ? base : "#{title} : #{base}" | ||||
end | end | ||||
@@ -12,4 +12,8 @@ module ApplicationHelper | |||||
year = Time.now.year | year = Time.now.year | ||||
year > start ? "#{start}–#{year}" : start | year > start ? "#{start}–#{year}" : start | ||||
end | end | ||||
def get_copyright_holders | |||||
AdminSetting.get('copyright') | |||||
end | |||||
end | end |
@@ -1,2 +1,6 @@ | |||||
module ToolsHelper | module ToolsHelper | ||||
def get_description | |||||
AdminSetting.get('description') | |||||
end | |||||
end | end |
@@ -0,0 +1,6 @@ | |||||
class AdminSetting < ActiveRecord::Base | |||||
def self.get(key) | |||||
self.find_by(key: key).value | |||||
end | |||||
end |
@@ -7,14 +7,11 @@ | |||||
<%= csrf_meta_tags %> | <%= csrf_meta_tags %> | ||||
</head> | </head> | ||||
<body> | <body> | ||||
<div id="header"> | |||||
<%= render "shared/header" %> | |||||
<%= render "shared/header" %> | |||||
</div> | </div> | ||||
<div id="content"> | <div id="content"> | ||||
<%= yield %> | <%= yield %> | ||||
</div> | </div> | ||||
<div id="footer"> | |||||
<%= render "shared/footer" %> | |||||
</div> | |||||
<%= render "shared/footer" %> | |||||
</body> | </body> | ||||
</html> | </html> |
@@ -1 +1,9 @@ | |||||
<p>Copyright © <%= get_copyright_year %> [copyright holders] • Running Calefaction <%= Calefaction::Version::VERSION_STRING %> • <a href="//eveonline.com">EVE Online</a> and all related trademarks are property of <a href="//ccpgames.com">CCP hf</a>.</p> | |||||
<div id="footer"> | |||||
<p> | |||||
Copyright © <%= get_copyright_year %> <%= get_copyright_holders %> | |||||
• | |||||
Running Calefaction <%= Calefaction::Version::VERSION_STRING %> | |||||
• | |||||
<a href="//eveonline.com">EVE Online</a> and all related trademarks are property of <a href="//ccpgames.com">CCP hf</a>. | |||||
</p> | |||||
</div> |
@@ -1 +1,3 @@ | |||||
<!-- --> | |||||
<div id="header"> | |||||
<!-- --> | |||||
</div> |
@@ -12,4 +12,4 @@ | |||||
</p> | </p> | ||||
<p>Tools: ...</p> | <p>Tools: ...</p> | ||||
<p>[Site description]</p> | |||||
<p><%= get_description %></p> |
@@ -0,0 +1,8 @@ | |||||
class CreateAdminSettings < ActiveRecord::Migration | |||||
def change | |||||
create_table :admin_settings do |t| | |||||
t.string :key | |||||
t.string :value | |||||
end | |||||
end | |||||
end |
@@ -11,7 +11,12 @@ | |||||
# | # | ||||
# It's strongly recommended that you check this file into your version control system. | # It's strongly recommended that you check this file into your version control system. | ||||
ActiveRecord::Schema.define(version: 20150311175036) do | |||||
ActiveRecord::Schema.define(version: 20150313054643) do | |||||
create_table "admin_settings", force: :cascade do |t| | |||||
t.string "key" | |||||
t.string "value" | |||||
end | |||||
create_table "users", force: :cascade do |t| | create_table "users", force: :cascade do |t| | ||||
t.string "name" | t.string "name" | ||||
@@ -5,3 +5,8 @@ | |||||
# | # | ||||
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) | ||||
# Mayor.create(name: 'Emanuel', city: cities.first) | # Mayor.create(name: 'Emanuel', city: cities.first) | ||||
AdminSetting.create(key: 'site_name', value: 'Your Corporation') | |||||
AdminSetting.create(key: 'corporation', value: 'Your Corporation') | |||||
AdminSetting.create(key: 'description', value: 'Your corporation\'s description goes here!') | |||||
AdminSetting.create(key: 'copyright', value: 'Your Corporation/Your Name') |
@@ -0,0 +1,9 @@ | |||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | |||||
one: | |||||
key: MyString | |||||
value: MyString | |||||
two: | |||||
key: MyString | |||||
value: MyString |
@@ -0,0 +1,7 @@ | |||||
require 'test_helper' | |||||
class AdminSettingTest < ActiveSupport::TestCase | |||||
# test "the truth" do | |||||
# assert true | |||||
# end | |||||
end |