outpost-cms 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +295 -0
  3. data/Rakefile +26 -0
  4. data/app/assets/images/glyphicons-halflings-red.png +0 -0
  5. data/app/assets/javascripts/outpost/application.js +1 -0
  6. data/app/assets/javascripts/outpost/auto_slug_field.js.coffee +53 -0
  7. data/app/assets/javascripts/outpost/base.js.coffee +1 -0
  8. data/app/assets/javascripts/outpost/date_time_input.js.coffee +108 -0
  9. data/app/assets/javascripts/outpost/field_counter.js.coffee +93 -0
  10. data/app/assets/javascripts/outpost/field_manager.js.coffee +37 -0
  11. data/app/assets/javascripts/outpost/global_plugins.js.coffee +87 -0
  12. data/app/assets/javascripts/outpost/index_manager.js.coffee +88 -0
  13. data/app/assets/javascripts/outpost/notification.js.coffee +46 -0
  14. data/app/assets/javascripts/outpost/preview.js.coffee +60 -0
  15. data/app/assets/javascripts/outpost/templates/date_field.jst.eco +3 -0
  16. data/app/assets/javascripts/outpost/templates/loading.jst.eco +11 -0
  17. data/app/assets/javascripts/outpost/templates/slug_generate_button.jst.eco +1 -0
  18. data/app/assets/javascripts/outpost/templates/time_field.jst.eco +3 -0
  19. data/app/assets/javascripts/outpost/templates.js +1 -0
  20. data/app/assets/javascripts/outpost.js +32 -0
  21. data/app/assets/stylesheets/outpost/_base.css.scss +127 -0
  22. data/app/assets/stylesheets/outpost/_edit.css.scss +13 -0
  23. data/app/assets/stylesheets/outpost/_forms.css.scss +116 -0
  24. data/app/assets/stylesheets/outpost/_index.css.scss +68 -0
  25. data/app/assets/stylesheets/outpost/_utility.css.scss +16 -0
  26. data/app/assets/stylesheets/outpost/application.css.scss +1 -0
  27. data/app/assets/stylesheets/outpost/bootstrap/bootstrap.css.scss +49 -0
  28. data/app/assets/stylesheets/outpost/bootstrap/datepicker.css.scss +301 -0
  29. data/app/assets/stylesheets/outpost.css.scss +14 -0
  30. data/app/controllers/outpost/application_controller.rb +40 -0
  31. data/app/controllers/outpost/base_controller.rb +3 -0
  32. data/app/controllers/outpost/errors_controller.rb +9 -0
  33. data/app/controllers/outpost/home_controller.rb +2 -0
  34. data/app/controllers/outpost/resource_controller.rb +12 -0
  35. data/app/controllers/outpost/sessions_controller.rb +36 -0
  36. data/app/helpers/authorization_helper.rb +44 -0
  37. data/app/helpers/list_helper.rb +243 -0
  38. data/app/helpers/outpost_helper.rb +49 -0
  39. data/app/helpers/render_helper.rb +41 -0
  40. data/app/helpers/utility_helper.rb +136 -0
  41. data/app/inputs/date_time_input.rb +12 -0
  42. data/app/models/permission.rb +18 -0
  43. data/app/models/user_permission.rb +4 -0
  44. data/app/views/kaminari/bootstrap/_first_page.html.erb +3 -0
  45. data/app/views/kaminari/bootstrap/_gap.html.erb +3 -0
  46. data/app/views/kaminari/bootstrap/_last_page.html.erb +3 -0
  47. data/app/views/kaminari/bootstrap/_next_page.html.erb +3 -0
  48. data/app/views/kaminari/bootstrap/_page.html.erb +3 -0
  49. data/app/views/kaminari/bootstrap/_paginator.html.erb +17 -0
  50. data/app/views/kaminari/bootstrap/_prev_page.html.erb +3 -0
  51. data/app/views/layouts/outpost/application.html.erb +101 -0
  52. data/app/views/layouts/outpost/minimal.html.erb +26 -0
  53. data/app/views/outpost/errors/error_404.html.erb +1 -0
  54. data/app/views/outpost/errors/error_500.html.erb +8 -0
  55. data/app/views/outpost/home/dashboard.html.erb +1 -0
  56. data/app/views/outpost/resource/_errors.html.erb +11 -0
  57. data/app/views/outpost/resource/_extra_fields.html.erb +1 -0
  58. data/app/views/outpost/resource/_form_fields.html.erb +9 -0
  59. data/app/views/outpost/resource/edit.html.erb +44 -0
  60. data/app/views/outpost/resource/index.html.erb +22 -0
  61. data/app/views/outpost/resource/new.html.erb +21 -0
  62. data/app/views/outpost/resource/search.html.erb +1 -0
  63. data/app/views/outpost/resource/show.html.erb +1 -0
  64. data/app/views/outpost/sessions/new.html.erb +16 -0
  65. data/app/views/outpost/shared/_add_link.html.erb +1 -0
  66. data/app/views/outpost/shared/_breadcrumbs.html.erb +15 -0
  67. data/app/views/outpost/shared/_cancel_link.html.erb +1 -0
  68. data/app/views/outpost/shared/_columns.html.erb +5 -0
  69. data/app/views/outpost/shared/_filters.html.erb +16 -0
  70. data/app/views/outpost/shared/_flash_messages.html.erb +6 -0
  71. data/app/views/outpost/shared/_form_block.html.erb +18 -0
  72. data/app/views/outpost/shared/_form_nav.html.erb +12 -0
  73. data/app/views/outpost/shared/_headers.html.erb +16 -0
  74. data/app/views/outpost/shared/_index_header.html.erb +4 -0
  75. data/app/views/outpost/shared/_list_table.html.erb +7 -0
  76. data/app/views/outpost/shared/_modal.html.erb +16 -0
  77. data/app/views/outpost/shared/_navigation.html.erb +31 -0
  78. data/app/views/outpost/shared/_notice.html.erb +1 -0
  79. data/app/views/outpost/shared/_pagination.html.erb +2 -0
  80. data/app/views/outpost/shared/_preview_errors.html.erb +9 -0
  81. data/app/views/outpost/shared/_submit_row.html.erb +50 -0
  82. data/config/routes.rb +4 -0
  83. data/lib/action_view/helpers/form_builder.rb +71 -0
  84. data/lib/outpost/breadcrumbs.rb +73 -0
  85. data/lib/outpost/config.rb +63 -0
  86. data/lib/outpost/controller/actions.rb +72 -0
  87. data/lib/outpost/controller/authentication.rb +34 -0
  88. data/lib/outpost/controller/authorization.rb +28 -0
  89. data/lib/outpost/controller/callbacks.rb +14 -0
  90. data/lib/outpost/controller/custom_errors.rb +41 -0
  91. data/lib/outpost/controller/filtering.rb +22 -0
  92. data/lib/outpost/controller/helpers.rb +52 -0
  93. data/lib/outpost/controller/ordering.rb +46 -0
  94. data/lib/outpost/controller/preferences.rb +71 -0
  95. data/lib/outpost/controller.rb +123 -0
  96. data/lib/outpost/engine.rb +10 -0
  97. data/lib/outpost/helpers/naming.rb +22 -0
  98. data/lib/outpost/helpers.rb +6 -0
  99. data/lib/outpost/hook.rb +35 -0
  100. data/lib/outpost/list/base.rb +78 -0
  101. data/lib/outpost/list/column.rb +24 -0
  102. data/lib/outpost/list/filter.rb +37 -0
  103. data/lib/outpost/list.rb +15 -0
  104. data/lib/outpost/model/authentication.rb +34 -0
  105. data/lib/outpost/model/authorization.rb +32 -0
  106. data/lib/outpost/model/identifier.rb +39 -0
  107. data/lib/outpost/model/methods.rb +23 -0
  108. data/lib/outpost/model/naming.rb +63 -0
  109. data/lib/outpost/model/routing.rb +138 -0
  110. data/lib/outpost/model/serializer.rb +27 -0
  111. data/lib/outpost/model.rb +22 -0
  112. data/lib/outpost/test.rb +21 -0
  113. data/lib/outpost/version.rb +3 -0
  114. data/lib/outpost-cms.rb +2 -0
  115. data/lib/outpost.rb +80 -0
  116. data/lib/tasks/outpost_tasks.rake +7 -0
  117. data/spec/controllers/authentication_spec.rb +62 -0
  118. data/spec/controllers/sessions_controller_spec.rb +99 -0
  119. data/spec/factories.rb +31 -0
  120. data/spec/helpers/authorization_helper_spec.rb +47 -0
  121. data/spec/helpers/list_helper_spec.rb +74 -0
  122. data/spec/helpers/outpost_helper_spec.rb +5 -0
  123. data/spec/helpers/render_helper_spec.rb +19 -0
  124. data/spec/helpers/utility_helper_spec.rb +53 -0
  125. data/spec/internal/app/controllers/application_controller.rb +3 -0
  126. data/spec/internal/app/controllers/outpost/people_controller.rb +23 -0
  127. data/spec/internal/app/controllers/outpost/pidgeons_controller.rb +5 -0
  128. data/spec/internal/app/controllers/people_controller.rb +9 -0
  129. data/spec/internal/app/controllers/pidgeons_controller.rb +3 -0
  130. data/spec/internal/app/models/person.rb +10 -0
  131. data/spec/internal/app/models/pidgeon.rb +3 -0
  132. data/spec/internal/app/models/post.rb +4 -0
  133. data/spec/internal/app/models/user.rb +4 -0
  134. data/spec/internal/app/views/people/index.html.erb +7 -0
  135. data/spec/internal/app/views/people/show.html.erb +1 -0
  136. data/spec/internal/config/database.yml +3 -0
  137. data/spec/internal/config/initializers/configuration.rb +3 -0
  138. data/spec/internal/config/initializers/outpost.rb +6 -0
  139. data/spec/internal/config/routes.rb +16 -0
  140. data/spec/internal/db/combustion_test.sqlite +0 -0
  141. data/spec/internal/db/schema.rb +44 -0
  142. data/spec/internal/db/seeds.rb +14 -0
  143. data/spec/internal/log/test.log +59277 -0
  144. data/spec/internal/public/favicon.ico +0 -0
  145. data/spec/lib/breadcrumbs_spec.rb +54 -0
  146. data/spec/lib/config_spec.rb +76 -0
  147. data/spec/lib/controller/actions_spec.rb +5 -0
  148. data/spec/lib/controller/authorization_spec.rb +4 -0
  149. data/spec/lib/controller/callbacks_spec.rb +31 -0
  150. data/spec/lib/controller/helpers_spec.rb +33 -0
  151. data/spec/lib/controller_spec.rb +25 -0
  152. data/spec/lib/helpers/naming_spec.rb +10 -0
  153. data/spec/lib/hook_spec.rb +13 -0
  154. data/spec/lib/list/base_spec.rb +96 -0
  155. data/spec/lib/list/column_spec.rb +46 -0
  156. data/spec/lib/list/filter_spec.rb +44 -0
  157. data/spec/lib/model/authentication_spec.rb +29 -0
  158. data/spec/lib/model/authorization_spec.rb +66 -0
  159. data/spec/lib/model/identifier_spec.rb +51 -0
  160. data/spec/lib/model/methods_spec.rb +8 -0
  161. data/spec/lib/model/naming_spec.rb +55 -0
  162. data/spec/lib/model/routing_spec.rb +166 -0
  163. data/spec/lib/model/serializer_spec.rb +13 -0
  164. data/spec/lib/outpost_spec.rb +34 -0
  165. data/spec/models/permission_spec.rb +10 -0
  166. data/spec/models/user_permission_spec.rb +4 -0
  167. data/spec/spec_helper.rb +22 -0
  168. metadata +411 -0
