diff --git a/README.md b/README.md index 6d4cca5..413dcf4 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,5 @@ Installing ---------- calefaction can be deployed as a standard Rails app. + +- describe db setup here... diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bcba2cd..36f54af 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3,7 +3,7 @@ require 'calefaction/version' module ApplicationHelper def get_title(title = '') - base = '[Site Name]' + base = AdminSetting.get('site_name') title.empty? ? base : "#{title} : #{base}" end @@ -12,4 +12,8 @@ module ApplicationHelper year = Time.now.year year > start ? "#{start}–#{year}" : start end + + def get_copyright_holders + AdminSetting.get('copyright') + end end diff --git a/app/helpers/tools_helper.rb b/app/helpers/tools_helper.rb index 6f87959..55d1fb9 100644 --- a/app/helpers/tools_helper.rb +++ b/app/helpers/tools_helper.rb @@ -1,2 +1,6 @@ module ToolsHelper + + def get_description + AdminSetting.get('description') + end end diff --git a/app/models/admin_setting.rb b/app/models/admin_setting.rb new file mode 100644 index 0000000..9e4ab4b --- /dev/null +++ b/app/models/admin_setting.rb @@ -0,0 +1,6 @@ +class AdminSetting < ActiveRecord::Base + + def self.get(key) + self.find_by(key: key).value + end +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 29de0ba..d1a8cd1 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -7,14 +7,11 @@ <%= csrf_meta_tags %> -
<%= yield %>
- + <%= render "shared/footer" %> diff --git a/app/views/shared/_footer.html.erb b/app/views/shared/_footer.html.erb index 1ba0bc5..6ab1827 100644 --- a/app/views/shared/_footer.html.erb +++ b/app/views/shared/_footer.html.erb @@ -1 +1,9 @@ -

Copyright © <%= get_copyright_year %> [copyright holders] • Running Calefaction <%= Calefaction::Version::VERSION_STRING %> • EVE Online and all related trademarks are property of CCP hf.

+ diff --git a/app/views/shared/_header.html.erb b/app/views/shared/_header.html.erb index c9f2992..4034bac 100644 --- a/app/views/shared/_header.html.erb +++ b/app/views/shared/_header.html.erb @@ -1 +1,3 @@ - + diff --git a/app/views/tools/index.html.erb b/app/views/tools/index.html.erb index b3691c0..31b7d6c 100644 --- a/app/views/tools/index.html.erb +++ b/app/views/tools/index.html.erb @@ -12,4 +12,4 @@

Tools: ...

-

[Site description]

+

<%= get_description %>

diff --git a/db/migrate/20150313054643_create_admin_settings.rb b/db/migrate/20150313054643_create_admin_settings.rb new file mode 100644 index 0000000..c23307d --- /dev/null +++ b/db/migrate/20150313054643_create_admin_settings.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 62071db..eca9a72 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,12 @@ # # 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| t.string "name" diff --git a/db/seeds.rb b/db/seeds.rb index 4edb1e8..931494a 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,3 +5,8 @@ # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # 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') diff --git a/test/fixtures/admin_settings.yml b/test/fixtures/admin_settings.yml new file mode 100644 index 0000000..a52816e --- /dev/null +++ b/test/fixtures/admin_settings.yml @@ -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 diff --git a/test/models/admin_setting_test.rb b/test/models/admin_setting_test.rb new file mode 100644 index 0000000..7c534cb --- /dev/null +++ b/test/models/admin_setting_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class AdminSettingTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end