Skip to content

Commit 34be34e

Browse files
Paul CampbellPaul Campbell
Paul Campbell
authored and
Paul Campbell
committed
add behavior
1 parent 4598335 commit 34be34e

File tree

8 files changed

+385
-1
lines changed

8 files changed

+385
-1
lines changed

app/views/layouts/admin.html.erb

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<li><%= link_to t('navigation.services'), admin_services_path %></li>
4343
<li><%= link_to t('navigation.users'), admin_users_path %></li>
4444
<li><%= link_to t('navigation.csvs'), admin_csv_path %></li>
45+
<li><%= link_to t('navigation.config'), admin_config_path %></li>
4546
</ul>
4647
</div>
4748
<div class="fluid">

config/behavior.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This file controls what config variables you want to be able to allow your users
2+
# to set, as well as those you'll be able to access from within the application.
3+
#
4+
# If you want to be able to access a string config[:site_title], for example:
5+
#
6+
# site_title:
7+
# name: Site Title
8+
# type: string
9+
# default: My Site
10+
#
11+
# 'name' is the name that appears in the edit form
12+
#
13+
# 'type' can be 'string' for a text field, 'password' for a password field or 'text' for a text area
14+
# 'type' defaults to 'string'
15+
#
16+
# 'default' is the default value to use if there's no entry in the database. Otherwise, nil will be returned
17+
#
18+
# Some Examples:
19+
#
20+
# site_title:
21+
# name: Site Title
22+
# default: My Site
23+
# type: string
24+
#
25+
tracking_code:
26+
name: Tracking Code
27+
default: <!-- TRACKING CODE -->
28+
type: text
29+
#
30+
# secret:
31+
# name: Secret Password for Accessing Secret Areas
32+
# default: secret
33+
# type: password

config/environment.rb

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
config.gem "authlogic", :version => '2.1.2'
2525
config.gem "fastercsv"
2626
config.gem "nokogiri", :version => '>= 1.3.3'
27+
config.gem 'behavior', :version => '0.1.1'
2728

2829
# Only load the plugins named here, in the order given (default is alphabetical).
2930
# :all can be used as a placeholder for all plugins not explicitly named

config/initializers/behavior.rb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Behavior::Settings.before_filters << 'admin_required'

config/locales/en.yml

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ en:
4949
admin: Admin
5050
pages: Pages
5151
csvs: CSV exports
52+
config: Site Config
5253

5354
#admin
5455
top_cities: Top Cities
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class CreateBehaviorConfigs < ActiveRecord::Migration
2+
def self.up
3+
create_table :behavior_configs, :force => true do |t|
4+
t.string :key
5+
t.text :value
6+
t.timestamps
7+
end
8+
9+
add_index :behavior_configs, :key
10+
end
11+
12+
def self.down
13+
remove_index :behavior_configs, :key
14+
drop_table :behavior_configs
15+
end
16+
end

db/schema.rb

+10-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#
1010
# It's strongly recommended to check this file into your version control system.
1111

12-
ActiveRecord::Schema.define(:version => 20091103093719) do
12+
ActiveRecord::Schema.define(:version => 20091210164854) do
1313

1414
create_table "audits", :force => true do |t|
1515
t.string "auditable_type"
@@ -25,6 +25,15 @@
2525
add_index "audits", ["user_id", "auditable_type"], :name => "auditable_user_index"
2626
add_index "audits", ["user_id"], :name => "index_audits_on_user_id"
2727

28+
create_table "behavior_configs", :force => true do |t|
29+
t.string "key"
30+
t.text "value"
31+
t.datetime "created_at"
32+
t.datetime "updated_at"
33+
end
34+
35+
add_index "behavior_configs", ["key"], :name => "index_behavior_configs_on_key"
36+
2837
create_table "endorsement_request_recipients", :force => true do |t|
2938
t.integer "endorsement_request_id"
3039
t.string "email"

0 commit comments

Comments
 (0)