@@ -0,0 +1,99 @@
1
+ require "spec_helper"
2
+
3
+ describe Outpost::SessionsController do
4
+ # -------------------------
5
+
6
+ describe "GET /new" do
7
+ it "returns success and renders new template if current_user false" do
8
+ controller.stub(:current_user) { nil }
9
+ get :new
10
+ response.should be_success
11
+ response.should render_template "new"
12
+ end
13
+
14
+ it "redirects to home page if current_user if set" do
15
+ controller.stub(:current_user) { create :user }
16
+ get :new
17
+ response.should redirect_to outpost_root_path
18
+ end
19
+ end
20
+
21
+ # -------------------------
22
+
23
+ describe "POST /create" do
24
+ describe "authentication fails" do
25
+ before :each do
26
+ post :create # no params, login info is nil, authentication will fail
27
+ end
28
+
29
+ it "renders the login form" do
30
+ controller.response.should render_template 'new'
31
+ end
32
+
33
+ it "sets the flash.now" do
34
+ controller.flash.now[:alert].should be_present
35
+ end
36
+ end
37
+
38
+ describe "authentication passes" do
39
+ let(:user) { create :user, email: "bricker@kpcc.org" }
40
+
41
+ before :each do
42
+ post :create, password: "secret", email: user.email
43
+ end
44
+
45
+ it "sets the session" do
46
+ controller.session[:user_id].should eq user.id
47
+ end
48
+
49
+ it "redirects to admin root" do
50
+ controller.response.should redirect_to outpost_root_path
51
+ end
52
+
53
+ it "sets the flash" do
54
+ controller.flash[:notice].should be_present
55
+ end
56
+ end
57
+
58
+ describe "alternate login attributes" do
59
+ let(:user) { create :user }
60
+
61
+ it "logs in properly" do
62
+ User.should_receive(:find_by_username).with("bricker").and_return(user)
63
+
64
+ Outpost.config.authentication_attribute = :username
65
+ post :create, password: "secret", username: "bricker"
66
+ controller.session[:user_id].should eq user.id
67
+ Outpost.config.authentication_attribute = nil
68
+ end
69
+ end
70
+ end
71
+
72
+ # -------------------------
73
+
74
+ describe "DELETE /destroy" do
75
+ let(:user) { create :user }
76
+
77
+ it "unsets @current_user" do
78
+ controller.instance_variable_set(:@current_user, user)
79
+ get :destroy
80
+ controller.instance_variable_get(:@current_user).should eq nil
81
+ end
82
+
83
+ it "unsets session" do
84
+ controller.session[:user_id] = user.id
85
+ get :destroy
86
+ controller.session[:user_id].should eq nil
87
+ end
88
+
89
+ it "redirects to login page" do
90
+ get :destroy
91
+ controller.response.should redirect_to outpost_login_path
92
+ end
93
+
94
+ it "sets the flash" do
95
+ get :destroy
96
+ controller.flash[:notice].should be_present
97
+ end
98
+ end
99
+ end
data/spec/factories.rb ADDED
@@ -0,0 +1,31 @@
1
+ FactoryGirl.define do
2
+ factory :post do
3
+ sequence(:title) { |n| "Post #{n}" }
4
+ body "Lorem, etc."
5
+ end
6
+
7
+ factory :person do
8
+ name "Marty McFly"
9
+ email "backin@time.com"
10
+ location "Hill Valley, California"
11
+ age 17
12
+ end
13
+
14
+ factory :pidgeon do
15
+ name "Doc Brown"
16
+ location "Everywhere"
17
+ end
18
+
19
+ factory :user do
20
+ name "Jackie Brown"
21
+ sequence(:email) { |n| "jbrown#{n}@qt.com" }
22
+ can_login true
23
+ is_superuser false
24
+ password "secret"
25
+ password_confirmation "secret"
26
+ end
27
+
28
+ factory :permission do
29
+ resource "Post"
30
+ end
31
+ end
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ describe AuthorizationHelper do
4
+ describe "#guard" do
5
+ let(:current_user) { create :user, is_superuser: false }
6
+ let(:permission) { create :permission, resource: "Post" }
7
+
8
+ before :each do
9
+ helper.stub(:current_user) { current_user }
10
+ end
11
+
12
+ it "returns the block if user has permission to manage the resource" do
13
+ current_user.permissions.push permission
14
+ helper.guard(Post) { "hello" }.should eq "hello"
15
+ end
16
+
17
+ it "returns nil if permission not granted and no message specified" do
18
+ helper.guard(Post) { "hello" }.should eq ""
19
+ end
20
+
21
+ it "returns message if permission not granted and message specified" do
22
+ helper.guard(Post, "Not Allowed") { "hello" }.should eq "Not Allowed"
23
+ end
24
+ end
25
+
26
+ #-----------------
27
+
28
+ describe "#guarded_link_to" do
29
+ let(:current_user) { create :user, is_superuser: false }
30
+ let(:permission) { create :permission, resource: "Post" }
31
+
32
+ before :each do
33
+ helper.stub(:current_user) { current_user }
34
+ end
35
+
36
+ it "sends to link_to if the user has permission" do
37
+ current_user.permissions.push permission
38
+ link = helper.guarded_link_to Post, "Title", "/some/path"
39
+ link.should eq helper.link_to("Title", "/some/path")
40
+ end
41
+
42
+ it "shows only the title if permission is not granted" do
43
+ link = helper.guarded_link_to Post, "Title", "/some/path"
44
+ link.should eq "Title"
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,74 @@
1
+ require 'spec_helper'
2
+
3
+ describe ListHelper do
4
+ let(:list) { Outpost::List::Base.new(Person) }
5
+ let(:person) { create :person, name: "Marty McFly", age: 17 }
6
+
7
+ describe '#render_attribute' do
8
+ it "evals the proc if the helper is a proc" do
9
+ column = list.column(:name, display: ->(r) { "Mr. #{r.name}" })
10
+ helper.render_attribute(column, person).should eq "Mr. Marty McFly"
11
+ end
12
+
13
+ it "uses _display_helper if it's present" do
14
+ column = list.column(:name, display: :some_display)
15
+ column._display_helper = :other_display
16
+ helper.stub(:other_display) { "Cool Name Bro" }
17
+ helper.render_attribute(column, person).should eq "Cool Name Bro"
18
+ end
19
+
20
+ it "sends the symbol if it's a symbol" do
21
+ column = list.column(:name, display: :some_display)
22
+ helper.stub(:some_display) { "Doc Brown" }
23
+ helper.render_attribute(column, person).should eq "Doc Brown"
24
+ end
25
+
26
+ it "uses a generic attribute-based method if no display specified" do
27
+ helper.class_eval do
28
+ def display_name(name)
29
+ "Mr. #{name}"
30
+ end
31
+ end
32
+
33
+ column = list.column(:name)
34
+ helper.render_attribute(column, person).should eq "Mr. Marty McFly"
35
+
36
+ # Get rid of the method we just added, just to be safe
37
+ helper.singleton_class.send :remove_method, :display_name
38
+ end
39
+
40
+ it "displays the association to_title if it is one" do
41
+ list = Outpost::List::Base.new(Post)
42
+ post = create :post, person: person
43
+ column = list.column(:person)
44
+
45
+ person.stub(:to_title) { "Biff" }
46
+ helper.render_attribute(column, post).should eq "Biff"
47
+ end
48
+
49
+ it "tries an even more generic column type method" do
50
+ helper.class_eval do
51
+ def display_integer(int)
52
+ int + 10
53
+ end
54
+ end
55
+
56
+ column = list.column(:age)
57
+ helper.render_attribute(column, person).should eq 27
58
+
59
+ helper.singleton_class.send :remove_method, :display_integer
60
+ end
61
+
62
+ it "just renders the attribute as a string as a last resort" do
63
+ column = list.column(:age)
64
+ helper.render_attribute(column, person).should eq "17"
65
+ end
66
+
67
+ it "sets _display_helper on the column to help for the next columns" do
68
+ column = list.column(:age)
69
+ column._display_helper.should eq nil
70
+ helper.render_attribute(column, person)
71
+ column._display_helper.should eq :display_string
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe OutpostHelper do
4
+
5
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe RenderHelper do
4
+ describe "#form_block" do
5
+ context "no title" do
6
+ it "renders the form_block partial" do
7
+ helper.form_block { "hello" }.should match /hello/
8
+ end
9
+ end
10
+
11
+ context "with title" do
12
+ it "renders the form_block partial" do
13
+ formblock = helper.form_block("some title") { "blah blah" }
14
+ formblock.should match /blah blah/
15
+ formblock.should match /some title/
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe UtilityHelper do
4
+ describe "#any_to_list?" do
5
+ it "returns the block if there are records" do
6
+ helper.any_to_list?(1..5) { "Records list" }.should match "Records list"
7
+ end
8
+
9
+ it "returns a default message if there are no records and no message is specified" do
10
+ helper.any_to_list?([]) { "Records list" }.should match "There is nothing here to list."
11
+ end
12
+
13
+ it "returns a specified message if there are no records" do
14
+ helper.any_to_list?([], message: "None!") { "Records list" }.should match "None!"
15
+ end
16
+
17
+ it "returns a special message if: no records, no message, title is specified" do
18
+ helper.any_to_list?([], title: "Events") { "Records list" }.should match "Events"
19
+ end
20
+ end
21
+
22
+ # -----------------------
23
+
24
+ describe "#format_date" do
25
+ before :each do
26
+ @date = Time.at(0).utc # 1970-01-01 00:00:00 UTC
27
+ end
28
+
29
+ it "returns a `iso` format" do
30
+ helper.format_date(@date, format: :iso).should match "1970-01-01"
31
+ end
32
+
33
+ it "returns a `full-date` format" do
34
+ helper.format_date(@date, format: :full_date).should match "January 1st, 1970"
35
+ end
36
+
37
+ it "returns a 'event' format" do
38
+ helper.format_date(@date, format: :event).should match "Thursday, January 1"
39
+ end
40
+
41
+ it "accepts a custom format" do
42
+ helper.format_date(@date, with: "%D").should match "01/01/70"
43
+ end
44
+
45
+ it "prefers the custom format if a premade format is also specified" do
46
+ helper.format_date(@date, with: "%D", format: :event).should match "01/01/70"
47
+ end
48
+
49
+ it "includes the time if specified" do
50
+ helper.format_date(@date, format: :event, time: true).should match "12:00am"
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,23 @@
1
+ module Outpost
2
+ class PeopleController < Outpost::ResourceController
3
+ outpost_controller model: Person
4
+
5
+ define_list do |l|
6
+ l.default_order = "name"
7
+ l.default_sort_mode = "desc"
8
+ l.per_page = 25
9
+
10
+ l.column :name
11
+ l.column :email
12
+ l.column :location
13
+ l.column :age
14
+ end
15
+
16
+ private
17
+
18
+ def form_params
19
+ params.require(model.singular_route_key)
20
+ .permit(:name, :email, :location, :age)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ module Outpost
2
+ class PidgeonsController < Outpost::ResourceController
3
+ outpost_controller model: Pidgeon
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class PeopleController < ApplicationController
2
+ def index
3
+ @people = Person.all
4
+ end
5
+
6
+ def show
7
+ @person = Person.find(params[:id])
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ class PidgeonsController < ApplicationController
2
+ outpost_controller model: Pidgeon
3
+ end
@@ -0,0 +1,10 @@
1
+ class Person < ActiveRecord::Base
2
+ outpost_model
3
+ ROUTE_KEY = "person"
4
+
5
+ def route_hash
6
+ {
7
+ :id => self.id
8
+ }
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ class Pidgeon < ActiveRecord::Base
2
+ include Outpost::Model::Routing
3
+ end
@@ -0,0 +1,4 @@
1
+ class Post < ActiveRecord::Base
2
+ outpost_model
3
+ belongs_to :person
4
+ end
@@ -0,0 +1,4 @@
1
+ class User < ActiveRecord::Base
2
+ include Outpost::Model::Authentication
3
+ include Outpost::Model::Authorization
4
+ end
@@ -0,0 +1,7 @@
1
+ <h2>People</h2>
2
+
3
+ <ul>
4
+ <% @people.each do |person| %>
5
+ <li><%= link_to person.name, person.public_path %></li>
6
+ <% end %>
7
+ </ul>
@@ -0,0 +1 @@
1
+ <h2><%= @person.name %></h2>
@@ -0,0 +1,3 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: db/combustion_test.sqlite
@@ -0,0 +1,3 @@
1
+ Combustion::Application.configure do
2
+ default_url_options[:host] = "www.scpr.org"
3
+ end
@@ -0,0 +1,6 @@
1
+ Outpost::Config.configure do |config|
2
+ config.registered_models = [
3
+ "Person",
4
+ "Post"
5
+ ]
6
+ end
@@ -0,0 +1,16 @@
1
+ Rails.application.routes.draw do
2
+ get '/people' => 'people#index', as: :people
3
+ get '/people/:id' => 'people#show', as: :person
4
+
5
+ namespace :outpost do
6
+ resources :people
7
+
8
+ root to: 'home#dashboard'
9
+
10
+ resources :sessions, only: [:create, :destroy]
11
+ get 'login' => "sessions#new", as: :login
12
+ get 'logout' => "sessions#destroy", as: :logout
13
+
14
+ get "*path" => 'errors#not_found'
15
+ end
16
+ end
@@ -0,0 +1,44 @@
1
+ ActiveRecord::Schema.define do
2
+ create_table :people, force: true do |t|
3
+ t.string :name
4
+ t.string :location
5
+ t.string :email
6
+ t.integer :age
7
+ t.timestamps
8
+ end
9
+
10
+ create_table :posts, force: true do |t|
11
+ t.string :title
12
+ t.text :body
13
+ t.integer :person_id
14
+ t.timestamps
15
+ end
16
+
17
+ create_table :pidgeons, force: true do |t|
18
+ t.string :name
19
+ t.string :location
20
+ t.timestamps
21
+ end
22
+
23
+ create_table :users, force: true do |t|
24
+ t.string :name
25
+ t.string :username
26
+ t.string :email
27
+ t.string :password_digest
28
+ t.boolean :is_superuser
29
+ t.boolean :can_login
30
+ t.datetime :last_login
31
+ t.timestamps
32
+ end
33
+
34
+ create_table :permissions, force: true do |t|
35
+ t.string :resource
36
+ t.timestamps
37
+ end
38
+
39
+ create_table :user_permissions, force: true do |t|
40
+ t.integer :permission_id
41
+ t.integer :user_id
42
+ t.timestamps
43
+ end
44
+ end
@@ -0,0 +1,14 @@
1
+ User.create(name: "Bryan Ricker", username: "bricker", email: "bricker@kpcc.org", password: "secret", is_superuser: true, can_login: true)
2
+
3
+ Outpost.config.registered_models.each do |model|
4
+ Outpost::Permission.create(resource: model)
5
+ end
6
+
7
+ 10.times do |n|
8
+ Person.create(
9
+ :name => "Test Person #{n}",
10
+ :email => "test#{n}@gmail.com",
11
+ :location => "Los Angeles",
12
+ :age => "#{n + 20}"
13
+ )
14
+ end